Commit 48cf22d2 authored by wansari's avatar wansari

D16JSUN0002 updated source after UTR review and changes


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@104624 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 3fbdff17
...@@ -22,6 +22,7 @@ import java.sql.Timestamp; ...@@ -22,6 +22,7 @@ import java.sql.Timestamp;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap;
import javax.ejb.Stateless; import javax.ejb.Stateless;
...@@ -2303,6 +2304,7 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal, ...@@ -2303,6 +2304,7 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
int count = 0; int count = 0;
int domID = 0; int domID = 0;
String lineNo = "",rateOptDescr = "",rateOpt = ""; String lineNo = "",rateOptDescr = "",rateOpt = "";
String discount = "0";
mode = checkEditMode(dom, "3"); mode = checkEditMode(dom, "3");
if("E".equalsIgnoreCase(mode)) if("E".equalsIgnoreCase(mode))
...@@ -2339,9 +2341,9 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal, ...@@ -2339,9 +2341,9 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
if(contractNo.length() > 0) if(contractNo.length() > 0)
{ {
//sql = " SELECT * FROM SCONTRACTDET S, ITEM I WHERE S.CONTRACT_NO = ? AND I.ITEM_CODE = S.ITEM_CODE "; //sql = " SELECT * FROM SCONTRACTDET S, ITEM I WHERE S.CONTRACT_NO = ? AND I.ITEM_CODE = S.ITEM_CODE ";
sql = " SELECT S.LINE_NO,S.RATE_OPT,S.ITEM_CODE,I.DESCR,S.SITE_CODE,S.VALID_UPTO,S.EFF_FROM,S.UNIT,S.ITEM_FLG," sql = " SELECT S.LINE_NO,S.RATE_OPT,S.ITEM_CODE,I.DESCR,S.SITE_CODE,S.VALID_UPTO,S.EFF_FROM,S.UNIT,S.UNIT__STD,S.ITEM_FLG,"
+ " S.TAX_CHAP,S.TAX_ENV,S.TAX_CLASS,S.RATE,S.RATE__CLG,S.UNIT__RATE,S.RATE__STDUOM,S.CONV__RTUOM_STDUOM," + " S.TAX_CHAP,S.TAX_ENV,S.TAX_CLASS,S.RATE,S.RATE__CLG,S.UNIT__RATE,S.RATE__STDUOM,S.CONV__RTUOM_STDUOM,"
+ " S.PRICE_LIST " + " S.PRICE_LIST,S.DISCOUNT,I.ITEM_SER "
+ " FROM SCONTRACTDET S, ITEM I WHERE S.CONTRACT_NO = ? AND I.ITEM_CODE = S.ITEM_CODE "; + " FROM SCONTRACTDET S, ITEM I WHERE S.CONTRACT_NO = ? AND I.ITEM_CODE = S.ITEM_CODE ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, contractNo); pstmt.setString(1, contractNo);
...@@ -2372,6 +2374,13 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal, ...@@ -2372,6 +2374,13 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
pstmtDescr.close();pstmtDescr = null; pstmtDescr.close();pstmtDescr = null;
} }
itemSer = checkNullAndTrim(rs.getString("ITEM_SER"));
HashMap hm = new HashMap();
hm = getDiscountPer(dom2,"2",itemSer);
discount = (String) hm.get("DISCOUNT");
priceList = (String) hm.get("PRICE_LIST");
valueXmlString.append("<Detail3 domID='"+lineNo.trim()+"' objContext='3' selected=\"Y\">\r\n"); valueXmlString.append("<Detail3 domID='"+lineNo.trim()+"' objContext='3' selected=\"Y\">\r\n");
valueXmlString.append("<attribute selected=\"Y\" updateFlag=\"E\" status=\"O\" pkNames=\"\" />\r\n"); valueXmlString.append("<attribute selected=\"Y\" updateFlag=\"E\" status=\"O\" pkNames=\"\" />\r\n");
...@@ -2380,7 +2389,7 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal, ...@@ -2380,7 +2389,7 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
valueXmlString.append("<item_code>").append("<![CDATA["+rs.getString("ITEM_CODE")+"]]>").append("</item_code>"); valueXmlString.append("<item_code>").append("<![CDATA["+rs.getString("ITEM_CODE")+"]]>").append("</item_code>");
valueXmlString.append("<rate_opt>").append("<![CDATA["+checkNullAndTrim(rs.getString("RATE_OPT"))+"]]>").append("</rate_opt>"); valueXmlString.append("<rate_opt>").append("<![CDATA["+checkNullAndTrim(rs.getString("RATE_OPT"))+"]]>").append("</rate_opt>");
valueXmlString.append("<rate_opt__descr>").append("<![CDATA["+rateOptDescr+"]]>").append("</rate_opt__descr>"); valueXmlString.append("<rate_opt__descr>").append("<![CDATA["+rateOptDescr+"]]>").append("</rate_opt__descr>");
valueXmlString.append("<price_list>").append("<![CDATA["+checkNullAndTrim(rs.getString("PRICE_LIST"))+"]]>").append("</price_list>"); valueXmlString.append("<price_list>").append("<![CDATA["+priceList+"]]>").append("</price_list>");
valueXmlString.append("<item_descr>").append("<![CDATA["+rs.getString("DESCR")+"]]>").append("</item_descr>"); valueXmlString.append("<item_descr>").append("<![CDATA["+rs.getString("DESCR")+"]]>").append("</item_descr>");
valueXmlString.append("<eff_from>").append("<![CDATA["+ genericUtility.getValidDateString(rs.getString("EFF_FROM"), genericUtility.getDBDateTimeFormat(), genericUtility.getApplDateFormat()) +"]]>").append("</eff_from>"); valueXmlString.append("<eff_from>").append("<![CDATA["+ genericUtility.getValidDateString(rs.getString("EFF_FROM"), genericUtility.getDBDateTimeFormat(), genericUtility.getApplDateFormat()) +"]]>").append("</eff_from>");
valueXmlString.append("<valid_upto>").append("<![CDATA["+ genericUtility.getValidDateString(rs.getString("VALID_UPTO"), genericUtility.getDBDateTimeFormat(), genericUtility.getApplDateFormat()) +"]]>").append("</valid_upto>"); valueXmlString.append("<valid_upto>").append("<![CDATA["+ genericUtility.getValidDateString(rs.getString("VALID_UPTO"), genericUtility.getDBDateTimeFormat(), genericUtility.getApplDateFormat()) +"]]>").append("</valid_upto>");
...@@ -2389,6 +2398,7 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal, ...@@ -2389,6 +2398,7 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
valueXmlString.append("<status_date>").append("<![CDATA["+ldDate+"]]>").append("</status_date>"); valueXmlString.append("<status_date>").append("<![CDATA["+ldDate+"]]>").append("</status_date>");
valueXmlString.append("<dsp_date>").append("<![CDATA[]]>").append("</dsp_date>"); valueXmlString.append("<dsp_date>").append("<![CDATA[]]>").append("</dsp_date>");
valueXmlString.append("<unit>").append("<![CDATA["+checkNullAndTrim(rs.getString("UNIT"))+"]]>").append("</unit>"); valueXmlString.append("<unit>").append("<![CDATA["+checkNullAndTrim(rs.getString("UNIT"))+"]]>").append("</unit>");
valueXmlString.append("<unit__std>").append("<![CDATA["+checkNullAndTrim(rs.getString("UNIT__STD"))+"]]>").append("</unit__std>");
valueXmlString.append("<item_flg>").append("<![CDATA["+checkNullAndTrim(rs.getString("ITEM_FLG"))+"]]>").append("</item_flg>"); valueXmlString.append("<item_flg>").append("<![CDATA["+checkNullAndTrim(rs.getString("ITEM_FLG"))+"]]>").append("</item_flg>");
valueXmlString.append("<tax_chap>").append("<![CDATA["+checkNullAndTrim(rs.getString("TAX_CHAP"))+"]]>").append("</tax_chap>"); valueXmlString.append("<tax_chap>").append("<![CDATA["+checkNullAndTrim(rs.getString("TAX_CHAP"))+"]]>").append("</tax_chap>");
valueXmlString.append("<tax_class>").append("<![CDATA["+checkNullAndTrim(rs.getString("TAX_CLASS"))+"]]>").append("</tax_class>"); valueXmlString.append("<tax_class>").append("<![CDATA["+checkNullAndTrim(rs.getString("TAX_CLASS"))+"]]>").append("</tax_class>");
...@@ -2403,6 +2413,8 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal, ...@@ -2403,6 +2413,8 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
valueXmlString.append("<chg_user>").append("<![CDATA["+userId+"]]>").append("</chg_user>"); valueXmlString.append("<chg_user>").append("<![CDATA["+userId+"]]>").append("</chg_user>");
valueXmlString.append("<chg_term>").append("<![CDATA["+chgTerm+"]]>").append("</chg_term>"); valueXmlString.append("<chg_term>").append("<![CDATA["+chgTerm+"]]>").append("</chg_term>");
valueXmlString.append("<discount>").append("<![CDATA["+discount+"]]>").append("</discount>");
valueXmlString.append("</Detail3>"); valueXmlString.append("</Detail3>");
count++; count++;
...@@ -2417,43 +2429,6 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal, ...@@ -2417,43 +2429,6 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
} }
} }
} }
/*if(count == 0)
{
//valueXmlString.append("<Detail3 domID = '"+1+"' objContext='3' selected = 'N'>\r\n");
//valueXmlString.append("<attribute selected=\"N\" updateFlag=\"A\" status=\"N\" pkNames=\"\" />\r\n");
valueXmlString.append("<Detail3 domID='" + 1 + "' objContext=\"3\" 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("<item_code>").append("<![CDATA[]]>").append("</item_code>");
valueXmlString.append("<item_descr>").append("<![CDATA[]]>").append("</item_descr>");
valueXmlString.append("<line_no>").append("<![CDATA[ 1]]>").append("</line_no>");
valueXmlString.append("<quantity>").append("<![CDATA[0]]>").append("</quantity>");
valueXmlString.append("<site_code>").append("<![CDATA["+siteCodeShip+"]]>").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[]]>").append("</unit>");
valueXmlString.append("<item_flg >").append("<![CDATA[]]>").append("</item_flg>");
valueXmlString.append("<tax_chap >").append("<![CDATA[]]>").append("</tax_chap>");
valueXmlString.append("<tax_class >").append("<![CDATA[]]>").append("</tax_class>");
valueXmlString.append("<tax_env >").append("<![CDATA[]]>").append("</tax_env>");
valueXmlString.append("<rate>").append("<![CDATA[]]>").append("</rate>");
valueXmlString.append("<rate__clg >").append("<![CDATA[]]>").append("</rate__clg>");
valueXmlString.append("<rate__nesp >").append("<![CDATA[]]>").append("</rate__nesp>");
valueXmlString.append("<unit__rate >").append("<![CDATA[]]>").append("</unit__rate>");
valueXmlString.append("<rate__stduom >").append("<![CDATA[]]>").append("</rate__stduom>");
valueXmlString.append("<conv__rtuom_stduom >").append("<![CDATA[]]>").append("</conv__rtuom_stduom>");
valueXmlString.append("<price_list>").append("<![CDATA[]]>").append("</price_list>");
valueXmlString.append("<rate_opt>").append("<![CDATA[]]>").append("</rate_opt>");
valueXmlString.append("<rate_opt__descr>").append("<![CDATA[]]>").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("</Detail3>");
}*/
} }
else if(currentColumn.trim().equalsIgnoreCase("itm_default_add")) else if(currentColumn.trim().equalsIgnoreCase("itm_default_add"))
{ {
...@@ -2465,8 +2440,10 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal, ...@@ -2465,8 +2440,10 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
System.out.println("itm_default_add Case 3-->valid_upto["+validUpTostr+"] and eff_from["+effFromStr+"]"); System.out.println("itm_default_add Case 3-->valid_upto["+validUpTostr+"] and eff_from["+effFromStr+"]");
domID = getMaxLineNoFromDOM(dom,"3"); domID = getMaxLineNoFromDOM(dom,"3");
lineNo = " " + domID; lineNo = " " + domID;
lineNo = lineNo.substring( lineNo.length()-3 ); lineNo = lineNo.substring( lineNo.length()-3 );
//lineNo = ""+domID;
//valueXmlString.append("<Detail3 domID = '"+domID+"' objContext='3' selected = 'N'>\r\n"); //valueXmlString.append("<Detail3 domID = '"+domID+"' objContext='3' selected = 'N'>\r\n");
//valueXmlString.append("<attribute selected=\"N\" updateFlag=\"A\" status=\"N\" pkNames=\"\" />\r\n"); //valueXmlString.append("<attribute selected=\"N\" updateFlag=\"A\" status=\"N\" pkNames=\"\" />\r\n");
...@@ -2501,99 +2478,7 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal, ...@@ -2501,99 +2478,7 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
valueXmlString.append("<chg_user >").append("<![CDATA["+userId+"]]>").append("</chg_user>"); valueXmlString.append("<chg_user >").append("<![CDATA["+userId+"]]>").append("</chg_user>");
valueXmlString.append("<chg_term >").append("<![CDATA["+chgTerm+"]]>").append("</chg_term>"); valueXmlString.append("<chg_term >").append("<![CDATA["+chgTerm+"]]>").append("</chg_term>");
valueXmlString.append("</Detail3>"); valueXmlString.append("<discount>").append("<![CDATA["+discount+"]]>").append("</discount>");
}
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("</Detail3>"); valueXmlString.append("</Detail3>");
} }
else if(currentColumn.trim().equalsIgnoreCase("item_code")) else if(currentColumn.trim().equalsIgnoreCase("item_code"))
...@@ -2621,7 +2506,7 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal, ...@@ -2621,7 +2506,7 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
valueXmlString.append("<contract_no>").append("<![CDATA["+contractNo+"]]>").append("</contract_no>"); valueXmlString.append("<contract_no>").append("<![CDATA["+contractNo+"]]>").append("</contract_no>");
valueXmlString.append("<site_code>").append("<![CDATA["+siteCode+"]]>").append("</site_code>"); valueXmlString.append("<site_code>").append("<![CDATA["+siteCode+"]]>").append("</site_code>");
valueXmlString.append("<line_no>").append("<![CDATA["+lineNo+"]]>").append("</line_no>"); valueXmlString.append("<line_no>").append("<![CDATA["+lineNo+"]]>").append("</line_no>");
valueXmlString.append("<price_list>").append("<![CDATA["+priceList+"]]>").append("</price_list>"); //valueXmlString.append("<price_list>").append("<![CDATA["+priceList+"]]>").append("</price_list>");
valueXmlString.append("<rate_opt>").append("<![CDATA["+rateOpt+"]]>").append("</rate_opt>"); valueXmlString.append("<rate_opt>").append("<![CDATA["+rateOpt+"]]>").append("</rate_opt>");
valueXmlString.append("<rate_opt__descr>").append("<![CDATA["+rateOptDescr+"]]>").append("</rate_opt__descr>"); valueXmlString.append("<rate_opt__descr>").append("<![CDATA["+rateOptDescr+"]]>").append("</rate_opt__descr>");
valueXmlString.append("<valid_upto >").append("<![CDATA[" + genericUtility.getValidDateString(validUpTostr , genericUtility.getApplDateFormat()) + "]]>").append("</valid_upto>"); valueXmlString.append("<valid_upto >").append("<![CDATA[" + genericUtility.getValidDateString(validUpTostr , genericUtility.getApplDateFormat()) + "]]>").append("</valid_upto>");
...@@ -3473,73 +3358,125 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal, ...@@ -3473,73 +3358,125 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
valueXmlString.append("<chg_user >").append("<![CDATA["+userId+"]]>").append("</chg_user>"); valueXmlString.append("<chg_user >").append("<![CDATA["+userId+"]]>").append("</chg_user>");
valueXmlString.append("<chg_term >").append("<![CDATA["+chgTerm+"]]>").append("</chg_term>"); valueXmlString.append("<chg_term >").append("<![CDATA["+chgTerm+"]]>").append("</chg_term>");
//Changed by wasim to set discount% [START]
HashMap hm = new HashMap();
hm = getDiscountPer(dom2,"2",itemSer);
discount = (String) hm.get("DISCOUNT");
priceList = (String) hm.get("PRICE_LIST");
valueXmlString.append("<discount>").append("<![CDATA["+discount+"]]>").append("</discount>");
valueXmlString.append("<price_list>").append("<![CDATA["+priceList+"]]>").append("</price_list>");
//Changed by wasim to set discount% [END]
valueXmlString.append("</Detail3>"); valueXmlString.append("</Detail3>");
} }
else if(currentColumn.trim().equalsIgnoreCase("rate")) else if (currentColumn.trim().equalsIgnoreCase("itm_defaultedit"))
{
valueXmlString.append("<Detail3 domID='1' objContext='3'>");
try
{
num = Integer.parseInt(genericUtility.getColumnValue("rate", dom));
}
catch(Exception e1)
{ {
System.out.println("Error at 1449 linr"+e1); contractNo = checkNullAndTrim(genericUtility.getColumnValue("contract_no", dom1));
} effFromStr = genericUtility.getColumnValue("eff_from", dom1);
unitRate = genericUtility.getColumnValue("unit__rate", dom); validUpTostr = genericUtility.getColumnValue("valid_upto", dom1);
unitStd = genericUtility.getColumnValue("unit__std", dom); 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); itemCode = genericUtility.getColumnValue("item_code", dom);
itemDescr = genericUtility.getColumnValue("item_descr", dom);
lineNo = checkNullAndTrim(genericUtility.getColumnValue("line_no", dom));
unit = genericUtility.getColumnValue("unit", dom);
unitStd = genericUtility.getColumnValue("unit__std", 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);
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);
discount = genericUtility.getColumnValue("discount", dom);
try try
{ {
num1 = Integer.parseInt(genericUtility.getColumnValue("conv__rtuom_stduom", dom)); rate = Double.parseDouble(genericUtility.getColumnValue("rate", dom));
} rateClg = Double.parseDouble(genericUtility.getColumnValue("rate__clg", dom));
catch(Exception e1)
{
System.out.println("Error at 1460 linr"+e1);
}
num3 = num1;
if(unitRate == null || unitRate.trim().length() == 0)
{
sql = "Select unit from item where item_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode);
rs = pstmt.executeQuery();
if(rs.next())
{
unitRate = rs.getString(1)==null?"":rs.getString(1);
}
if(rs!=null)
{
rs.close();rs = null;
} }
if(pstmt!=null) catch(Exception e)
{ {
pstmt.close();pstmt = null; System.out.println("Excpetion for rate and rate__clg="+e.getMessage());
} }
num = getConvQuantityFact(unitStd,unitRate,itemCode,num,num1,conn); lineNo = " " + lineNo;
valueXmlString.append("<unit__rate >").append("<![CDATA[" + unitRate + "]]>").append("</unit__rate>"); 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("<price_list>").append("<![CDATA["+priceList+"]]>").append("</price_list>");
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("<unit__std>").append("<![CDATA["+unitStd+"]]>").append("</unit__std>");
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("<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>");
} }
else /*else if (currentColumn.trim().equalsIgnoreCase("rate_opt"))
{ {
num = getConvQuantityFact(unitStd,unitRate,itemCode,num,num1,conn); contractNo = checkNullAndTrim(genericUtility.getColumnValue("contract_no", dom1));
} effFromStr = genericUtility.getColumnValue("eff_from", dom1);
if(num3 == 0) 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
{ {
valueXmlString.append("<conv__rtuom_stduom >").append("<![CDATA[" + num1 + "]]>").append("</conv__rtuom_stduom>"); rate = Double.parseDouble(genericUtility.getColumnValue("rate", dom));
rateClg = Double.parseDouble(genericUtility.getColumnValue("rate__clg", dom));
} }
valueXmlString.append("<rate__stduom >").append("<![CDATA[" + num2 + "]]>").append("</rate__stduom>"); catch(Exception e)
priceListClg = genericUtility.getColumnValue("PRICE_LIST__CLG", dom1);
if(priceListClg == null || priceListClg.trim().length() == 0)
{ {
valueXmlString.append("<rate__clg >").append("<![CDATA[" + num + "]]>").append("</rate__clg>"); System.out.println("Excpetion for rate and rate__clg="+e.getMessage());
}
valueXmlString.append("</Detail3>");
} }
/*else if (currentColumn.trim().equalsIgnoreCase("itm_defaultedit")) unitRate = genericUtility.getColumnValue("unit__rate", dom);
{ rateNesp = genericUtility.getColumnValue("rate__nesp", dom);
rateOpt = checkNullAndTrim(genericUtility.getColumnValue("rate_opt", 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 = ? "; 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 = conn.prepareStatement(sql);
...@@ -3549,6 +3486,10 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal, ...@@ -3549,6 +3486,10 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
{ {
rateOptDescr = rs.getString(1)==null?"":rs.getString(1); rateOptDescr = rs.getString(1)==null?"":rs.getString(1);
} }
else
{
rateOptDescr = "";
}
if(rs!=null) if(rs!=null)
{ {
rs.close();rs = null; rs.close();rs = null;
...@@ -3558,13 +3499,43 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal, ...@@ -3558,13 +3499,43 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
pstmt.close();pstmt = null; pstmt.close();pstmt = null;
} }
valueXmlString.append("<Detail3 domID='1' objContext='3'>"); 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>").append("<![CDATA["+rateOpt+"]]>").append("</rate_opt>");
valueXmlString.append("<rate_opt__descr>").append("<![CDATA["+rateOptDescr+"]]>").append("</rate_opt__descr>"); 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>"); valueXmlString.append("</Detail3>");
}*/ }*/
//valueXmlString.append("</Detail3>");
} }
break; break;
case 4: case 4:
...@@ -4916,4 +4887,93 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal, ...@@ -4916,4 +4887,93 @@ public class ScontractGwtIC extends ValidatorEJB implements ScontractGwtICLocal,
return selected; return selected;
} }
public HashMap getDiscountPer(Document dom,String objContext,String itemSer)throws Exception
{
HashMap hm = new HashMap();
String mode = "";
NodeList parentNodeList = null;
NodeList childNodeList = null;
Node parentNode = null;
Node childNode = null;
String childNodeName = null;
int childNodeListLength,parentNodeListLength;
int ctr = 0;
String division = "",priceList = "",discount = "0";
String [] divList = null;
try
{
System.out.println("Inside getDiscountPer objContext["+objContext+"] ItemSer["+itemSer+"]");
hm.put("PRICE_LIST", "");
hm.put("DISCOUNT", "0");
parentNodeList = dom.getElementsByTagName("Detail"+objContext+"");
parentNodeListLength = parentNodeList.getLength();
for (int selectedRow = 0; selectedRow < parentNodeListLength; selectedRow++)
{
division = "";discount = "";priceList = "";
divList = null;
parentNode = parentNodeList.item(selectedRow);
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
for (int childRow = 0; childRow < childNodeListLength; childRow++)
{
childNode = childNodeList.item(childRow);
childNodeName = childNode.getNodeName();
if(childNode == null || childNode.getNodeType() != childNode.ELEMENT_NODE)
{
continue;
}
if(childNode != null && "division".equalsIgnoreCase(childNode.getNodeName()) && childNode.getFirstChild() != null)
{
division = checkNullAndTrim(childNode.getFirstChild().getNodeValue());
}
else if(childNode != null && "discount".equalsIgnoreCase(childNode.getNodeName()) && childNode.getFirstChild() != null)
{
discount = checkNullAndTrim(childNode.getFirstChild().getNodeValue());
}
else if(childNode != null && "price_list".equalsIgnoreCase(childNode.getNodeName()) && childNode.getFirstChild() != null)
{
priceList = checkNullAndTrim(childNode.getFirstChild().getNodeValue());
}
}
System.out.println("Division ["+division+"] Discount ["+discount+"] PriceList ["+priceList+"]");
if(division!= null && division.length() > 0)
{
divList = division.split(",");
for(String dvsn : divList)
{
System.out.println("Divsn["+dvsn+"]====["+itemSer+"]");
if(itemSer.trim().equalsIgnoreCase(dvsn.trim()))
{
System.out.println("Match Found-->Division ["+dvsn.trim()+"] Discount ["+discount+"] PriceList ["+priceList+"]");
hm.put("PRICE_LIST", priceList);
hm.put("DISCOUNT", discount);
return hm;
}
}
}
}
}
catch(Exception e)
{
System.out.println("Exception getDiscountPer="+e.getMessage());
e.printStackTrace();
}
System.out.println("Returning from getDiscountPer"+discount);
return hm;
}
} }
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