Commit be159b15 authored by wansari's avatar wansari

D16JSUN0002 updated source for fixing QC issues


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@104646 ce508802-f39f-4f6c-b175-0d175dae99d5
parent c04cc379
......@@ -115,6 +115,11 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
String effFrom = "",ValidUpto = "",discount = "",msgNo = "";
int countRecord = 0;
String selected = "",updFlag = "",status = "";
boolean deleteFlag = false;
int countSelectd = 0;
ArrayList recordList = new ArrayList();
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
try
{
......@@ -276,31 +281,6 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
errString = itmDBAccessLocal.getErrorString("","VMBLKPRCRL","","",conn);
return errString;
}
else
{
sql = " SELECT COUNT(*) FROM GENCODES WHERE FLD_NAME='PRICE_RULE' AND MOD_NAME = 'W_SCONTRACT_GWT_WIZ' AND FLD_VALUE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, priceRule);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);
if(cnt == 0 )
{
errString = itmDBAccessLocal.getErrorString("","VMPRCRULE","","",conn);
return errString;
}
}
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
}
custType = checkNullAndTrim(genericUtility.getColumnValue("cust_type", dom));
if(custType.length() == 0)
......@@ -308,30 +288,6 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
errString = itmDBAccessLocal.getErrorString("","VMNLCSTYPE","","",conn);
return errString;
}
else
{
sql = " SELECT COUNT(*) FROM GENCODES WHERE FLD_NAME='CUST_TYPE' AND MOD_NAME = 'W_SCONTRACT_GWT_WIZ' AND FLD_VALUE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custType);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);
if(cnt == 0 )
{
errString = itmDBAccessLocal.getErrorString("","VMCUSTTYPE","","",conn);
return errString;
}
}
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
}
transMode = genericUtility.getColumnValue("trans_mode", dom);
if(transMode == null || transMode.trim().length() == 0 )
......@@ -370,53 +326,55 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
pstmt.close();pstmt = null;
}
crTerm = genericUtility.getColumnValue("cr_term", dom);
sql = "Select Count(*) from crterm where cr_term = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, crTerm);
rs = pstmt.executeQuery();
if(rs.next())
if("R".equalsIgnoreCase(custType))
{
cnt = rs.getInt(1);
if(cnt == 0 )
crTerm = genericUtility.getColumnValue("cr_term", dom);
sql = "Select Count(*) from crterm where cr_term = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, crTerm);
rs = pstmt.executeQuery();
if(rs.next())
{
errString = itmDBAccessLocal.getErrorString("","VTCRTERM1","","",conn);
return errString;
cnt = rs.getInt(1);
if(cnt == 0 )
{
errString = itmDBAccessLocal.getErrorString("","VTCRTERM1","","",conn);
return errString;
}
}
}
if(rs != null)
{
rs.close();rs = null;
}
if(pstmt != null)
{
pstmt.close();pstmt = null;
}
currCode = genericUtility.getColumnValue("curr_code", dom);
sql = "Select Count(*) from currency where curr_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, currCode);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);
if(cnt == 0 )
if(rs != null)
{
errString = itmDBAccessLocal.getErrorString("","VTCURRCD1","","",conn);
return errString;
rs.close();rs = null;
}
}
if(rs != null)
{
rs.close();rs = null;
}
if(pstmt != null)
{
pstmt.close();pstmt = null;
}
if(pstmt != null)
{
pstmt.close();pstmt = null;
}
currCode = genericUtility.getColumnValue("curr_code", dom);
sql = "Select Count(*) from currency where curr_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, currCode);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);
if(cnt == 0 )
{
errString = itmDBAccessLocal.getErrorString("","VTCURRCD1","","",conn);
return errString;
}
}
if(rs != null)
{
rs.close();rs = null;
}
if(pstmt != null)
{
pstmt.close();pstmt = null;
}
}
}//End case1
break;
......@@ -428,6 +386,7 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
for (int selectedRow = 0; selectedRow < parentNodeListLength; selectedRow++)
{
division = "";scope = "";lineNo = "";priceList = "";effFrom = "";ValidUpto = "";discount = "";
deleteFlag = false;
parentNode = parentNodeList.item(selectedRow);
childNodeList = parentNode.getChildNodes();
......@@ -439,6 +398,20 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
System.out.println("Detail2 childNodeName ["+childNodeName+"] childNode["+childNode+"] ");
if("attribute".equalsIgnoreCase(childNodeName))
{
selected = childNode.getAttributes().getNamedItem("selected").getNodeValue();
updFlag = childNode.getAttributes().getNamedItem("updateFlag").getNodeValue();
status = childNode.getAttributes().getNamedItem("status").getNodeValue();
System.out.println("Inside selected Attribute Selected ["+selected+"] UpdFlag["+updFlag+"] Status["+status+"]");
if("D".equalsIgnoreCase(updFlag))
{
deleteFlag = true;
break;
}
}
if(childNode == null || childNode.getNodeType() != childNode.ELEMENT_NODE)
{
continue;
......@@ -473,8 +446,14 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
discount = checkNullAndTrim(childNode.getFirstChild().getNodeValue());
}
}
System.out.println("Contract_scope["+scope+"] lineNo["+lineNo+"] priceList["+priceList+"] eff["+effFrom+"] valid["+ValidUpto+"]");
System.out.println("Delete Flag="+deleteFlag);
if(deleteFlag)
{
countRecord++;
continue;
}
if(lineNo.length() > 0)
{
......@@ -484,30 +463,7 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
{
return getError("\n Line Number: "+lineNo+", Division: "+division+" ", "VMNULSCOPE", conn);
}
else
{
sql = " SELECT COUNT(*) FROM GENCODES WHERE FLD_NAME='CONTRACT_SCOPE' AND MOD_NAME = 'W_SCONTRACT_GWT_WIZ' AND FLD_VALUE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, scope);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);
if(cnt == 0 )
{
return getError(" \n Line Number: "+lineNo+", Division: "+division+" ", "VMINVSCOPE", conn);
}
}
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
}
if(priceList.length() == 0)
{
return getError(" \n Line Number: "+lineNo+", Division: "+division+" ", "NULPRLIST", conn);
......@@ -654,7 +610,7 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
break;
case 3:
{
String itemCode = "",itemSer = "",siteCode = "",selected = "";
String itemCode = "",itemSer = "",siteCode = "";
int selCnt = 0;
parentNodeList = dom2.getElementsByTagName("Detail3");
......@@ -663,6 +619,7 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
for (int selectedRow = 0; selectedRow < parentNodeListLength; selectedRow++)
{
itemCode = "";rateOpt = "";lineNo = "";selected = "";
deleteFlag = false;
parentNode = parentNodeList.item(selectedRow);
childNodeList = parentNode.getChildNodes();
......@@ -674,6 +631,20 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
System.out.println("Detail3 childNodeName ["+childNodeName+"]");
if("attribute".equalsIgnoreCase(childNodeName))
{
selected = childNode.getAttributes().getNamedItem("selected").getNodeValue();
updFlag = childNode.getAttributes().getNamedItem("updateFlag").getNodeValue();
status = childNode.getAttributes().getNamedItem("status").getNodeValue();
System.out.println("Inside selected Attribute Selected ["+selected+"] UpdFlag["+updFlag+"] Status["+status+"]");
if("D".equalsIgnoreCase(updFlag))
{
deleteFlag = true;
break;
}
}
if(childNode == null || childNode.getNodeType() != childNode.ELEMENT_NODE)
{
continue;
......@@ -702,7 +673,12 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
}
System.out.println("Item Code ["+itemCode+"] Line Number["+lineNo+"] Rate Opt["+rateOpt+"]");
System.out.println("Delete Flag="+deleteFlag);
if(deleteFlag)
{
countRecord++;
continue;
}
if(lineNo.length() > 0)
{
......@@ -804,74 +780,19 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
}
}
//Date check start
/*if(effFrom.length() == 0 || ValidUpto.length() == 0)
{
return getError(" \n Line Number: "+lineNo+", Item Code: "+itemCode+" ", "VMEFFUPTO", conn);
}
date1 = Timestamp.valueOf(genericUtility.getValidDateString( effFrom==null?getCurrdateAppFormat():effFrom , genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
date2 = Timestamp.valueOf(genericUtility.getValidDateString( ValidUpto==null?getCurrdateAppFormat():ValidUpto , genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
date3 = Timestamp.valueOf(genericUtility.getValidDateString( getCurrdateAppFormat() , genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");;
if(date1 == null)
{
return getError(" \n Line Number: "+lineNo+", Item Code: "+itemCode+" ", "VFTDT1", conn);
}
else if(date1.after(date2))
{
return getError(" \n Line Number: "+lineNo+", Item Code: "+itemCode+" ", "VEFFDTVLER", conn);
}
else if(date1.before(date3))
{
return getError(" \n Line Number: "+lineNo+", Item Code: "+itemCode+" ", "VEFFDTTD", conn);
}
date1 = Timestamp.valueOf(genericUtility.getValidDateString( ValidUpto==null?getCurrdateAppFormat():ValidUpto , genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");;
date2 = Timestamp.valueOf(genericUtility.getValidDateString( effFrom==null?getCurrdateAppFormat():effFrom , genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");;
date3 = Timestamp.valueOf(genericUtility.getValidDateString( getCurrdateAppFormat() , genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");;
if(date1 == null)
{
return getError(" \n Line Number: "+lineNo+", Item Code: "+itemCode+" ", "VMVAL_UPT1", conn);
}
else if(date1.before(date2))
if(rateOpt.length() == 0)
{
return getError(" \n Line Number: "+lineNo+", Item Code: "+itemCode+" ", "VEFFDTVLER", conn);
return getError(" \n Line Number: "+lineNo+", Item Code: "+itemCode+" ", "VMNULLOPT", conn);
}
else if(date1.before(date3))
{
return getError(" \n Line Number: "+lineNo+", Item Code: "+itemCode+" ", "VVDTERR", conn);
}*/
//Date check End
if(rateOpt.length() == 0)
if(recordList.contains(itemCode))
{
return getError(" \n Line Number: "+lineNo+", Item Code: "+itemCode+" ", "VMNULLOPT", conn);
return getError(" \n Line Number: "+lineNo+", Item Code: "+itemCode+" ", "VMDUPITEM", conn);
}
else
{
sql = " SELECT COUNT(*) FROM GENCODES WHERE FLD_NAME='RATE_OPT' AND MOD_NAME = 'W_SCONTRACT_GWT_WIZ' AND FLD_VALUE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, rateOpt);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);
if(cnt == 0 )
{
return getError(" \n Line Number: "+lineNo+", Item Code: "+itemCode+" ", "VMINVOPT", conn);
}
}
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
{
recordList.add(itemCode);
}
}
}
......@@ -974,30 +895,15 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
{
pstmt.close();pstmt = null;
}
if(custType.length() > 0)
{
sql = " SELECT COUNT(*) FROM GENCODES WHERE FLD_NAME='CUST_TYPE' AND MOD_NAME = 'W_SCONTRACT_GWT_WIZ' AND FLD_VALUE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custType);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);
if(cnt == 0 )
{
return getError(" \n Line Number: "+lineNo+", Customer Code: "+custCode+" ", "VMCUSTTYPE", conn);
}
}
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
}
}
if(recordList.contains(custCode))
{
return getError(" \n Line Number: "+lineNo+", Customer Code: "+custCode+" ", "VMDUPCUST" , conn);
}
else
{
recordList.add(custCode);
}
}
}
......@@ -1377,13 +1283,13 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
valueXmlString.append("<chg_user >").append("<![CDATA["+userId+"]]>").append("</chg_user>");
valueXmlString.append("<chg_term >").append("<![CDATA["+chgTerm+"]]>").append("</chg_term>");
sql = " SELECT DESCR FROM GENCODES WHERE FLD_NAME='PRICE_RULE' AND MOD_NAME = 'W_SCONTRACT_GWT_WIZ' AND FLD_VALUE = ? ";
sql = " SELECT DESCR FROM SORDERTYPE WHERE ORDER_TYPE = ? ";
pstmtDescr = conn.prepareStatement(sql);
pstmtDescr.setString(1, priceRule);
pstmtDescr.setString(1, orderType);
rsDescr = pstmtDescr.executeQuery();
if(rsDescr.next())
{
priceRuleDescr = rsDescr.getString(1)==null?"":rsDescr.getString(1);
orderTypeDescr = rsDescr.getString(1)==null?"":rsDescr.getString(1);
}
if(rsDescr!=null)
{
......@@ -1394,47 +1300,20 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
pstmtDescr.close();pstmtDescr = null;
}
sql = " SELECT DESCR FROM GENCODES WHERE FLD_NAME='CUST_TYPE' AND MOD_NAME = 'W_SCONTRACT_GWT_WIZ' AND FLD_VALUE = ? ";
pstmtDescr = conn.prepareStatement(sql);
pstmtDescr.setString(1, custType);
rsDescr = pstmtDescr.executeQuery();
if(rsDescr.next())
{
custTypeDescr = rsDescr.getString(1)==null?"":rsDescr.getString(1);
}
if(rsDescr!=null)
if("S".equalsIgnoreCase(custType))
{
rsDescr.close();rsDescr = null;
sql = " SELECT FIRST_NAME FROM STRG_CUSTOMER WHERE SC_CODE = ? ";
}
if(pstmtDescr!=null)
else
{
pstmtDescr.close();pstmtDescr = null;
sql = " SELECT CUST_NAME FROM CUSTOMER WHERE CUST_CODE = ? ";
}
sql = " SELECT DESCR FROM SORDERTYPE WHERE ORDER_TYPE = ? ";
pstmtDescr = conn.prepareStatement(sql);
pstmtDescr.setString(1, orderType);
pstmtDescr.setString(1, custCode);
rsDescr = pstmtDescr.executeQuery();
if(rsDescr.next())
{
orderTypeDescr = rsDescr.getString(1)==null?"":rsDescr.getString(1);
}
if(rsDescr!=null)
{
rsDescr.close();rsDescr = null;
}
if(pstmtDescr!=null)
{
pstmtDescr.close();pstmtDescr = null;
}
sql = " SELECT CUST_NAME FROM CUSTOMER WHERE CUST_CODE = ? ";
pstmtDescr = conn.prepareStatement(sql);
pstmtDescr.setString(1, custCode);
rsDescr = pstmtDescr.executeQuery();
if(rsDescr.next())
{
custName = rsDescr.getString(1)==null?"":rsDescr.getString(1);
custName = rsDescr.getString(1)==null?"":rsDescr.getString(1);
}
if(rsDescr!=null)
{
......@@ -1446,8 +1325,6 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
}
valueXmlString.append("<cust_name >").append("<![CDATA["+checkNullAndTrim(custName)+"]]>").append("</cust_name>");
valueXmlString.append("<price_rule__descr>").append("<![CDATA["+priceRuleDescr+"]]>").append("</price_rule__descr>");
valueXmlString.append("<cust_type__descr>").append("<![CDATA["+custTypeDescr+"]]>").append("</cust_type__descr>");
valueXmlString.append("<order_type__appl_descr>").append("<![CDATA["+orderTypeDescr+"]]>").append("</order_type__appl_descr>");
}
if(rs!=null)
......@@ -1489,112 +1366,6 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
valueXmlString.append("<chg_term >").append("<![CDATA["+chgTerm+"]]>").append("</chg_term>");
}
}
else if(currentColumn.trim().equalsIgnoreCase("price_rule"))
{
String priceRule = "",priceRuleDescr = "",custType = "",custTypeDescr = "",orderTypeAppl = "",orderTypeApplDescr = "";
priceRule = checkNullAndTrim(genericUtility.getColumnValue("price_rule", dom));
custCode = checkNullAndTrim(genericUtility.getColumnValue("cust_code", dom));
custName = checkNullAndTrim(genericUtility.getColumnValue("cust_name", dom));
city = checkNullAndTrim(genericUtility.getColumnValue("dlv_city", dom));
effFromStr = checkNullAndTrim(genericUtility.getColumnValue("eff_from", dom));
validUpTostr = checkNullAndTrim(genericUtility.getColumnValue("valid_upto", dom));
custType = checkNullAndTrim(genericUtility.getColumnValue("cust_type", dom));
custTypeDescr = checkNullAndTrim(genericUtility.getColumnValue("cust_type__descr", dom));
orderTypeAppl = checkNullAndTrim(genericUtility.getColumnValue("order_type__appl", dom));
orderTypeApplDescr = checkNullAndTrim(genericUtility.getColumnValue("order_type__appl_descr", dom));
sql = " SELECT DESCR FROM GENCODES WHERE FLD_NAME='PRICE_RULE' AND MOD_NAME = 'W_SCONTRACT_GWT_WIZ' AND FLD_VALUE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, priceRule);
rs = pstmt.executeQuery();
if(rs.next())
{
priceRuleDescr = rs.getString(1)==null?"":rs.getString(1);
}
else
{
priceRuleDescr = "";
}
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
valueXmlString.append("<Detail1 domID='1' objContext='1'>");
valueXmlString.append("<price_rule>").append("<![CDATA["+priceRule+"]]>").append("</price_rule>");
valueXmlString.append("<price_rule__descr>").append("<![CDATA["+priceRuleDescr+"]]>").append("</price_rule__descr>");
valueXmlString.append("<cust_code>").append("<![CDATA["+custCode+"]]>").append("</cust_code>");
valueXmlString.append("<cust_name>").append("<![CDATA["+custName+"]]>").append("</cust_name>");
valueXmlString.append("<dlv_city>").append("<![CDATA["+city+"]]>").append("</dlv_city>");
valueXmlString.append("<valid_upto>").append("<![CDATA["+genericUtility.getValidDateString(validUpTostr , genericUtility.getApplDateFormat()) + "]]>").append("</valid_upto>");
valueXmlString.append("<eff_from>").append("<![CDATA["+genericUtility.getValidDateString(effFromStr , genericUtility.getApplDateFormat()) + "]]>").append("</eff_from>");
valueXmlString.append("<cust_type>").append("<![CDATA["+custType+"]]>").append("</cust_type>");
valueXmlString.append("<cust_type__descr>").append("<![CDATA["+custTypeDescr+"]]>").append("</cust_type__descr>");
valueXmlString.append("<order_type__appl>").append("<![CDATA["+orderTypeAppl+"]]>").append("</order_type__appl>");
valueXmlString.append("<order_type__appl_descr>").append("<![CDATA["+orderTypeApplDescr+"]]>").append("</order_type__appl_descr>");
valueXmlString.append("<confirmed>").append("<![CDATA[N]]>").append("</confirmed>");
}
else if(currentColumn.trim().equalsIgnoreCase("cust_type"))
{
String custType = "",custTypeDescr = "",priceRule = "",priceRuleDescr = "",orderTypeAppl = "",orderTypeApplDescr = "";
custType = checkNullAndTrim(genericUtility.getColumnValue("cust_type", dom));
priceRule = checkNullAndTrim(genericUtility.getColumnValue("price_rule", dom));
priceRuleDescr = checkNullAndTrim(genericUtility.getColumnValue("price_rule__descr", dom));
custCode = checkNullAndTrim(genericUtility.getColumnValue("cust_code", dom));
custName = checkNullAndTrim(genericUtility.getColumnValue("cust_name", dom));
city = checkNullAndTrim(genericUtility.getColumnValue("dlv_city", dom));
effFromStr = checkNullAndTrim(genericUtility.getColumnValue("eff_from", dom));
validUpTostr = checkNullAndTrim(genericUtility.getColumnValue("valid_upto", dom));
validUpTostr = checkNullAndTrim(genericUtility.getColumnValue("valid_upto", dom));
orderTypeAppl = checkNullAndTrim(genericUtility.getColumnValue("order_type__appl", dom));
orderTypeApplDescr = checkNullAndTrim(genericUtility.getColumnValue("order_type__appl_descr", dom));
sql = " SELECT DESCR FROM GENCODES WHERE FLD_NAME='CUST_TYPE' AND MOD_NAME = 'W_SCONTRACT_GWT_WIZ' AND FLD_VALUE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custType);
rs = pstmt.executeQuery();
if(rs.next())
{
custTypeDescr = rs.getString(1)==null?"":rs.getString(1);
}
else
{
custTypeDescr = "";
}
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
valueXmlString.append("<Detail1 domID='1' objContext='1'>");
valueXmlString.append("<cust_type>").append("<![CDATA["+custType+"]]>").append("</cust_type>");
valueXmlString.append("<cust_type__descr>").append("<![CDATA["+custTypeDescr+"]]>").append("</cust_type__descr>");
valueXmlString.append("<cust_code>").append("<![CDATA["+custCode+"]]>").append("</cust_code>");
valueXmlString.append("<cust_name>").append("<![CDATA["+custName+"]]>").append("</cust_name>");
valueXmlString.append("<dlv_city>").append("<![CDATA["+city+"]]>").append("</dlv_city>");
valueXmlString.append("<valid_upto>").append("<![CDATA["+genericUtility.getValidDateString(validUpTostr , genericUtility.getApplDateFormat()) + "]]>").append("</valid_upto>");
valueXmlString.append("<eff_from>").append("<![CDATA["+genericUtility.getValidDateString(effFromStr , genericUtility.getApplDateFormat()) + "]]>").append("</eff_from>");
valueXmlString.append("<order_type__appl>").append("<![CDATA["+orderTypeAppl+"]]>").append("</order_type__appl>");
valueXmlString.append("<order_type__appl_descr>").append("<![CDATA["+orderTypeApplDescr+"]]>").append("</order_type__appl_descr>");
valueXmlString.append("<price_rule>").append("<![CDATA["+priceRule+"]]>").append("</price_rule>");
valueXmlString.append("<price_rule__descr>").append("<![CDATA["+priceRuleDescr+"]]>").append("</price_rule__descr>");
valueXmlString.append("<confirmed>").append("<![CDATA[N]]>").append("</confirmed>");
}
else if(currentColumn.trim().equalsIgnoreCase("order_type__appl"))
{
String orderType = "",orderTypeDescr = "",priceRule = "",priceRuleDescr = "",custType = "",custTypeDescr = "";
......@@ -1648,18 +1419,50 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
}
else if(currentColumn.trim().equalsIgnoreCase("cust_code"))
{
String orderType = "",orderTypeDescr = "",priceRule = "",custType = "",contractDateAppl = "";
custCode = genericUtility.getColumnValue("cust_code", dom);
siteCode = genericUtility.getColumnValue("site_code", dom);
custType = checkNullAndTrim(genericUtility.getColumnValue("cust_type", dom));
orderType = checkNullAndTrim(genericUtility.getColumnValue("order_type__appl", dom));
orderTypeDescr = checkNullAndTrim(genericUtility.getColumnValue("order_type__appl_descr", dom));
effFromStr = checkNullAndTrim(genericUtility.getColumnValue("eff_from", dom));
validUpTostr = checkNullAndTrim(genericUtility.getColumnValue("valid_upto", dom));
priceRule = checkNullAndTrim(genericUtility.getColumnValue("price_rule", dom));
custCode = checkNullAndTrim(genericUtility.getColumnValue("cust_code", dom));
//contractDateAppl = checkNullAndTrim(genericUtility.getColumnValue("contract_date", dom));
contractDateStr = genericUtility.getValidDateString(genericUtility.getColumnValue("contract_date", dom1) , genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat());
contractDate = Timestamp.valueOf(contractDateStr + " 00:00:00.0");
sql = " select price_list__clg from site_customer where cust_code = ? and site_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCode);
pstmt.setString(2, siteCode);
rs = pstmt.executeQuery();
if(rs.next())
System.out.println("Inside customer item change CustCode["+custCode+"] CustType["+custType+"] ContractDate["+contractDate+"]");
if("S".equalsIgnoreCase(custType))
{
priceListClg = rs.getString(1)==null?"":rs.getString(1);
sql = " select first_name, addr1, addr2,addr3, city, pin, count_code, stan_code, " +
" email_addr,mobile_no, state_code, tele1, tele2, tele3,fax ,curr_code,tax_chap,tax_class,tax_env " +
" from strg_customer where sc_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCode);
rs = pstmt.executeQuery();
if(rs.next())
{
custName = rs.getString(1)==null?"":rs.getString(1);
addr1 = rs.getString(2)==null?"":rs.getString(2);
addr2 = rs.getString(3)==null?"":rs.getString(3);
addr3 = rs.getString(4)==null?"":rs.getString(4);
city = rs.getString(5)==null?"":rs.getString(5);
pin = rs.getString(6)==null?"":rs.getString(6);
countCode = rs.getString(7)==null?"":rs.getString(7);
stanCode = rs.getString(8)==null?"":rs.getString(8);
stateCode = rs.getString(11)==null?"":rs.getString(11);
tele1 = rs.getString(12)==null?"":rs.getString(12);
tele2 = rs.getString(13)==null?"":rs.getString(13);
tele3 = rs.getString(14)==null?"":rs.getString(14);
fax = rs.getString(15)==null?"":rs.getString(15);
curr = rs.getString(16)==null?"":rs.getString(16);
taxClass = rs.getString(17)==null?"":rs.getString(17);
taxChap = rs.getString(18)==null?"":rs.getString(18);
taxEnv = rs.getString(19)==null?"":rs.getString(19);
}
if(rs!=null)
{
rs.close();rs = null;
......@@ -1669,427 +1472,498 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
pstmt.close();pstmt = null;
}
if(priceListClg == null || !(priceListClg.trim().length() > 0))
valueXmlString.append("<Detail1 domID='1' objContext='1'>");
valueXmlString.append("<cust_code>").append("<![CDATA[" + custCode + "]]>").append("</cust_code>");
valueXmlString.append("<cust_code__bil >").append("<![CDATA[" + custCode + "]]>").append("</cust_code__bil>");
valueXmlString.append("<cust_code__dlv >").append("<![CDATA[" + custCode + "]]>").append("</cust_code__dlv>");
valueXmlString.append("<tax_chap >").append("<![CDATA[" + taxChap + "]]>").append("</tax_chap>");
valueXmlString.append("<tax_class >").append("<![CDATA[" + taxClass + "]]>").append("</tax_class>");
valueXmlString.append("<contract_type >").append("<![CDATA[" + contractType + "]]>").append("</contract_type>");
valueXmlString.append("<cust_name >").append("<![CDATA[" + custName + "]]>").append("</cust_name>");
valueXmlString.append("<dlv_to >").append("<![CDATA[" + custName + "]]>").append("</dlv_to>");
valueXmlString.append("<dlv_add1 >").append("<![CDATA[" + addr1 + "]]>").append("</dlv_add1>");
valueXmlString.append("<dlv_add2 >").append("<![CDATA[" + addr2 + "]]>").append("</dlv_add2>");
valueXmlString.append("<dlv_add3 >").append("<![CDATA[" + addr3 + "]]>").append("</dlv_add3>");
valueXmlString.append("<dlv_city >").append("<![CDATA[" + city + "]]>").append("</dlv_city>");
valueXmlString.append("<dlv_pin >").append("<![CDATA[" + pin + "]]>").append("</dlv_pin>");
valueXmlString.append("<count_code__dlv >").append("<![CDATA[" + countCode + "]]>").append("</count_code__dlv>");
valueXmlString.append("<tran_code >").append("<![CDATA[" + tranCode + "]]>").append("</tran_code>");
valueXmlString.append("<stan_code >").append("<![CDATA[" + stanCode + "]]>").append("</stan_code>");
valueXmlString.append("<state_code__dlv >").append("<![CDATA[" + stateCode.trim() + "]]>").append("</state_code__dlv>");
valueXmlString.append("<tel1__dlv >").append("<![CDATA[" + tele1 + "]]>").append("</tel1__dlv>");
valueXmlString.append("<tel2__dlv >").append("<![CDATA[" + tele2 + "]]>").append("</tel2__dlv>");
valueXmlString.append("<tel3__dlv >").append("<![CDATA[" + tele3 + "]]>").append("</tel3__dlv>");
valueXmlString.append("<fax__dlv >").append("<![CDATA[" + fax + "]]>").append("</fax__dlv>");
valueXmlString.append("<curr_code >").append("<![CDATA[" + curr + "]]>").append("</curr_code>");
valueXmlString.append("<dlv_term >").append("<![CDATA[" + dlvTerm + "]]>").append("</dlv_term>");
valueXmlString.append("<confirmed>").append("<![CDATA[N]]>").append("</confirmed>");
valueXmlString.append("<trans_mode >").append("<![CDATA[R]]>").append("</trans_mode>");
valueXmlString.append("<exch_rate >").append("<![CDATA[0]]>").append("</exch_rate>");
valueXmlString.append("<cr_term>").append("<![CDATA[NA]]>").append("</cr_term>");
valueXmlString.append("<valid_upto>").append("<![CDATA["+genericUtility.getValidDateString(validUpTostr , genericUtility.getApplDateFormat()) + "]]>").append("</valid_upto>");
valueXmlString.append("<eff_from>").append("<![CDATA["+genericUtility.getValidDateString(effFromStr , genericUtility.getApplDateFormat()) + "]]>").append("</eff_from>");
valueXmlString.append("<price_rule>").append("<![CDATA["+priceRule+"]]>").append("</price_rule>");
valueXmlString.append("<cust_type>").append("<![CDATA["+custType+"]]>").append("</cust_type>");
valueXmlString.append("<order_type__appl>").append("<![CDATA["+orderType+"]]>").append("</order_type__appl>");
valueXmlString.append("<order_type__appl_descr>").append("<![CDATA["+orderTypeDescr+"]]>").append("</order_type__appl_descr>");
valueXmlString.append("<chg_date >").append("<![CDATA["+ldDate+"]]>").append("</chg_date>");
valueXmlString.append("<chg_user >").append("<![CDATA["+userId+"]]>").append("</chg_user>");
valueXmlString.append("<chg_term >").append("<![CDATA["+chgTerm+"]]>").append("</chg_term>");
}
else //Regulat customer
{
sql = " select price_list__clg from site_customer where cust_code = ? and site_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCode);
pstmt.setString(2, siteCode);
rs = pstmt.executeQuery();
if(rs.next())
{
sql = " select price_list__clg from customer where cust_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCode);
rs = pstmt.executeQuery();
if(rs.next())
priceListClg = rs.getString(1)==null?"":rs.getString(1);
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
if(priceListClg == null || !(priceListClg.trim().length() > 0))
{
priceListClg = rs.getString(1)==null?"":rs.getString(1);
if(priceListClg == null || !(priceListClg.trim().length() > 0) || priceListClg.trim().equals("NULLFOUND"))
sql = " select price_list__clg from customer where cust_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCode);
rs = pstmt.executeQuery();
if(rs.next())
{
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
sql = "SELECT VAR_VALUE FROM DISPARM WHERE PRD_CODE = ? AND VAR_NAME = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, "999999");
pstmt.setString(2, "PRICE_LIST__CLG");
rs = pstmt.executeQuery();
if(rs.next())
{
priceListClg = rs.getString(1)==null?"":rs.getString(1);
}
else
{
priceListClg = "NULLFOUND";
}
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
priceListClg = rs.getString(1)==null?"":rs.getString(1);
if(priceListClg == null || !(priceListClg.trim().length() > 0) || priceListClg.trim().equals("NULLFOUND"))
{
pstmt.close();pstmt = null;
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
sql = "SELECT VAR_VALUE FROM DISPARM WHERE PRD_CODE = ? AND VAR_NAME = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, "999999");
pstmt.setString(2, "PRICE_LIST__CLG");
rs = pstmt.executeQuery();
if(rs.next())
{
priceListClg = rs.getString(1)==null?"":rs.getString(1);
}
else
{
priceListClg = "NULLFOUND";
}
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
}
}
}
}
}
sql = " select PRICE_LIST from site_customer where site_code = ? and cust_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, custCode);
rs = pstmt.executeQuery();
if(rs.next())
{
priceList = rs.getString(1)==null?"":rs.getString(1);
}
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
sql = "select cr_term, tax_chap, tax_class, sales_pers, sales_pers__1,sales_pers__2, price_list," +
" price_list__disc , ORDER_TYPE from customer where cust_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCode);
rs = pstmt.executeQuery();
if(rs.next())
{
crTerm = rs.getString(1)==null?"":rs.getString(1);
taxChap = rs.getString(2)==null?"":rs.getString(2);
taxClass = rs.getString(3)==null?"":rs.getString(3);
salesPers = rs.getString(4)==null?"":rs.getString(4);
salesPers1 = rs.getString(5)==null?"":rs.getString(5);
salesPers2 = rs.getString(6)==null?"":rs.getString(6);
pList = rs.getString(7)==null?"":rs.getString(7);
pListDisc = rs.getString(8)==null?"":rs.getString(8);
contractType = rs.getString(9)==null?"":rs.getString(9);
sql = " select PRICE_LIST from site_customer where site_code = ? and cust_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, custCode);
rs = pstmt.executeQuery();
if(rs.next())
{
priceList = rs.getString(1)==null?"":rs.getString(1);
}
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
}
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
sql = "select descr from crterm where cr_term = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, crTerm);
rs = pstmt.executeQuery();
if(rs.next())
{
crDescr = rs.getString(1)==null?"":rs.getString(1);
}
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
if(priceList == null || priceList.trim().length()==0)
{
priceList = pList;
}
valueXmlString.append("<Detail1 domID='1' objContext='1'>");
valueXmlString.append("<cust_code>").append("<![CDATA[" + custCode + "]]>").append("</cust_code>");
valueXmlString.append("<cust_code__bil >").append("<![CDATA[" + custCode + "]]>").append("</cust_code__bil>");
valueXmlString.append("<cr_term >").append("<![CDATA[" + crTerm + "]]>").append("</cr_term>");
valueXmlString.append("<crterm_descr >").append("<![CDATA[" + crDescr + "]]>").append("</crterm_descr>");
valueXmlString.append("<cust_code__dlv >").append("<![CDATA[" + custCode + "]]>").append("</cust_code__dlv>");
valueXmlString.append("<tax_chap >").append("<![CDATA[" + taxChap + "]]>").append("</tax_chap>");
valueXmlString.append("<tax_class >").append("<![CDATA[" + taxClass + "]]>").append("</tax_class>");
valueXmlString.append("<price_list >").append("<![CDATA[" + priceList + "]]>").append("</price_list>");
valueXmlString.append("<price_list__disc >").append("<![CDATA[" + pListDisc + "]]>").append("</price_list__disc>");
valueXmlString.append("<price_list__clg >").append("<![CDATA[" + priceListClg + "]]>").append("</price_list__clg>");
valueXmlString.append("<contract_type >").append("<![CDATA[" + contractType + "]]>").append("</contract_type>");
sql = "select cust_name, addr1, addr2,addr3, city, pin, count_code, stan_code, " +
"tran_code, trans_mode,state_code, tele1, tele2, tele3,fax ,curr_code" +
" from customer where cust_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCode);
rs = pstmt.executeQuery();
if(rs.next())
{
custName = rs.getString(1)==null?"":rs.getString(1);
addr1 = rs.getString(2)==null?"":rs.getString(2);
addr2 = rs.getString(3)==null?"":rs.getString(3);
addr3 = rs.getString(4)==null?"":rs.getString(4);
city = rs.getString(5)==null?"":rs.getString(5);
pin = rs.getString(6)==null?"":rs.getString(6);
countCode = rs.getString(7)==null?"":rs.getString(7);
stanCode = rs.getString(8)==null?"":rs.getString(8);
tranCode = rs.getString(9)==null?"":rs.getString(9);
transMode = rs.getString(10)==null?"":rs.getString(10);
stateCode = rs.getString(11)==null?"":rs.getString(11);
tele1 = rs.getString(12)==null?"":rs.getString(12);
tele2 = rs.getString(13)==null?"":rs.getString(13);
tele3 = rs.getString(14)==null?"":rs.getString(14);
fax = rs.getString(15)==null?"":rs.getString(15);
curr = rs.getString(16)==null?"":rs.getString(16);
}
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
valueXmlString.append("<cust_name >").append("<![CDATA[" + custName + "]]>").append("</cust_name>");
valueXmlString.append("<dlv_to >").append("<![CDATA[" + custName + "]]>").append("</dlv_to>");
valueXmlString.append("<dlv_add1 >").append("<![CDATA[" + addr1 + "]]>").append("</dlv_add1>");
valueXmlString.append("<dlv_add2 >").append("<![CDATA[" + addr2 + "]]>").append("</dlv_add2>");
valueXmlString.append("<dlv_add3 >").append("<![CDATA[" + addr3 + "]]>").append("</dlv_add3>");
valueXmlString.append("<dlv_city >").append("<![CDATA[" + city + "]]>").append("</dlv_city>");
valueXmlString.append("<dlv_pin >").append("<![CDATA[" + pin + "]]>").append("</dlv_pin>");
valueXmlString.append("<count_code__dlv >").append("<![CDATA[" + countCode + "]]>").append("</count_code__dlv>");
valueXmlString.append("<tran_code >").append("<![CDATA[" + tranCode + "]]>").append("</tran_code>");
valueXmlString.append("<trans_mode >").append("<![CDATA[" + transMode + "]]>").append("</trans_mode>");
valueXmlString.append("<stan_code >").append("<![CDATA[" + stanCode + "]]>").append("</stan_code>");
valueXmlString.append("<state_code__dlv >").append("<![CDATA[" + stateCode.trim() + "]]>").append("</state_code__dlv>");
valueXmlString.append("<tel1__dlv >").append("<![CDATA[" + tele1 + "]]>").append("</tel1__dlv>");
valueXmlString.append("<tel2__dlv >").append("<![CDATA[" + tele2 + "]]>").append("</tel2__dlv>");
valueXmlString.append("<tel3__dlv >").append("<![CDATA[" + tele3 + "]]>").append("</tel3__dlv>");
valueXmlString.append("<fax__dlv >").append("<![CDATA[" + fax + "]]>").append("</fax__dlv>");
valueXmlString.append("<curr_code >").append("<![CDATA[" + curr + "]]>").append("</curr_code>");
sql = "select descr,std_exrt from currency where curr_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, curr);
rs = pstmt.executeQuery();
if(rs.next())
{
currDescr = rs.getString(1)==null?"":rs.getString(1);
num = rs.getInt(2);
}
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
num = getDailyExchRate(curr , "",siteCode , contractDate , "S" , conn);
valueXmlString.append("<exch_rate >").append("<![CDATA[" + num + "]]>").append("</exch_rate>");
valueXmlString.append("<currency_descr >").append("<![CDATA[" + currDescr + "]]>").append("</currency_descr>");
descr = " ";
descr1 = " ";
num = 0;
sql = "select descr from station where stan_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, stanCode);
rs = pstmt.executeQuery();
if(rs.next())
{
descr = rs.getString(1)==null?"":rs.getString(1);
}
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
valueXmlString.append("<station_descr >").append("<![CDATA[" + descr + "]]>").append("</station_descr>");
descr = " ";
descr1 = " ";
num = 0;
sql = "select tran_name, frt_term, curr_code from transporter where tran_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranCode);
rs = pstmt.executeQuery();
if(rs.next())
{
descr = rs.getString(1)==null?"":rs.getString(1);
descr1 = rs.getString(2)==null?"":rs.getString(2);
curr = rs.getString(3)==null?"":rs.getString(3);
}
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
valueXmlString.append("<tran_name >").append("<![CDATA[" + descr + "]]>").append("</tran_name>");
valueXmlString.append("<frt_term >").append("<![CDATA[" + descr1.trim() + "]]>").append("</frt_term>");
valueXmlString.append("<curr_code__frt >").append("<![CDATA[" + curr + "]]>").append("</curr_code__frt>");
valueXmlString.append("<curr_code__ins >").append("<![CDATA[" + curr + "]]>").append("</curr_code__ins>");
valueXmlString.append("<exch_rate__frt >").append("<![CDATA[" + num + "]]>").append("</exch_rate__frt>");
valueXmlString.append("<exch_rate__ins >").append("<![CDATA[" + num + "]]>").append("</exch_rate__ins>");
descr = " ";
descr1 = " ";
num = 0;
currCode = " ";
sql = "select sp_name, comm_perc, comm_perc__on,curr_code from sales_pers where sales_pers = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, salesPers);
rs = pstmt.executeQuery();
if(rs.next())
{
descr = rs.getString(1)==null?"":rs.getString(1);
num = rs.getInt(2);
descr1 = rs.getString(3)==null?"":rs.getString(3);
currCode = rs.getString(4)==null?"":rs.getString(4);
}
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
valueXmlString.append("<sales_pers >").append("<![CDATA[" + salesPers + "]]>").append("</sales_pers>");
valueXmlString.append("<sp_name >").append("<![CDATA[" + descr + "]]>").append("</sp_name>");
valueXmlString.append("<comm_perc >").append("<![CDATA[" + num + "]]>").append("</comm_perc>");
valueXmlString.append("<curr_code__comm >").append("<![CDATA[" + currCode + "]]>").append("</curr_code__comm>");
if(descr1 != null)
{
valueXmlString.append("<comm_perc__on >").append("<![CDATA[" + descr1 + "]]>").append("</comm_perc__on>");
}
siteCode = genericUtility.getColumnValue("site_code", dom);
contractDateStr = genericUtility.getValidDateString(genericUtility.getColumnValue("contract_date", dom1) , genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat());
contractDate = Timestamp.valueOf(contractDateStr + " 00:00:00.0");
num = getDailyExchRate(curr , "",siteCode , contractDate , "S" , conn);
valueXmlString.append("<exch_rate__comm >").append("<![CDATA[" + num + "]]>").append("</exch_rate__comm>");
descr = " ";
descr1 = " ";
num = 0;
currCode = " ";
sql = "select sp_name, comm_perc, comm_perc__on ,curr_code from sales_pers where sales_pers = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, salesPers1);
rs = pstmt.executeQuery();
if(rs.next())
{
descr = rs.getString(1)==null?"":rs.getString(1);
num = rs.getInt(2);
descr1 = rs.getString(3)==null?"":rs.getString(3);
currCode = rs.getString(4)==null?"":rs.getString(4);
}
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
valueXmlString.append("<sales_pers__1 >").append("<![CDATA[" + salesPers1 + "]]>").append("</sales_pers__1>");
valueXmlString.append("<sp_name_1 >").append("<![CDATA[" + descr + "]]>").append("</sp_name_1>");
valueXmlString.append("<comm_perc_1 >").append("<![CDATA[" + num + "]]>").append("</comm_perc_1>");
valueXmlString.append("<curr_code__comm_1 >").append("<![CDATA[" + checkNullAndTrim(currCode) + "]]>").append("</curr_code__comm_1>");
if(descr1 != null)
{
valueXmlString.append("<comm_perc_on_1 >").append("<![CDATA[" + checkNullAndTrim(descr1) + "]]>").append("</comm_perc_on_1>");
}
siteCode = genericUtility.getColumnValue("site_code", dom);
contractDateStr = genericUtility.getValidDateString(genericUtility.getColumnValue("contract_date", dom1) , genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat());
contractDate = Timestamp.valueOf(contractDateStr + " 00:00:00.0");
num = getDailyExchRate(curr , "",siteCode , contractDate , "S" , conn);
valueXmlString.append("<exch_rate__comm_1 >").append("<![CDATA[" + num + "]]>").append("</exch_rate__comm_1>");
descr = " ";
descr1 = " ";
num = 0;
currCode = " ";
sql = "select sp_name, comm_perc, comm_perc__on ,curr_code from sales_pers where sales_pers = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, salesPers2);
rs = pstmt.executeQuery();
if(rs.next())
{
descr = rs.getString(1)==null?"":rs.getString(1);
num = rs.getInt(2);
descr1 = rs.getString(3)==null?"":rs.getString(3);
currCode = rs.getString(4)==null?"":rs.getString(4);
}
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
valueXmlString.append("<sales_pers__2 >").append("<![CDATA[" + salesPers2 + "]]>").append("</sales_pers__2>");
valueXmlString.append("<sp_name_2 >").append("<![CDATA[" + descr + "]]>").append("</sp_name_2>");
valueXmlString.append("<comm_perc_2 >").append("<![CDATA[" + num + "]]>").append("</comm_perc_2>");
valueXmlString.append("<curr_code__comm_2 >").append("<![CDATA[" + checkNullAndTrim(currCode) + "]]>").append("</curr_code__comm_2>");
if(descr1 != null)
{
valueXmlString.append("<comm_perc_on_2 >").append("<![CDATA[" + checkNullAndTrim(descr1) + "]]>").append("</comm_perc_on_2>");
}
siteCode = genericUtility.getColumnValue("site_code", dom);
itemSer = genericUtility.getColumnValue("item_ser", dom);
contractDateStr = genericUtility.getValidDateString(genericUtility.getColumnValue("contract_date", dom1) , genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat());
contractDate = Timestamp.valueOf(contractDateStr + " 00:00:00.0");
num = getDailyExchRate(curr , "",siteCode , contractDate , "S" , conn);
valueXmlString.append("<exch_rate__comm_2 >").append("<![CDATA[" + num + "]]>").append("</exch_rate__comm_2>");
sql = "select dlv_term from customer_series where cust_code = ? and item_ser = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCode);
pstmt.setString(2, itemSer);
rs = pstmt.executeQuery();
if(rs.next())
{
dlvTerm = rs.getString(1)==null?"":rs.getString(1);
}
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
if(dlvTerm == null || dlvTerm.trim().length() == 0)
{
sql = "select dlv_term from customer where cust_code = ?";
sql = "select cr_term, tax_chap, tax_class, sales_pers, sales_pers__1,sales_pers__2, price_list," +
" price_list__disc , ORDER_TYPE from customer where cust_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCode);
rs = pstmt.executeQuery();
if(rs.next())
{
dlvTerm = rs.getString(1)==null?"":rs.getString(1);
crTerm = rs.getString(1)==null?"":rs.getString(1);
taxChap = rs.getString(2)==null?"":rs.getString(2);
taxClass = rs.getString(3)==null?"":rs.getString(3);
salesPers = rs.getString(4)==null?"":rs.getString(4);
salesPers1 = rs.getString(5)==null?"":rs.getString(5);
salesPers2 = rs.getString(6)==null?"":rs.getString(6);
pList = rs.getString(7)==null?"":rs.getString(7);
pListDisc = rs.getString(8)==null?"":rs.getString(8);
contractType = rs.getString(9)==null?"":rs.getString(9);
}
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
sql = "select descr from crterm where cr_term = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, crTerm);
rs = pstmt.executeQuery();
if(rs.next())
{
crDescr = rs.getString(1)==null?"":rs.getString(1);
}
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
if(priceList == null || priceList.trim().length()==0)
{
priceList = pList;
}
valueXmlString.append("<Detail1 domID='1' objContext='1'>");
valueXmlString.append("<cust_code>").append("<![CDATA[" + custCode + "]]>").append("</cust_code>");
valueXmlString.append("<cust_code__bil >").append("<![CDATA[" + custCode + "]]>").append("</cust_code__bil>");
valueXmlString.append("<cr_term >").append("<![CDATA[" + crTerm + "]]>").append("</cr_term>");
valueXmlString.append("<crterm_descr >").append("<![CDATA[" + crDescr + "]]>").append("</crterm_descr>");
valueXmlString.append("<cust_code__dlv >").append("<![CDATA[" + custCode + "]]>").append("</cust_code__dlv>");
valueXmlString.append("<tax_chap >").append("<![CDATA[" + taxChap + "]]>").append("</tax_chap>");
valueXmlString.append("<tax_class >").append("<![CDATA[" + taxClass + "]]>").append("</tax_class>");
valueXmlString.append("<price_list >").append("<![CDATA[" + priceList + "]]>").append("</price_list>");
valueXmlString.append("<price_list__disc >").append("<![CDATA[" + pListDisc + "]]>").append("</price_list__disc>");
valueXmlString.append("<price_list__clg >").append("<![CDATA[" + priceListClg + "]]>").append("</price_list__clg>");
valueXmlString.append("<contract_type >").append("<![CDATA[" + contractType + "]]>").append("</contract_type>");
sql = "select cust_name, addr1, addr2,addr3, city, pin, count_code, stan_code, " +
"tran_code, trans_mode,state_code, tele1, tele2, tele3,fax ,curr_code" +
" from customer where cust_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCode);
rs = pstmt.executeQuery();
if(rs.next())
{
custName = rs.getString(1)==null?"":rs.getString(1);
addr1 = rs.getString(2)==null?"":rs.getString(2);
addr2 = rs.getString(3)==null?"":rs.getString(3);
addr3 = rs.getString(4)==null?"":rs.getString(4);
city = rs.getString(5)==null?"":rs.getString(5);
pin = rs.getString(6)==null?"":rs.getString(6);
countCode = rs.getString(7)==null?"":rs.getString(7);
stanCode = rs.getString(8)==null?"":rs.getString(8);
tranCode = rs.getString(9)==null?"":rs.getString(9);
transMode = rs.getString(10)==null?"":rs.getString(10);
stateCode = rs.getString(11)==null?"":rs.getString(11);
tele1 = rs.getString(12)==null?"":rs.getString(12);
tele2 = rs.getString(13)==null?"":rs.getString(13);
tele3 = rs.getString(14)==null?"":rs.getString(14);
fax = rs.getString(15)==null?"":rs.getString(15);
curr = rs.getString(16)==null?"":rs.getString(16);
}
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
valueXmlString.append("<cust_name >").append("<![CDATA[" + custName + "]]>").append("</cust_name>");
valueXmlString.append("<dlv_to >").append("<![CDATA[" + custName + "]]>").append("</dlv_to>");
valueXmlString.append("<dlv_add1 >").append("<![CDATA[" + addr1 + "]]>").append("</dlv_add1>");
valueXmlString.append("<dlv_add2 >").append("<![CDATA[" + addr2 + "]]>").append("</dlv_add2>");
valueXmlString.append("<dlv_add3 >").append("<![CDATA[" + addr3 + "]]>").append("</dlv_add3>");
valueXmlString.append("<dlv_city >").append("<![CDATA[" + city + "]]>").append("</dlv_city>");
valueXmlString.append("<dlv_pin >").append("<![CDATA[" + pin + "]]>").append("</dlv_pin>");
valueXmlString.append("<count_code__dlv >").append("<![CDATA[" + countCode + "]]>").append("</count_code__dlv>");
valueXmlString.append("<tran_code >").append("<![CDATA[" + tranCode + "]]>").append("</tran_code>");
valueXmlString.append("<trans_mode >").append("<![CDATA[" + transMode + "]]>").append("</trans_mode>");
valueXmlString.append("<stan_code >").append("<![CDATA[" + stanCode + "]]>").append("</stan_code>");
valueXmlString.append("<state_code__dlv >").append("<![CDATA[" + stateCode.trim() + "]]>").append("</state_code__dlv>");
valueXmlString.append("<tel1__dlv >").append("<![CDATA[" + tele1 + "]]>").append("</tel1__dlv>");
valueXmlString.append("<tel2__dlv >").append("<![CDATA[" + tele2 + "]]>").append("</tel2__dlv>");
valueXmlString.append("<tel3__dlv >").append("<![CDATA[" + tele3 + "]]>").append("</tel3__dlv>");
valueXmlString.append("<fax__dlv >").append("<![CDATA[" + fax + "]]>").append("</fax__dlv>");
valueXmlString.append("<curr_code >").append("<![CDATA[" + curr + "]]>").append("</curr_code>");
sql = "select descr,std_exrt from currency where curr_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, curr);
rs = pstmt.executeQuery();
if(rs.next())
{
currDescr = rs.getString(1)==null?"":rs.getString(1);
num = rs.getInt(2);
}
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
num = getDailyExchRate(curr , "",siteCode , contractDate , "S" , conn);
valueXmlString.append("<exch_rate >").append("<![CDATA[" + num + "]]>").append("</exch_rate>");
valueXmlString.append("<currency_descr >").append("<![CDATA[" + currDescr + "]]>").append("</currency_descr>");
descr = " ";
descr1 = " ";
num = 0;
sql = "select descr from station where stan_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, stanCode);
rs = pstmt.executeQuery();
if(rs.next())
{
descr = rs.getString(1)==null?"":rs.getString(1);
}
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
valueXmlString.append("<station_descr>").append("<![CDATA[" + descr + "]]>").append("</station_descr>");
descr = " ";
descr1 = " ";
num = 0;
sql = "select tran_name, frt_term, curr_code from transporter where tran_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranCode);
rs = pstmt.executeQuery();
if(rs.next())
{
descr = rs.getString(1)==null?"":rs.getString(1);
descr1 = rs.getString(2)==null?"":rs.getString(2);
curr = rs.getString(3)==null?"":rs.getString(3);
}
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
valueXmlString.append("<tran_name >").append("<![CDATA[" + descr + "]]>").append("</tran_name>");
valueXmlString.append("<frt_term >").append("<![CDATA[" + descr1.trim() + "]]>").append("</frt_term>");
valueXmlString.append("<curr_code__frt >").append("<![CDATA[" + curr + "]]>").append("</curr_code__frt>");
valueXmlString.append("<curr_code__ins >").append("<![CDATA[" + curr + "]]>").append("</curr_code__ins>");
valueXmlString.append("<exch_rate__frt >").append("<![CDATA[" + num + "]]>").append("</exch_rate__frt>");
valueXmlString.append("<exch_rate__ins >").append("<![CDATA[" + num + "]]>").append("</exch_rate__ins>");
descr = " ";
descr1 = " ";
num = 0;
currCode = " ";
sql = "select sp_name, comm_perc, comm_perc__on,curr_code from sales_pers where sales_pers = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, salesPers);
rs = pstmt.executeQuery();
if(rs.next())
{
descr = rs.getString(1)==null?"":rs.getString(1);
num = rs.getInt(2);
descr1 = rs.getString(3)==null?"":rs.getString(3);
currCode = rs.getString(4)==null?"":rs.getString(4);
}
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
valueXmlString.append("<sales_pers >").append("<![CDATA[" + salesPers + "]]>").append("</sales_pers>");
valueXmlString.append("<sp_name >").append("<![CDATA[" + descr + "]]>").append("</sp_name>");
valueXmlString.append("<comm_perc >").append("<![CDATA[" + num + "]]>").append("</comm_perc>");
valueXmlString.append("<curr_code__comm >").append("<![CDATA[" + currCode + "]]>").append("</curr_code__comm>");
if(descr1 != null)
{
valueXmlString.append("<comm_perc__on >").append("<![CDATA[" + descr1 + "]]>").append("</comm_perc__on>");
}
siteCode = genericUtility.getColumnValue("site_code", dom);
contractDateStr = genericUtility.getValidDateString(genericUtility.getColumnValue("contract_date", dom1) , genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat());
contractDate = Timestamp.valueOf(contractDateStr + " 00:00:00.0");
//num = getDailyExchRate(curr , "",siteCode , contractDate , "S" , conn);
valueXmlString.append("<exch_rate__comm >").append("<![CDATA[" + num + "]]>").append("</exch_rate__comm>");
descr = " ";
descr1 = " ";
num = 0;
currCode = " ";
sql = "select sp_name, comm_perc, comm_perc__on ,curr_code from sales_pers where sales_pers = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, salesPers1);
rs = pstmt.executeQuery();
if(rs.next())
{
descr = rs.getString(1)==null?"":rs.getString(1);
num = rs.getInt(2);
descr1 = rs.getString(3)==null?"":rs.getString(3);
currCode = rs.getString(4)==null?"":rs.getString(4);
}
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
valueXmlString.append("<sales_pers__1 >").append("<![CDATA[" + salesPers1 + "]]>").append("</sales_pers__1>");
valueXmlString.append("<sp_name_1 >").append("<![CDATA[" + descr + "]]>").append("</sp_name_1>");
valueXmlString.append("<comm_perc_1 >").append("<![CDATA[" + num + "]]>").append("</comm_perc_1>");
valueXmlString.append("<curr_code__comm_1 >").append("<![CDATA[" + checkNullAndTrim(currCode) + "]]>").append("</curr_code__comm_1>");
if(descr1 != null)
{
valueXmlString.append("<comm_perc_on_1 >").append("<![CDATA[" + checkNullAndTrim(descr1) + "]]>").append("</comm_perc_on_1>");
}
siteCode = genericUtility.getColumnValue("site_code", dom);
contractDateStr = genericUtility.getValidDateString(genericUtility.getColumnValue("contract_date", dom1) , genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat());
contractDate = Timestamp.valueOf(contractDateStr + " 00:00:00.0");
//num = getDailyExchRate(curr , "",siteCode , contractDate , "S" , conn);
valueXmlString.append("<exch_rate__comm_1 >").append("<![CDATA[" + num + "]]>").append("</exch_rate__comm_1>");
descr = " ";
descr1 = " ";
num = 0;
currCode = " ";
sql = "select sp_name, comm_perc, comm_perc__on ,curr_code from sales_pers where sales_pers = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, salesPers2);
rs = pstmt.executeQuery();
if(rs.next())
{
descr = rs.getString(1)==null?"":rs.getString(1);
num = rs.getInt(2);
descr1 = rs.getString(3)==null?"":rs.getString(3);
currCode = rs.getString(4)==null?"":rs.getString(4);
}
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
valueXmlString.append("<sales_pers__2 >").append("<![CDATA[" + salesPers2 + "]]>").append("</sales_pers__2>");
valueXmlString.append("<sp_name_2 >").append("<![CDATA[" + descr + "]]>").append("</sp_name_2>");
valueXmlString.append("<comm_perc_2 >").append("<![CDATA[" + num + "]]>").append("</comm_perc_2>");
valueXmlString.append("<curr_code__comm_2 >").append("<![CDATA[" + checkNullAndTrim(currCode) + "]]>").append("</curr_code__comm_2>");
if(descr1 != null)
{
valueXmlString.append("<comm_perc_on_2 >").append("<![CDATA[" + checkNullAndTrim(descr1) + "]]>").append("</comm_perc_on_2>");
}
siteCode = genericUtility.getColumnValue("site_code", dom);
itemSer = genericUtility.getColumnValue("item_ser", dom);
contractDateStr = genericUtility.getValidDateString(genericUtility.getColumnValue("contract_date", dom1) , genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat());
contractDate = Timestamp.valueOf(contractDateStr + " 00:00:00.0");
//num = getDailyExchRate(curr , "",siteCode , contractDate , "S" , conn);
valueXmlString.append("<exch_rate__comm_2 >").append("<![CDATA[" + num + "]]>").append("</exch_rate__comm_2>");
sql = "select dlv_term from customer_series where cust_code = ? and item_ser = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCode);
pstmt.setString(2, itemSer);
rs = pstmt.executeQuery();
if(rs.next())
{
dlvTerm = rs.getString(1)==null?"":rs.getString(1);
}
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
if(dlvTerm == null || dlvTerm.trim().length() == 0)
{
sql = "select dlv_term from customer where cust_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCode);
rs = pstmt.executeQuery();
if(rs.next())
{
dlvTerm = rs.getString(1)==null?"":rs.getString(1);
}
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
}
if(dlvTerm == null || dlvTerm.trim().length() == 0)
{
pstmt.close();pstmt = null;
dlvTerm = "NA";
}
valueXmlString.append("<dlv_term >").append("<![CDATA[" + dlvTerm + "]]>").append("</dlv_term>");
valueXmlString.append("<confirmed>").append("<![CDATA[N]]>").append("</confirmed>");
valueXmlString.append("<valid_upto>").append("<![CDATA["+genericUtility.getValidDateString(validUpTostr , genericUtility.getApplDateFormat()) + "]]>").append("</valid_upto>");
valueXmlString.append("<eff_from>").append("<![CDATA["+genericUtility.getValidDateString(effFromStr , genericUtility.getApplDateFormat()) + "]]>").append("</eff_from>");
valueXmlString.append("<price_rule>").append("<![CDATA["+priceRule+"]]>").append("</price_rule>");
valueXmlString.append("<cust_type>").append("<![CDATA["+custType+"]]>").append("</cust_type>");
valueXmlString.append("<order_type__appl>").append("<![CDATA["+orderType+"]]>").append("</order_type__appl>");
valueXmlString.append("<order_type__appl_descr>").append("<![CDATA["+orderTypeDescr+"]]>").append("</order_type__appl_descr>");
valueXmlString.append("<chg_date >").append("<![CDATA["+ldDate+"]]>").append("</chg_date>");
valueXmlString.append("<chg_user >").append("<![CDATA["+userId+"]]>").append("</chg_user>");
valueXmlString.append("<chg_term >").append("<![CDATA["+chgTerm+"]]>").append("</chg_term>");
}
if(dlvTerm == null || dlvTerm.trim().length() == 0)
{
dlvTerm = "NA";
}
valueXmlString.append("<dlv_term >").append("<![CDATA[" + dlvTerm + "]]>").append("</dlv_term>");
valueXmlString.append("<confirmed>").append("<![CDATA[N]]>").append("</confirmed>");
}
valueXmlString.append("</Detail1>");
}
......@@ -2143,23 +2017,6 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
//lineNo = " " + lineNo;
//lineNo = lineNo.substring( lineNo.length()-3 );
sql = " SELECT DESCR FROM GENCODES WHERE FLD_NAME='CONTRACT_SCOPE' AND MOD_NAME = 'W_SCONTRACT_GWT_WIZ' AND FLD_VALUE = ? ";
pstmtDescr = conn.prepareStatement(sql);
pstmtDescr.setString(1, contractScope);
rsDescr = pstmtDescr.executeQuery();
if(rsDescr.next())
{
contractScopeDescr = rsDescr.getString(1)==null?"":rsDescr.getString(1);
}
if(rsDescr!=null)
{
rsDescr.close();rsDescr = null;
}
if(pstmtDescr!=null)
{
pstmtDescr.close();pstmtDescr = null;
}
valueXmlString.append("<Detail2 domID = '"+lineNo.trim()+"' objContext='2' selected = 'Y'>\r\n");
valueXmlString.append("<attribute selected=\"Y\" updateFlag=\"E\" status=\"O\" pkNames=\"\" />\r\n");
valueXmlString.append("<contract_no protect ='1'>").append("<![CDATA[" + contractNo + "]]>").append("</contract_no>");
......@@ -2185,28 +2042,6 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
}
}
}
/*if(count == 0)
{
//valueXmlString.append("<Detail2 domID = '"+1+"' objContext='2' selected = 'N'>\r\n");
//valueXmlString.append("<attribute selected=\"N\" updateFlag=\"A\" status=\"N\" pkNames=\"\" />\r\n");
valueXmlString.append("<Detail2 domID='" + 1 + "' objContext=\"2\" selected=\"Y\">\r\n");
valueXmlString.append("<attribute selected=\"Y\" updateFlag=\"A\" status=\"N\" pkNames=\"\" />\r\n");
//valueXmlString.append( "<Detail2 dbID='' domID='"+1+"' objContext='2' objName='scontract_gwt_wiz' selected='"+selectedChk+"'>\r\n" );
//valueXmlString.append("<attribute pkNames='' status='"+statusChk+"' updateFlag='"+editCustomeFlag+"' selected='"+selectedChk+"' />\r\n");
valueXmlString.append("<contract_no protect ='1'>").append("<![CDATA[" + contractNo + "]]>").append("</contract_no>");
valueXmlString.append("<line_no protect ='1'>").append("<![CDATA[ 1]]>").append("</line_no>");
valueXmlString.append("<valid_upto >").append("<![CDATA[" + genericUtility.getValidDateString(validUpTostr , genericUtility.getApplDateFormat()) + "]]>").append("</valid_upto>");
valueXmlString.append("<eff_from >").append("<![CDATA[" + genericUtility.getValidDateString(effFromStr , genericUtility.getApplDateFormat()) + "]]>").append("</eff_from>");
valueXmlString.append("<division>").append("<![CDATA[]]>").append("</division>");
valueXmlString.append("<contract_scope>").append("<![CDATA[]]>").append("</contract_scope>");
valueXmlString.append("<contract_scope__descr>").append("<![CDATA[]]>").append("</contract_scope__descr>");
valueXmlString.append("<price_list>").append("<![CDATA[]]>").append("</price_list>");
valueXmlString.append("<discount>").append("<![CDATA[]]>").append("</discount>");
valueXmlString.append("</Detail2>");
}*/
}
else if(currentColumn.trim().equalsIgnoreCase("itm_default_add"))
{
......@@ -2238,64 +2073,6 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
valueXmlString.append("<discount>").append("<![CDATA[0]]>").append("</discount>");
valueXmlString.append("</Detail2>");
}
else if (currentColumn.trim().equalsIgnoreCase("contract_scope"))
{
contractNo = checkNullAndTrim(genericUtility.getColumnValue("contract_no", dom1));
contractScope = checkNullAndTrim(genericUtility.getColumnValue("contract_scope", dom));
lineNo = checkNullAndTrim(genericUtility.getColumnValue("line_no", dom));
effFrom = checkNullAndTrim(genericUtility.getColumnValue("eff_from", dom));
validUpto = checkNullAndTrim(genericUtility.getColumnValue("valid_upto", dom));
division = checkNullAndTrim(genericUtility.getColumnValue("division", dom));
contractScopeDescr = checkNullAndTrim(genericUtility.getColumnValue("contract_scope__descr", dom));
priceList = checkNullAndTrim(genericUtility.getColumnValue("price_list", dom));
discount = checkNullAndTrim(genericUtility.getColumnValue("discount", dom));
System.out.println("contract_scope LINE NO ["+lineNo+"] eFFECTIVE dATE["+effFrom+"] vALID UPTO["+validUpto+"]");
lineNo = " " + lineNo;
lineNo = lineNo.substring( lineNo.length()-3 );
System.out.println("Line Number after["+lineNo+"]");
sql = " SELECT DESCR FROM GENCODES WHERE FLD_NAME='CONTRACT_SCOPE' AND MOD_NAME = 'W_SCONTRACT_GWT_WIZ' AND FLD_VALUE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, contractScope);
rs = pstmt.executeQuery();
if(rs.next())
{
contractScopeDescr = rs.getString(1)==null?"":rs.getString(1);
}
else
{
contractScopeDescr = "";
}
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
//valueXmlString.append("<Detail2 domID='"+lineNo+"' objContext='2'>");
valueXmlString.append("<Detail2 domID='" + lineNo.trim() + "' objContext=\"2\" selected=\"Y\">\r\n");
valueXmlString.append("<attribute selected=\"Y\" updateFlag=\""+updateFlag+"\" status=\""+status+"\" pkNames=\"\" />\r\n");
valueXmlString.append("<contract_scope>").append("<![CDATA["+contractScope+"]]>").append("</contract_scope>");
valueXmlString.append("<contract_scope__descr>").append("<![CDATA["+contractScopeDescr+"]]>").append("</contract_scope__descr>");
valueXmlString.append("<line_no protect ='1'>").append("<![CDATA["+lineNo+"]]>").append("</line_no>");
valueXmlString.append("<contract_no protect ='1'>").append("<![CDATA[" + contractNo + "]]>").append("</contract_no>");
valueXmlString.append("<valid_upto >").append("<![CDATA[" + genericUtility.getValidDateString(validUpto , genericUtility.getApplDateFormat()) + "]]>").append("</valid_upto>");
valueXmlString.append("<eff_from >").append("<![CDATA[" + genericUtility.getValidDateString(effFrom , genericUtility.getApplDateFormat()) + "]]>").append("</eff_from>");
valueXmlString.append("<division>").append("<![CDATA["+division+"]]>").append("</division>");
valueXmlString.append("<price_list>").append("<![CDATA["+priceList+"]]>").append("</price_list>");
valueXmlString.append("<discount>").append("<![CDATA["+discount+"]]>").append("</discount>");
valueXmlString.append("</Detail2>");
}
}
break;
case 3:
......@@ -2357,23 +2134,6 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
rateOpt = checkNullAndTrim(rs.getString("RATE_OPT"));
sql = " SELECT DESCR FROM GENCODES WHERE FLD_NAME='RATE_OPT' AND MOD_NAME = 'W_SCONTRACT_GWT_WIZ' AND FLD_VALUE = ? ";
pstmtDescr = conn.prepareStatement(sql);
pstmtDescr.setString(1, rateOpt);
rsDescr = pstmtDescr.executeQuery();
if(rsDescr.next())
{
rateOptDescr = rsDescr.getString(1)==null?"":rsDescr.getString(1);
}
if(rsDescr!=null)
{
rsDescr.close();rsDescr = null;
}
if(pstmtDescr!=null)
{
pstmtDescr.close();pstmtDescr = null;
}
itemSer = checkNullAndTrim(rs.getString("ITEM_SER"));
HashMap hm = new HashMap();
hm = getDiscountPer(dom2,"2",itemSer);
......@@ -3442,100 +3202,6 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
valueXmlString.append("<discount>").append("<![CDATA["+discount+"]]>").append("</discount>");
valueXmlString.append("</Detail3>");
}
/*else if (currentColumn.trim().equalsIgnoreCase("rate_opt"))
{
contractNo = checkNullAndTrim(genericUtility.getColumnValue("contract_no", dom1));
effFromStr = genericUtility.getColumnValue("eff_from", dom1);
validUpTostr = genericUtility.getColumnValue("valid_upto", dom1);
siteCode = genericUtility.getColumnValue("site_code", dom1);
siteCodeShip = genericUtility.getColumnValue("site_code__ship", dom1);
rateOpt = genericUtility.getColumnValue("rate_opt", dom);
rateOptDescr = genericUtility.getColumnValue("rate_opt__descr", dom);
priceList = genericUtility.getColumnValue("price_list", dom);
itemCode = genericUtility.getColumnValue("item_code", dom);
itemDescr = genericUtility.getColumnValue("item_descr", dom);
lineNo = checkNullAndTrim(genericUtility.getColumnValue("line_no", dom));
unit = genericUtility.getColumnValue("unit", dom);
itemFlag = genericUtility.getColumnValue("item_flg", dom);
taxChap = genericUtility.getColumnValue("tax_chap", dom);
taxClass = genericUtility.getColumnValue("tax_class", dom);
taxEnv = genericUtility.getColumnValue("tax_env", dom);
//rate = Integer.parseInt(genericUtility.getColumnValue("rate", dom));
//rateClg = Integer.parseInt(genericUtility.getColumnValue("rate__clg", dom));
System.out.println("Rate opt item change effFromStr["+effFromStr+"] validUpTostr["+validUpTostr+"]");
try
{
rate = Double.parseDouble(genericUtility.getColumnValue("rate", dom));
rateClg = Double.parseDouble(genericUtility.getColumnValue("rate__clg", dom));
}
catch(Exception e)
{
System.out.println("Excpetion for rate and rate__clg="+e.getMessage());
}
unitRate = genericUtility.getColumnValue("unit__rate", dom);
rateNesp = genericUtility.getColumnValue("rate__nesp", dom);
rateStduom = genericUtility.getColumnValue("rate__stduom", dom);
convRtuomStduom = genericUtility.getColumnValue("conv__rtuom_stduom", dom);
sql = " SELECT DESCR FROM GENCODES WHERE FLD_NAME='RATE_OPT' AND MOD_NAME = 'W_SCONTRACT_GWT_WIZ' AND FLD_VALUE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, rateOpt);
rs = pstmt.executeQuery();
if(rs.next())
{
rateOptDescr = rs.getString(1)==null?"":rs.getString(1);
}
else
{
rateOptDescr = "";
}
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
lineNo = " " + lineNo;
lineNo = lineNo.substring( lineNo.length()-3 );
valueXmlString.append("<Detail3 domID='" + lineNo.trim() + "' objContext=\"3\" selected=\"Y\">\r\n");
valueXmlString.append("<attribute selected=\"Y\" updateFlag=\""+updateFlag+"\" status=\""+status+"\" pkNames=\"\" />\r\n");
valueXmlString.append("<contract_no >").append("<![CDATA[" + contractNo + "]]>").append("</contract_no>");
valueXmlString.append("<item_code>").append("<![CDATA["+itemCode+"]]>").append("</item_code>");
valueXmlString.append("<item_descr>").append("<![CDATA["+itemDescr+"]]>").append("</item_descr>");
valueXmlString.append("<line_no>").append("<![CDATA["+lineNo+"]]>").append("</line_no>");
valueXmlString.append("<quantity>").append("<![CDATA[0]]>").append("</quantity>");
valueXmlString.append("<site_code>").append("<![CDATA["+siteCode+"]]>").append("</site_code>");
valueXmlString.append("<status_date >").append("<![CDATA["+ ldDate +"]]>").append("</status_date>");
valueXmlString.append("<dsp_date>").append("<![CDATA["+contractDateStr+"]]>").append("</dsp_date>");
valueXmlString.append("<valid_upto >").append("<![CDATA[" + genericUtility.getValidDateString(validUpTostr , genericUtility.getApplDateFormat()) + "]]>").append("</valid_upto>");
valueXmlString.append("<eff_from >").append("<![CDATA[" + genericUtility.getValidDateString(effFromStr , genericUtility.getApplDateFormat()) + "]]>").append("</eff_from>");
valueXmlString.append("<unit >").append("<![CDATA["+unit+"]]>").append("</unit>");
valueXmlString.append("<item_flg >").append("<![CDATA["+itemFlag+"]]>").append("</item_flg>");
valueXmlString.append("<tax_chap >").append("<![CDATA["+taxChap+"]]>").append("</tax_chap>");
valueXmlString.append("<tax_class >").append("<![CDATA["+taxClass+"]]>").append("</tax_class>");
valueXmlString.append("<tax_env >").append("<![CDATA["+taxEnv+"]]>").append("</tax_env>");
valueXmlString.append("<rate>").append("<![CDATA["+rate+"]]>").append("</rate>");
valueXmlString.append("<rate__clg >").append("<![CDATA["+rateClg+"]]>").append("</rate__clg>");
valueXmlString.append("<rate__nesp >").append("<![CDATA["+rateNesp+"]]>").append("</rate__nesp>");
valueXmlString.append("<unit__rate >").append("<![CDATA["+unitRate+"]]>").append("</unit__rate>");
valueXmlString.append("<rate__stduom >").append("<![CDATA["+rateStduom+"]]>").append("</rate__stduom>");
valueXmlString.append("<conv__rtuom_stduom >").append("<![CDATA["+convRtuomStduom+"]]>").append("</conv__rtuom_stduom>");
valueXmlString.append("<price_list>").append("<![CDATA["+priceList+"]]>").append("</price_list>");
valueXmlString.append("<rate_opt>").append("<![CDATA["+rateOpt+"]]>").append("</rate_opt>");
valueXmlString.append("<rate_opt__descr>").append("<![CDATA["+rateOptDescr+"]]>").append("</rate_opt__descr>");
valueXmlString.append("<chg_date >").append("<![CDATA["+ldDate+"]]>").append("</chg_date>");
valueXmlString.append("<chg_user >").append("<![CDATA["+userId+"]]>").append("</chg_user>");
valueXmlString.append("<chg_term >").append("<![CDATA["+chgTerm+"]]>").append("</chg_term>");
valueXmlString.append("<discount>").append("<![CDATA["+discount+"]]>").append("</discount>");
valueXmlString.append("</Detail3>");
}*/
}
break;
case 4:
......@@ -3610,27 +3276,6 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
pstmtDescr.close();pstmtDescr = null;
}
sql = " SELECT DESCR FROM GENCODES WHERE FLD_NAME='CUST_TYPE' AND MOD_NAME = 'W_SCONTRACT_GWT_WIZ' AND FLD_VALUE = ? ";
pstmtDescr = conn.prepareStatement(sql);
pstmtDescr.setString(1, custType);
rsDescr = pstmtDescr.executeQuery();
if(rsDescr.next())
{
custTypeDescr = rsDescr.getString(1)==null?"":rsDescr.getString(1);
}
else
{
custTypeDescr = "";
}
if(rsDescr != null)
{
rsDescr.close();rsDescr = null;
}
if(pstmtDescr != null)
{
pstmtDescr.close();pstmtDescr = null;
}
valueXmlString.append("<Detail4 domID = '"+lineNo+"' objContext='4' selected = 'Y'>\r\n");
valueXmlString.append("<attribute selected=\"Y\" updateFlag=\"E\" status=\"O\" pkNames=\"\" />\r\n");
valueXmlString.append("<contract_no>").append("<![CDATA[" +contractNo+"]]>").append("</contract_no>");
......@@ -3654,22 +3299,6 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
}
}
}
/*if(count == 0)
{
//valueXmlString.append("<Detail4 domID = '"+1+"' objContext='4' selected = 'N'>\r\n");
//valueXmlString.append("<attribute selected=\"N\" updateFlag=\"A\" status=\"N\" pkNames=\"\" />\r\n");
valueXmlString.append("<Detail4 domID='" + 1 + "' objContext=\"4\" selected=\"Y\">\r\n");
valueXmlString.append("<attribute selected=\"Y\" updateFlag=\"A\" status=\"N\" pkNames=\"\" />\r\n");
valueXmlString.append("<contract_no>").append("<![CDATA[" +contractNo+"]]>").append("</contract_no>");
valueXmlString.append("<line_no>").append("<![CDATA[1]]>").append("</line_no>");
valueXmlString.append("<cust_code >").append("<![CDATA[]]>").append("</cust_code>");
valueXmlString.append("<cust_name >").append("<![CDATA[]]>").append("</cust_name>");
valueXmlString.append("<drug_lic_no >").append("<![CDATA[]]>").append("</drug_lic_no>");
valueXmlString.append("<cust_type >").append("<![CDATA["+custType+"]]>").append("</cust_type>");
valueXmlString.append("<cust_type__descr>").append("<![CDATA[]]>").append("</cust_type__descr>");
valueXmlString.append("</Detail4>");
}*/
}
else if(currentColumn.trim().equalsIgnoreCase("itm_default_add"))
{
......@@ -3679,30 +3308,7 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
domID = getMaxLineNoFromDOM(dom,"4");
lineNo = " " + domID;
lineNo = lineNo.substring( lineNo.length()-3 );
sql = " SELECT DESCR FROM GENCODES WHERE FLD_NAME='CUST_TYPE' AND MOD_NAME = 'W_SCONTRACT_GWT_WIZ' AND FLD_VALUE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custType);
rs = pstmt.executeQuery();
if(rs.next())
{
custTypeDescr = rs.getString(1)==null?"":rs.getString(1);
}
else
{
custTypeDescr = "";
}
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
//valueXmlString.append("<Detail4 domID = '"+domID+"' objContext='4' selected = 'N'>\r\n");
//valueXmlString.append("<attribute selected=\"N\" updateFlag=\"A\" status=\"N\" pkNames=\"\" />\r\n");
valueXmlString.append("<Detail4 domID='" + domID + "' objContext=\"4\" selected=\"Y\">\r\n");
valueXmlString.append("<attribute selected=\"Y\" updateFlag=\"A\" status=\"N\" pkNames=\"\" />\r\n");
......@@ -3716,56 +3322,7 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
valueXmlString.append("<cust_type__descr>").append("<![CDATA["+custTypeDescr+"]]>").append("</cust_type__descr>");
valueXmlString.append("</Detail4>");
}
else if (currentColumn.trim().equalsIgnoreCase("cust_type"))
{
contractNo = checkNullAndTrim(genericUtility.getColumnValue("contract_no", dom1));
lineNo = checkNullAndTrim(genericUtility.getColumnValue("line_no", dom));
custCode = checkNullAndTrim(genericUtility.getColumnValue("cust_code", dom));
custName = checkNullAndTrim(genericUtility.getColumnValue("cust_name", dom));
city = checkNullAndTrim(genericUtility.getColumnValue("city", dom));
drgLicNo = checkNullAndTrim(genericUtility.getColumnValue("drug_lic_no", dom));
custType = checkNullAndTrim(genericUtility.getColumnValue("cust_type", dom));
custTypeDescr = checkNullAndTrim(genericUtility.getColumnValue("cust_type__descr", dom));
lineNo = " " + lineNo;
lineNo = lineNo.substring( lineNo.length()-3 );
sql = " SELECT DESCR FROM GENCODES WHERE FLD_NAME='CUST_TYPE' AND MOD_NAME = 'W_SCONTRACT_GWT_WIZ' AND FLD_VALUE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custType);
rs = pstmt.executeQuery();
if(rs.next())
{
custTypeDescr = rs.getString(1)==null?"":rs.getString(1);
}
else
{
custTypeDescr = "";
}
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
valueXmlString.append("<Detail4 domID='" + lineNo.trim() + "' objContext=\"4\" selected=\"Y\">\r\n");
valueXmlString.append("<attribute selected=\"Y\" updateFlag=\""+updateFlag+"\" status=\""+status+"\" pkNames=\"\" />\r\n");
valueXmlString.append("<contract_no>").append("<![CDATA[" +contractNo+"]]>").append("</contract_no>");
valueXmlString.append("<line_no>").append("<![CDATA["+lineNo+"]]>").append("</line_no>");
valueXmlString.append("<cust_code >").append("<![CDATA["+custCode+"]]>").append("</cust_code>");
valueXmlString.append("<cust_name >").append("<![CDATA["+custName+"]]>").append("</cust_name>");
valueXmlString.append("<city>").append("<![CDATA["+city+"]]>").append("</city>");
valueXmlString.append("<drug_lic_no >").append("<![CDATA["+drgLicNo+"]]>").append("</drug_lic_no>");
valueXmlString.append("<cust_type >").append("<![CDATA["+custType+"]]>").append("</cust_type>");
valueXmlString.append("<cust_type__descr>").append("<![CDATA["+custTypeDescr+"]]>").append("</cust_type__descr>");
valueXmlString.append("</Detail4>");
}
else if(currentColumn.trim().equalsIgnoreCase("cust_code"))
//else if(currentColumn.trim().equalsIgnoreCase("sc_code"))
{
contractNo = checkNullAndTrim(genericUtility.getColumnValue("contract_no", dom1));
lineNo = checkNullAndTrim(genericUtility.getColumnValue("line_no", dom));
......
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