Commit 83bfd71b authored by prahate's avatar prahate

Changes done for Charge back replacement.

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@194065 ce508802-f39f-4f6c-b175-0d175dae99d5
parent ad35d3e4
package ibase.webitm.ejb.dis; package ibase.webitm.ejb.dis;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.text.*; import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Timestamp;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.sql.*;
import java.text.SimpleDateFormat;
import org.w3c.dom.*; import javax.ejb.Stateless; // added for ejb3
import javax.ejb.*; import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import ibase.system.config.ConnDriver;
import ibase.utility.E12GenericUtility; import ibase.utility.E12GenericUtility;
import ibase.webitm.utility.*; import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.system.config.*; import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.ejb.*; import ibase.webitm.utility.ITMException;
import javax.ejb.Stateless; // added for ejb3
@Stateless @Stateless
// added for ejb3 // added for ejb3
...@@ -57,6 +61,9 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C ...@@ -57,6 +61,9 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C
{ {
dom2 = parseString(xmlString2); dom2 = parseString(xmlString2);
} }
System.out.println("xml string:"+xmlString);
System.out.println("xml String1:"+xmlString1);
System.out.println("xml string2:"+xmlString2);
errString = wfValData(dom, dom1, dom2, objContext, editFlag, xtraParams); errString = wfValData(dom, dom1, dom2, objContext, editFlag, xtraParams);
} catch (Exception e) } catch (Exception e)
{ {
...@@ -438,6 +445,73 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C ...@@ -438,6 +445,73 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C
} }
} }
// END OF CASE1 // END OF CASE1
//Added by Saiprasad G. [When the settle_mth change in edit case] START
String settlemth=genericUtility.getColumnValue("settle_mth", dom2,"1");
NodeList parentNodeList1 = dom2.getElementsByTagName("Detail2");
parentNode = null;
childNodeList = null;
childNodeListLength = 0;
childNode = null;
childNodeName = "";
System.out.println("All the object are done null : "+childNodeList);
//boolean isUpdated = false;
int parentNodeListPOCLen = parentNodeList1.getLength();
System.out.println("parentNodeListPOCLen : "+ parentNodeListPOCLen);
for ( int rowCnt=0; rowCnt < parentNodeListPOCLen; rowCnt++ )
{
parentNode = parentNodeList1.item(rowCnt);
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
for(ctr = 0; ctr < childNodeListLength; ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
System.out.println("childNodeName : "+childNodeName);
if(childNodeName.equalsIgnoreCase("attribute"))
{
String updateNodeValue = childNode.getAttributes().getNamedItem("updateFlag").getFirstChild().getNodeValue();
System.out.println("updateNodeValue : "+updateNodeValue);
if((settlemth.equalsIgnoreCase("V") || settlemth.equalsIgnoreCase("Q"))&&(! "D".equalsIgnoreCase(updateNodeValue)))
{
errList.add("VMNVSECOND");
errFields.add(childNodeName.toLowerCase());
}
}
}
}
NodeList parentNodeList2 = dom2.getElementsByTagName("Detail3");
parentNode = null;
childNodeList = null;
childNodeListLength = 0;
childNode = null;
childNodeName = "";
System.out.println("All the object are done null : "+childNodeList);
int parentNodeListPOCLen1 = parentNodeList2.getLength();
System.out.println("parentNodeListPOCLen1 : "+ parentNodeListPOCLen1);
for ( int rowCnt=0; rowCnt < parentNodeListPOCLen1; rowCnt++ )
{
parentNode = parentNodeList2.item(rowCnt);
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
for(ctr = 0; ctr < childNodeListLength; ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
System.out.println("childNodeName : "+childNodeName);
if(childNodeName.equalsIgnoreCase("attribute"))
{
String updateNodeValue2 = childNode.getAttributes().getNamedItem("updateFlag").getFirstChild().getNodeValue();
System.out.println("updateNodeValue : "+updateNodeValue2);
if((settlemth.equalsIgnoreCase("C")) && (! "D".equalsIgnoreCase(updateNodeValue2)))
{
errList.add("VMINVTHIRD");
errFields.add(childNodeName.toLowerCase());
}
}
}
}
//Added by Saiprasad G. [When the settle_mth change in edit case] END
break; break;
case 2: case 2:
System.out.println("VALIDATION FOR DETAIL [ 2 ].........."); System.out.println("VALIDATION FOR DETAIL [ 2 ]..........");
...@@ -714,7 +788,9 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C ...@@ -714,7 +788,9 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C
parentNode = parentNodeList.item(0); parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength(); childNodeListLength = childNodeList.getLength();
for (ctr = 0; ctr < childNodeListLength; ctr++) { String rate="",qty="";
for (ctr = 0; ctr < childNodeListLength; ctr++)
{
childNode = childNodeList.item(ctr); childNode = childNodeList.item(ctr);
System.out.println("child Node in third form:"+childNode); System.out.println("child Node in third form:"+childNode);
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
...@@ -756,30 +832,105 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C ...@@ -756,30 +832,105 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C
} }
} }
} }
String settleMethod=E12GenericUtility.checkNull(genericUtility.getColumnValue("settle_mth", dom2,"1")); else if(childNodeName.equalsIgnoreCase("rate"))
String itemCodeFormTwo=genericUtility.getColumnValue("item_code", dom2, "2"); {
System.out.println("item code of the second form:"+itemCodeFormTwo); rate=E12GenericUtility.checkNull(genericUtility.getColumnValue("rate", dom));
System.out.println("settmethod for vaildation"+settleMethod); int rate1=0;
if(settleMethod.equalsIgnoreCase("V")) if(rate.length()>0)
{
try
{
rate1=Integer.parseInt(rate);
System.out.println("rate for the validation"+rate1);
}
catch(NumberFormatException nm)
{
errCode = "INVRATE";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
catch(Exception e)
{
errCode = "INVRATE";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
else
{
errCode = "INVRATE";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
else if(childNodeName.equalsIgnoreCase("quantity"))
{
quantity=E12GenericUtility.checkNull(genericUtility.getColumnValue("quantity", dom));
int quantity1=0;
if(quantity.length()>0)
{
try
{
quantity1=Integer.parseInt(quantity);
System.out.println("Quantity for the validation:"+quantity1);
}
catch(NumberFormatException nm)
{
errCode = "INVQTY";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
catch(Exception e)
{
errCode = "INVQTY";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
else
{ {
errCode = "INVQTY";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
else if(childNodeName.equalsIgnoreCase("free_value"))
{
settlemth=genericUtility.getColumnValue("settle_mth", dom2,"1");
freeValue=E12GenericUtility.checkNull(genericUtility.getColumnValue("free_value", dom)); freeValue=E12GenericUtility.checkNull(genericUtility.getColumnValue("free_value", dom));
if(E12GenericUtility.checkNull(freeValue).length()<=0)
System.out.println("settlemth : freeValue P : "+settlemth);
System.out.println("freeValue : freeValue P : "+freeValue);
if(settlemth.equalsIgnoreCase("V"))
{
if(E12GenericUtility.checkNull(freeValue).length() <= 0)
{ {
errCode = "VTFREEVAl"; errCode = "VTFREEVAl";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
break; break;
} }
else if(itemCodeFormTwo!=null) }
else if (settlemth.equalsIgnoreCase("C"))
{ {
System.out.println("settlemethod in third form:"+settleMethod); System.out.println("settle method in third form for the credit note:"+settlemth);
errList.add("VMNVSECOND"); errList.add("VMINVTHIRD");
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
else if(settleMethod.equalsIgnoreCase("Q")) else if(childNodeName.equalsIgnoreCase("free_qty"))
{ {
settlemth=genericUtility.getColumnValue("settle_mth", dom2,"1");
freeQty=E12GenericUtility.checkNull(genericUtility.getColumnValue("free_qty", dom)); freeQty=E12GenericUtility.checkNull(genericUtility.getColumnValue("free_qty", dom));
System.out.println("settlemth : free_qty P : "+settlemth);
System.out.println("freeQty : free_qty P : "+freeQty);
if(settlemth.equalsIgnoreCase("Q"))
{
if(E12GenericUtility.checkNull(freeQty).length()<=0) if(E12GenericUtility.checkNull(freeQty).length()<=0)
{ {
errCode = "VTNFREEQTY"; errCode = "VTNFREEQTY";
...@@ -787,24 +938,83 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C ...@@ -787,24 +938,83 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
break; break;
} }
else if(itemCodeFormTwo!=null) }
else if (settlemth.equalsIgnoreCase("C"))
{
System.out.println("settle method in third form for the credit note:"+settlemth);
errList.add("VMINVTHIRD");
errFields.add(childNodeName.toLowerCase());
}
}
}// End of for loop CASE3
//Added by Saiprasad G. [When the settle_mth change in edit case] START
settlemth=genericUtility.getColumnValue("settle_mth", dom2,"1");
NodeList parentNodeList3 = dom2.getElementsByTagName("Detail2");
parentNode = null;
childNodeList = null;
childNodeListLength = 0;
childNode = null;
childNodeName = "";
System.out.println("All the object are done null : "+childNodeList);
//boolean isUpdated = false;
int parentNodeListPOCLen3 = parentNodeList3.getLength();
System.out.println("parentNodeListPOCLen3 : "+ parentNodeListPOCLen3);
for ( int rowCnt=0; rowCnt < parentNodeListPOCLen3; rowCnt++ )
{
parentNode = parentNodeList3.item(rowCnt);
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
for(ctr = 0; ctr < childNodeListLength; ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
System.out.println("childNodeName : "+childNodeName);
if(childNodeName.equalsIgnoreCase("attribute"))
{
String updateNodeValue = childNode.getAttributes().getNamedItem("updateFlag").getFirstChild().getNodeValue();
System.out.println("updateNodeValue : "+updateNodeValue);
if((settlemth.equalsIgnoreCase("V") || settlemth.equalsIgnoreCase("Q"))&&(! "D".equalsIgnoreCase(updateNodeValue)))
{ {
System.out.println("settlemethod in third form:"+settleMethod);
errList.add("VMNVSECOND"); errList.add("VMNVSECOND");
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
/* if(settleMethod.equalsIgnoreCase("V") || settleMethod.equalsIgnoreCase("Q")) }
}
NodeList parentNodeList4 = dom2.getElementsByTagName("Detail3");
parentNode = null;
childNodeList = null;
childNodeListLength = 0;
childNode = null;
childNodeName = "";
System.out.println("All the object are done null : "+childNodeList);
int parentNodeListPOCLen2 = parentNodeList4.getLength();
System.out.println("parentNodeListPOCLen2 : "+ parentNodeListPOCLen2);
for ( int rowCnt=0; rowCnt < parentNodeListPOCLen2; rowCnt++ )
{ {
parentNode = parentNodeList4.item(rowCnt);
}*/ childNodeList = parentNode.getChildNodes();
if(settleMethod.equalsIgnoreCase("C")) childNodeListLength = childNodeList.getLength();
for(ctr = 0; ctr < childNodeListLength; ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
System.out.println("childNodeName : "+childNodeName);
if(childNodeName.equalsIgnoreCase("attribute"))
{
String updateNodeValue2 = childNode.getAttributes().getNamedItem("updateFlag").getFirstChild().getNodeValue();
System.out.println("updateNodeValue : "+updateNodeValue2);
if((settlemth.equalsIgnoreCase("C")) && (! "D".equalsIgnoreCase(updateNodeValue2)))
{ {
System.out.println("settle method in third form for the credit note:"+settleMethod);
errList.add("VMINVTHIRD"); errList.add("VMINVTHIRD");
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
}// End of for loop CASE3 }
}
}
break; break;
//Added by saiprasad on 22-Nov-18 for replacement form. [END] //Added by saiprasad on 22-Nov-18 for replacement form. [END]
}// END SWITCH }// END SWITCH
...@@ -2030,14 +2240,37 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C ...@@ -2030,14 +2240,37 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C
} }
else if (currentColumn.trim().equals("rate") || currentColumn.trim().equals("quantity")) else if (currentColumn.trim().equals("rate") || currentColumn.trim().equals("quantity"))
{ {
String rate1 = genericUtility.getColumnValue("rate", dom); String rate1 = E12GenericUtility.checkNull(genericUtility.getColumnValue("rate", dom));
double rateT = Double.parseDouble(rate1); String qty = E12GenericUtility.checkNull(genericUtility.getColumnValue("quantity", dom));
System.out.println("Rate of the third form:" + rate1); int qty1=0;
String qty = genericUtility.getColumnValue("quantity", dom); double rateT=0.0;
System.out.println("quantity of the third form:" + qty); if(qty.length() > 0)
int qty1 = Integer.parseInt(qty); {
qty1 = Integer.parseInt(qty);
}
else
{
qty1 = 0;
}
if(rate1.length() > 0)
{
rateT = Double.parseDouble(rate1);
}
else
{
rateT = 0;
valueXmlString.append("<rate><![CDATA[").append(rateT).append("]]></rate>");
}
System.out.println("rate String "+rate1);
System.out.println("rate double "+rateT);
System.out.println("qty String "+qty);
System.out.println("qty int "+qty1);
netAmt = rateT * qty1; netAmt = rateT * qty1;
System.out.println("net amount of the third form:" + netAmt); System.out.println("net amount of the third form:" + netAmt);
valueXmlString.append("<net_amt><![CDATA[").append(netAmt).append("]]></net_amt>"); valueXmlString.append("<net_amt><![CDATA[").append(netAmt).append("]]></net_amt>");
} }
else if (currentColumn.trim().equals("item_code__repl")) else if (currentColumn.trim().equals("item_code__repl"))
......
...@@ -136,8 +136,6 @@ public class ChrgBckLocConf extends ActionHandlerEJB implements ChrgBckLocConfLo ...@@ -136,8 +136,6 @@ public class ChrgBckLocConf extends ActionHandlerEJB implements ChrgBckLocConfLo
String valueString=""; String valueString="";
ArrayList<String> valueStringList=new ArrayList<String>(); ArrayList<String> valueStringList=new ArrayList<String>();
int countError = 0; int countError = 0;
//Added by saiprasad on 22-Nov-18 for replacement form. [START]
StringBuilder schemebalsb = new StringBuilder();
String chargeBakSql = "", secondarySchSql = "", schemeBalSql = "",drcrRcpSql=""; String chargeBakSql = "", secondarySchSql = "", schemeBalSql = "",drcrRcpSql="";
String custCode1 = "", itemCodeRepl = "", freeQty = "", freeVaule = "", confDateStr = "", settleMethod = "", String custCode1 = "", itemCodeRepl = "", freeQty = "", freeVaule = "", confDateStr = "", settleMethod = "",
offer = "", vaildUpto = ""; offer = "", vaildUpto = "";
...@@ -851,6 +849,8 @@ public class ChrgBckLocConf extends ActionHandlerEJB implements ChrgBckLocConfLo ...@@ -851,6 +849,8 @@ public class ChrgBckLocConf extends ActionHandlerEJB implements ChrgBckLocConfLo
System.out.println("settle method2::[" + settleMethod + "]"); System.out.println("settle method2::[" + settleMethod + "]");
if (settleMethod.equalsIgnoreCase("V") || settleMethod.equalsIgnoreCase("Q")) if (settleMethod.equalsIgnoreCase("V") || settleMethod.equalsIgnoreCase("Q"))
{ {
//Added by saiprasad on 22-Nov-18 for replacement form. [START]
StringBuilder schemebalsb = new StringBuilder();
schemebalsb.append("INSERT INTO SCHEME_BALANCE(TRAN_ID,SCHEME_CODE,CUST_CODE,ITEM_CODE,EFF_FROM,VALID_UPTO,BALANCE_FREE_QTY,"); schemebalsb.append("INSERT INTO SCHEME_BALANCE(TRAN_ID,SCHEME_CODE,CUST_CODE,ITEM_CODE,EFF_FROM,VALID_UPTO,BALANCE_FREE_QTY,");
schemebalsb.append("BALANCE_FREE_VALUE,USED_FREE_QTY,USED_FREE_VALUE,CHG_USER,CHG_DATE,CHG_TERM,ENTRY_SOURCE)"); schemebalsb.append("BALANCE_FREE_VALUE,USED_FREE_QTY,USED_FREE_VALUE,CHG_USER,CHG_DATE,CHG_TERM,ENTRY_SOURCE)");
schemebalsb.append("VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); schemebalsb.append("VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment