Commit 7e2df95b authored by vkadam's avatar vkadam

Changes after review


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@34938 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 874e1ac0
/******************************************************** /********************************************************
Title : BillofQuantityIC Title : Customer
Date : 20/09/12 Date : 20/10/14
Developer: Akhilesh Sikarwar Developer: Vallabh Kadam
********************************************************/ ********************************************************/
package ibase.webitm.ejb.dis; package ibase.webitm.ejb.dis;
...@@ -29,44 +29,44 @@ import org.w3c.dom.NodeList; ...@@ -29,44 +29,44 @@ import org.w3c.dom.NodeList;
@Stateless @Stateless
public class Customer extends ValidatorEJB public class Customer extends ValidatorEJB
implements CustomerLocal, CustomerRemote { implements CustomerLocal, CustomerRemote
{
GenericUtility genericUtility = GenericUtility.getInstance(); GenericUtility genericUtility = GenericUtility.getInstance();
String winName = null; String winName = null;
FinCommon finCommon = null; FinCommon finCommon = null;
ValidatorEJB validator = null; ValidatorEJB validator = null;
public String wfValData(String xmlString, String xmlString1, public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException, ITMException
String xmlString2, String objContext, String editFlag, {
String xtraParams) throws RemoteException, ITMException {
String errString = ""; String errString = "";
Document dom = null; Document dom = null;
Document dom1 = null; Document dom1 = null;
Document dom2 = null; Document dom2 = null;
try { try
System.out.println("Val xmlString :: " + xmlString); {
System.out.println("Val xmlString1 :: " + xmlString1); if (xmlString != null && xmlString.trim().length() > 0)
System.out.println("Val xmlString2 :: " + xmlString2); {
if (xmlString != null && xmlString.trim().length() > 0) {
dom = parseString(xmlString); dom = parseString(xmlString);
} }
if (xmlString1 != null && xmlString1.trim().length() > 0) { if (xmlString1 != null && xmlString1.trim().length() > 0)
{
dom1 = parseString(xmlString1); dom1 = parseString(xmlString1);
} }
if (xmlString2 != null && xmlString2.trim().length() > 0) { if (xmlString2 != null && xmlString2.trim().length() > 0)
{
dom2 = parseString("<Root>" + xmlString2 + "</Root>"); dom2 = parseString("<Root>" + xmlString2 + "</Root>");
} }
errString = wfValData(dom, dom1, dom2, objContext, editFlag, errString = wfValData(dom, dom1, dom2, objContext, editFlag, xtraParams);
xtraParams); } catch (Exception e)
} catch (Exception e) { {
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e); throw new ITMException(e);
} }
return errString; return errString;
} }
public String wfValData(Document dom, Document dom1, Document dom2, public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException, ITMException
String objContext, String editFlag, String xtraParams) {
throws RemoteException, ITMException {
NodeList parentNodeList = null; NodeList parentNodeList = null;
NodeList childNodeList = null; NodeList childNodeList = null;
Node parentNode = null; Node parentNode = null;
...@@ -79,58 +79,59 @@ implements CustomerLocal, CustomerRemote { ...@@ -79,58 +79,59 @@ implements CustomerLocal, CustomerRemote {
String errorType = ""; String errorType = "";
String errString = ""; String errString = "";
String tranId = ""; String tranId = "";
String custCode="",ignoreCredit="",ignoreDays="",acctCodeAdv="",cctrCodeAdv="",groupCode="",custCodeBil="",stanCode="",terrCode=""; String custCode = "", ignoreCredit = "", ignoreDays = "", acctCodeAdv = "", cctrCodeAdv = "", groupCode = "", custCodeBil = "", stanCode = "", terrCode = "";
String stateCode="",countCode="",crTerm="",currCode="",currCode1="",acctCodeAr="",cctrCodeAr="",taxClass="",taxChap="",priceList=""; String stateCode = "", countCode = "", crTerm = "", currCode = "", currCode1 = "", acctCodeAr = "", cctrCodeAr = "", taxClass = "", taxChap = "", priceList = "";
String salesPers="",tranCode="",siteCodeRcp="",siteCode="",channelPartner="",blackListing="",contactCode="",bankCode="",priceListDisc=""; String salesPers = "", tranCode = "", siteCodeRcp = "", siteCode = "", channelPartner = "", blackListing = "", contactCode = "", bankCode = "", priceListDisc = "";
String salesOption="",dlvTerm="",lossPerc="",adhocReplPerc="",termTableNo="",priceListClg="",salesPers1="",salesPers2=""; String salesOption = "", dlvTerm = "", lossPerc = "", adhocReplPerc = "", termTableNo = "", priceListClg = "", salesPers1 = "", salesPers2 = "";
String keyFlag="",active="",lsVal3="",empCodeOrd="",empCodeOrd1="",custCodePd="",custCodeDisc="",sgroupCode="",custCodeAr="",currCodeFrt=""; String keyFlag = "", active = "", lsVal3 = "", empCodeOrd = "", empCodeOrd1 = "", custCodePd = "", custCodeDisc = "", sgroupCode = "", custCodeAr = "", currCodeFrt = "";
String blankVar="",custName="",shName="",availableYn="",creditLmt="",round="",roundTo="",currCodeIns=""; String blankVar = "", custName = "", shName = "", availableYn = "", creditLmt = "", round = "", roundTo = "", currCodeIns = "";
String regCode="",validUpto="",regDate=""; String regCode = "", validUpto = "", regDate = "";
int ctr = 0; int ctr = 0;
int currentFormNo = 0; int currentFormNo = 0;
int cnt = 0,cnt1=0; int cnt = 0, cnt1 = 0;
ArrayList errList = new ArrayList(); ArrayList errList = new ArrayList();
ArrayList errFields = new ArrayList(); ArrayList errFields = new ArrayList();
Connection conn = null; Connection conn = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
StringBuffer errStringXml = new StringBuffer( StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
"<?xml version = \"1.0\"?> \r\n <Root> <Errors>"); try
try { {
this.finCommon = new FinCommon(); this.finCommon = new FinCommon();
this.validator = new ValidatorEJB(); this.validator = new ValidatorEJB();
conn = connDriver.getConnectDB("DriverITM"); conn = connDriver.getConnectDB("DriverITM");
userId = getValueFromXTRA_PARAMS(xtraParams, "loginCode"); userId = getValueFromXTRA_PARAMS(xtraParams, "loginCode");
if ((objContext != null) && (objContext.trim().length() > 0)) { if ((objContext != null) && (objContext.trim().length() > 0))
{
currentFormNo = Integer.parseInt(objContext); currentFormNo = Integer.parseInt(objContext);
} }
valueXmlString = new StringBuffer( valueXmlString = new StringBuffer("<?xml version = \"1.0\"?> <Root> <header> <editFlag>");
"<?xml version = \"1.0\"?> <Root> <header> <editFlag>");
valueXmlString.append(editFlag).append("</editFlag> </header>"); valueXmlString.append(editFlag).append("</editFlag> </header>");
switch (currentFormNo) { switch (currentFormNo)
{
case 1: case 1:
parentNodeList = dom.getElementsByTagName("Detail1"); parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0); parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
valueXmlString.append("<Detail1>"); valueXmlString.append("<Detail1>");
int childNodeListLength = childNodeList.getLength(); int childNodeListLength = childNodeList.getLength();
tranId = checkNull(this.genericUtility.getColumnValue( tranId = checkNull(this.genericUtility.getColumnValue("tran_id", dom));
"tran_id", dom)); System.out.println("tran id from boqdet --4-->>>>[" + tranId + "]");
System.out.println("tran id from boqdet --4-->>>>[" + tranId for (ctr = 0; ctr < childNodeListLength; ctr++)
+ "]"); {
for (ctr = 0; ctr < childNodeListLength; ctr++) {
childNode = childNodeList.item(ctr); childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
System.out.println("CURRENT COLUMN IN VALIDATION ["+ childNodeName + "]"); System.out.println("CURRENT COLUMN IN VALIDATION [" + childNodeName + "]");
if (childNodeName.equalsIgnoreCase("cust_code")) { if (childNodeName.equalsIgnoreCase("cust_code"))
{
custCode = this.genericUtility.getColumnValue("cust_code", dom); custCode = this.genericUtility.getColumnValue("cust_code", dom);
sql = "select key_flag from transetup where tran_window = 'w_customer'"; sql = "select key_flag from transetup where tran_window = 'w_customer'";
// sql = "select key_flag from transetup where tran_window = 'w_customer_test'";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
keyFlag = rs.getString("key_flag"); keyFlag = rs.getString("key_flag");
} }
rs.close(); rs.close();
...@@ -138,22 +139,26 @@ implements CustomerLocal, CustomerRemote { ...@@ -138,22 +139,26 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(keyFlag==null){ if (keyFlag == null)
keyFlag="M"; {
keyFlag = "M";
} }
System.out.println("Key flag is :-["+keyFlag+"]"); System.out.println("Key flag is :-[" + keyFlag + "]");
if(keyFlag.equalsIgnoreCase("M") && (custCode==null || custCode.trim().length()<=0)){ if ("M".equalsIgnoreCase(keyFlag) && (custCode == null || custCode.trim().length() <= 0))
{
System.out.print("Throw error...."); System.out.print("Throw error....");
errCode = "VMCODNULL"; errCode = "VMCODNULL";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
}else if(editFlag.equalsIgnoreCase("A")){ } else if ("A".equalsIgnoreCase(editFlag))
cnt=0; {
cnt = 0;
sql = "select count(*) as ll_count from customer where cust_code =?"; sql = "select count(*) as ll_count from customer where cust_code =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCode); pstmt.setString(1, custCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
cnt = rs.getInt("ll_count"); cnt = rs.getInt("ll_count");
} }
rs.close(); rs.close();
...@@ -161,163 +166,193 @@ implements CustomerLocal, CustomerRemote { ...@@ -161,163 +166,193 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(cnt>0){ if (cnt > 0)
{
errCode = "VMDUPL1"; errCode = "VMDUPL1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
}else if(childNodeName.equalsIgnoreCase("cust_name")){ } else if (childNodeName.equalsIgnoreCase("cust_name"))
{
custName = this.genericUtility.getColumnValue("cust_name", dom); custName = this.genericUtility.getColumnValue("cust_name", dom);
if(custName==null || custName.trim().length()<=0){ if (custName == null || custName.trim().length() <= 0)
errCode = "VMCNAMENLL";//Name is blank {
errCode = "VMCNAMENLL";// Name is blank
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} } else if (childNodeName.equalsIgnoreCase("sh_name"))
else if(childNodeName.equalsIgnoreCase("sh_name")){ {
shName = this.genericUtility.getColumnValue("sh_name", dom); shName = this.genericUtility.getColumnValue("sh_name", dom);
if(shName==null || shName.trim().length()<=0){ if (shName == null || shName.trim().length() <= 0)
errCode = "VMSHNAMNLL";//Short Name is blank {
errCode = "VMSHNAMNLL";// Short Name is blank
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} } else if (childNodeName.equalsIgnoreCase("available_yn"))
else if(childNodeName.equalsIgnoreCase("available_yn")){ {
availableYn = this.genericUtility.getColumnValue("available_yn", dom); availableYn = this.genericUtility.getColumnValue("available_yn", dom);
if(availableYn==null || availableYn.trim().length()<=0){ if (availableYn == null || availableYn.trim().length() <= 0)
errCode = "VMAVLBNULL";//Available Name is blank {
errCode = "VMAVLBNULL";// Available Name is blank
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} } else if (childNodeName.equalsIgnoreCase("round"))
else if(childNodeName.equalsIgnoreCase("round")){ {
round = this.genericUtility.getColumnValue("round", dom); round = this.genericUtility.getColumnValue("round", dom);
if(round==null || round.trim().length()<=0){ if (round == null || round.trim().length() <= 0)
errCode = "VMROUNDNLL";//Round Name is blank {
errCode = "VMROUNDNLL";// Round Name is blank
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
}else if(childNodeName.equalsIgnoreCase("round_to")){ } else if (childNodeName.equalsIgnoreCase("round_to"))
{
roundTo = this.genericUtility.getColumnValue("round_to", dom); roundTo = this.genericUtility.getColumnValue("round_to", dom);
if(roundTo==null || roundTo.trim().length()<=0){ if (roundTo == null || roundTo.trim().length() <= 0)
errCode = "VMRNDTONLL";//Round To Name is blank {
errCode = "VMRNDTONLL";// Round To Name is blank
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
}else if(childNodeName.equalsIgnoreCase("curr_code__frt")){ } else if (childNodeName.equalsIgnoreCase("curr_code__frt"))
{
currCodeFrt = this.genericUtility.getColumnValue("curr_code__frt", dom); currCodeFrt = this.genericUtility.getColumnValue("curr_code__frt", dom);
if(currCodeFrt==null || currCodeFrt.trim().length()<=0){ if (currCodeFrt == null || currCodeFrt.trim().length() <= 0)
errCode = "VMCRCDFRNL";//Fright Currency is blank {
errCode = "VMCRCDFRNL";// Fright Currency is blank
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
}else if(childNodeName.equalsIgnoreCase("curr_code__ins")){ } else if (childNodeName.equalsIgnoreCase("curr_code__ins"))
{
currCodeIns = this.genericUtility.getColumnValue("curr_code__ins", dom); currCodeIns = this.genericUtility.getColumnValue("curr_code__ins", dom);
if(currCodeIns==null || currCodeIns.trim().length()<=0){ if (currCodeIns == null || currCodeIns.trim().length() <= 0)
errCode = "VMINSCRRNL";//Insurance Currency is blank {
errCode = "VMINSCRRNL";// Insurance Currency is
// blank
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} } else if (childNodeName.equalsIgnoreCase("ignore_credit"))
else if(childNodeName.equalsIgnoreCase("ignore_credit")){ {
ignoreCredit = this.genericUtility.getColumnValue("ignore_credit", dom); ignoreCredit = this.genericUtility.getColumnValue("ignore_credit", dom);
cnt=0; cnt = 0;
if(ignoreCredit!=null && ignoreCredit.trim().length()>0){ if (ignoreCredit != null && ignoreCredit.trim().length() > 0)
cnt=Integer.parseInt(ignoreCredit.trim()); {
if(cnt<0){ cnt = Integer.parseInt(ignoreCredit.trim());
if (cnt < 0)
{
errCode = "VMIGCRT"; errCode = "VMIGCRT";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
}else{ } else
{
errCode = "VMIGCRTNLL"; errCode = "VMIGCRTNLL";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
}else if(childNodeName.equalsIgnoreCase("credit_lmt")){ } else if (childNodeName.equalsIgnoreCase("credit_lmt"))
{
creditLmt = this.genericUtility.getColumnValue("credit_lmt", dom); creditLmt = this.genericUtility.getColumnValue("credit_lmt", dom);
if(creditLmt==null){ if (creditLmt == null)
{
errCode = "VMCRTLMNLL"; errCode = "VMCRTLMNLL";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} } else if (childNodeName.equalsIgnoreCase("ignore_days"))
else if(childNodeName.equalsIgnoreCase("ignore_days")){ {
ignoreDays = this.genericUtility.getColumnValue("ignore_days", dom); ignoreDays = this.genericUtility.getColumnValue("ignore_days", dom);
cnt=0; cnt = 0;
if(ignoreDays!=null && ignoreDays.trim().length()>0){ if (ignoreDays != null && ignoreDays.trim().length() > 0)
cnt=Integer.parseInt(ignoreDays.trim()); {
if(cnt<0){ cnt = Integer.parseInt(ignoreDays.trim());
if (cnt < 0)
{
errCode = "VMCRDYS"; errCode = "VMCRDYS";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
}else if(childNodeName.equalsIgnoreCase("acct_code__adv")){ } else if (childNodeName.equalsIgnoreCase("acct_code__adv"))
{
acctCodeAdv = this.genericUtility.getColumnValue("acct_code__adv", dom); acctCodeAdv = this.genericUtility.getColumnValue("acct_code__adv", dom);
if(acctCodeAdv!=null){
cnt=0;
sql = "select count(*) as cnt from accounts where acct_code =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, acctCodeAdv);
rs = pstmt.executeQuery();
if (rs.next()) {
cnt = rs.getInt("cnt");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(cnt!=0){ if (acctCodeAdv != null)
sql = "select active from accounts where acct_code =?"; {
cnt = 0;
sql = "select count(*) as cnt from accounts where acct_code =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, acctCodeAdv); pstmt.setString(1, acctCodeAdv);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
active = rs.getString("active"); {
cnt = rs.getInt("cnt");
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(!active.equalsIgnoreCase("Y")){ if (cnt != 0)
errCode = "VMACCTA"; {
sql = "select active from accounts where acct_code =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, acctCodeAdv);
rs = pstmt.executeQuery();
if (rs.next())
{
active = rs.getString("active");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (!active.equalsIgnoreCase("Y"))
{
errCode = "VMACCTA";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
} else
{
errCode = "VTACCTCD1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
}else{ } else
errCode = "VTACCTCD1"; {
errList.add(errCode); errCode = "VTACCTNLL";// Account adv null
errFields.add(childNodeName.toLowerCase());
}
}else{
errCode = "VTACCTNLL";//Account adv null
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
}else if(childNodeName.equalsIgnoreCase("cctr_code__adv")){ } else if (childNodeName.equalsIgnoreCase("cctr_code__adv"))
{
cctrCodeAdv = this.genericUtility.getColumnValue("cctr_code__adv", dom); cctrCodeAdv = this.genericUtility.getColumnValue("cctr_code__adv", dom);
cnt=0; cnt = 0;
sql = "select count(*) as cnt from costctr where cctr_code =?"; sql = "select count(*) as cnt from costctr where cctr_code =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, cctrCodeAdv); pstmt.setString(1, cctrCodeAdv);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
cnt = rs.getInt("cnt"); cnt = rs.getInt("cnt");
} }
rs.close(); rs.close();
...@@ -325,62 +360,70 @@ implements CustomerLocal, CustomerRemote { ...@@ -325,62 +360,70 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(cnt==0){ if (cnt == 0)
{
errCode = "VTCCTRCD1"; errCode = "VTCCTRCD1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
}else if(childNodeName.equalsIgnoreCase("group_code")){ } else if (childNodeName.equalsIgnoreCase("group_code"))
{
groupCode = this.genericUtility.getColumnValue("group_code", dom); groupCode = this.genericUtility.getColumnValue("group_code", dom);
custCode = this.genericUtility.getColumnValue("cust_code", dom); custCode = this.genericUtility.getColumnValue("cust_code", dom);
if(groupCode!=null && groupCode.trim().length()>0){ if (groupCode != null && groupCode.trim().length() > 0)
if(!groupCode.equalsIgnoreCase(custCode)){ {
cnt=0; if (!groupCode.equalsIgnoreCase(custCode))
sql = "select count(*) as cnt from customer where cust_code =?"; {
pstmt = conn.prepareStatement(sql); cnt = 0;
pstmt.setString(1, groupCode); sql = "select count(*) as cnt from customer where cust_code =?";
rs = pstmt.executeQuery(); pstmt = conn.prepareStatement(sql);
if (rs.next()) { pstmt.setString(1, groupCode);
cnt = rs.getInt("cnt"); rs = pstmt.executeQuery();
} if (rs.next())
rs.close(); {
rs = null; cnt = rs.getInt("cnt");
pstmt.close(); }
pstmt = null; rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql = "select key_flag from transetup where tran_window = 'w_customer'"; sql = "select key_flag from transetup where tran_window = 'w_customer'";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
//pstmt.setString(1, groupCode); rs = pstmt.executeQuery();
rs = pstmt.executeQuery(); if (rs.next())
if (rs.next()) { {
keyFlag = rs.getString("key_flag"); keyFlag = rs.getString("key_flag");
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(cnt==0 && !(keyFlag.equalsIgnoreCase("A"))){ if (cnt == 0 && !("A".equalsIgnoreCase(keyFlag)))
errCode = "VMCUST1"; {
errList.add(errCode); errCode = "VMCUST1";
errFields.add(childNodeName.toLowerCase()); errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
} }
} } else
}else{ {
errCode = "VMGRPCNULL";//Group Code is null errCode = "VMGRPCNULL";// Group Code is null
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
}else if(childNodeName.equalsIgnoreCase("cust_code__bil")){ } else if (childNodeName.equalsIgnoreCase("cust_code__bil"))
{
custCodeBil = this.genericUtility.getColumnValue("cust_code__bil", dom); custCodeBil = this.genericUtility.getColumnValue("cust_code__bil", dom);
custCode = this.genericUtility.getColumnValue("cust_code", dom); custCode = this.genericUtility.getColumnValue("cust_code", dom);
sql = "select key_flag from transetup where tran_window = 'w_customer'"; sql = "select key_flag from transetup where tran_window = 'w_customer'";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
// pstmt.setString(1, groupCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
keyFlag = rs.getString("key_flag"); keyFlag = rs.getString("key_flag");
} }
rs.close(); rs.close();
...@@ -388,17 +431,20 @@ implements CustomerLocal, CustomerRemote { ...@@ -388,17 +431,20 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if((custCodeBil!=null || custCodeBil.trim().length()>0) && !(keyFlag.equalsIgnoreCase("A"))){ if ((custCodeBil != null || custCodeBil.trim().length() > 0) && !("A".equalsIgnoreCase(keyFlag)))
{
errCode = "VEBILLTO"; errCode = "VEBILLTO";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
}else if(!custCodeBil.equalsIgnoreCase(custCode)){ } else if (!custCodeBil.equalsIgnoreCase(custCode))
cnt=0; {
cnt = 0;
sql = "select count(*) as cnt from customer where cust_code =?"; sql = "select count(*) as cnt from customer where cust_code =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCodeBil); pstmt.setString(1, custCodeBil);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
cnt = rs.getInt("cnt"); cnt = rs.getInt("cnt");
} }
rs.close(); rs.close();
...@@ -406,53 +452,63 @@ implements CustomerLocal, CustomerRemote { ...@@ -406,53 +452,63 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(cnt==0){ if (cnt == 0)
{
errCode = "VMBILLTO"; errCode = "VMBILLTO";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
}else if(custCodeBil==null){ } else if (custCodeBil == null || custCodeBil.trim().length() <= 0)
{
errCode = "VMBLLTONLL";// Bill To is null errCode = "VMBLLTONLL";// Bill To is null
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
}else if(childNodeName.equalsIgnoreCase("stan_code")){ } else if (childNodeName.equalsIgnoreCase("stan_code"))
{
stanCode = this.genericUtility.getColumnValue("stan_code", dom); stanCode = this.genericUtility.getColumnValue("stan_code", dom);
cnt=0; cnt = 0;
if(stanCode!=null){ if (stanCode != null)
sql = "select count(*) as cnt from station where stan_code =?"; {
pstmt = conn.prepareStatement(sql); sql = "select count(*) as cnt from station where stan_code =?";
pstmt.setString(1, stanCode); pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery(); pstmt.setString(1, stanCode);
if (rs.next()) { rs = pstmt.executeQuery();
cnt = rs.getInt("cnt"); if (rs.next())
} {
rs.close(); cnt = rs.getInt("cnt");
rs = null; }
pstmt.close(); rs.close();
pstmt = null; rs = null;
pstmt.close();
pstmt = null;
if(cnt==0){ if (cnt == 0)
errCode = "VTSTAN1"; {
errList.add(errCode); errCode = "VTSTAN1";
errFields.add(childNodeName.toLowerCase()); errList.add(errCode);
} errFields.add(childNodeName.toLowerCase());
}else{ }
} else
{
errCode = "VMSTNCDNLL"; errCode = "VMSTNCDNLL";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
}else if(childNodeName.equalsIgnoreCase("terr_code")){ } else if (childNodeName.equalsIgnoreCase("terr_code"))
{
terrCode = this.genericUtility.getColumnValue("terr_code", dom); terrCode = this.genericUtility.getColumnValue("terr_code", dom);
if(terrCode!=null && terrCode.trim().length()>0){ if (terrCode != null && terrCode.trim().length() > 0)
cnt=0; {
cnt = 0;
sql = "select count(*) as ll_count from territory where terr_code =?"; sql = "select count(*) as ll_count from territory where terr_code =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, terrCode); pstmt.setString(1, terrCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
cnt = rs.getInt("ll_count"); cnt = rs.getInt("ll_count");
} }
rs.close(); rs.close();
...@@ -460,22 +516,26 @@ implements CustomerLocal, CustomerRemote { ...@@ -460,22 +516,26 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(cnt==0){ if (cnt == 0)
{
errCode = "VTTERRCD"; errCode = "VTTERRCD";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
}else if(childNodeName.equalsIgnoreCase("state_code")){ } else if (childNodeName.equalsIgnoreCase("state_code"))
{
stateCode = this.genericUtility.getColumnValue("state_code", dom); stateCode = this.genericUtility.getColumnValue("state_code", dom);
if(stateCode!=null && stateCode.trim().length()>0){ if (stateCode != null && stateCode.trim().length() > 0)
cnt=0; {
cnt = 0;
sql = "select count(*) as cnt from state where state_code =?"; sql = "select count(*) as cnt from state where state_code =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, stateCode); pstmt.setString(1, stateCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
cnt = rs.getInt("cnt"); cnt = rs.getInt("cnt");
} }
rs.close(); rs.close();
...@@ -483,22 +543,26 @@ implements CustomerLocal, CustomerRemote { ...@@ -483,22 +543,26 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(cnt==0){ if (cnt == 0)
{
errCode = "VTSTATE1"; errCode = "VTSTATE1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
}else if(childNodeName.equalsIgnoreCase("count_code")){ } else if (childNodeName.equalsIgnoreCase("count_code"))
{
countCode = this.genericUtility.getColumnValue("count_code", dom); countCode = this.genericUtility.getColumnValue("count_code", dom);
if(countCode!=null && countCode.trim().length()>0){ if (countCode != null && countCode.trim().length() > 0)
cnt=0; {
cnt = 0;
sql = "select count(*) as cnt from country where count_code =?"; sql = "select count(*) as cnt from country where count_code =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, countCode); pstmt.setString(1, countCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
cnt = rs.getInt("cnt"); cnt = rs.getInt("cnt");
} }
rs.close(); rs.close();
...@@ -506,22 +570,26 @@ implements CustomerLocal, CustomerRemote { ...@@ -506,22 +570,26 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(cnt==0){ if (cnt == 0)
{
errCode = "VTCONTCD1"; errCode = "VTCONTCD1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
}else if(childNodeName.equalsIgnoreCase("cr_term")){ } else if (childNodeName.equalsIgnoreCase("cr_term"))
{
crTerm = this.genericUtility.getColumnValue("cr_term", dom); crTerm = this.genericUtility.getColumnValue("cr_term", dom);
if(crTerm!=null && crTerm.trim().length()>0){ if (crTerm != null && crTerm.trim().length() > 0)
cnt=0; {
cnt = 0;
sql = "select count(*) as cnt from crterm where cr_term =?"; sql = "select count(*) as cnt from crterm where cr_term =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, crTerm); pstmt.setString(1, crTerm);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
cnt = rs.getInt("cnt"); cnt = rs.getInt("cnt");
} }
rs.close(); rs.close();
...@@ -529,21 +597,24 @@ implements CustomerLocal, CustomerRemote { ...@@ -529,21 +597,24 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(cnt==0){ if (cnt == 0)
{
errCode = "VTCRTERM1"; errCode = "VTCRTERM1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
}else if(childNodeName.equalsIgnoreCase("curr_code")){ } else if (childNodeName.equalsIgnoreCase("curr_code"))
{
currCode = this.genericUtility.getColumnValue("curr_code", dom); currCode = this.genericUtility.getColumnValue("curr_code", dom);
cnt=0; cnt = 0;
sql = "select count(*) as cnt from currency where curr_code =?"; sql = "select count(*) as cnt from currency where curr_code =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, currCode); pstmt.setString(1, currCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
cnt = rs.getInt("cnt"); cnt = rs.getInt("cnt");
} }
rs.close(); rs.close();
...@@ -551,19 +622,23 @@ implements CustomerLocal, CustomerRemote { ...@@ -551,19 +622,23 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(cnt==0){ if (cnt == 0)
{
errCode = "VTCURRCD1"; errCode = "VTCURRCD1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
}else{ } else
if(editFlag.equalsIgnoreCase("E")){ {
if (editFlag.equalsIgnoreCase("E"))
{
custCode = this.genericUtility.getColumnValue("cust_code", dom); custCode = this.genericUtility.getColumnValue("cust_code", dom);
sql = "select curr_code from customer where cust_code =?"; sql = "select curr_code from customer where cust_code =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCode); pstmt.setString(1, custCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
currCode1 = rs.getString("curr_code"); currCode1 = rs.getString("curr_code");
} }
rs.close(); rs.close();
...@@ -571,19 +646,18 @@ implements CustomerLocal, CustomerRemote { ...@@ -571,19 +646,18 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(!currCode.equalsIgnoreCase(currCode1) && currCode1!=null){ if (!currCode.equalsIgnoreCase(currCode1) && currCode1 != null)
lsVal3="C"; {
cnt=0; lsVal3 = "C";
cnt = 0;
sql = "select count(distinct curr_code__ac) as ll_count from sundrybal" sql = "select count(distinct curr_code__ac) as ll_count from sundrybal" + " where sundry_code =?" + " and sundry_type =?" + " and (dr_amt != 0 or cr_amt != 0)";
+ " where sundry_code =?"
+ " and sundry_type =?"
+ " and (dr_amt != 0 or cr_amt != 0)";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCode); pstmt.setString(1, custCode);
pstmt.setString(2, lsVal3); pstmt.setString(2, lsVal3);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
cnt = rs.getInt("ll_count"); cnt = rs.getInt("ll_count");
} }
rs.close(); rs.close();
...@@ -591,18 +665,15 @@ implements CustomerLocal, CustomerRemote { ...@@ -591,18 +665,15 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
cnt1=0; cnt1 = 0;
sql = "select count(*) as cnt from sundrybal" sql = "select count(*) as cnt from sundrybal" + " where sundry_code = ?" + " and sundry_type = ?" + " and (dr_amt != 0 or cr_amt != 0)" + " and curr_code__ac = ?";
+ " where sundry_code = ?"
+ " and sundry_type = ?"
+ " and (dr_amt != 0 or cr_amt != 0)"
+ " and curr_code__ac = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCode); pstmt.setString(1, custCode);
pstmt.setString(2, lsVal3); pstmt.setString(2, lsVal3);
pstmt.setString(3, currCode1); pstmt.setString(3, currCode1);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
cnt1 = rs.getInt("ll_count"); cnt1 = rs.getInt("ll_count");
} }
rs.close(); rs.close();
...@@ -610,7 +681,8 @@ implements CustomerLocal, CustomerRemote { ...@@ -610,7 +681,8 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(cnt1!=0 && cnt>1){ if (cnt1 != 0 && cnt > 1)
{
errCode = "VXCURRCD1"; errCode = "VXCURRCD1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
...@@ -618,16 +690,19 @@ implements CustomerLocal, CustomerRemote { ...@@ -618,16 +690,19 @@ implements CustomerLocal, CustomerRemote {
} }
} }
} }
}else if(childNodeName.equalsIgnoreCase("acct_code__ar")){ } else if (childNodeName.equalsIgnoreCase("acct_code__ar"))
{
acctCodeAr = this.genericUtility.getColumnValue("acct_code__ar", dom); acctCodeAr = this.genericUtility.getColumnValue("acct_code__ar", dom);
if(acctCodeAr!=null && acctCodeAr.trim().length()>0){ if (acctCodeAr != null && acctCodeAr.trim().length() > 0)
cnt=0; {
cnt = 0;
sql = "select count(*) as cnt from accounts where acct_code = ?"; sql = "select count(*) as cnt from accounts where acct_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, acctCodeAr); pstmt.setString(1, acctCodeAr);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
cnt = rs.getInt("cnt"); cnt = rs.getInt("cnt");
} }
rs.close(); rs.close();
...@@ -635,12 +710,14 @@ implements CustomerLocal, CustomerRemote { ...@@ -635,12 +710,14 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(cnt!=0){ if (cnt != 0)
{
sql = "select active from accounts where acct_code =?"; sql = "select active from accounts where acct_code =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, acctCodeAr); pstmt.setString(1, acctCodeAr);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
active = rs.getString("active"); active = rs.getString("active");
} }
rs.close(); rs.close();
...@@ -648,31 +725,37 @@ implements CustomerLocal, CustomerRemote { ...@@ -648,31 +725,37 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(!active.equalsIgnoreCase("Y")){ if (!"Y".equalsIgnoreCase(active))
{
errCode = "VMACCTA"; errCode = "VMACCTA";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
}else{ } else
{
errCode = "VTACCTCD1"; errCode = "VTACCTCD1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
}else { } else
{
errCode = "VMACCTNLL";// A/C Rec is null errCode = "VMACCTNLL";// A/C Rec is null
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
}else if(childNodeName.equalsIgnoreCase("cctr_code__ar")){ } else if (childNodeName.equalsIgnoreCase("cctr_code__ar"))
{
cctrCodeAr = this.genericUtility.getColumnValue("cctr_code__ar", dom); cctrCodeAr = this.genericUtility.getColumnValue("cctr_code__ar", dom);
if(cctrCodeAr!=null && cctrCodeAr.trim().length()>0){ if (cctrCodeAr != null && cctrCodeAr.trim().length() > 0)
cnt=0; {
cnt = 0;
sql = "select count(*) as cnt from costctr where cctr_code =?"; sql = "select count(*) as cnt from costctr where cctr_code =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, cctrCodeAr); pstmt.setString(1, cctrCodeAr);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
cnt = rs.getInt("cnt"); cnt = rs.getInt("cnt");
} }
rs.close(); rs.close();
...@@ -680,30 +763,36 @@ implements CustomerLocal, CustomerRemote { ...@@ -680,30 +763,36 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(cnt==0){ if (cnt == 0)
{
errCode = "VTCCTRCD1"; errCode = "VTCCTRCD1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
}else{ } else
{
acctCodeAr = this.genericUtility.getColumnValue("acct_code__ar", dom); acctCodeAr = this.genericUtility.getColumnValue("acct_code__ar", dom);
if(acctCodeAr!=null && acctCodeAr.trim().length()>0){ if (acctCodeAr != null && acctCodeAr.trim().length() > 0)
{
valueXmlString.append("<cctr_code__ar ><![CDATA[" + blankVar + "]]></cctr_code__ar>"); valueXmlString.append("<cctr_code__ar ><![CDATA[" + blankVar + "]]></cctr_code__ar>");
} }
errCode = "VTCCTRNLL";//Cost Center null errCode = "VTCCTRNLL";// Cost Center null
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
}else if(childNodeName.equalsIgnoreCase("tax_class")){ } else if (childNodeName.equalsIgnoreCase("tax_class"))
{
taxClass = this.genericUtility.getColumnValue("tax_class", dom); taxClass = this.genericUtility.getColumnValue("tax_class", dom);
if(taxClass!=null && taxClass.trim().length()>0){ if (taxClass != null && taxClass.trim().length() > 0)
cnt=0; {
cnt = 0;
sql = "select count(*) as cnt from taxclass where tax_class =?"; sql = "select count(*) as cnt from taxclass where tax_class =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, taxClass); pstmt.setString(1, taxClass);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
cnt = rs.getInt("cnt"); cnt = rs.getInt("cnt");
} }
rs.close(); rs.close();
...@@ -711,22 +800,26 @@ implements CustomerLocal, CustomerRemote { ...@@ -711,22 +800,26 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(cnt==0){ if (cnt == 0)
{
errCode = "VTTAXCLA1"; errCode = "VTTAXCLA1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
}else if(childNodeName.equalsIgnoreCase("tax_chap")){ } else if (childNodeName.equalsIgnoreCase("tax_chap"))
{
taxChap = this.genericUtility.getColumnValue("tax_chap", dom); taxChap = this.genericUtility.getColumnValue("tax_chap", dom);
if(taxChap!=null && taxChap.trim().length()>0){ if (taxChap != null && taxChap.trim().length() > 0)
cnt=0; {
cnt = 0;
sql = "select count(*) as cnt from taxchap where tax_chap =?"; sql = "select count(*) as cnt from taxchap where tax_chap =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, taxChap); pstmt.setString(1, taxChap);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
cnt = rs.getInt("cnt"); cnt = rs.getInt("cnt");
} }
rs.close(); rs.close();
...@@ -734,22 +827,26 @@ implements CustomerLocal, CustomerRemote { ...@@ -734,22 +827,26 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(cnt==0){ if (cnt == 0)
{
errCode = "VTTAXCHAP1"; errCode = "VTTAXCHAP1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
}else if(childNodeName.equalsIgnoreCase("price_list")){ } else if (childNodeName.equalsIgnoreCase("price_list"))
{
priceList = this.genericUtility.getColumnValue("price_list", dom); priceList = this.genericUtility.getColumnValue("price_list", dom);
if(priceList!=null && priceList.trim().length()>0){ if (priceList != null && priceList.trim().length() > 0)
cnt=0; {
cnt = 0;
sql = "select count(*) as cnt from pricelist_mst where price_list =?"; sql = "select count(*) as cnt from pricelist_mst where price_list =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, priceList); pstmt.setString(1, priceList);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
cnt = rs.getInt("cnt"); cnt = rs.getInt("cnt");
} }
rs.close(); rs.close();
...@@ -757,22 +854,26 @@ implements CustomerLocal, CustomerRemote { ...@@ -757,22 +854,26 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(cnt==0){ if (cnt == 0)
{
errCode = "VTPLIST1"; errCode = "VTPLIST1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
}else if(childNodeName.equalsIgnoreCase("price_list__clg")){ } else if (childNodeName.equalsIgnoreCase("price_list__clg"))
{
priceListClg = this.genericUtility.getColumnValue("price_list__clg", dom); priceListClg = this.genericUtility.getColumnValue("price_list__clg", dom);
if(priceListClg!=null && priceListClg.trim().length()>0){ if (priceListClg != null && priceListClg.trim().length() > 0)
cnt=0; {
cnt = 0;
sql = "select count(*) as cnt from pricelist_mst where price_list =?"; sql = "select count(*) as cnt from pricelist_mst where price_list =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, priceListClg); pstmt.setString(1, priceListClg);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
cnt = rs.getInt("cnt"); cnt = rs.getInt("cnt");
} }
rs.close(); rs.close();
...@@ -780,23 +881,26 @@ implements CustomerLocal, CustomerRemote { ...@@ -780,23 +881,26 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(cnt==0){ if (cnt == 0)
{
errCode = "VTPLIST1"; errCode = "VTPLIST1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
} } else if (childNodeName.equalsIgnoreCase("sales_pers"))
else if(childNodeName.equalsIgnoreCase("sales_pers")){ {
salesPers = this.genericUtility.getColumnValue("sales_pers", dom); salesPers = this.genericUtility.getColumnValue("sales_pers", dom);
if(salesPers!=null && salesPers.trim().length()>0){ if (salesPers != null && salesPers.trim().length() > 0)
cnt=0; {
cnt = 0;
sql = "select count(*) as cnt from sales_pers where sales_pers = ?"; sql = "select count(*) as cnt from sales_pers where sales_pers = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, salesPers); pstmt.setString(1, salesPers);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
cnt = rs.getInt("cnt"); cnt = rs.getInt("cnt");
} }
rs.close(); rs.close();
...@@ -804,26 +908,30 @@ implements CustomerLocal, CustomerRemote { ...@@ -804,26 +908,30 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(cnt==0){ if (cnt == 0)
{
errCode = "VMSLPERS1"; errCode = "VMSLPERS1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
}else{ } else
{
errCode = "VMSLPERNLL"; errCode = "VMSLPERNLL";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} } else if (childNodeName.equalsIgnoreCase("sales_pers__1"))
else if(childNodeName.equalsIgnoreCase("sales_pers__1")){ {
salesPers1 = this.genericUtility.getColumnValue("sales_pers__1", dom); salesPers1 = this.genericUtility.getColumnValue("sales_pers__1", dom);
if(salesPers1!=null && salesPers1.trim().length()>0){ if (salesPers1 != null && salesPers1.trim().length() > 0)
cnt=0; {
cnt = 0;
sql = "select count(*) as cnt from sales_pers where sales_pers = ?"; sql = "select count(*) as cnt from sales_pers where sales_pers = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, salesPers1); pstmt.setString(1, salesPers1);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
cnt = rs.getInt("cnt"); cnt = rs.getInt("cnt");
} }
rs.close(); rs.close();
...@@ -831,46 +939,52 @@ implements CustomerLocal, CustomerRemote { ...@@ -831,46 +939,52 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(cnt==0){ if (cnt == 0)
{
errCode = "VMSLPERS1"; errCode = "VMSLPERS1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
} } else if (childNodeName.equalsIgnoreCase("sales_pers__2"))
else if(childNodeName.equalsIgnoreCase("sales_pers__2")){ {
salesPers2 = this.genericUtility.getColumnValue("sales_pers__2", dom); salesPers2 = this.genericUtility.getColumnValue("sales_pers__2", dom);
if(salesPers2!=null && salesPers2.trim().length()>0){ if (salesPers2 != null && salesPers2.trim().length() > 0)
cnt=0; {
cnt = 0;
sql = "select count(*) as cnt from sales_pers where sales_pers = ?"; sql = "select count(*) as cnt from sales_pers where sales_pers = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, salesPers2); pstmt.setString(1, salesPers2);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
cnt = rs.getInt("cnt"); cnt = rs.getInt("cnt");
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(cnt==0){ if (cnt == 0)
{
errCode = "VMSLPERS1"; errCode = "VMSLPERS1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
} } else if (childNodeName.equalsIgnoreCase("tran_code"))
else if(childNodeName.equalsIgnoreCase("tran_code")){ {
tranCode = this.genericUtility.getColumnValue("tran_code", dom); tranCode = this.genericUtility.getColumnValue("tran_code", dom);
if(tranCode!=null && tranCode.trim().length()>0){ if (tranCode != null && tranCode.trim().length() > 0)
cnt=0; {
cnt = 0;
sql = "select count(*) as cnt from transporter where tran_code = ?"; sql = "select count(*) as cnt from transporter where tran_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranCode); pstmt.setString(1, tranCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
cnt = rs.getInt("cnt"); cnt = rs.getInt("cnt");
} }
rs.close(); rs.close();
...@@ -878,22 +992,26 @@ implements CustomerLocal, CustomerRemote { ...@@ -878,22 +992,26 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(cnt==0){ if (cnt == 0)
{
errCode = "VTTRANCD1"; errCode = "VTTRANCD1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
}else if(childNodeName.equalsIgnoreCase("site_code__rcp")){ } else if (childNodeName.equalsIgnoreCase("site_code__rcp"))
{
siteCodeRcp = this.genericUtility.getColumnValue("site_code__rcp", dom); siteCodeRcp = this.genericUtility.getColumnValue("site_code__rcp", dom);
if(siteCodeRcp!=null && siteCodeRcp.trim().length()>0){ if (siteCodeRcp != null && siteCodeRcp.trim().length() > 0)
cnt=0; {
cnt = 0;
sql = "select count(*) as cnt from site where site_code =?"; sql = "select count(*) as cnt from site where site_code =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCodeRcp); pstmt.setString(1, siteCodeRcp);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
cnt = rs.getInt("cnt"); cnt = rs.getInt("cnt");
} }
rs.close(); rs.close();
...@@ -901,33 +1019,40 @@ implements CustomerLocal, CustomerRemote { ...@@ -901,33 +1019,40 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(cnt==0){ if (cnt == 0)
{
errCode = "VTSITECD1"; errCode = "VTSITECD1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
}else if(childNodeName.equalsIgnoreCase("site_code")){ } else if (childNodeName.equalsIgnoreCase("site_code"))
{
siteCode = this.genericUtility.getColumnValue("site_code", dom); siteCode = this.genericUtility.getColumnValue("site_code", dom);
channelPartner = this.genericUtility.getColumnValue("channel_partner", dom); channelPartner = this.genericUtility.getColumnValue("channel_partner", dom);
if(channelPartner.equalsIgnoreCase("Y") && (siteCode==null && siteCode.trim().length()<=0)){ if ("Y".equalsIgnoreCase(channelPartner) && (siteCode == null && siteCode.trim().length() <= 0))
{
errCode = "VMSITECD1"; errCode = "VMSITECD1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
}else{ } else
if(channelPartner.equalsIgnoreCase("N") && (siteCode!=null)){ {
if ("N".equalsIgnoreCase(channelPartner) && (siteCode != null))
{
errCode = "VNRSITE"; errCode = "VNRSITE";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
if(channelPartner.equalsIgnoreCase("Y") && (siteCode!=null && siteCode.trim().length()>0)){ if ("Y".equalsIgnoreCase(channelPartner) && (siteCode != null && siteCode.trim().length() > 0))
cnt=0; {
cnt = 0;
sql = "select count(*) as cnt from site where site_code =?"; sql = "select count(*) as cnt from site where site_code =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode); pstmt.setString(1, siteCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
cnt = rs.getInt("cnt"); cnt = rs.getInt("cnt");
} }
rs.close(); rs.close();
...@@ -935,30 +1060,35 @@ implements CustomerLocal, CustomerRemote { ...@@ -935,30 +1060,35 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(cnt==0){ if (cnt == 0)
{
errCode = "VTSITECD1"; errCode = "VTSITECD1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
} }
}else if(childNodeName.equalsIgnoreCase("black_listing")){ } else if (childNodeName.equalsIgnoreCase("black_listing"))
{
blackListing = this.genericUtility.getColumnValue("black_listing", dom); blackListing = this.genericUtility.getColumnValue("black_listing", dom);
if(!blackListing.equalsIgnoreCase("P")){ if (!"P".equalsIgnoreCase(blackListing))
{
errCode = "VMBLACKLIS"; errCode = "VMBLACKLIS";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
}else if(childNodeName.equalsIgnoreCase("contact_code")){ } else if (childNodeName.equalsIgnoreCase("contact_code"))
{
contactCode = this.genericUtility.getColumnValue("contact_code", dom); contactCode = this.genericUtility.getColumnValue("contact_code", dom);
cnt=0; cnt = 0;
sql = "select count(*) as cnt from contact where contact_code =?"; sql = "select count(*) as cnt from contact where contact_code =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, contactCode); pstmt.setString(1, contactCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
cnt = rs.getInt("cnt"); cnt = rs.getInt("cnt");
} }
rs.close(); rs.close();
...@@ -966,47 +1096,55 @@ implements CustomerLocal, CustomerRemote { ...@@ -966,47 +1096,55 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(cnt==0){ if (cnt == 0)
{
errCode = "VMCONTCD1"; errCode = "VMCONTCD1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
}else if(childNodeName.equalsIgnoreCase("bank_code")){ } else if (childNodeName.equalsIgnoreCase("bank_code"))
{
bankCode = this.genericUtility.getColumnValue("bank_code", dom); bankCode = this.genericUtility.getColumnValue("bank_code", dom);
if(bankCode!=null){ if (bankCode != null)
cnt=0; {
cnt = 0;
sql = "select count(*) as cnt from bank where bank_code =?"; sql = "select count(*) as cnt from bank where bank_code =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, bankCode); pstmt.setString(1, bankCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
cnt = rs.getInt("cnt"); cnt = rs.getInt("cnt");
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(cnt<=0){ if (cnt <= 0)
{
errCode = "VMBANK1"; errCode = "VMBANK1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
}else if(childNodeName.equalsIgnoreCase("price_list__disc")){ } else if (childNodeName.equalsIgnoreCase("price_list__disc"))
{
priceListDisc = this.genericUtility.getColumnValue("price_list__disc", dom); priceListDisc = this.genericUtility.getColumnValue("price_list__disc", dom);
if(priceListDisc!=null && priceListDisc.trim().length()>0){ if (priceListDisc != null && priceListDisc.trim().length() > 0)
// cnt1=Integer.parseInt(priceListDisc.trim()); {
// } // cnt1=Integer.parseInt(priceListDisc.trim());
// if(cnt1>0){ // }
cnt=0; // if(cnt1>0){
cnt = 0;
sql = "select count(*) as cnt from pricelist where price_list =?"; sql = "select count(*) as cnt from pricelist where price_list =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, priceListDisc); pstmt.setString(1, priceListDisc);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
cnt = rs.getInt("cnt"); cnt = rs.getInt("cnt");
} }
rs.close(); rs.close();
...@@ -1014,30 +1152,36 @@ implements CustomerLocal, CustomerRemote { ...@@ -1014,30 +1152,36 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(cnt==0){ if (cnt == 0)
{
errCode = "VTPLIST1"; errCode = "VTPLIST1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
}else if(childNodeName.equalsIgnoreCase("sales_option")){ } else if (childNodeName.equalsIgnoreCase("sales_option"))
{
salesOption = this.genericUtility.getColumnValue("sales_option", dom); salesOption = this.genericUtility.getColumnValue("sales_option", dom);
if(salesOption==null || salesOption.trim().length()<=0){ if (salesOption == null || salesOption.trim().length() <= 0)
{
errCode = "VTSLOPT"; errCode = "VTSLOPT";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
}else if(childNodeName.equalsIgnoreCase("dlv_term")){ } else if (childNodeName.equalsIgnoreCase("dlv_term"))
{
dlvTerm = this.genericUtility.getColumnValue("dlv_term", dom); dlvTerm = this.genericUtility.getColumnValue("dlv_term", dom);
if(dlvTerm!=null || dlvTerm.trim().length()>0){ if (dlvTerm != null || dlvTerm.trim().length() > 0)
cnt=0; {
cnt = 0;
sql = "select count(*) as cnt from delivery_term where dlv_term =?"; sql = "select count(*) as cnt from delivery_term where dlv_term =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, dlvTerm); pstmt.setString(1, dlvTerm);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
cnt = rs.getInt("cnt"); cnt = rs.getInt("cnt");
} }
rs.close(); rs.close();
...@@ -1045,47 +1189,57 @@ implements CustomerLocal, CustomerRemote { ...@@ -1045,47 +1189,57 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(cnt==0){ if (cnt == 0)
{
errCode = "VMDLVTERM1"; errCode = "VMDLVTERM1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
}else if(childNodeName.equalsIgnoreCase("loss_perc")){ } else if (childNodeName.equalsIgnoreCase("loss_perc"))
{
lossPerc = this.genericUtility.getColumnValue("loss_perc", dom); lossPerc = this.genericUtility.getColumnValue("loss_perc", dom);
if(lossPerc!=null){ if (lossPerc != null)
cnt1=Integer.parseInt(lossPerc); {
cnt1 = Integer.parseInt(lossPerc);
} }
if(cnt1<0){ if (cnt1 < 0)
{
errCode = "VTLOSSPERC"; errCode = "VTLOSSPERC";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
}else if(childNodeName.equalsIgnoreCase("adhoc_repl_perc")){ } else if (childNodeName.equalsIgnoreCase("adhoc_repl_perc"))
{
adhocReplPerc = this.genericUtility.getColumnValue("adhoc_repl_perc", dom); adhocReplPerc = this.genericUtility.getColumnValue("adhoc_repl_perc", dom);
double adhocvalue=0.00; double adhocvalue = 0.00;
if(adhocReplPerc!=null||adhocReplPerc.trim().length()>0){ if (adhocReplPerc != null || adhocReplPerc.trim().length() > 0)
{
adhocvalue=Double.valueOf(adhocReplPerc.trim());
// cnt1=Integer.parseInt(adhocReplPerc.trim()); adhocvalue = Double.valueOf(adhocReplPerc.trim());
// if(cnt1<0 || cnt1>100){ // cnt1=Integer.parseInt(adhocReplPerc.trim());
if(adhocvalue<0 || adhocvalue>100){ // if(cnt1<0 || cnt1>100){
if (adhocvalue < 0 || adhocvalue > 100)
{
errCode = "VTADH"; errCode = "VTADH";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
}else if(childNodeName.equalsIgnoreCase("term_table__no")){ } else if (childNodeName.equalsIgnoreCase("term_table__no"))
{
termTableNo = this.genericUtility.getColumnValue("term_table__no", dom); termTableNo = this.genericUtility.getColumnValue("term_table__no", dom);
if(termTableNo!=null){ if (termTableNo != null)
{
sql = "select count(1) as cnt from sale_term_table where term_table = ?"; sql = "select count(1) as cnt from sale_term_table where term_table = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, termTableNo); pstmt.setString(1, termTableNo);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
cnt = rs.getInt("cnt"); cnt = rs.getInt("cnt");
} }
rs.close(); rs.close();
...@@ -1093,23 +1247,26 @@ implements CustomerLocal, CustomerRemote { ...@@ -1093,23 +1247,26 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(cnt==0){ if (cnt == 0)
{
errCode = "VMSALETERM"; errCode = "VMSALETERM";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
}else if(childNodeName.equalsIgnoreCase("emp_code__ord")){ } else if (childNodeName.equalsIgnoreCase("emp_code__ord"))
{
empCodeOrd = checkNull(this.genericUtility.getColumnValue("emp_code__ord", dom)); empCodeOrd = checkNull(this.genericUtility.getColumnValue("emp_code__ord", dom));
if (empCodeOrd != null && empCodeOrd.trim().length() > 0)
if(empCodeOrd!=null && empCodeOrd.trim().length()>0){ {
cnt=0; cnt = 0;
sql = "select count(*) as cnt from employee where emp_code=?"; sql = "select count(*) as cnt from employee where emp_code=?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCodeOrd); pstmt.setString(1, empCodeOrd);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
cnt = rs.getInt("cnt"); cnt = rs.getInt("cnt");
} }
rs.close(); rs.close();
...@@ -1117,23 +1274,27 @@ implements CustomerLocal, CustomerRemote { ...@@ -1117,23 +1274,27 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(cnt==0){ if (cnt == 0)
{
errCode = "VMEMPORD2"; errCode = "VMEMPORD2";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
}else if(childNodeName.equalsIgnoreCase("emp_code__ord1")){ } else if (childNodeName.equalsIgnoreCase("emp_code__ord1"))
{
empCodeOrd1 = checkNull(this.genericUtility.getColumnValue("emp_code__ord1", dom)); empCodeOrd1 = checkNull(this.genericUtility.getColumnValue("emp_code__ord1", dom));
if(empCodeOrd1!=null && empCodeOrd1.trim().length()>0){ if (empCodeOrd1 != null && empCodeOrd1.trim().length() > 0)
cnt=0; {
cnt = 0;
sql = "select count(*) as cnt from employee where emp_code=?"; sql = "select count(*) as cnt from employee where emp_code=?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCodeOrd1); pstmt.setString(1, empCodeOrd1);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
cnt = rs.getInt("cnt"); cnt = rs.getInt("cnt");
} }
rs.close(); rs.close();
...@@ -1141,113 +1302,123 @@ implements CustomerLocal, CustomerRemote { ...@@ -1141,113 +1302,123 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(cnt==0){ if (cnt == 0)
{
errCode = "VMEMPORD2"; errCode = "VMEMPORD2";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
} }
// else if(childNodeName.equalsIgnoreCase("cust_code__pd")){ // else if(childNodeName.equalsIgnoreCase("cust_code__pd")){
// custCodePd = checkNull(this.genericUtility.getColumnValue( // custCodePd =
// "cust_code__pd", dom)); // checkNull(this.genericUtility.getColumnValue(
// // "cust_code__pd", dom));
// if(custCodePd!=null){ //
// cnt=0; // if(custCodePd!=null){
// sql = "select count(*) as cnt from customer where cust_code__pd=?"; // cnt=0;
// pstmt = conn.prepareStatement(sql); // sql =
// pstmt.setString(1, custCodePd); // "select count(*) as cnt from customer where cust_code__pd=?";
// rs = pstmt.executeQuery(); // pstmt = conn.prepareStatement(sql);
// if (rs.next()) { // pstmt.setString(1, custCodePd);
// cnt = rs.getInt("cnt"); // rs = pstmt.executeQuery();
// } // if (rs.next()) {
// rs.close(); // cnt = rs.getInt("cnt");
// rs = null; // }
// pstmt.close(); // rs.close();
// pstmt = null; // rs = null;
// // pstmt.close();
// if(cnt==0){ // pstmt = null;
// errCode = ""; //
// errList.add(errCode); // if(cnt==0){
// errFields.add(childNodeName.toLowerCase()); // errCode = "";
// } // errList.add(errCode);
// } // errFields.add(childNodeName.toLowerCase());
// } // }
// else if(childNodeName.equalsIgnoreCase("cust_code__disc")){ // }
// custCodeDisc = checkNull(this.genericUtility.getColumnValue( // }
// "cust_code__disc", dom)); // else
// // if(childNodeName.equalsIgnoreCase("cust_code__disc")){
// if(custCodeDisc!=null){ // custCodeDisc =
// cnt=0; // checkNull(this.genericUtility.getColumnValue(
// sql = "select count(*) as cnt from customer where cust_code__disc=?"; // "cust_code__disc", dom));
// pstmt = conn.prepareStatement(sql); //
// pstmt.setString(1, custCodeDisc); // if(custCodeDisc!=null){
// rs = pstmt.executeQuery(); // cnt=0;
// if (rs.next()) { // sql =
// cnt = rs.getInt("cnt"); // "select count(*) as cnt from customer where cust_code__disc=?";
// } // pstmt = conn.prepareStatement(sql);
// rs.close(); // pstmt.setString(1, custCodeDisc);
// rs = null; // rs = pstmt.executeQuery();
// pstmt.close(); // if (rs.next()) {
// pstmt = null; // cnt = rs.getInt("cnt");
// // }
// if(cnt==0){ // rs.close();
// errCode = ""; // rs = null;
// errList.add(errCode); // pstmt.close();
// errFields.add(childNodeName.toLowerCase()); // pstmt = null;
// } //
// } // if(cnt==0){
// } // errCode = "";
// else if(childNodeName.equalsIgnoreCase("sgroup_code")){ // errList.add(errCode);
// sgroupCode = checkNull(this.genericUtility.getColumnValue( // errFields.add(childNodeName.toLowerCase());
// "sgroup_code", dom)); // }
// // }
// if(sgroupCode!=null){ // }
// cnt=0; // else if(childNodeName.equalsIgnoreCase("sgroup_code")){
// sql = "select count(*) as cnt from acctsgrp where sgroup_code=?"; // sgroupCode =
// pstmt = conn.prepareStatement(sql); // checkNull(this.genericUtility.getColumnValue(
// pstmt.setString(1, sgroupCode); // "sgroup_code", dom));
// rs = pstmt.executeQuery(); //
// if (rs.next()) { // if(sgroupCode!=null){
// cnt = rs.getInt("cnt"); // cnt=0;
// } // sql =
// rs.close(); // "select count(*) as cnt from acctsgrp where sgroup_code=?";
// rs = null; // pstmt = conn.prepareStatement(sql);
// pstmt.close(); // pstmt.setString(1, sgroupCode);
// pstmt = null; // rs = pstmt.executeQuery();
// // if (rs.next()) {
// if(cnt==0){ // cnt = rs.getInt("cnt");
// errCode = ""; // }
// errList.add(errCode); // rs.close();
// errFields.add(childNodeName.toLowerCase()); // rs = null;
// } // pstmt.close();
// } // pstmt = null;
// } //
// else if(childNodeName.equalsIgnoreCase("cust_code__ar")){ // if(cnt==0){
// custCodeAr = checkNull(this.genericUtility.getColumnValue( // errCode = "";
// "cust_code__ar", dom)); // errList.add(errCode);
// // errFields.add(childNodeName.toLowerCase());
// if(custCodeAr!=null){ // }
// cnt=0; // }
// sql = "select count(*) as cnt from customer where cust_code__ar=?"; // }
// pstmt = conn.prepareStatement(sql); // else if(childNodeName.equalsIgnoreCase("cust_code__ar")){
// pstmt.setString(1, custCodeAr); // custCodeAr =
// rs = pstmt.executeQuery(); // checkNull(this.genericUtility.getColumnValue(
// if (rs.next()) { // "cust_code__ar", dom));
// cnt = rs.getInt("cnt"); //
// } // if(custCodeAr!=null){
// rs.close(); // cnt=0;
// rs = null; // sql =
// pstmt.close(); // "select count(*) as cnt from customer where cust_code__ar=?";
// pstmt = null; // pstmt = conn.prepareStatement(sql);
// // pstmt.setString(1, custCodeAr);
// if(cnt==0){ // rs = pstmt.executeQuery();
// errCode = ""; // if (rs.next()) {
// errList.add(errCode); // cnt = rs.getInt("cnt");
// errFields.add(childNodeName.toLowerCase()); // }
// } // rs.close();
// } // rs = null;
// } // pstmt.close();
// pstmt = null;
//
// if(cnt==0){
// errCode = "";
// errList.add(errCode);
// errFields.add(childNodeName.toLowerCase());
// }
// }
// }
} }
valueXmlString.append("</Detail1>"); valueXmlString.append("</Detail1>");
...@@ -1258,113 +1429,125 @@ implements CustomerLocal, CustomerRemote { ...@@ -1258,113 +1429,125 @@ implements CustomerLocal, CustomerRemote {
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
valueXmlString.append("<Detail2>"); valueXmlString.append("<Detail2>");
childNodeListLength = childNodeList.getLength(); childNodeListLength = childNodeList.getLength();
System.out.println("editFlag -->>[" + editFlag + "]"); for (ctr = 0; ctr < childNodeListLength; ctr++)
for (ctr = 0; ctr < childNodeListLength; ctr++) { {
childNode = childNodeList.item(ctr); childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
if (childNodeName.trim().equalsIgnoreCase("reg_code")) { if (childNodeName.trim().equalsIgnoreCase("reg_code"))
{
regCode = this.genericUtility.getColumnValue("reg_code", dom); regCode = this.genericUtility.getColumnValue("reg_code", dom);
if(regCode!=null){ if (regCode != null && regCode.trim().length()>0)
cnt=0; {
cnt = 0;
sql = "select count(*) as cnt from reg_requirements where reg_code=?"; sql = "select count(*) as cnt from reg_requirements where reg_code=?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, regCode); pstmt.setString(1, regCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
cnt = rs.getInt("cnt"); cnt = rs.getInt("cnt");
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(cnt==0){ if (cnt == 0)
{
errCode = "VTRCODEXT"; errCode = "VTRCODEXT";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
}else { } else
{
errCode = "VTRCODNULL"; errCode = "VTRCODNULL";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} else if(childNodeName.trim().equalsIgnoreCase("reg_date")){ } else if (childNodeName.trim().equalsIgnoreCase("reg_date"))
{
regDate = this.genericUtility.getColumnValue("reg_date", dom); regDate = this.genericUtility.getColumnValue("reg_date", dom);
if(regDate==null || regDate.trim().length()<=0){ if (regDate == null || regDate.trim().length() <= 0)
{
errCode = "VTREGNULL"; errCode = "VTREGNULL";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} } else if (childNodeName.trim().equalsIgnoreCase("valid_upto"))
else if(childNodeName.trim().equalsIgnoreCase("valid_upto")){ {
validUpto = this.genericUtility.getColumnValue("valid_upto", dom); validUpto = this.genericUtility.getColumnValue("valid_upto", dom);
regDate = this.genericUtility.getColumnValue("reg_date", dom); regDate = this.genericUtility.getColumnValue("reg_date", dom);
if(validUpto!=null){ if (validUpto != null)
{
Timestamp validUptoDate = Timestamp.valueOf(genericUtility.getValidDateString(validUpto, Timestamp validUptoDate = Timestamp.valueOf(genericUtility.getValidDateString(validUpto,
genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0"); genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
Timestamp regDateNew = Timestamp.valueOf(genericUtility.getValidDateString(regDate, Timestamp regDateNew = Timestamp.valueOf(genericUtility.getValidDateString(regDate,
genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0"); genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
if(validUptoDate.compareTo(regDateNew)<=0) if (validUptoDate.compareTo(regDateNew) <= 0)
{ {
errCode = "VTVALREGDT"; errCode = "VTVALREGDT";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
}else{ } else
{
errCode = "VTVALNULL"; errCode = "VTVALNULL";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
} }
valueXmlString.append("</Detail1>"); valueXmlString.append("</Detail1>");
} }
int errListSize = errList.size(); int errListSize = errList.size();
cnt = 0; cnt = 0;
String errFldName = null; String errFldName = null;
if ((errList != null) && (errListSize > 0)) { if ((errList != null) && (errListSize > 0))
for (cnt = 0; cnt < errListSize; cnt++) { {
for (cnt = 0; cnt < errListSize; cnt++)
{
errCode = (String) errList.get(cnt); errCode = (String) errList.get(cnt);
errFldName = (String) errFields.get(cnt); errFldName = (String) errFields.get(cnt);
errString = getErrorString(errFldName, errCode, userId); errString = getErrorString(errFldName, errCode, userId);
errorType = errorType(conn, errCode); errorType = errorType(conn, errCode);
if (errString.length() > 0) { if (errString.length() > 0)
String bifurErrString = errString.substring( {
errString.indexOf("<Errors>") + 8, String bifurErrString = errString.substring(errString.indexOf("<Errors>") + 8, errString.indexOf("<trace>"));
errString.indexOf("<trace>")); bifurErrString = bifurErrString + errString.substring(errString.indexOf("</trace>") + 8, errString.indexOf("</Errors>"));
bifurErrString = bifurErrString
+ errString.substring(
errString.indexOf("</trace>") + 8,
errString.indexOf("</Errors>"));
errStringXml.append(bifurErrString); errStringXml.append(bifurErrString);
errString = ""; errString = "";
} }
if (errorType.equalsIgnoreCase("E")) { if (errorType.equalsIgnoreCase("E"))
{
break; break;
} }
} }
errStringXml.append("</Errors> </Root> \r\n"); errStringXml.append("</Errors> </Root> \r\n");
} else { } else
{
errStringXml = new StringBuffer(""); errStringXml = new StringBuffer("");
} }
} catch (Exception e)
} catch (Exception e) { {
e.printStackTrace(); e.printStackTrace();
errString = e.getMessage(); errString = e.getMessage();
throw new ITMException(e); throw new ITMException(e);
} finally { } finally
try { {
if (conn != null) { try
if (rs != null) { {
if (conn != null)
{
if (rs != null)
{
rs.close(); rs.close();
rs = null; rs = null;
} }
if (pstmt != null) { if (pstmt != null)
{
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
...@@ -1372,7 +1555,8 @@ implements CustomerLocal, CustomerRemote { ...@@ -1372,7 +1555,8 @@ implements CustomerLocal, CustomerRemote {
conn.close(); conn.close();
} }
conn = null; conn = null;
} catch (Exception d) { } catch (Exception d)
{
d.printStackTrace(); d.printStackTrace();
throw new ITMException(d); throw new ITMException(d);
} }
...@@ -1381,42 +1565,40 @@ implements CustomerLocal, CustomerRemote { ...@@ -1381,42 +1565,40 @@ implements CustomerLocal, CustomerRemote {
return errString; return errString;
} }
public String itemChanged(String xmlString, String xmlString1, public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException
String xmlString2, String objContext, String currentColumn, {
String editFlag, String xtraParams) throws RemoteException,
ITMException {
Document dom = null; Document dom = null;
Document dom1 = null; Document dom1 = null;
Document dom2 = null; Document dom2 = null;
String valueXmlString = ""; String valueXmlString = "";
try { try
{
dom = parseString(xmlString); dom = parseString(xmlString);
dom1 = parseString(xmlString1); dom1 = parseString(xmlString1);
if (xmlString2.trim().length() > 0) { if (xmlString2.trim().length() > 0)
{
dom2 = parseString(xmlString2); dom2 = parseString(xmlString2);
} }
System.out.println("HELLO1 PRINT"); System.out.println("HELLO1 PRINT");
valueXmlString = itemChanged(dom, dom1, dom2, objContext,currentColumn, editFlag, xtraParams); valueXmlString = itemChanged(dom, dom1, dom2, objContext, currentColumn, editFlag, xtraParams);
System.out.println("valueXmlString[" + valueXmlString + "]"); System.out.println("valueXmlString[" + valueXmlString + "]");
} catch (Exception e) { } catch (Exception e)
System.out.println("Exception : [MiscVal][itemChanged( String, String )] :==>\n"+ e.getMessage()); {
System.out.println("Exception : [MiscVal][itemChanged( String, String )] :==>\n" + e.getMessage());
throw new ITMException(e); throw new ITMException(e);
} }
System.out.println("VALUE HELLO PRINTA[" + valueXmlString + "]"); System.out.println("VALUE HELLO PRINTA[" + valueXmlString + "]");
return valueXmlString; return valueXmlString;
} }
public String itemChanged(Document dom, Document dom1, Document dom2, public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException
String objContext, String currentColumn, String editFlag, {
String xtraParams) throws RemoteException, ITMException {
System.out.println("sTART PRINT ");
NodeList parentNodeList = null; NodeList parentNodeList = null;
NodeList childNodeList = null; NodeList childNodeList = null;
Node parentNode = null; Node parentNode = null;
Node childNode = null; Node childNode = null;
String childNodeName = null; String childNodeName = null;
String sql = "",sql1 = "",sql2 = ""; String sql = "", sql1 = "", sql2 = "";
Connection conn = null; Connection conn = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
PreparedStatement pstmt1 = null; PreparedStatement pstmt1 = null;
...@@ -1424,19 +1606,18 @@ implements CustomerLocal, CustomerRemote { ...@@ -1424,19 +1606,18 @@ implements CustomerLocal, CustomerRemote {
ResultSet rs = null; ResultSet rs = null;
ResultSet rs1 = null; ResultSet rs1 = null;
ResultSet rs2 = null; ResultSet rs2 = null;
String resBKList = "",lsDescr = "",lsBKListed = ""; String resBKList = "", lsDescr = "", lsBKListed = "";
String lsNull = "",nullVarr="",ldDate=""; String lsNull = "", nullVarr = "", ldDate = "";
String custCodeBill="",custCode="",stanCode="",currCode="",countCode=""; String custCodeBill = "", custCode = "", stanCode = "", currCode = "", countCode = "";
String lsStateCode="",lsCity="",lsPin=""; String lsStateCode = "", lsCity = "", lsPin = "";
String custName="",chqName="",terrCode="",terrDesc="",salesPers="",spName="",contactCode="",groupCode=""; String custName = "", chqName = "", terrCode = "", terrDesc = "", salesPers = "", spName = "", contactCode = "", groupCode = "";
String bankCode="",bankName=""; String bankCode = "", bankName = "";
String channelPartner=""; String channelPartner = "";
String crTerm="",crDays=""; String crTerm = "", crDays = "";
String rateRound=""; String rateRound = "";
String name="", shName="", contPers="", contPfx="", addr1="", addr2="",addr3="", stateCode="", String name = "", shName = "", contPers = "", contPfx = "", addr1 = "", addr2 = "", addr3 = "", stateCode = "", tele1 = "", tele2 = "", tele3 = "", teleExt = "", fax = "", emailAddr = "", ediAddr = "";
tele1="", tele2="", tele3="",teleExt="", fax="", emailAddr="", ediAddr=""; String contPfx1 = "", contPers1 = "", Add1 = "", emailAddr1 = "", ediAddr1 = "", keyFlag = "";
String contPfx1="",contPers1="",Add1="",emailAddr1="",ediAddr1="",keyFlag=""; String regCode = "", regDescr = "", empCodeOrd = "", empFname = "", empLname = "", empCodeOrd1 = "", deptCode = "";
String regCode="",regDescr="",empCodeOrd="",empFname="",empLname="",empCodeOrd1="",deptCode="";
int ctr = 0; int ctr = 0;
int currentFormNo = 0; int currentFormNo = 0;
java.util.Date reqDate = null; java.util.Date reqDate = null;
...@@ -1449,47 +1630,49 @@ implements CustomerLocal, CustomerRemote { ...@@ -1449,47 +1630,49 @@ implements CustomerLocal, CustomerRemote {
GenericUtility genericUtility = GenericUtility.getInstance(); GenericUtility genericUtility = GenericUtility.getInstance();
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
try { try
{
sdf = new SimpleDateFormat(genericUtility.getApplDateFormat()); sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
conn = connDriver.getConnectDB("DriverITM"); conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false); conn.setAutoCommit(false);
connDriver = null; connDriver = null;
this.finCommon = new FinCommon(); this.finCommon = new FinCommon();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat( SimpleDateFormat simpleDateFormat = new SimpleDateFormat(genericUtility.getApplDateFormat());
genericUtility.getApplDateFormat()); if ((objContext != null) && (objContext.trim().length() > 0))
if ((objContext != null) && (objContext.trim().length() > 0)) { {
currentFormNo = Integer.parseInt(objContext); currentFormNo = Integer.parseInt(objContext);
} }
valueXmlString = new StringBuffer( valueXmlString = new StringBuffer("<?xml version = \"1.0\"?> <Root> <header> <editFlag>");
"<?xml version = \"1.0\"?> <Root> <header> <editFlag>");
valueXmlString.append(editFlag).append("</editFlag> </header>"); valueXmlString.append(editFlag).append("</editFlag> </header>");
switch (currentFormNo) { switch (currentFormNo)
{
case 1: case 1:
parentNodeList = dom.getElementsByTagName("Detail1"); parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0); parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
valueXmlString.append("<Detail1>"); valueXmlString.append("<Detail1>");
childNodeListLength = childNodeList.getLength(); childNodeListLength = childNodeList.getLength();
do { do
{
childNode = childNodeList.item(ctr); childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
if (childNodeName.equals(currentColumn)) { if (childNodeName.equals(currentColumn))
{
childNode.getFirstChild(); childNode.getFirstChild();
} }
ctr++; ctr++;
} while ((ctr < childNodeListLength)&& (!childNodeName.equals(currentColumn))); } while ((ctr < childNodeListLength) && (!childNodeName.equals(currentColumn)));
System.out.println("CURRENT COLUMN [" + currentColumn + "]"); System.out.println("CURRENT COLUMN [" + currentColumn + "]");
if (currentColumn.trim().equalsIgnoreCase("itm_defaultedit")) { if (currentColumn.trim().equalsIgnoreCase("itm_defaultedit"))
{
resBKList = checkNull(this.genericUtility.getColumnValue("reas_code__bklist", dom)); resBKList = checkNull(this.genericUtility.getColumnValue("reas_code__bklist", dom));
sql = "select descr from gencodes where fld_name = 'REAS_CODE__BKLIST' " sql = "select descr from gencodes where fld_name = 'REAS_CODE__BKLIST' " + "and fld_value = ?";
+ "and fld_value = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, resBKList); pstmt.setString(1, resBKList);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
lsDescr = checkNull(rs.getString("descr")); lsDescr = checkNull(rs.getString("descr"));
} }
rs.close(); rs.close();
...@@ -1499,23 +1682,23 @@ implements CustomerLocal, CustomerRemote { ...@@ -1499,23 +1682,23 @@ implements CustomerLocal, CustomerRemote {
valueXmlString.append("<bklist_reason ><![CDATA[" + lsDescr + "]]></bklist_reason>"); valueXmlString.append("<bklist_reason ><![CDATA[" + lsDescr + "]]></bklist_reason>");
lsBKListed = checkNull(this.genericUtility.getColumnValue("black_listed", dom)); lsBKListed = checkNull(this.genericUtility.getColumnValue("black_listed", dom));
if (lsBKListed.equalsIgnoreCase("N")) { if (lsBKListed.equalsIgnoreCase("N"))
{
valueXmlString.append("<reas_code__bklist protect = \"1\"><![CDATA[" + lsNull + "]]></reas_code__bklist>"); valueXmlString.append("<reas_code__bklist protect = \"1\"><![CDATA[" + lsNull + "]]></reas_code__bklist>");
valueXmlString.append("<bklist_reason ><![CDATA[" + lsNull + "]]></bklist_reason>"); valueXmlString.append("<bklist_reason ><![CDATA[" + lsNull + "]]></bklist_reason>");
} else { } else
{
valueXmlString.append("<reas_code__bklist><![CDATA[" + lsNull + "]]></reas_code__bklist>"); valueXmlString.append("<reas_code__bklist><![CDATA[" + lsNull + "]]></reas_code__bklist>");
} }
} else if (currentColumn.trim().equalsIgnoreCase("itm_default")) { } else if (currentColumn.trim().equalsIgnoreCase("itm_default"))
// valueXmlString.append("<emp_code__ord ><![CDATA[" + login_emp_code + "]]></emp_code__ord>"); {
// valueXmlString.append("<emp_code__ord1 ><![CDATA[" + login_emp_code + "]]></emp_code__ord1>");
resBKList = checkNull(this.genericUtility.getColumnValue("reas_code__bklist", dom)); resBKList = checkNull(this.genericUtility.getColumnValue("reas_code__bklist", dom));
sql = "select descr from gencodes where fld_name = 'REAS_CODE__BKLIST' " sql = "select descr from gencodes where fld_name = 'REAS_CODE__BKLIST' " + "and fld_value = ?";
+ "and fld_value = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, resBKList); pstmt.setString(1, resBKList);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
lsDescr = checkNull(rs.getString("descr")); lsDescr = checkNull(rs.getString("descr"));
} }
rs.close(); rs.close();
...@@ -1526,30 +1709,34 @@ implements CustomerLocal, CustomerRemote { ...@@ -1526,30 +1709,34 @@ implements CustomerLocal, CustomerRemote {
valueXmlString.append("<bklist_reason ><![CDATA[" + lsDescr + "]]></bklist_reason>"); valueXmlString.append("<bklist_reason ><![CDATA[" + lsDescr + "]]></bklist_reason>");
lsBKListed = checkNull(this.genericUtility.getColumnValue("black_listed", dom)); lsBKListed = checkNull(this.genericUtility.getColumnValue("black_listed", dom));
if (lsBKListed.equalsIgnoreCase("N")) { if ("N".equalsIgnoreCase(lsBKListed))
{
valueXmlString.append("<reas_code__bklist protect = \"1\"><![CDATA[" + lsNull + "]]></reas_code__bklist>"); valueXmlString.append("<reas_code__bklist protect = \"1\"><![CDATA[" + lsNull + "]]></reas_code__bklist>");
valueXmlString.append("<bklist_reason ><![CDATA[" + lsNull + "]]></bklist_reason>"); valueXmlString.append("<bklist_reason ><![CDATA[" + lsNull + "]]></bklist_reason>");
} else { } else
{
valueXmlString.append("<reas_code__bklist><![CDATA[" + lsNull + "]]></reas_code__bklist>"); valueXmlString.append("<reas_code__bklist><![CDATA[" + lsNull + "]]></reas_code__bklist>");
} }
}else if (currentColumn.trim().equalsIgnoreCase("cust_code")) { } else if (currentColumn.trim().equalsIgnoreCase("cust_code"))
{
custCode = checkNull(this.genericUtility.getColumnValue("cust_code", dom)); custCode = checkNull(this.genericUtility.getColumnValue("cust_code", dom));
custCodeBill = checkNull(this.genericUtility.getColumnValue( custCodeBill = checkNull(this.genericUtility.getColumnValue("cust_code__bil", dom));
"cust_code__bil", dom)); // if(custCodeBill==null &&
// if(custCodeBill==null && custCodeBill.trim().length()<=0){ // custCodeBill.trim().length()<=0){
valueXmlString.append("<cust_code__bil><![CDATA[" + custCode + "]]></cust_code__bil>"); valueXmlString.append("<cust_code__bil><![CDATA[" + custCode + "]]></cust_code__bil>");
valueXmlString.append("<group_code><![CDATA[" + custCode + "]]></group_code>"); valueXmlString.append("<group_code><![CDATA[" + custCode + "]]></group_code>");
// } // }
} else if (currentColumn.trim().equalsIgnoreCase("stan_code")) } else if (currentColumn.trim().equalsIgnoreCase("stan_code"))
{ {
stanCode = checkNull(this.genericUtility.getColumnValue("stan_code", dom)); stanCode = checkNull(this.genericUtility.getColumnValue("stan_code", dom));
sql = "select state_code, city, pin from station where stan_code = ?"; sql = "select state_code, city, pin from station where stan_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, stanCode); pstmt.setString(1, stanCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
lsStateCode = checkNull(rs.getString("state_code")); lsStateCode = checkNull(rs.getString("state_code"));
lsCity = checkNull(rs.getString("city")); lsCity = checkNull(rs.getString("city"));
lsPin = checkNull(rs.getString("pin")); lsPin = checkNull(rs.getString("pin"));
...@@ -1559,13 +1746,15 @@ implements CustomerLocal, CustomerRemote { ...@@ -1559,13 +1746,15 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(lsStateCode!=null && lsStateCode.trim().length()>0){ if (lsStateCode != null && lsStateCode.trim().length() > 0)
{
sql1 = "select count_code from state where state_code =?"; sql1 = "select count_code from state where state_code =?";
pstmt1 = conn.prepareStatement(sql1); pstmt1 = conn.prepareStatement(sql1);
pstmt1.setString(1, lsStateCode); pstmt1.setString(1, lsStateCode);
rs1 = pstmt1.executeQuery(); rs1 = pstmt1.executeQuery();
if (rs1.next()) { if (rs1.next())
countCode = checkNull(rs1.getString("count_code")); {
countCode = checkNull(rs1.getString("count_code"));
} }
rs1.close(); rs1.close();
rs1 = null; rs1 = null;
...@@ -1573,13 +1762,15 @@ implements CustomerLocal, CustomerRemote { ...@@ -1573,13 +1762,15 @@ implements CustomerLocal, CustomerRemote {
pstmt1 = null; pstmt1 = null;
} }
if(countCode!=null && countCode.trim().length()>0){ if (countCode != null && countCode.trim().length() > 0)
{
sql2 = "select curr_code from country where count_code =?"; sql2 = "select curr_code from country where count_code =?";
pstmt2 = conn.prepareStatement(sql2); pstmt2 = conn.prepareStatement(sql2);
pstmt2.setString(1, countCode); pstmt2.setString(1, countCode);
rs2 = pstmt2.executeQuery(); rs2 = pstmt2.executeQuery();
if (rs2.next()) { if (rs2.next())
currCode = checkNull(rs2.getString("curr_code")); {
currCode = checkNull(rs2.getString("curr_code"));
} }
rs2.close(); rs2.close();
rs2 = null; rs2 = null;
...@@ -1590,21 +1781,26 @@ implements CustomerLocal, CustomerRemote { ...@@ -1590,21 +1781,26 @@ implements CustomerLocal, CustomerRemote {
valueXmlString.append("<state_code><![CDATA[" + lsStateCode + "]]></state_code>"); valueXmlString.append("<state_code><![CDATA[" + lsStateCode + "]]></state_code>");
valueXmlString.append("<count_code><![CDATA[" + countCode + "]]></count_code>"); valueXmlString.append("<count_code><![CDATA[" + countCode + "]]></count_code>");
valueXmlString.append("<curr_code><![CDATA[" + currCode + "]]></curr_code>"); valueXmlString.append("<curr_code><![CDATA[" + currCode + "]]></curr_code>");
}else if(currentColumn.trim().equalsIgnoreCase("cust_name")){ } else if (currentColumn.trim().equalsIgnoreCase("cust_name"))
{
custName = checkNull(this.genericUtility.getColumnValue("cust_name", dom)); custName = checkNull(this.genericUtility.getColumnValue("cust_name", dom));
chqName=checkNull(this.genericUtility.getColumnValue("chq_name", dom)); chqName = checkNull(this.genericUtility.getColumnValue("chq_name", dom));
if(chqName==null || chqName.trim().length()<=0){ if (chqName == null || chqName.trim().length() <= 0)
{
valueXmlString.append("<chq_name><![CDATA[" + custName + "]]></chq_name>"); valueXmlString.append("<chq_name><![CDATA[" + custName + "]]></chq_name>");
} }
}else if(currentColumn.trim().equalsIgnoreCase("terr_code")){ } else if (currentColumn.trim().equalsIgnoreCase("terr_code"))
{
terrCode = checkNull(this.genericUtility.getColumnValue("terr_code", dom)); terrCode = checkNull(this.genericUtility.getColumnValue("terr_code", dom));
if(terrCode!=null && terrCode.trim().length()>0){ if (terrCode != null && terrCode.trim().length() > 0)
{
sql = "select descr from territory where terr_code =?"; sql = "select descr from territory where terr_code =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, terrCode); pstmt.setString(1, terrCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
terrDesc = checkNull(rs.getString("descr")); terrDesc = checkNull(rs.getString("descr"));
} }
rs.close(); rs.close();
...@@ -1612,15 +1808,17 @@ implements CustomerLocal, CustomerRemote { ...@@ -1612,15 +1808,17 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
valueXmlString.append("<territory_descr><![CDATA[" + terrDesc + "]]></territory_descr>"); valueXmlString.append("<territory_descr><![CDATA[" + terrDesc + "]]></territory_descr>");
}else if(currentColumn.trim().equalsIgnoreCase("sales_pers")){ } else if (currentColumn.trim().equalsIgnoreCase("sales_pers"))
{
salesPers = checkNull(this.genericUtility.getColumnValue("sales_pers", dom)); salesPers = checkNull(this.genericUtility.getColumnValue("sales_pers", dom));
sql = "select sp_name from sales_pers where sales_pers=?"; sql = "select sp_name from sales_pers where sales_pers=?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, salesPers); pstmt.setString(1, salesPers);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
spName = checkNull(rs.getString("sp_name")); spName = checkNull(rs.getString("sp_name"));
} }
rs.close(); rs.close();
...@@ -1628,16 +1826,16 @@ implements CustomerLocal, CustomerRemote { ...@@ -1628,16 +1826,16 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
valueXmlString.append("<sp_name><![CDATA[" + spName + "]]></sp_name>"); valueXmlString.append("<sp_name><![CDATA[" + spName + "]]></sp_name>");
}else if(currentColumn.trim().equalsIgnoreCase("contact_code")){ } else if (currentColumn.trim().equalsIgnoreCase("contact_code"))
{
contactCode = checkNull(this.genericUtility.getColumnValue("contact_code", dom)); contactCode = checkNull(this.genericUtility.getColumnValue("contact_code", dom));
sql = "select name, sh_name, cont_pers, cont_pfx, addr1, addr2,addr3, city, pin, state_code," sql = "select name, sh_name, cont_pers, cont_pfx, addr1, addr2,addr3, city, pin, state_code," + " count_code, tele1, tele2, tele3,tele_ext, fax, email_addr, edi_addr" + " from contact where contact_code = ?";
+ " count_code, tele1, tele2, tele3,tele_ext, fax, email_addr, edi_addr"
+ " from contact where contact_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, contactCode); pstmt.setString(1, contactCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
name = checkNull(rs.getString("name")); name = checkNull(rs.getString("name"));
shName = checkNull(rs.getString("sh_name")); shName = checkNull(rs.getString("sh_name"));
contPers = checkNull(rs.getString("cont_pers")); contPers = checkNull(rs.getString("cont_pers"));
...@@ -1663,29 +1861,29 @@ implements CustomerLocal, CustomerRemote { ...@@ -1663,29 +1861,29 @@ implements CustomerLocal, CustomerRemote {
pstmt = null; pstmt = null;
custName = checkNull(this.genericUtility.getColumnValue("cust_name", dom)); custName = checkNull(this.genericUtility.getColumnValue("cust_name", dom));
if(custName==null || custName.trim().length()<=0){ if (custName == null || custName.trim().length() <= 0)
valueXmlString.append("<cust_name>") {
.append("<![CDATA[" +name+ "]]>") valueXmlString.append("<cust_name>").append("<![CDATA[" + name + "]]>").append("</cust_name>");
.append("</cust_name>");
valueXmlString.append("<chq_name><![CDATA[" + name + "]]></chq_name>"); valueXmlString.append("<chq_name><![CDATA[" + name + "]]></chq_name>");
valueXmlString.append("<sh_name><![CDATA[" + shName + "]]></sh_name>"); valueXmlString.append("<sh_name><![CDATA[" + shName + "]]></sh_name>");
} }
contPfx1 = checkNull(this.genericUtility.getColumnValue("cont_pfx", dom)); contPfx1 = checkNull(this.genericUtility.getColumnValue("cont_pfx", dom));
if(contPfx1==null || contPfx1.trim().length()<=0){ if (contPfx1 == null || contPfx1.trim().length() <= 0)
{
valueXmlString.append("<cont_pfx><![CDATA[" + contPfx + "]]></cont_pfx>"); valueXmlString.append("<cont_pfx><![CDATA[" + contPfx + "]]></cont_pfx>");
} }
contPers1 = checkNull(this.genericUtility.getColumnValue("cont_pers", dom)); contPers1 = checkNull(this.genericUtility.getColumnValue("cont_pers", dom));
if(contPers1==null || contPers1.trim().length()<=0){ if (contPers1 == null || contPers1.trim().length() <= 0)
{
valueXmlString.append("<cont_pers><![CDATA[" + contPers + "]]></cont_pers>"); valueXmlString.append("<cont_pers><![CDATA[" + contPers + "]]></cont_pers>");
} }
Add1 = checkNull(this.genericUtility.getColumnValue("addr1", dom)); Add1 = checkNull(this.genericUtility.getColumnValue("addr1", dom));
if(Add1==null || Add1.trim().length()<=0){ if (Add1 == null || Add1.trim().length() <= 0)
{
valueXmlString.append("<addr1><![CDATA[" + addr1 + "]]></addr1>"); valueXmlString.append("<addr1><![CDATA[" + addr1 + "]]></addr1>");
valueXmlString.append("<addr2><![CDATA[" + addr2 + "]]></addr2>"); valueXmlString.append("<addr2><![CDATA[" + addr2 + "]]></addr2>");
valueXmlString.append("<addr3><![CDATA[" + addr3 + "]]></addr3>"); valueXmlString.append("<addr3><![CDATA[" + addr3 + "]]></addr3>");
...@@ -1705,12 +1903,14 @@ implements CustomerLocal, CustomerRemote { ...@@ -1705,12 +1903,14 @@ implements CustomerLocal, CustomerRemote {
} }
emailAddr1 = checkNull(this.genericUtility.getColumnValue("email_addr", dom)); emailAddr1 = checkNull(this.genericUtility.getColumnValue("email_addr", dom));
if(emailAddr1==null || emailAddr1.trim().length()<=0){ if (emailAddr1 == null || emailAddr1.trim().length() <= 0)
{
valueXmlString.append("<email_addr ><![CDATA[" + emailAddr + "]]></email_addr>"); valueXmlString.append("<email_addr ><![CDATA[" + emailAddr + "]]></email_addr>");
} }
ediAddr1 = checkNull(this.genericUtility.getColumnValue("edi_addr", dom)); ediAddr1 = checkNull(this.genericUtility.getColumnValue("edi_addr", dom));
if(ediAddr1==null || ediAddr1.trim().length()<=0){ if (ediAddr1 == null || ediAddr1.trim().length() <= 0)
{
valueXmlString.append("<edi_addr ><![CDATA[" + ediAddr + "]]></edi_addr>"); valueXmlString.append("<edi_addr ><![CDATA[" + ediAddr + "]]></edi_addr>");
} }
...@@ -1718,29 +1918,33 @@ implements CustomerLocal, CustomerRemote { ...@@ -1718,29 +1918,33 @@ implements CustomerLocal, CustomerRemote {
sql2 = "select key_flag from transetup where tran_window = 'w_customer'"; sql2 = "select key_flag from transetup where tran_window = 'w_customer'";
pstmt2 = conn.prepareStatement(sql2); pstmt2 = conn.prepareStatement(sql2);
rs2 = pstmt2.executeQuery(); rs2 = pstmt2.executeQuery();
if (rs2.next()) { if (rs2.next())
keyFlag = checkNull(rs2.getString("key_flag")); {
keyFlag = checkNull(rs2.getString("key_flag"));
} }
rs2.close(); rs2.close();
rs2 = null; rs2 = null;
pstmt2.close(); pstmt2.close();
pstmt2 = null; pstmt2 = null;
if(custCode==null && !(keyFlag.equalsIgnoreCase("A"))){ if (custCode == null && !(keyFlag.equalsIgnoreCase("A")))
{
contactCode = checkNull(this.genericUtility.getColumnValue("contact_code", dom)); contactCode = checkNull(this.genericUtility.getColumnValue("contact_code", dom));
valueXmlString.append("<cust_code ><![CDATA[" + contactCode + "]]></cust_code>"); valueXmlString.append("<cust_code ><![CDATA[" + contactCode + "]]></cust_code>");
} }
custCodeBill = checkNull(this.genericUtility.getColumnValue("cust_code__bil", dom)); custCodeBill = checkNull(this.genericUtility.getColumnValue("cust_code__bil", dom));
if(custCodeBill==null || custCodeBill.trim().length()<=0){ if (custCodeBill == null || custCodeBill.trim().length() <= 0)
{
contactCode = checkNull(this.genericUtility.getColumnValue("contact_code", dom)); contactCode = checkNull(this.genericUtility.getColumnValue("contact_code", dom));
valueXmlString.append("<cust_code__bil ><![CDATA[" + contactCode + "]]></cust_code__bil>"); valueXmlString.append("<cust_code__bil ><![CDATA[" + contactCode + "]]></cust_code__bil>");
sql = "select cust_name from customer where cust_code =?"; sql = "select cust_name from customer where cust_code =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, contactCode); pstmt.setString(1, contactCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
custName = checkNull(rs.getString("cust_name")); custName = checkNull(rs.getString("cust_name"));
} }
rs.close(); rs.close();
...@@ -1748,22 +1952,24 @@ implements CustomerLocal, CustomerRemote { ...@@ -1748,22 +1952,24 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(custName!=null){ if (custName != null)
valueXmlString.append("<customer_cust_name_1 ><![CDATA[" + custName + "]]></customer_cust_name_1>"); {
valueXmlString.append("<customer_cust_name_1 ><![CDATA[" + custName + "]]></customer_cust_name_1>");
} }
} }
groupCode = checkNull(this.genericUtility.getColumnValue( groupCode = checkNull(this.genericUtility.getColumnValue("group_code", dom));
"group_code", dom)); if (groupCode == null || groupCode.trim().length() <= 0)
if(groupCode==null || groupCode.trim().length()<=0){ {
contactCode = checkNull(this.genericUtility.getColumnValue("contact_code", dom)); contactCode = checkNull(this.genericUtility.getColumnValue("contact_code", dom));
valueXmlString.append("<group_code ><![CDATA[" + contactCode + "]]></group_code>"); valueXmlString.append("<group_code ><![CDATA[" + contactCode + "]]></group_code>");
sql = "select cust_name from customer where cust_code =?"; sql = "select cust_name from customer where cust_code =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, contactCode); pstmt.setString(1, contactCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
custName = checkNull(rs.getString("cust_name")); custName = checkNull(rs.getString("cust_name"));
} }
rs.close(); rs.close();
...@@ -1771,18 +1977,21 @@ implements CustomerLocal, CustomerRemote { ...@@ -1771,18 +1977,21 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(custName!=null){ if (custName != null)
valueXmlString.append("<customer_cust_name ><![CDATA[" + custName + "]]></customer_cust_name>"); {
valueXmlString.append("<customer_cust_name ><![CDATA[" + custName + "]]></customer_cust_name>");
} }
} }
}else if(currentColumn.trim().equalsIgnoreCase("bank_code")){ } else if (currentColumn.trim().equalsIgnoreCase("bank_code"))
{
bankCode = checkNull(this.genericUtility.getColumnValue("bank_code", dom)); bankCode = checkNull(this.genericUtility.getColumnValue("bank_code", dom));
sql = "select bank_name from bank where bank_code=?"; sql = "select bank_name from bank where bank_code=?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, bankCode); pstmt.setString(1, bankCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
bankName = checkNull(rs.getString("bank_name")); bankName = checkNull(rs.getString("bank_name"));
} }
rs.close(); rs.close();
...@@ -1791,38 +2000,46 @@ implements CustomerLocal, CustomerRemote { ...@@ -1791,38 +2000,46 @@ implements CustomerLocal, CustomerRemote {
pstmt = null; pstmt = null;
valueXmlString.append("<bank_name ><![CDATA[" + bankName + "]]></bank_name>"); valueXmlString.append("<bank_name ><![CDATA[" + bankName + "]]></bank_name>");
}else if(currentColumn.trim().equalsIgnoreCase("channel_partner")){ } else if (currentColumn.trim().equalsIgnoreCase("channel_partner"))
{
channelPartner = checkNull(this.genericUtility.getColumnValue("channel_partner", dom)); channelPartner = checkNull(this.genericUtility.getColumnValue("channel_partner", dom));
if(channelPartner.equalsIgnoreCase("Y")){ if (channelPartner.equalsIgnoreCase("Y"))
{
valueXmlString.append("<site_code protect = \"0\"><![CDATA[]]></site_code>"); valueXmlString.append("<site_code protect = \"0\"><![CDATA[]]></site_code>");
valueXmlString.append("<fin_link protect = \"0\"><![CDATA[]]></fin_link>"); valueXmlString.append("<fin_link protect = \"0\"><![CDATA[]]></fin_link>");
valueXmlString.append("<dis_link protect = \"0\"><![CDATA[]]></dis_link>"); valueXmlString.append("<dis_link protect = \"0\"><![CDATA[]]></dis_link>");
}else{ } else
{
valueXmlString.append("<site_code protect = \"1\"><![CDATA[" + nullVarr + "]]></site_code>"); valueXmlString.append("<site_code protect = \"1\"><![CDATA[" + nullVarr + "]]></site_code>");
valueXmlString.append("<fin_link protect = \"1\"><![CDATA[" + nullVarr + "]]></fin_link>"); valueXmlString.append("<fin_link protect = \"1\"><![CDATA[" + nullVarr + "]]></fin_link>");
valueXmlString.append("<dis_link protect = \"1\"><![CDATA[" + nullVarr + "]]></dis_link>"); valueXmlString.append("<dis_link protect = \"1\"><![CDATA[" + nullVarr + "]]></dis_link>");
} }
}else if(currentColumn.trim().equalsIgnoreCase("black_listed")){ } else if (currentColumn.trim().equalsIgnoreCase("black_listed"))
{
lsBKListed = checkNull(this.genericUtility.getColumnValue("black_listed", dom)); lsBKListed = checkNull(this.genericUtility.getColumnValue("black_listed", dom));
System.out.println("black_listed :- "+lsBKListed); System.out.println("black_listed :- " + lsBKListed);
if(lsBKListed.equalsIgnoreCase("N")){ if (lsBKListed.equalsIgnoreCase("N"))
{
valueXmlString.append("<black_listed_date protect = \"1\"><![CDATA[" + ldDate + "]]></black_listed_date>"); valueXmlString.append("<black_listed_date protect = \"1\"><![CDATA[" + ldDate + "]]></black_listed_date>");
valueXmlString.append("<reas_code__bklist protect = \"1\"><![CDATA[" + lsNull + "]]></reas_code__bklist>"); valueXmlString.append("<reas_code__bklist protect = \"1\"><![CDATA[" + lsNull + "]]></reas_code__bklist>");
valueXmlString.append("<bklist_reason protect = \"1\"><![CDATA[" + lsNull + "]]></bklist_reason>"); valueXmlString.append("<bklist_reason protect = \"1\"><![CDATA[" + lsNull + "]]></bklist_reason>");
}else{ } else
{
valueXmlString.append("<black_listed_date protect = \"0\"><![CDATA[]]></black_listed_date>"); valueXmlString.append("<black_listed_date protect = \"0\"><![CDATA[]]></black_listed_date>");
valueXmlString.append("<reas_code__bklist protect = \"0\"><![CDATA[]]></reas_code__bklist>"); valueXmlString.append("<reas_code__bklist protect = \"0\"><![CDATA[]]></reas_code__bklist>");
} }
}else if(currentColumn.trim().equalsIgnoreCase("reas_code__bklist")){ } else if (currentColumn.trim().equalsIgnoreCase("reas_code__bklist"))
{
resBKList = checkNull(this.genericUtility.getColumnValue("reas_code__bklist", dom)); resBKList = checkNull(this.genericUtility.getColumnValue("reas_code__bklist", dom));
sql = "select descr from gencodes where fld_name = 'REAS_CODE__BKLIST' and fld_value =?"; sql = "select descr from gencodes where fld_name = 'REAS_CODE__BKLIST' and fld_value =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, resBKList); pstmt.setString(1, resBKList);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
lsDescr = checkNull(rs.getString("descr")); lsDescr = checkNull(rs.getString("descr"));
} }
rs.close(); rs.close();
...@@ -1830,17 +2047,17 @@ implements CustomerLocal, CustomerRemote { ...@@ -1830,17 +2047,17 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
valueXmlString.append("<bklist_reason >") valueXmlString.append("<bklist_reason >").append("<![CDATA[" + lsDescr + "]]>").append("</bklist_reason>");
.append("<![CDATA[" + lsDescr + "]]>") } else if (currentColumn.trim().equalsIgnoreCase("cr_term"))
.append("</bklist_reason>"); {
}else if(currentColumn.trim().equalsIgnoreCase("cr_term")){
crTerm = checkNull(this.genericUtility.getColumnValue("cr_term", dom)); crTerm = checkNull(this.genericUtility.getColumnValue("cr_term", dom));
sql = "select cr_days from crterm where cr_term =?"; sql = "select cr_days from crterm where cr_term =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, crTerm); pstmt.setString(1, crTerm);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
crDays = checkNull(rs.getString("cr_days")); crDays = checkNull(rs.getString("cr_days"));
} }
rs.close(); rs.close();
...@@ -1849,22 +2066,27 @@ implements CustomerLocal, CustomerRemote { ...@@ -1849,22 +2066,27 @@ implements CustomerLocal, CustomerRemote {
pstmt = null; pstmt = null;
valueXmlString.append("<credit_prd ><![CDATA[" + crDays + "]]></credit_prd>"); valueXmlString.append("<credit_prd ><![CDATA[" + crDays + "]]></credit_prd>");
}else if(currentColumn.trim().equalsIgnoreCase("rate_round")){ } else if (currentColumn.trim().equalsIgnoreCase("rate_round"))
{
rateRound = checkNull(this.genericUtility.getColumnValue("rate_round", dom)); rateRound = checkNull(this.genericUtility.getColumnValue("rate_round", dom));
if(rateRound.equalsIgnoreCase("N")){ if (rateRound.equalsIgnoreCase("N"))
{
valueXmlString.append("<rate_round_to protect = \"1\"><![CDATA[]]></rate_round_to>"); valueXmlString.append("<rate_round_to protect = \"1\"><![CDATA[]]></rate_round_to>");
}else{ } else
{
valueXmlString.append("<rate_round_to protect = \"0\"><![CDATA[]]></rate_round_to>"); valueXmlString.append("<rate_round_to protect = \"0\"><![CDATA[]]></rate_round_to>");
} }
}else if(currentColumn.trim().equalsIgnoreCase("group_code")){ } else if (currentColumn.trim().equalsIgnoreCase("group_code"))
{
groupCode = checkNull(this.genericUtility.getColumnValue("group_code", dom)); groupCode = checkNull(this.genericUtility.getColumnValue("group_code", dom));
sql = "select cust_name from customer where cust_code =?"; sql = "select cust_name from customer where cust_code =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, groupCode); pstmt.setString(1, groupCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
custName = checkNull(rs.getString("cust_name")); custName = checkNull(rs.getString("cust_name"));
} }
rs.close(); rs.close();
...@@ -1873,14 +2095,16 @@ implements CustomerLocal, CustomerRemote { ...@@ -1873,14 +2095,16 @@ implements CustomerLocal, CustomerRemote {
pstmt = null; pstmt = null;
valueXmlString.append("<customer_cust_name ><![CDATA[" + custName + "]]></customer_cust_name>"); valueXmlString.append("<customer_cust_name ><![CDATA[" + custName + "]]></customer_cust_name>");
}else if(currentColumn.trim().equalsIgnoreCase("cust_code__bil")){ } else if (currentColumn.trim().equalsIgnoreCase("cust_code__bil"))
{
custCodeBill = checkNull(this.genericUtility.getColumnValue("cust_code__bil", dom)); custCodeBill = checkNull(this.genericUtility.getColumnValue("cust_code__bil", dom));
sql = "select cust_name from customer where cust_code =?"; sql = "select cust_name from customer where cust_code =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCodeBill); pstmt.setString(1, custCodeBill);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
custName = checkNull(rs.getString("cust_name")); custName = checkNull(rs.getString("cust_name"));
} }
rs.close(); rs.close();
...@@ -1888,16 +2112,18 @@ implements CustomerLocal, CustomerRemote { ...@@ -1888,16 +2112,18 @@ implements CustomerLocal, CustomerRemote {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
valueXmlString.append("<customer_cust_name_1 ><![CDATA[" + custName + "]]></customer_cust_name_1>"); valueXmlString.append("<customer_cust_name_1 ><![CDATA[" + custName + "]]></customer_cust_name_1>");
}else if(currentColumn.trim().equalsIgnoreCase("emp_code__ord")){ } else if (currentColumn.trim().equalsIgnoreCase("emp_code__ord"))
{
empCodeOrd = checkNull(this.genericUtility.getColumnValue("emp_code__ord", dom)); empCodeOrd = checkNull(this.genericUtility.getColumnValue("emp_code__ord", dom));
if(empCodeOrd!=null){ if (empCodeOrd != null)
{
sql = "select emp_fname,emp_lname,dept_code from employee where emp_code=?"; sql = "select emp_fname,emp_lname,dept_code from employee where emp_code=?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCodeOrd); pstmt.setString(1, empCodeOrd);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
empFname = checkNull(rs.getString("emp_fname")); empFname = checkNull(rs.getString("emp_fname"));
empLname = checkNull(rs.getString("emp_lname")); empLname = checkNull(rs.getString("emp_lname"));
deptCode = checkNull(rs.getString("dept_code")); deptCode = checkNull(rs.getString("dept_code"));
...@@ -1911,14 +2137,17 @@ implements CustomerLocal, CustomerRemote { ...@@ -1911,14 +2137,17 @@ implements CustomerLocal, CustomerRemote {
valueXmlString.append("<emp_lname ><![CDATA[" + empLname + "]]></emp_lname>"); valueXmlString.append("<emp_lname ><![CDATA[" + empLname + "]]></emp_lname>");
valueXmlString.append("<dept_code ><![CDATA[" + deptCode + "]]></dept_code>"); valueXmlString.append("<dept_code ><![CDATA[" + deptCode + "]]></dept_code>");
} }
}else if(currentColumn.trim().equalsIgnoreCase("emp_code__ord1")){ } else if (currentColumn.trim().equalsIgnoreCase("emp_code__ord1"))
{
empCodeOrd1 = checkNull(this.genericUtility.getColumnValue("emp_code__ord1", dom)); empCodeOrd1 = checkNull(this.genericUtility.getColumnValue("emp_code__ord1", dom));
if(empCodeOrd1!=null){ if (empCodeOrd1 != null)
{
sql = "select emp_fname,emp_lname,dept_code from employee where emp_code=?"; sql = "select emp_fname,emp_lname,dept_code from employee where emp_code=?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCodeOrd1); pstmt.setString(1, empCodeOrd1);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
empFname = checkNull(rs.getString("emp_fname")); empFname = checkNull(rs.getString("emp_fname"));
empLname = checkNull(rs.getString("emp_lname")); empLname = checkNull(rs.getString("emp_lname"));
deptCode = checkNull(rs.getString("dept_code")); deptCode = checkNull(rs.getString("dept_code"));
...@@ -1942,49 +2171,52 @@ implements CustomerLocal, CustomerRemote { ...@@ -1942,49 +2171,52 @@ implements CustomerLocal, CustomerRemote {
valueXmlString.append("<Detail2>"); valueXmlString.append("<Detail2>");
childNodeListLength = childNodeList.getLength(); childNodeListLength = childNodeList.getLength();
do { do
{
childNode = childNodeList.item(ctr); childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
if (childNodeName.equals(currentColumn)) { if (childNodeName.equals(currentColumn))
{
childNode.getFirstChild(); childNode.getFirstChild();
} }
ctr++; ctr++;
} while ((ctr < childNodeListLength) } while ((ctr < childNodeListLength) && (!childNodeName.equals(currentColumn)));
&& (!childNodeName.equals(currentColumn)));
System.out.println("CURRENT COLUMN [" + currentColumn + "]"); System.out.println("CURRENT COLUMN [" + currentColumn + "]");
if (currentColumn.trim().equalsIgnoreCase("reg_code")) { if (currentColumn.trim().equalsIgnoreCase("reg_code"))
{
regCode = checkNull(this.genericUtility.getColumnValue("reg_code", dom)); regCode = checkNull(this.genericUtility.getColumnValue("reg_code", dom));
sql = "select descr from reg_requirements where reg_code=?"; sql = "select descr from reg_requirements where reg_code=?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, regCode); pstmt.setString(1, regCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
regDescr = checkNull(rs.getString("descr")); regDescr = checkNull(rs.getString("descr"));
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
System.out.println("Registration descr from field value $$$$$$$$$$$$$$$444444444444444444444:-["+regDescr+"]");
valueXmlString.append("<descr ><![CDATA[" + regDescr + "]]></descr>"); valueXmlString.append("<descr ><![CDATA[" + regDescr + "]]></descr>");
} }
valueXmlString.append("</Detail2>"); valueXmlString.append("</Detail2>");
} }
valueXmlString.append("</Root>"); valueXmlString.append("</Root>");
} catch (Exception e) { } catch (Exception e)
{
e.printStackTrace(); e.printStackTrace();
System.out.println("Exception ::" + e.getMessage()); System.out.println("Exception ::" + e.getMessage());
throw new ITMException(e); throw new ITMException(e);
} finally { } finally
try { {
if (conn != null) { try
{
if (conn != null)
{
if (pstmt != null) if (pstmt != null)
pstmt.close(); pstmt.close();
if (rs != null) if (rs != null)
...@@ -1994,7 +2226,8 @@ implements CustomerLocal, CustomerRemote { ...@@ -1994,7 +2226,8 @@ implements CustomerLocal, CustomerRemote {
conn.close(); conn.close();
conn = null; conn = null;
} }
} catch (Exception d) { } catch (Exception d)
{
d.printStackTrace(); d.printStackTrace();
throw new ITMException(d); throw new ITMException(d);
} }
...@@ -2002,68 +2235,83 @@ implements CustomerLocal, CustomerRemote { ...@@ -2002,68 +2235,83 @@ implements CustomerLocal, CustomerRemote {
return valueXmlString.toString(); return valueXmlString.toString();
} }
private String checkNull(String str) { private String checkNull(String str)
if (str == null) { {
if (str == null)
{
return ""; return "";
} else { } else
{
return str; return str;
} }
} }
private double checkDoubleNull(String str) { private double checkDoubleNull(String str)
if (str == null || str.trim().length() == 0) { {
if (str == null || str.trim().length() == 0)
{
return 0.0; return 0.0;
} else { } else
{
return Double.parseDouble(str); return Double.parseDouble(str);
} }
} }
private String errorType(Connection conn, String errorCode) private String errorType(Connection conn, String errorCode) throws ITMException
throws ITMException { {
String msgType = ""; String msgType = "";
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
try { try
{
String sql = "SELECT MSG_TYPE FROM MESSAGES WHERE MSG_NO = ?"; String sql = "SELECT MSG_TYPE FROM MESSAGES WHERE MSG_NO = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, errorCode); pstmt.setString(1, errorCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) { while (rs.next())
{
msgType = rs.getString("MSG_TYPE"); msgType = rs.getString("MSG_TYPE");
} }
} catch (Exception ex) { } catch (Exception ex)
{
ex.printStackTrace(); ex.printStackTrace();
try { try
if (rs != null) { {
if (rs != null)
{
rs.close(); rs.close();
rs = null; rs = null;
} }
if (pstmt != null) { if (pstmt != null)
{
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
} catch (Exception e) { } catch (Exception e)
{
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e); throw new ITMException(e);
} }
} finally { } finally
try { {
if (rs != null) { try
{
if (rs != null)
{
rs.close(); rs.close();
rs = null; rs = null;
} }
if (pstmt != null) { if (pstmt != null)
{
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
} catch (Exception e) { } catch (Exception e)
{
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e); throw new ITMException(e);
} }
} }
return msgType; return msgType;
} }
} }
/******************************************************** /********************************************************
Title : BillofQuantityICLocal Title : CustomerLocal
Date : 20/09/2012 Date : 20/10/14
Developer: Akhilesh Sikarwar Developer: Vallabh Kadam
********************************************************/ ********************************************************/
package ibase.webitm.ejb.dis; package ibase.webitm.ejb.dis;
......
/******************************************************** /********************************************************
Title : BillofQuantityICRemote Title : CustomerRemote
Date : 22/09/2012 Date : 20/10/14
Developer: Akhilesh Sikarwar Developer: Vallabh Kadam
********************************************************/ ********************************************************/
......
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