Commit 9e69a42b authored by pgole's avatar pgole

Updated porder ejb changes as per manohar sir suggestion


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@103603 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 5be93a90
/********************************************************
Title : POrderIC []
Date : 27 - APR - 2016
Author: Poonam Gole
********************************************************/
......@@ -156,7 +155,7 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
"<?xml version=\"1.0\"?>\r\n<Root><Errors>");
try {
System.out.println("wfValData called");
//onn = connDriver.getConnectDB("DriverITM");
//conn = connDriver.getConnectDB("DriverITM");
conn = getConnection();
DistCommon distComm = new DistCommon();
FinCommon finCommon = new FinCommon();
......@@ -2391,6 +2390,8 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
"ind_no", dom));
quotNo = checkNull(genericUtility.getColumnValue(
"quot_no", dom));
qty = qty == "" ? "0" : qty ;
if (qty == null || Double.parseDouble(qty) <= 0) {
errcode = "VTQTY";
......@@ -2450,16 +2451,16 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
unitRate = checkNull(genericUtility
.getColumnValue("unit__rate", dom));
if (rateStr == null) {
if (rateStr == null || rateStr.trim().length() == 0) {
rateStr = "0";
}
if (ratestdStr == null) {
if (ratestdStr == null || ratestdStr.trim().length() == 0) {
ratestdStr = "0";
}
if (qtyStr == null) {
if (qtyStr == null || qtyStr.trim().length() == 0) {
qtyStr = "0";
}
if (qtystdStr == null) {
if (qtystdStr == null || qtystdStr.trim().length() == 0) {
qtystdStr = "0";
}
varValue = distComm.getDisparams("999999",
......@@ -2486,7 +2487,7 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
}
if (unitRate.trim().equalsIgnoreCase(unit.trim())) {
if (Math.abs(Double.parseDouble(qtyStr)
if (Math.abs(Double.parseDouble(qtyStr == "" ? "0" : qtyStr)
* Double.parseDouble(rateStr)
- Double.parseDouble(qtystdStr)
* Double.parseDouble(ratestdStr)) > Double
......@@ -2629,6 +2630,8 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
} else if (!unit.equalsIgnoreCase(unitStd)) {
convQtyStduom = checkNull(genericUtility
.getColumnValue("conv__qty_stduom", dom));
convQtyStduom = convQtyStduom == "" ? "0" : convQtyStduom ;
if (convQtyStduom == null
|| Double.parseDouble(convQtyStduom) == 0) {
......@@ -2749,6 +2752,8 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
rs = null;
pStmt.close();
pStmt = null;
rate = rate == "" ? "0" : rate ;
if (Double.parseDouble(rate) > estRate) {
errcode = "VTTASK5";
......@@ -2757,7 +2762,8 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
}
}
}
if (rate == null && Double.parseDouble(rate) > 0) {
rate = rate == "" ? "0" : rate ;
if (rate != null && Double.parseDouble(rate) > 0) {
indNo = checkNull(genericUtility.getColumnValue(
"ind_no", dom));
......@@ -2799,10 +2805,9 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
lbflag = true;
}
}
discount = discount == "" ? "0" :discount ;
if (lbflag = false) {
if (discount != null
&& Double.parseDouble(discount) > 0) {
if (discount != null && Double.parseDouble(discount) > 0) {
} else {
}
......@@ -3210,37 +3215,15 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
}
/*
* for ll_count = 1 to
* dw_detbrow[ii_currformno].RowCount() //if
* dw_detbrow
* [ii_currformno].GetItemNumber(ll_count
* ,"line_no_dist_order") = ll_line_no_dord and
* & // dw_detbrow[ii_currformno].GetItemNumber
* (ll_count,"line_no") <> ll_line_no then
* //Commented by jasmina 25/09/08- DI89MAN022
*
* if
* trim(dw_detbrow[ii_currformno].GetItemString
* (ll_count,"line_no")) <> trim(ls_lineno) and
* &
* trim(dw_detbrow[ii_currformno].GetItemString
* (ll_count,"acct_code__cr")) <>
* trim(ls_acct_code__cr) then errcode =
* 'VTACCTCODE'+'~t In a Single PO two account
* code credit is not allowed'
*
* end if
*/
}
//}
}
if (childNodeName.equalsIgnoreCase("cctr_code__dr")) {
cctrCodeDr = checkNull(genericUtility.getColumnValue(
"cctr_code__dr", dom));
acctCodeDr = checkNull(genericUtility.getColumnValue(
"acct_code__dr", dom));
if( cctrCodeDr == null || cctrCodeDr.length() == 0 )
if( cctrCodeDr == null || cctrCodeDr.trim().length() == 0 )
{
errList.add("VMCCTRDRNU");
errFields.add(childNodeName.toLowerCase());
......@@ -3262,7 +3245,9 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
acctCodeCr = checkNull(genericUtility.getColumnValue(
"acct_code__cr", dom));
if( cctrCodeCr == null || cctrCodeCr.length() == 0 )
System.out.println("cctrCodeCr["+cctrCodeCr+"]acctCodeCr["+acctCodeCr+"]");
if( cctrCodeCr == null || cctrCodeCr.trim().length() == 0 )
{
errList.add("VMCCTRCRNU");
errFields.add(childNodeName.toLowerCase());
......@@ -3449,11 +3434,13 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
}
}
}
if (childNodeName.equalsIgnoreCase("discount")) {
/*if (childNodeName.equalsIgnoreCase("discount")) {
discount = checkNull(genericUtility.getColumnValue(
"discount", dom));
if (discount == null) {
discount = discount== "" ? "0" :discount ;
if (discount == null || discount.trim().length() == 0) {
errcode = "VTDISC";
errList.add(errcode);
errFields.add(childNodeName.toLowerCase());
......@@ -3462,7 +3449,7 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
errList.add(errcode);
errFields.add(childNodeName.toLowerCase());
}
}
}*/
if (childNodeName.equalsIgnoreCase("op_reason")) {
opReason = checkNull(genericUtility.getColumnValue(
"op_reason", dom));
......@@ -4034,6 +4021,11 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
"item_code", dom));
qty = checkNull(genericUtility.getColumnValue(
"quantity", dom));
if(qty == null || qty.trim().length() == 0)
{
qty = "0" ;
}
sql = "select sum(case when b.quantity is null then 0 else b.quantity end) - sum(case when b.dlv_qty is null then 0 else b.dlv_qty end)"
+ " From porder a, porddet b Where a.purc_order = b.purc_order and a.purc_order <> :ls_purc_order and b.form_no = ? ";
......@@ -4073,7 +4065,7 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
genericUtility.getColumnValue(
"quantity", dom2)).trim();
if (qtyBrow == null) {
if (qtyBrow == null || qtyBrow.trim().length() == 0) {
qtyBrow = "0";
}
......@@ -4187,7 +4179,7 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
quantityFc = checkNull(genericUtility.getColumnValue(
"quantity__fc", dom));
if (quantityFc == null) {
if (quantityFc == null || quantityFc.trim().length() == 0) {
quantityFc = "0";
}
if ( "0".equalsIgnoreCase(quantityFc)) {
......@@ -4214,7 +4206,7 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
genericUtility.getColumnValue(
"quantity__fc", dom2)).trim();
if (quantityFcTemp == null) {
if (quantityFcTemp == null || quantityFcTemp.trim().length() == 0) {
quantityFcTemp = "0";
}
totFc1 = totFc
......@@ -4338,6 +4330,8 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
|| childNodeName.equalsIgnoreCase("amt_type")) {
relAmt = checkNull(genericUtility.getColumnValue(
"rel_amt", dom));
relAmt = relAmt == "" ? "0" : relAmt ;
if (relAmt == null || relAmt.trim().length() == 0
|| Double.parseDouble(relAmt) == 0) {
......@@ -4345,6 +4339,7 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
errList.add(errcode);
errFields.add(childNodeName.toLowerCase());
}
ordAmt = checkNull(genericUtility.getColumnValue(
"ord_amt", dom1));
......@@ -4354,13 +4349,13 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
"line_no", dom));
lcAmount = 0;
if (ordAmt != null && ordAmt.trim().length() == 0) {
if (ordAmt == null || ordAmt.trim().length() == 0) {
ordAmt = "0";
}
if (totAmt != null && totAmt.trim().length() == 0) {
if (totAmt == null || totAmt.trim().length() == 0) {
totAmt = "0";
}
if (relAmt != null && relAmt.trim().length() == 0) {
if (relAmt == null || relAmt.trim().length() == 0) {
relAmt = "0";
}
/*
......@@ -4400,6 +4395,8 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
System.out.println("@@@@@@@3942 lcAmount[" + lcAmount
+ "] > totAmt[" + totAmt + "]");
if (lcAmount > Double.parseDouble(totAmt)) {
errcode = "POADVMIS";
errList.add(errcode);
......@@ -4891,7 +4888,7 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
"min_amt", dom);
String maxAmt = genericUtility.getColumnValue(
"max_amt", dom);
if (minAmt != null && Integer.parseInt(minAmt) < 0) {
errcode = "VMMINAMT1";
if (errcode != null && errcode.trim().length() > 0) {
......@@ -4899,7 +4896,7 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
errFields.add(childNodeName.toLowerCase());
}
}
if (Integer.parseInt(maxAmt) < Integer.parseInt(minAmt)) {
if (minAmt != null && maxAmt != null && Integer.parseInt(maxAmt) < Integer.parseInt(minAmt)) {
errcode = "VMMINAMT";
if (errcode != null && errcode.trim().length() > 0) {
errList.add(errcode);
......@@ -4911,7 +4908,7 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
}
}
break;
break;
}
int errListSize = errList.size();
......@@ -5224,7 +5221,7 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
String exchRate = "",exchRateSp="";
String taxEnv = "";
String sysDate = "";
String mcode = "";
String mcode = "",qtyStr = "",trandt = "";
String sdescr = "";
String sadd1 = "";
String sadd2 = "";
......@@ -5378,13 +5375,13 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
String ratestd = "";
String qtystd = "";
String Value = "";
String taskCodeDescr = "";
String taskCodeDescr = "",convRtuomStduom = "";
double exchRate1 = 0, advPercInt = 0, advance = 0, totAmt = 0, ordAmt = 0, frtRatedouble = 0;
double exchRate1 = 0, advPercInt = 0, advance = 0, totAmt = 0, ordAmt = 0, frtRatedouble = 0 ,exchRatelc =0;
double convQtystdDob = 0, pendqtyDouble = 0, mrateDou = 0, budgetAmt = 0, convTemp = 0;
double budgetAmtanal1 = 0, consumedAmtanal1 = 0, qtyTot = 0, stdCost = 0, stdCode = 0, varie = 0;
double amt = 0, amtStd = 0, qtystdlc = 0, lcConvlc = 0, ratestdlc = 0, Ratelc = 0;
double rateLc = 0.0, qtyLc = 0.0 ,qtystdLc =0.0 ,ratestdLc = 0.0 ,ValueLc =0.0 ,convQtystduomLc = 0.0 ,stdRateLc = 0.0 , mrateLc = 0.0 ;
ArrayList pendqtyArr = new ArrayList();
ArrayList ratestduomArr = new ArrayList();
ArrayList qtystduomArr = new ArrayList();
......@@ -5466,8 +5463,8 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
currentFormNo = Integer.parseInt(objContext);
}
loginSite = getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
// chguser = getValueFromXTRA_PARAMS(xtraParams, "loginCode");
chguser = getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode");
chguser = getValueFromXTRA_PARAMS(xtraParams, "loginCode");
empCode = getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode");
// chgtermhdr = getValueFromXTRA_PARAMS(xtraParams, "chgTerm");
sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
......@@ -5475,8 +5472,7 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
date = (sdf.format(timestamp).toString()).trim();
System.out.println("loginSite[" + loginSite + "][chguserhdr "
+ chguser + "][ld_date" + date + "]");
valueXmlString = new StringBuffer(
"<?xml version=\"1.0\"?><Root><header><editFlag>");
valueXmlString = new StringBuffer("<?xml version=\"1.0\"?><Root><header><editFlag>");
valueXmlString.append(editFlag).append("</editFlag></header>");
System.out.println("Current Form No [" + currentFormNo + "]");
......@@ -5546,7 +5542,7 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
pStmt.close();
pStmt = null;
sql = "select Site_code__dlv,Site_code__ord, Status, Curr_code__purc, Tax_opt, Single_Ser from PurcCtrl";
/*sql = "select Site_code__dlv,Site_code__ord, Status, Curr_code__purc, Tax_opt, Single_Ser from PurcCtrl";
pStmt = conn.prepareStatement(sql);
rs = pStmt.executeQuery();
if (rs.next()) {
......@@ -5556,20 +5552,21 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
rs.close();
rs = null;
pStmt.close();
pStmt = null;
pStmt = null;*/
sql = "select std_exrt from Currency where Curr_code = ?";
/*sql = "select std_exrt from Currency where Curr_code = ?";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, mCurrency);
rs = pStmt.executeQuery();
if (rs.next()) {
exchRate = checkNull(rs.getString("std_exrt"));
if (rs.next()) {*/
//exchRate = checkNull(rs.getString("std_exrt"));
//exchRate = fincommon.getDailyExchRateSellBuy(currcode, lscurrcodebase, sitecode, trandt, "B", conn);
}
/*}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
pStmt = null;*/
sql = "select count(1) as cnt from gencodes where fld_name = 'PORD_TYPE' "
+ "and ltrim(rtrim(fld_value)) = 'R'";
......@@ -5656,14 +5653,14 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
.append("<![CDATA[" + date + "]]>")
.append("</ref_date>");
valueXmlString.append("<emp_code>")
.append("<![CDATA[" + chguser + "]]>")
.append("<![CDATA[" + empCode + "]]>")
.append("</emp_code>");
valueXmlString.append("<adv_perc protect = '1'>")
.append("").append("</adv_perc>");
valueXmlString.append("<ind_no protect = '0'>").append("")
.append("</ind_no>");
valueXmlString.append("<site_code__dlv protect = '0'>")
.append("").append("</site_code__dlv>");
.append("<![CDATA[" + loginSite + "]]>").append("</site_code__dlv>");
valueXmlString.append("<proj_code protect = '0'>")
.append("").append("</proj_code>");
valueXmlString.append("<adv_perc>").append("0.000")
......@@ -5922,8 +5919,7 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
pStmt.setString(1, pordType);
rs = pStmt.executeQuery();
if (rs.next()) {
locGroupJwiss = checkNull(rs
.getString("loc_group__jwiss"));
locGroupJwiss = checkNull(rs.getString("loc_group__jwiss"));
valueXmlString.append("<loc_group__jwiss>")
.append("<![CDATA[" + locGroupJwiss + "]]>")
.append("</loc_group__jwiss>");
......@@ -5936,6 +5932,13 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
if (currentColumn.trim().equals("ind_no")) {
mcode = checkNull(genericUtility.getColumnValue("ind_no",
dom));
contractNo = checkNull(genericUtility.getColumnValue(
"contract_no", dom));
quotNo = checkNull(genericUtility.getColumnValue(
"quot_no", dom));
projCode = checkNull(genericUtility.getColumnValue(
"proj_code", dom));
if ((mcode != null && mcode.trim().length() > 0)) {
sql = "select count(*) as cnt from boqhdr where indent_no = ?";
......@@ -5969,11 +5972,11 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
}
valueXmlString.append("<contract_no protect = '1'>")
.append("").append("</contract_no>");
.append("<![CDATA[" + contractNo + "]]>").append("</contract_no>");
valueXmlString.append("<quot_no protect = '1'>")
.append("").append("</quot_no>");
.append("<![CDATA[" + quotNo + "]]>").append("</quot_no>");
valueXmlString.append("<proj_code protect = '1'>")
.append("").append("</proj_code>");
.append("<![CDATA[" + projCode + "]]>").append("</proj_code>");
sql = "select b.item_ser item_ser,a.site_code__dlv site_code__dlv, a.supp_code__pref supp_code__pref, "
+ "a.emp_code__pur emp_code__pur, a.SITE_CODE__BIL SITE_CODE__BIL, proj_code proj_code, a.anal_code anal_code"
......@@ -6036,12 +6039,12 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
}
// dw_edit.setcolumn("ref_date")
} else {
valueXmlString.append("<proj_code>").append("")
.append("</proj_code>");
valueXmlString.append("<contract_no protect = '0'>")
.append("").append("</contract_no>");
valueXmlString.append("<quot_no protect = '0'>")
.append("").append("</quot_no>");
.append("<![CDATA[" + contractNo + "]]>").append("</contract_no>");
valueXmlString.append("<quot_no protect = '0'>")
.append("<![CDATA[" + quotNo + "]]>").append("</quot_no>");
valueXmlString.append("<proj_code >")
.append("<![CDATA[" + projCode + "]]>").append("</proj_code>");
// valueXmlString.append("<proj_code protect = '0'>").append("").append("</proj_code>");
}
......@@ -6199,6 +6202,7 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
"supp_code", dom));
siteCodeDlv = checkNull(genericUtility.getColumnValue(
"site_code__dlv", dom));
trandt = genericUtility.getColumnValue("ord_date", dom);
sql = "select cr_term, curr_code from site_supplier "
+ " where supp_code = ? and site_code = ? ";
......@@ -6272,6 +6276,9 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
rs = null;
pStmt.close();
pStmt = null;
exchRatelc = finCommon.getDailyExchRateSellBuy(currCode, "", siteCodeDlv, trandt, "B", conn);
valueXmlString
.append("<curr_code__frt>")
......@@ -6333,6 +6340,9 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
.append("<tran_code>")
.append("<![CDATA[" + getAbsString(tranCode)
+ "]]>").append("</tran_code>");
valueXmlString.append("<exch_rate>")
.append("<![CDATA[" + exchRatelc + "]]>")
.append("</exch_rate>");
setNodeValue(dom, "tran_code", getAbsString(tranCode));
reStr = itemChanged(dom, dom1, dom2, objContext,
......@@ -6511,6 +6521,8 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
if (currentColumn.trim().equals("site_code__dlv")) {
mcode = genericUtility
.getColumnValue("site_code__dlv", dom);
System.out.println("site_code__dlv mcode"+mcode);
sql = "select descr, add1, add2, city, stan_code from site where site_code = ? ";
pStmt = conn.prepareStatement(sql);
......@@ -6996,15 +7008,21 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
if (currentColumn.trim().equals("contract_no")) {
mcode = checkNull(genericUtility.getColumnValue(
"contract_no", dom));
indNo = checkNull(genericUtility.getColumnValue(
"ind_no", dom));
quotNo = checkNull(genericUtility.getColumnValue(
"quot_no", dom));
projCode = checkNull(genericUtility.getColumnValue(
"proj_code", dom));
if (mcode != null && mcode.trim().length() > 0) {
valueXmlString.append("<ind_no protect='1'>")
.append("").append("</ind_no>");
.append("<![CDATA[" + indNo + "]]>").append("</ind_no>");
valueXmlString.append("<quot_no protect='1'>")
.append("").append("</quot_no>");
.append("<![CDATA[" + quotNo + "]]>").append("</quot_no>");
valueXmlString.append("<proj_code protect='1'>")
.append("").append("</proj_code>");
.append("<![CDATA[" + projCode + "]]>").append("</proj_code>");
sql = "select supp_code,proj_code,tran_code,tax_class,tax_chap,tax_env,frt_term,curr_code__frt,dlv_term,cr_term,"
+ "frt_amt,contract_type, price_list from pcontract_hdr where contract_no = ?";
......@@ -7073,13 +7091,14 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
// gbf_itemchangedhdr("supp_code")
} else {
valueXmlString.append("<ind_no protect = '0'>")
.append("").append("</ind_no>");
valueXmlString.append("<quot_no protect = '0'>")
.append("").append("</quot_no>");
valueXmlString.append("<proj_code protect = '0'>")
.append("").append("</proj_code>");
}
else {
valueXmlString.append("<ind_no protect='0'>")
.append("<![CDATA[" + indNo + "]]>").append("</ind_no>");
valueXmlString.append("<quot_no protect='0'>")
.append("<![CDATA[" + quotNo + "]]>").append("</quot_no>");
valueXmlString.append("<proj_code protect='0'>")
.append("<![CDATA[" + projCode + "]]>").append("</proj_code>");
}
......@@ -7353,9 +7372,8 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
.append("</budget_amt>");
}
valueXmlString.append("</Detail1>");
valueXmlString.append("</Root>");
}
break;
break;
case 2: {
valueXmlString.append("<Detail2>");
......@@ -8554,8 +8572,12 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
if (!uom.trim().equalsIgnoreCase(ls_unitpur.trim())) {
// lc_qty = dw_detedit[ii_currformno].GetItemNumber(1,
// "quantity")
lc_qty = Double.parseDouble(checkNull(genericUtility
.getColumnValue("quantity", dom)));
qty = checkNull(genericUtility
.getColumnValue("quantity", dom)) ;
if(qty != null && qty.trim().length() > 0 )
{
lc_qty = Double.parseDouble(qty);
}
lc_temp = lc_qty;
/*
* if(lc_qty == null ) { lc_qty = 1; } if( lc_rate ==
......@@ -8592,8 +8614,13 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
.append("</quantity__stduom>");
}
// end if
lc_rate = Double.parseDouble(checkNull(genericUtility
.getColumnValue("rate", dom)));
rate = checkNull(genericUtility
.getColumnValue("rate", dom));
if(rate != null && rate.trim().length() > 0 )
{
lc_rate = Double.parseDouble(rate);
}
// lc_rate = dw_detedit[ii_currformno].GetItemNumber(1,
// "rate")
lc_temp = lc_rate;
......@@ -8921,8 +8948,14 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
.getColumnValue("ord_date", dom1));
// lc_qty =
// dw_detedit[ii_currformno].getitemdecimal(1,"quantity")
lc_qty = Double.parseDouble(checkNull(genericUtility
.getColumnValue("quantity", dom)));
qtyStr = checkNull(genericUtility
.getColumnValue("quantity", dom));
if(qtyStr == null || qtyStr.trim().length() == 0)
{
qtyStr = "0";
lc_qty = Double.parseDouble(qtyStr);
}
// ls_unitpur =
// dw_detedit[ii_currformno].getitemstring(1,"unit__rate")
ls_unitpur = genericUtility.getColumnValue(
......@@ -8953,28 +8986,26 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
// lc_conv =
// dw_detedit[ii_currformno].GetItemNumber(1,
// "conv__rtuom_stduom")
lc_conv = Double
.parseDouble(checkNull(genericUtility
.getColumnValue(
"conv__rtuom_stduom",
dom)));
convRtuomStduom = checkNull(genericUtility
.getColumnValue(
"conv__rtuom_stduom",
dom));
if(convRtuomStduom != null && convRtuomStduom.trim().length() >0)
{
lc_conv = Double.parseDouble(convRtuomStduom);
}
lc_convtemp = lc_conv;
// SHARON 21-Aug-2003
if ("R".equalsIgnoreCase(lsValue)
|| "B".equalsIgnoreCase(lsValue)) {
// lc_ratestduom = gf_conv_qty_fact1(mVal1,
// ls_unitpur, mcode, lc_rate, lc_conv,'Y')
lc_ratestduomArrayList = distComm
.convQtyFactor(mVal1, ls_unitpur,
mcode, lc_rate, lc_conv,
conn);
lc_ratestduomArrayList = distComm.convQtyFactor(mVal1, ls_unitpur,mcode, lc_rate, lc_conv,conn);
} else {
// lc_ratestduom = gf_conv_qty_fact1(mVal1,
// ls_unitpur, mcode, lc_rate, lc_conv,'N')
lc_ratestduomArrayList = distComm
.convQtyFactor(mVal1, ls_unitpur,
mcode, lc_rate, lc_conv,
conn);
lc_ratestduomArrayList = distComm.convQtyFactor(mVal1, ls_unitpur,mcode, lc_rate, lc_conv,conn);
}
// End If
// End Sharon
......@@ -9980,6 +10011,10 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
lcConv = lcConv == "" ? "0" : lcConv;
convTemp = Double.parseDouble(lcConv);
if(qty != null && qty.trim().length() > 0)
{
qtyLc = Double.parseDouble(qty);
}
if (mVal1.trim().length() == 0) {
sql = " select unit from item where item_code = ?";
pStmt = conn.prepareStatement(sql);
......@@ -9997,13 +10032,13 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
// lc_qtystduom = gf_conv_qty_fact1(unit, mVal1,
// itemCode, qty, lcConv,'Y') ;
qtystduomArr = distComm.convQtyFactor(unit, mVal1,
itemCode, Double.parseDouble(qty),
itemCode, qtyLc,
Double.parseDouble(lcConv), conn);
} else {
// lc_qtystduom = gf_conv_qty_fact1(mVal, mVal1,
// itemCode, lc_qty, lc_conv,'N')
qtystduomArr = distComm.convQtyFactor(unit, mVal1,
itemCode, Double.parseDouble(qty),
itemCode, qtyLc,
Double.parseDouble(lcConv), conn);
}
valueXmlString.append("<unit__std>")
......@@ -10044,10 +10079,11 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
"ord_date", dom));
rate = checkNull(genericUtility.getColumnValue("rate", dom));
rate = rate =="" ? "0" : rate ;
if (rate == null || Double.parseDouble(rate) <= 0) {
if (priceList != null && priceList.trim().length() > 0) {
Ratelc = distComm.pickRate(priceList, ordDate,
itemCode, "", "L", Double.parseDouble(qty),
itemCode, "", "L", qtyLc,
unit, conn);
System.out.println("@@@@@@@@@@@8286 Ratelc["
+ Ratelc + "] ");
......@@ -10080,7 +10116,7 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
dom);
lcConv = genericUtility.getColumnValue(
"conv__rtuom_stduom", dom);
lcConv = lcConv == "" ? "0" : lcConv;
convTemp = Double.parseDouble(lcConv);
if ( "R".equalsIgnoreCase(Value) || "B".equalsIgnoreCase(Value))
......@@ -10129,10 +10165,10 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
dom) == null ? "0" : genericUtility.getColumnValue(
"actual_cost", dom);
stdCode = Double.parseDouble(qty)
stdCode = Double.parseDouble(qty == "" ? "0" : qty)
* Double.parseDouble(stdRate == "" ? "0" : stdRate);
varie = (stdCode - Double.parseDouble(actualCost));
varie = (stdCode - Double.parseDouble(actualCost == "" ? "0" : actualCost));
valueXmlString.append("<std_cost>").append(stdCode)
.append("</std_cost>");
valueXmlString.append("<varience>").append(varie)
......@@ -10163,19 +10199,40 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
"RCP_UOM_VARIANCE", conn);
// ls_value = gf_getenv_dis('999999',
// 'RCP_UOM_VARIANCE')
if(qty != null && qty.trim().length() > 0)
{
qtyLc = Double.parseDouble(qty) ;
}
if(rate != null && rate.trim().length() > 0)
{
rateLc = Double.parseDouble(rate) ;
}
if(qtystd != null && qtystd.trim().length() > 0)
{
qtystdLc = Double.parseDouble(qtystd) ;
}
if(ratestd != null && ratestd.trim().length() > 0)
{
ratestdLc = Double.parseDouble(ratestd) ;
}
if(Value != null && Value.trim().length() > 0)
{
ValueLc = Double.parseDouble(ratestd) ;
}
if (Double.parseDouble(qty) > 0
&& Double.parseDouble(rate) > 0) {
amt = Double.parseDouble(qty)
* Double.parseDouble(rate);
amtStd = Double.parseDouble(qtystd)
* Double.parseDouble(ratestd);
if (qtyLc > 0 && rateLc > 0)
{
amt = qtyLc
* rateLc;
amtStd = qtystdLc
* ratestdLc;
if ((amt - amtStd) > Double.parseDouble(Value)
if ((amt - amtStd) > ValueLc
&& ! unit.trim().equalsIgnoreCase(unitRate.trim())) {
qtystdlc = (amt / Double.parseDouble(ratestd));
lcConvlc = Double.parseDouble(qtystd)
/ Double.parseDouble(qty);
qtystdlc = (amt / ratestdLc);
lcConvlc = qtystdLc / qtyLc;
valueXmlString.append("<conv__qty_stduom>")
.append(df.format(lcConvlc))
.append("</conv__qty_stduom>");
......@@ -10184,13 +10241,12 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
.append("</quantity__stduom>");
}
amtStd = Double.parseDouble(qtystd)
* Double.parseDouble(ratestd);
if ((amt - amtStd) > Double.parseDouble(Value)
amtStd = qtystdLc
* ratestdLc;
if ((amt - amtStd) > ValueLc
&& ! unit.trim().equalsIgnoreCase(unitRate.trim())) {
ratestdlc = (amt / Double.parseDouble(qtystd));
lcConvlc = Double.parseDouble(ratestd)
/ Double.parseDouble(rate);
ratestdlc = (amt / qtystdLc);
lcConvlc = ratestdLc/ rateLc;
valueXmlString.append("<conv__rtuom_stduom>")
.append(df.format(lcConv))
.append("</conv__rtuom_stduom>");
......@@ -10212,6 +10268,10 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
"item_code", dom));
qty = checkNull(genericUtility.getColumnValue("quantity",
dom));
if(qty != null && qty.trim().length() > 0)
{
qtyLc = Double.parseDouble(qty) ;
}
// convQtystdDob = Double.parseDouble(lcConv);
if (mval1 == null || mval1.trim().length() == 0) {
......@@ -10238,13 +10298,13 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
// lc_qtystduom = gf_conv_qty_fact1(mcode, mVal1,
// itemCode, lc_qty, lc_conv,'Y')
qtystduomArr = distComm.convQtyFactor(mcode, mVal1,
itemCode, Double.parseDouble(qty),
itemCode, qtyLc,
convQtystdDob, conn);
} else {
// lc_qtystduom = gf_conv_qty_fact1(mcode, mVal1,
// itemCode, lc_qty, lc_conv,'N')
qtystduomArr = distComm.convQtyFactor(mcode, mVal1,
itemCode, Double.parseDouble(qty),
itemCode, qtyLc,
convQtystdDob, conn);
}
valueXmlString.append("<conv__qty_stduom>").append(lcConv)
......@@ -10264,13 +10324,26 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
"item_code", dom));
qty = checkNull(genericUtility.getColumnValue("quantity",
dom));
if(qty != null && qty.trim().length() > 0)
{
qtyLc = Double.parseDouble(qty) ;
}
stdRate = checkNull(genericUtility.getColumnValue(
"std_rate", dom));
if(convQtystduom != null && convQtystduom.trim().length() > 0)
{
convQtystduomLc = Double.parseDouble(convQtystduom) ;
}
if(stdRate != null && stdRate.trim().length() > 0)
{
stdRateLc = Double.parseDouble(stdRate) ;
}
valueXmlString.append("<std_cost>").append(stdCost)
.append("</std_cost>");
stdCost = Double.parseDouble(qty)
* Double.parseDouble(stdRate);
stdCost = qtyLc * stdRateLc;
valueXmlString.append("<std_cost>").append(stdCost)
.append("</std_cost>");
......@@ -10285,7 +10358,7 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
actualCost = "0";
}
valueXmlString.append("<varience>")
.append((stdCost - Double.parseDouble(actualCost)))
.append((stdCost - Double.parseDouble(actualCost == "" ? "0" : actualCost)))
.append("</varience>");
if (mval1 == null || mval1.trim().length() == 0) {
......@@ -10310,12 +10383,12 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
// lc_qtystduom = gf_conv_qty_fact1(mVal, mVal1,
// itemCode, lc_qty, lc_conv,'Y')
qtystduomArr = distComm.convQtyFactor(mVal, mVal1,
itemCode, Double.parseDouble(qty),
Double.parseDouble(convQtystduom), conn);
itemCode, qtyLc,
convQtystduomLc, conn);
} else {
qtystduomArr = distComm.convQtyFactor(mVal, mVal1,
itemCode, Double.parseDouble(qty),
Double.parseDouble(convQtystduom), conn);
itemCode, qtyLc,
convQtystduomLc, conn);
}
}
if (currentColumn.trim().equals("rate")) {
......@@ -10334,6 +10407,10 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
System.out.println("@@@@@@@@@8511 mVal1[" + mVal1
+ "]lc_convtemp[" + lc_convtemp + "]rate[" + rate
+ "]");
if(rate != null && rate.trim().length() > 0)
{
rateLc = Double.parseDouble(rate) ;
}
if (mVal1 == null || mVal1.trim().length() == 0) {
sql = "Select unit from item where item_code = ? ";
pStmt = conn.prepareStatement(sql);
......@@ -10369,14 +10446,14 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
// lc_ratestduom = gf_conv_qty_fact1(mVal1, mVal,
// itemCode, lc_rate, lc_conv,'Y')
ratestduomArr = distComm.getConvQuantityFact(mVal1,
mVal, itemCode, Double.parseDouble(rate),
mVal, itemCode, rateLc,
convQtystdDob, conn);
} else {
// lc_ratestduom = gf_conv_qty_fact1(mVal1, mVal,
// itemCode, rate, convQty,'N')
ratestduomArr = distComm.getConvQuantityFact(mVal1,
mVal, itemCode, Double.parseDouble(rate),
mVal, itemCode,rateLc,
convQtystdDob, conn);
}
valueXmlString.append("<unit__rate>").append(mVal)
......@@ -10387,13 +10464,13 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
// lc_ratestduom = gf_conv_qty_fact1(mVal1, mVal,
// itemCode, lc_rate, lc_conv,'Y')
ratestduomArr = distComm.getConvQuantityFact(mVal1,
mVal, itemCode, Double.parseDouble(rate),
mVal, itemCode, rateLc,
convQtystdDob, conn);
} else {
// lc_ratestduom = gf_conv_qty_fact1(mVal1, mVal,
// itemCode, rate, convQty,'N')
ratestduomArr = distComm.getConvQuantityFact(mVal1,
mVal, itemCode, Double.parseDouble(rate),
mVal, itemCode, rateLc,
convQtystdDob, conn);
}
}
......@@ -10419,8 +10496,13 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
"rate__clg", dom));
System.out.println("@@@@@@8583 rate[" + rate + "]mrate["
+ mrate + "]");
if(mrate != null && mrate.trim().length() > 0)
{
mrateLc = Double.parseDouble(mrate) ;
}
if (mrate == null || mrate.trim().length() == 0
|| Double.parseDouble(mrate) <= 0) {
|| mrateLc <= 0) {
// dw_detedit[ii_currformno].setitem(1,"rate__clg",lc_rate)
valueXmlString.append("<rate__clg>").append(rate)
.append("</rate__clg>");
......@@ -10481,13 +10563,13 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
// ratestduom = gf_conv_qty_fact1(mVal1, mcode,
// itemCode, lc_rate, lc_conv,'Y')
ratestduomArr = distComm.convQtyFactor(mVal1, mcode,
itemCode, Double.parseDouble(rate),
itemCode, Double.parseDouble(rate == "" ? "0" : rate),
convQtystdDob, conn);
} else {
// ratestduom = gf_conv_qty_fact1(mVal1, mcode,
// itemCode, lc_rate, lc_conv,'N')
ratestduomArr = distComm.convQtyFactor(mVal1, mcode,
itemCode, Double.parseDouble(rate),
itemCode, Double.parseDouble(rate == "" ? "0" : rate),
convQtystdDob, conn);
}
System.out.println("@@@@@@@8647 ratestduomArr["
......@@ -10574,7 +10656,6 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
}
valueXmlString.append("</Detail2>");
valueXmlString.append("</Root>");
}
break;
case 3: {
......@@ -10621,9 +10702,9 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
}
valueXmlString.append("</Detail3>");
valueXmlString.append("</Root>");
//valueXmlString.append("</Root>");
}
break;
break;
case 4: {
valueXmlString.append("<Detail4>");
parentNodeList = dom.getElementsByTagName("Detail4");
......@@ -10717,9 +10798,9 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
.append(taskCodeDescr).append("</task_code_descr>");
}
valueXmlString.append("</Detail4>");
valueXmlString.append("</Root>");
//valueXmlString.append("</Root>");
}
break;
break;
case 5: {
valueXmlString.append("<Detail5>");
......@@ -10743,13 +10824,14 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
.append("</line_no>");
}
}
valueXmlString.append("</Detail5>");
valueXmlString.append("</Root>");
}
break;
}
valueXmlString.append("</Root>");
} catch (Exception e) {
System.out.println("POrderIC Exception ::" + e.getMessage());
e.printStackTrace();
......@@ -10834,8 +10916,8 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
if (qtystdTemp == null) {
qtystdTemp = "0";
}
curordqty = Double.parseDouble(qtyStduom)
+ Double.parseDouble(qtystdTemp);
curordqty = Double.parseDouble(qtyStduom == "" ? "0" : qtyStduom)
+ Double.parseDouble(qtystdTemp == "" ? "0" : qtystdTemp);
}
sql = " select (case when quantity__stduom is null then 0 else quantity__stduom end),(case when ord_qty is null then 0 else ord_qty end)"
......@@ -10893,6 +10975,8 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
String sql = null;
StringBuffer valueXmlString = new StringBuffer();
int cnt = 0;
System.out.println("editFlag >>"+editFlag);
editFlag = editFlag == null ? "" : editFlag ;
try {
if (!editFlag.equalsIgnoreCase("V")) {
plist = checkNull(genericUtility.getColumnValue("price_list",
......
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