Commit 5620161c authored by kshinde's avatar kshinde

D18CKOY001 Changes in sales return form to split on basis of invoice ID

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@186639 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 848651c6
......@@ -105,7 +105,10 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
try
{
dom = parseString(xmlString);
//System.out.println("xmlString" + xmlString);
System.out.println("xmlString" + xmlString);
System.out.println("xmlString1" + xmlString1);
System.out.println("C" + xmlString1);
dom1 = parseString(xmlString1);
if (xmlString2.trim().length() > 0 )
{
......@@ -1142,7 +1145,7 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
if (invoiceId == null || invoiceId.trim().length() == 0 || "null".equalsIgnoreCase( invoiceId.trim() ) )
{
valueXmlString.append("<line_no__inv protect =\"1\">").append("<![CDATA["+""+"]]>").append("</line_no__inv>");
valueXmlString.append("<line_no__inv protect =\"0\">").append("<![CDATA["+""+"]]>").append("</line_no__inv>");
valueXmlString.append("<item_code protect =\"0\">").append("<![CDATA["+""+"]]>").append("</item_code>");
}
else
......@@ -1180,6 +1183,8 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
varValue = distCommon.getDisparams("999999","ALLOC_FGLOC",conn);
valueXmlString.append("<loc_code>").append("<![CDATA[" + varValue + "]]>").append("</loc_code>");
sql =" select descr from location where loc_code = ? ";
pstmt= conn.prepareStatement( sql );
pstmt.setString( 1, varValue );
......@@ -1709,6 +1714,7 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
reStr = reStr.substring(0,pos);
valueXmlString.append(reStr);
varValue = distCommon.getDisparams("999999","DAMAGED_LOC",conn);
valueXmlString.append("<loc_code>").append("<![CDATA[" + varValue + "]]>").append("</loc_code>");
setNodeValue( dom, "loc_code", varValue );
......@@ -1757,6 +1763,7 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
valueXmlString.append("<stk_opt>").append("<![CDATA[U]]>").append("</stk_opt>");
setNodeValue( dom, "stk_opt", "U" );
varValue = distCommon.getDisparams("999999","ALLOC_FGLOC",conn);
valueXmlString.append("<loc_code>").append("<![CDATA[" + varValue + "]]>").append("</loc_code>");
setNodeValue( dom, "loc_code", varValue );
valueXmlString.append("<invoice_id>").append("<![CDATA["+""+"]]>").append("</invoice_id>");
......@@ -1993,6 +2000,8 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
String taxEnvVal = null;
lineNoTrace = genericUtility.getColumnValue("line_no__inv", dom);
lineNoTrace = lineNoTrace == null ?"0" : lineNoTrace.trim();
iLineNoTrace = Integer.parseInt( lineNoTrace ) ;
invoiceId = genericUtility.getColumnValue("invoice_id", dom1);
retOpt = genericUtility.getColumnValue("ret_opt", dom1);
......@@ -2224,6 +2233,7 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
{
locCode = rs.getString(1);
locDescr = rs.getString(2);
valueXmlString.append("<loc_code>").append("<![CDATA[" + locCode + "]]>").append("</loc_code>");
setNodeValue( dom, "loc_code", locCode );
//tempNode = dom.getElementsByTagName("loc_code").item(0);
......@@ -2248,6 +2258,7 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
locCode = distCommon.getDisparams("999999","ALLOC_FGLOC", conn);
if (!locCode.equals("NULLFOUND"))
{
valueXmlString.append("<loc_code>").append("<![CDATA[" + locCode + "]]>").append("</loc_code>");
sql = "select descr from location where loc_code = ? ";
pstmt= conn.prepareStatement( sql );
......@@ -2355,6 +2366,587 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
valueXmlString.append(reStr);
}//end if invoice id
}// end of line_no__inv
else if (currentColumn.trim().equals("line_no__invtrace") )
{
String taxClassVal = null;
String taxChapVal = null;
String taxEnvVal = null;
lineNoTrace = genericUtility.getColumnValue("line_no__invtrace", dom);
invoiceId = genericUtility.getColumnValue("invoice_id", dom);
retOpt = genericUtility.getColumnValue("ret_opt", dom1);
if (invoiceId != null && invoiceId.trim().length() > 0)
{
lineNoTrace = lineNoTrace == null || lineNoTrace.trim().length() == 0 ? "0" : lineNoTrace.trim();
if( lineNoTrace != null )
{
pos = lineNoTrace.indexOf(".");
}
if (pos > 0)
{
lineNoTrace = lineNoTrace.substring(0,pos);
}
iLineNoTrace = Integer.parseInt(lineNoTrace);
sql = " select inv_line_no,site_code__mfg, mfg_date, exp_date, lot_no, "
+ " lot_sl, desp_id, desp_line_no, rate__std, cost_rate, item_code, quantity, "
+ " tax_class, tax_chap, tax_env, rate, rate__clg, sord_no, sord_line_no, "
+ " item_code__ord, line_type,unit__rate "
+ " from invoice_trace where invoice_id = ? and line_no = ? ";
pstmt= conn.prepareStatement( sql );
pstmt.setString( 1, invoiceId );
pstmt.setInt( 2, iLineNoTrace );
rs = pstmt.executeQuery();
if( rs.next() )
{
//lineNoInv = Integer.parseInt( getNumString( rs.getString("inv_line_no") ) );
lineNoInvStr = getNumString( rs.getString("inv_line_no") ) ;
lineNoInvStr = lineNoInvStr == null || lineNoInvStr.trim().length() == 0 ? "0" : lineNoInvStr.trim();
if( lineNoInvStr != null )
{
pos = lineNoInvStr.indexOf(".");
}
if (pos > 0)
{
lineNoInvStr = lineNoInvStr.substring(0,pos);
}
lineNoInv = Integer.parseInt(lineNoInvStr);
valueXmlString.append("<line_no__inv>").append("<![CDATA[" + lineNoInv + "]]>").append("</line_no__inv>");
System.out.println("lineNoInv before >>> " + lineNoInv);
setNodeValue( dom, "line_no__inv", lineNoInv );
//lineNoInv = genericUtility.getColumnValue("line_no__inv", dom);
System.out.println("lineNoInv after >>> " + genericUtility.getColumnValue("line_no__inv", dom));
if (invoiceId != null && invoiceId.trim().length() > 0 && lineNoTrace != null && lineNoTrace.trim().length() > 0 )
{
if ("R".equals(retOpt) || "C".equals(retOpt))
{
retReplFlag = "R";
}
else
{
retReplFlag = "P";
}
valueXmlString.append("<ret_rep_flag>").append("<![CDATA[" + retReplFlag + "]]>").append("</ret_rep_flag>");
setNodeValue( dom, "ret_rep_flag", retReplFlag );
//tempNode = dom.getElementsByTagName("ret_rep_flag").item(0);
//tempNode.getFirstChild().setNodeValue(retReplFlag);
}
siteCodeMfg = rs.getString("site_code__mfg");
siteCodeMfg = getAbsString( siteCodeMfg );
mfgDate = rs.getTimestamp("mfg_date");
expDate = rs.getTimestamp("exp_date");
lotNo = rs.getString("lot_no");
lotSl = rs.getString("lot_sl");
despId = rs.getString("desp_id");
despLineNo = rs.getString("desp_line_no");
rateStd = rs.getDouble("rate__std");
costRate = rs.getDouble("cost_rate");
itemCode = rs.getString("item_code");
sQuantity = rs.getDouble("quantity");
taxClasss = rs.getString("tax_class");
taxChap = rs.getString("tax_chap");
taxEnv = rs.getString("tax_env");
sRate = rs.getString("rate");
sRateClg = rs.getDouble("rate__clg");
sorder = rs.getString("sord_no");
sordLineNo = rs.getString("sord_line_no");
itemCodeOrd = rs.getString("item_code__ord");
//lineType = rs.getString("line_type");
unitRate = rs.getString("unit__rate");//Changed by Priyanka Das for unit to be set from invoice_trace
System.out.println( "taxClasss :1: " + taxClasss );
taxClasss = getAbsString(taxClasss);
taxClassVal = taxClasss;
taxChapVal = getAbsString(taxChap);
taxEnvVal = getAbsString(taxEnv);
System.out.println( "taxClassVal :1: " + taxClassVal );
System.out.println( "taxChapVal :1: " + taxChapVal );
System.out.println( "taxEnvVal :1: " + taxEnvVal );
rate = Double.parseDouble( ( sRate == null || sRate.trim().length() == 0 ? "0" : sRate.trim() ) );
valueXmlString.append("<item_code>").append("<![CDATA[" + getAbsString(itemCode) + "]]>").append("</item_code>");
setNodeValue( dom, "item_code", getAbsString(itemCode) );
//tempNode = dom.getElementsByTagName("item_code").item(0);
//tempNode.getFirstChild().setNodeValue(itemCode);
System.out.println("IC1 ItemCodeBefore"+valueXmlString);
reStr = itemChanged(dom, dom1, dom2, objContext, "item_code", editFlag, xtraParams);
pos = reStr.indexOf("<Detail2>");
reStr = reStr.substring(pos + 9);
pos = reStr.indexOf("</Detail2>");
reStr = reStr.substring(0,pos);
valueXmlString.append(reStr);
System.out.println("IC1 ItemCode"+valueXmlString);
valueXmlString.append("<site_code__mfg>").append("<![CDATA[" + getAbsString(siteCodeMfg) + "]]>").append("</site_code__mfg>");
setNodeValue( dom, "site_code__mfg", siteCodeMfg );
if (mfgDate != null)
{
valueXmlString.append("<mfg_date>").append("<![CDATA[" + genericUtility.getValidDateString( mfgDate.toString(), genericUtility.getDBDateFormat(), genericUtility.getApplDateFormat() ) + "]]>").append("</mfg_date>");
setNodeValue( dom, "mfg_date", genericUtility.getValidDateString( mfgDate.toString(), genericUtility.getDBDateFormat(), genericUtility.getApplDateFormat() ) );
}
if (expDate != null)
{
valueXmlString.append("<exp_date>").append("<![CDATA[" + genericUtility.getValidDateString( expDate.toString(), genericUtility.getDBDateFormat(), genericUtility.getApplDateFormat() ) + "]]>").append("</exp_date>");
setNodeValue( dom, "exp_date", genericUtility.getValidDateString( expDate.toString(), genericUtility.getDBDateFormat(), genericUtility.getApplDateFormat() ) );
}
valueXmlString.append("<lot_no>").append("<![CDATA[" + lotNo + "]]>").append("</lot_no>");
setNodeValue( dom, "lot_no", lotNo );
valueXmlString.append("<rate__std>").append("<![CDATA[" + rateStd + "]]>").append("</rate__std>");
setNodeValue( dom, "rate__std", Double.toString( rateStd ) );
valueXmlString.append("<cost_rate>").append("<![CDATA[" + costRate + "]]>").append("</cost_rate>");
setNodeValue( dom, "cost_rate", Double.toString( costRate ) );
/*lineType = getAbsString( lineType );
valueXmlString.append("<line_type>").append("<![CDATA[" + lineType + "]]>").append("</line_type>");
setNodeValue( dom, "line_type", lineType );*/
valueXmlString.append("<rate__clg>").append("<![CDATA[" + sRateClg + "]]>").append("</rate__clg>");
setNodeValue( dom, "rate__clg", Double.toString( sRateClg ) );
valueXmlString.append("<lot_sl>").append("<![CDATA[" + lotSl + "]]>").append("</lot_sl>");
setNodeValue( dom, "lot_sl", lotSl );
valueXmlString.append("<quantity>").append("<![CDATA[" + getRequiredDecimal( sQuantity, 3 ) + "]]>").append("</quantity>");
setNodeValue( dom, "quantity", getRequiredDecimal( sQuantity, 3 ) );
retReplFlag = genericUtility.getColumnValue("ret_repl_flag", dom);
siteCode = genericUtility.getColumnValue("site_code", dom1);
locCode = genericUtility.getColumnValue("loc_code", dom);
tranDate = genericUtility.getColumnValue("tran_date", dom1);
//invoiceId = genericUtility.getColumnValue("invoice_id", dom1);
invoiceId = genericUtility.getColumnValue("invoice_id", dom);
lineNoTrace = genericUtility.getColumnValue("line_no__invtrace", dom);
valStr = genericUtility.getColumnValue("quantity__stduom", dom);
valStr = valStr == null || valStr.trim().length() == 0 ? "0" : valStr.trim();
qtyStdUom = Double.parseDouble( valStr );
quantity = qtyStdUom;
packCode = genericUtility.getColumnValue("pack_code", dom);
rs.close();
pstmt.close();
pstmt = null;
rs = null;
itemSer = distCommon.getItemSer(itemCode,siteCode,
Timestamp.valueOf(genericUtility.getValidDateString(tranDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0"),
custCode,"C",conn);
valueXmlString.append("<item_ser>").append("<![CDATA[" + itemSer + "]]>").append("</item_ser>");
setNodeValue( dom, "item_ser", itemSer );
sql = " select descr, unit from item where item_code = ? ";
pstmt= conn.prepareStatement( sql );
pstmt.setString( 1, itemCode );
rs = pstmt.executeQuery();
if( rs.next() )
{
descr = rs.getString(1);
unit = rs.getString(2);
// unitRate = rs.getString(3);
unitStd = unit;
valueXmlString.append("<item_descr>").append("<![CDATA[" + descr + "]]>").append("</item_descr>");
setNodeValue( dom, "item_descr", descr );
valueXmlString.append("<unit>").append("<![CDATA[" + unit + "]]>").append("</unit>");
setNodeValue( dom, "unit", unit );
valueXmlString.append("<unit__rate>").append("<![CDATA[" + unitRate + "]]>").append("</unit__rate>");
setNodeValue( dom, "unit__rate", unitRate );
valueXmlString.append("<unit__std>").append("<![CDATA[" + unit + "]]>").append("</unit__std>");
setNodeValue( dom, "unit__std", unit );
}
rs.close();
pstmt.close();
pstmt = null;
rs = null;
valueXmlString.append("<conv__qty_stduom>").append("<![CDATA[1]]>").append("</conv__qty_stduom>");
setNodeValue( dom, "conv__qty_stduom", "1" );
infoMap = new HashMap();
infoMap.put("ret_repl_flag",retReplFlag);
infoMap.put("item_code", itemCode);
infoMap.put("site_code", siteCode);
infoMap.put("loc_code",locCode);
infoMap.put("lot_no", lotNo);
infoMap.put("lot_sl", lotSl);
infoMap.put("tran_date", tranDate);
infoMap.put("invoice_id", invoiceId);
infoMap.put("line_no__invtrace",lineNoTrace);
infoMap.put("quantity__stduom",new Double(-1 * quantity));
costRate = getCostRate(infoMap, conn);
infoMap = null;
valueXmlString.append("<cost_rate>").append("<![CDATA[" + costRate + "]]>").append("</cost_rate>");
/*sql = " select sum((case when quantity is null then 0 else quantity end) * (case when rate is null then 0 else rate end)), "
+ " sum(case when quantity is null then 0 else quantity end) "
+ " from invoice_trace "
+ " where invoice_id = ? "
+ " and line_no =? ";
pstmt= conn.prepareStatement( sql );
pstmt.setString( 1, invoiceId);
if( lineNoTrace != null )
{
pos = lineNoTrace.indexOf(".");
}
if (pos > 0)
{
lineNoTrace = lineNoTrace.substring(0,pos);
}
lineNoTrace = lineNoTrace == null || lineNoTrace.trim().length() == 0 ? "0" : lineNoTrace.trim();
pstmt.setInt( 2, Integer.parseInt(lineNoTrace));
rs = pstmt.executeQuery();
if( rs.next() )
{
amount = rs.getDouble(1);
quantity = rs.getDouble(2);
}
rs.close();
pstmt.close();
pstmt = null;
rs = null;*/
/* sql = " select sum(case when a.drcr_flag = 'D' then (case when b.drcr_amt is null then 0 else b.drcr_amt end) "
+ " else ((case when b.drcr_amt is null then 0 else b.drcr_amt end) * -1) End) "
+ " from drcr_rcp a, drcr_rdet b "
+ " where a.tran_id = b.tran_id "
+ " and b.invoice_id = ? "
+ " and b.line_no__inv = ? ";
pstmt= conn.prepareStatement( sql );
pstmt.setString( 1, invoiceId);
if( lineNoTrace != null )
{
pos = lineNoTrace.indexOf(".");
}
if (pos > 0)
{
lineNoTrace = lineNoTrace.substring(0,pos);
}
lineNoTrace = lineNoTrace == null || lineNoTrace.trim().length() == 0 ? "0" : lineNoTrace.trim();
pstmt.setInt( 2, Integer.parseInt( lineNoTrace ) );
rs = pstmt.executeQuery();
if( rs.next() )
{
drcrAmount = rs.getDouble(1);
}
rs.close();
pstmt.close();
pstmt = null;
rs = null;
//if ( drcrAmount != 0 )
//{
System.out.println( "amount :: " + amount );
System.out.println( "drcrAmount :: " + drcrAmount );
System.out.println( "quantity :: " + quantity );
rate = (amount + drcrAmount) / quantity;
//}
*/
priceList = genericUtility.getColumnValue("price_list", dom1);
priceListClg = genericUtility.getColumnValue("price_list__clg", dom1);
pickLowerRate = distCommon.getDisparams("999999","PICK_LOWER_RATE", conn);
System.out.println( "pickLowerRate :: " + pickLowerRate );
if (pickLowerRate.equals("NULLFOUND"))
{
pickLowerRate = "N";
}
if (pickLowerRate.equals("Y"))
{
if (priceList != null && priceList.trim().length() > 0 && !"null".equalsIgnoreCase( priceList.trim() ) )
{
tranDate = tranDate == null ? ( new Timestamp( System.currentTimeMillis() ) ).toString() : tranDate;
itemCode = itemCode == null ? "" : itemCode;
lotNo = lotNo == null ? "" : lotNo;
priceListRate = distCommon.pickRate(priceList,tranDate,itemCode,lotNo,"L", quantity, conn);
System.out.println( "IN priceListRate :: " + priceListRate );
if (priceListRate < rate )
{
System.out.println( "IN rate :: " + rate );
rate = priceListRate;
}
}
}
System.out.println( "out rate :: " + rate );
valueXmlString.append("<rate>").append("<![CDATA[" + rate + "]]>").append("</rate>");
setNodeValue( dom, "rate", rate );
//tempNode = dom.getElementsByTagName("rate").item(0);
//tempNode.getFirstChild().setNodeValue("" +rate);
rateClg = sRateClg ;
priceListClg = priceListClg == null ?"" : priceListClg.trim();
if (rateClg <= 0 )
{
if (priceListClg.trim().length() > 0)
{
tranDate = tranDate == null ? ( genericUtility.getValidDateString( new Timestamp( System.currentTimeMillis() ).toString().toString(), genericUtility.getDBDateFormat(), genericUtility.getApplDateFormat() ) ).toString() : tranDate;
itemCode = itemCode == null ? "" : itemCode;
lotNo = lotNo == null ? "" : lotNo;
rateClg = distCommon.pickRate(priceListClg,tranDate,itemCode,lotNo,"L", quantity, conn);
if (rateClg == -1)
{
rateClg = 0 ;
}
}
if (rateClg == 0 )
{
valueXmlString.append("<rate__clg>").append("<![CDATA[" + getRequiredDecimal( rate, 4 ) + "]]>").append("</rate__clg>");
setNodeValue( dom, "rate__clg", getRequiredDecimal( rate, 4 ) );
}
else
{
valueXmlString.append("<rate__clg>").append("<![CDATA[" + getRequiredDecimal( rateClg, 4 ) + "]]>").append("</rate__clg>");
setNodeValue( dom, "rate__clg", getRequiredDecimal( rateClg, 4 ) );
}
}
unit = unit == null ?"" : unit.trim();
unitRate = unitRate == null ?"" : unitRate.trim();
if ( unit.trim().equals(unitRate.trim()))
{
System.out.println("manohar rate__stduom 3 [" + getRequiredDecimal( rate, 4 ) + "]");
valueXmlString.append("<rate__stduom>").append("<![CDATA[" + getRequiredDecimal( rate, 4 ) + "]]>").append("</rate__stduom>");
setNodeValue( dom, "rate__stduom", getRequiredDecimal( rate, 4 ) );
valueXmlString.append("<conv__rtuom_stduom>").append("<![CDATA[1]]>").append("</conv__rtuom_stduom>");
setNodeValue( dom, "conv__rtuom_stduom", "1" );
}
else
{
convAr = distCommon.getConvQuantityFact(unit, unitRate, itemCode, rate, (double) fact, conn);
convFact = Double.parseDouble( convAr.get(0).toString() );
rateStd = Double.parseDouble( convAr.get(1).toString() );
System.out.println("manohar rate__stduom 4 [" + rateStd + "]");
valueXmlString.append("<rate__stduom>").append("<![CDATA[" + rateStd + "]]>").append("</rate__stduom>");
setNodeValue( dom, "rate__stduom", rateStd );
valueXmlString.append("<conv__rtuom_stduom>").append("<![CDATA[" + convFact + "]]>").append("</conv__rtuom_stduom>");
setNodeValue( dom, "conv__rtuom_stduom", convFact );
}
sql = "select a.loc_code, b.descr from despatchdet a, location b "
+ "where a.loc_code = b.loc_code "
+ " and a.desp_id = ? and a.line_no = ?";
pstmt= conn.prepareStatement( sql );
pstmt.setString( 1, despId);
pstmt.setString( 2, despLineNo);
rs = pstmt.executeQuery();
if( rs.next() )
{
locCode = rs.getString(1);
locDescr = rs.getString(2);
valueXmlString.append("<loc_code>").append("<![CDATA[" + locCode + "]]>").append("</loc_code>");
setNodeValue( dom, "loc_code", locCode );
//tempNode = dom.getElementsByTagName("loc_code").item(0);
//tempNode.getFirstChild().setNodeValue(locCode);
valueXmlString.append("<location_descr>").append("<![CDATA[" + locDescr + "]]>").append("</location_descr>");
}
rs.close();
pstmt.close();
pstmt = null;
rs = null;
System.out.println("IC2 LotNoBefore"+valueXmlString);
reStr = itemChanged(dom, dom1, dom2, objContext, "lot_no", editFlag, xtraParams);
pos = reStr.indexOf("<Detail2>");
reStr = reStr.substring(pos + 9);
pos = reStr.indexOf("</Detail2>");
reStr = reStr.substring(0,pos);
valueXmlString.append(reStr);
System.out.println("IC2 LotNo"+valueXmlString);
sretLocCode = getAbsString( distCommon.getDisparams("999999","SRET_LOC_CODE", conn) );
if (sretLocCode.equals("D"))
{
locCode = distCommon.getDisparams("999999","ALLOC_FGLOC", conn);
if (!locCode.equals("NULLFOUND"))
{
valueXmlString.append("<loc_code>").append("<![CDATA[" + locCode + "]]>").append("</loc_code>");
sql = "select descr from location where loc_code = ? ";
pstmt= conn.prepareStatement( sql );
pstmt.setString( 1, locCode);
rs = pstmt.executeQuery();
if( rs.next() )
{
locDescr = rs.getString(1);
valueXmlString.append("<location_descr>").append("<![CDATA[" + locDescr + "]]>").append("</location_descr>");
}
rs.close();
pstmt.close();
pstmt = null;
rs = null;
}
}
taxCal = distCommon.getDisparams("999999","SRET_TAX_CALC", conn);
if (taxCal.equals("NULLFOUND"))
{
taxCal = "Y";
}
sql = "select sorddet.item_code "
+ " from invoice, invoice_trace, sorddet, item "
+ " where invoice_trace.invoice_id = invoice.invoice_id "
+ " and sorddet.sale_order = invoice.sale_order "
+ " and sorddet.line_no = invoice_trace.sord_line_no "
+ " and invoice.invoice_id = ? "
+ " and invoice_trace.line_no = ? "
+ " and sorddet.item_flg = 'B' "
+ " and item.item_code = sorddet.item_code "
+ " and item.item_stru = 'F' ";
pstmt= conn.prepareStatement( sql );
pstmt.setString( 1, invoiceId);
pstmt.setInt( 2, iLineNoTrace);
rs = pstmt.executeQuery();
if( rs.next() )
{
if (!taxCal.equals("N"))
{
if("C".equals(retOpt))
{
taxClasss = getAbsString(taxClassVal);
taxChap = getAbsString( taxChapVal );
taxEnv = getAbsString( taxEnvVal );
System.out.println( "taxClass :4: " + taxClass );
valueXmlString.append("<tax_class>").append("<![CDATA[" +taxClass + "]]>").append("</tax_class>");
valueXmlString.append("<tax_chap>").append("<![CDATA[" + taxChap + "]]>").append("</tax_chap>");
valueXmlString.append("<tax_env>").append("<![CDATA[" + taxEnv + "]]>").append("</tax_env>");
}
}
itemCodeOrd = rs.getString(1);
rs.close();
pstmt.close();
pstmt = null;
rs = null;
sql = "select eff_cost from bomdet "
+ " where bom_code = ? "
+ " and item_code = ? ";
pstmt= conn.prepareStatement( sql );
pstmt.setString( 1, itemCodeOrd);
pstmt.setString( 2, itemCode);
rs = pstmt.executeQuery();
if( rs.next() )
{
effCost = rs.getDouble(1);
valueXmlString.append("<rate>").append("<![CDATA[" + effCost + "]]>").append("</rate>");
}
rs.close();
pstmt.close();
pstmt = null;
rs = null;
}
else
{
rs.close();
pstmt.close();
pstmt = null;
rs = null;
if("C".equals(retOpt))
{
taxClasss = getAbsString(taxClassVal);
taxChap = getAbsString( taxChapVal );
taxEnv = getAbsString( taxEnvVal );
System.out.println( "taxClass :5: " + taxClasss );
valueXmlString.append("<tax_class>").append("<![CDATA[" +taxClasss + "]]>").append("</tax_class>");
valueXmlString.append("<tax_chap>").append("<![CDATA[" + taxChap + "]]>").append("</tax_chap>");
valueXmlString.append("<tax_env>").append("<![CDATA[" + taxEnv + "]]>").append("</tax_env>");
}
}
}
else
{
rs.close();
pstmt.close();
pstmt = null;
rs = null;
System.out.println( "taxClass :7: " + taxClass );
valueXmlString.append("<line_no__inv>").append("<![CDATA[" + "" + "]]>").append("</line_no__inv>");
valueXmlString.append("<tax_class>").append("<![CDATA[" + "" + "]]>").append("</tax_class>");
valueXmlString.append("<tax_chap>").append("<![CDATA[" + "" + "]]>").append("</tax_chap>");
valueXmlString.append("<tax_env>").append("<![CDATA[" + "" + "]]>").append("</tax_env>");
valueXmlString.append("<rate>").append("<![CDATA[" + "" + "]]>").append("</rate>");
valueXmlString.append("<loc_code>").append("<![CDATA[" + "" + "]]>").append("</loc_code>");
valueXmlString.append("<location_descr>").append("<![CDATA[" + "" + "]]>").append("</location_descr>");
valueXmlString.append("<rate__stduom>").append("<![CDATA[" + "" + "]]>").append("</rate__stduom>");
valueXmlString.append("<conv__rtuom_stduom>").append("<![CDATA[" + "" + "]]>").append("</conv__rtuom_stduom>");
valueXmlString.append("<item_code>").append("<![CDATA[" + "" + "]]>").append("</item_code>");
valueXmlString.append("<item_descr>").append("<![CDATA[" + "" + "]]>").append("</item_descr>");
}
//unit = genericUtility.getColumnValue("unit", dom);
//unit = unit == null || unit.trim().length() == 0 ? "" : unit;
//unitStd = genericUtility.getColumnValue("unit_std", dom);
//unitStd = unitStd == null || unitStd.trim().length() == 0 ? "" : unitStd;
/*
System.out.println( "unit :1: " + unit );
System.out.println( "unitStd :1: " + unitStd );
varValue = genericUtility.getColumnValue("conv__qty_stduom", dom);
if (varValue == null || varValue.trim().length() == 0)
{
varValue = "0";
}
convFact = Double.parseDouble(varValue);
System.out.println( "convFact :1: " +convFact );
System.out.println( "varValue :1: " + varValue );
if ( unit != null && !unit.trim().equals( unitStd.trim() ) )
{
convAr = distCommon.getConvQuantityFact(unit, unitStd, itemCode, quantity, convFact, conn);
convFact = Double.parseDouble( convAr.get(0).toString() );
quantity = Double.parseDouble( convAr.get(1).toString() );
System.out.println( "convFact :2: " +convFact );
System.out.println( "quantity :2: " + quantity );
}
else
{
convFact = 1;
quantity = sQuantity;
System.out.println( "convFact :3: " +convFact );
System.out.println( "quantity :3: " + quantity );
}
System.out.println( "quantity__stduom :3: " + quantity );
valueXmlString.append("<quantity__stduom>").append("<![CDATA[" + quantity + "]]>").append("</quantity__stduom>");
*/
System.out.println("IC3 quantityBefore"+valueXmlString);
reStr = itemChanged(dom, dom1, dom2, objContext, "quantity", editFlag, xtraParams);
pos = reStr.indexOf("<Detail2>");
reStr = reStr.substring(pos + 9);
pos = reStr.indexOf("</Detail2>");
reStr = reStr.substring(0,pos);
valueXmlString.append(reStr);
System.out.println("IC3 quantity"+valueXmlString);
}
}
else if (currentColumn.trim().equals("lot_no") )
{
priceList = genericUtility.getColumnValue("price_list", dom1);
......@@ -2645,7 +3237,7 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
setNodeValue( dom, "mrp_value", quantity * rateClg );
valueXmlString.append("<discount>").append("<![CDATA[" + discount + "]]>").append("</discount>");
setNodeValue( dom, "discount", discount );
System.out.println("END getMinRate start");
StringBuffer minRateBuff = getMinRate( dom, dom1, currentColumn.trim(), valueXmlString, conn );
System.out.println( "minRateBuff2 :: " + minRateBuff.toString() );
valueXmlString = minRateBuff;
......@@ -3023,6 +3615,7 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
valueXmlString.append("<stk_opt>").append("<![CDATA[" + "N" + "]]>").append("</stk_opt>");
mvarValue = distCommon.getDisparams( "999999", "EXPIRED_LOC", conn );
valueXmlString.append("<loc_code>").append("<![CDATA[" + mvarValue + "]]>").append("</loc_code>"); //dw_currobj.setitem(1,"loc_code",mvar_value)
sqlStr = "select descr " //into :ls_loc_descr
......@@ -3069,6 +3662,8 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
mchkDate = distCommon.CalcExpiry( mtranDate, mminShlife );
System.out.println("mchkDate["+mchkDate+"] mexpDate["+mexpDate+"]");
if( mexpDate.before( mchkDate ) )
{
valueXmlString.append("<status>").append("<![CDATA[" + "N" + "]]>").append("</status>");
......@@ -3528,9 +4123,9 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
mvarName = "ALLOC_FGLOC";
}
else
{
{
lsInvoiceId = genericUtility.getColumnValue( "invoice_id", dom1 ); //dw_header.getitemstring(1, "invoice_id")
lsInvoiceId = genericUtility.getColumnValue( "invoice_id", dom ); //dw_header.getitemstring(1, "invoice_id")
System.out.println( "lsInvoiceId :157: " + lsInvoiceId );
if( lsInvoiceId != null && lsInvoiceId.trim().length() > 0 && !"null".equalsIgnoreCase( lsInvoiceId.trim() ) )
{
......@@ -3613,6 +4208,7 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
if (lsLocCode != null && lsLocCode.trim().length() > 0 && !"null".equalsIgnoreCase( lsLocCode.trim() ) )
{
System.out.println( "lsLocCode :5tt: " + lsLocCode );
valueXmlString.append("<loc_code>").append("<![CDATA[" + lsLocCode + "]]>").append("</loc_code>");
setNodeValue( dom, "loc_code", lsLocCode );
//dw_detedit[ii_currformno].setitem(1,"loc_code", ls_loc_code)
......@@ -3645,6 +4241,7 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
{
lsLocCode = distCommon.getDisparams( "999999", "ALLOC_FGLOC", conn );
System.out.println( "lsLocCode :4: " + lsLocCode );
valueXmlString.append("<loc_code>").append("<![CDATA[" + lsLocCode + "]]>").append("</loc_code>");
setNodeValue( dom, "loc_code", lsLocCode );
//dw_detedit[ii_currformno].setitem(1,"loc_code", ls_loc_code)
......@@ -3705,6 +4302,7 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
{
mvarValue = distCommon.getDisparams( "999999", mvarName, conn );
System.out.println( "mvarValue :5: " + mvarValue );
valueXmlString.append("<loc_code>").append("<![CDATA[" + mvarValue + "]]>").append("</loc_code>");
}
if( !"NULLFOUND".equalsIgnoreCase( mvarValue ) )
......@@ -6381,6 +6979,10 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
{
invoiceId = genericUtility.getColumnValue("invoice_id",dom1);
/*if(invoiceId==null || invoiceId.trim().length()==0)
{
invoiceId = genericUtility.getColumnValue("invoice_id",dom);
}*/
System.out.println( "invoiceId :: " + invoiceId );
if (invoiceId != null && invoiceId.trim().length() > 0 )
{
......@@ -6482,7 +7084,8 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
for (int colCtr = 0; colCtr <= colCount; colCtr++)
{
colName = col[colCtr];
if ( "site_code".equalsIgnoreCase(colName.trim()) || "invoice_id".equalsIgnoreCase(colName.trim()) || "cust_code".equalsIgnoreCase(colName.trim()) )
//if ( "site_code".equalsIgnoreCase(colName.trim()) || "invoice_id".equalsIgnoreCase(colName.trim()) || "cust_code".equalsIgnoreCase(colName.trim()) )
if ( "site_code".equalsIgnoreCase(colName.trim()) || "cust_code".equalsIgnoreCase(colName.trim()) )
{
docValue = genericUtility.getColumnValue(colName.trim(),dom1);
}
......@@ -6496,7 +7099,7 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
}
else
{
docKey = docValue;
docKey = docValue.trim();
}
}
sql = " select eff_cost from min_rate_history where doc_key = ?" ;
......
......@@ -235,7 +235,7 @@ public class SalesReturnFormSplit extends ActionHandlerEJB implements SalesRetur
String custCd = "";
String custCodeBill="",custCodeDlv="",siteCodeDlv = "";
double lineNoInv = 0, quantity = 0, netAmountDet = 0, rate = 0, effNetAmountDet = 0,claimQuantity = 0,physicalQuantity=0;
double lineNoInv = 0, quantity = 0, netAmountDet = 0, rate = 0, effNetAmountDet = 0,claimQuantity = 0,physicalQuantity=0,lineNoInvtrace=0;
double convQtyStdUom = 0, convRtUomStdUom = 0, quantityStdUom = 0, rateStdUom = 0;
double discount = 0, taxAmtDet = 0, rateClg = 0, costRate = 0;
......@@ -347,7 +347,7 @@ public class SalesReturnFormSplit extends ActionHandlerEJB implements SalesRetur
projCode = checkNull(rs.getString("proj_code"));
analCode = checkNull(rs.getString("anal_code"));
remarks = checkNull(rs.getString("remarks"));
//fullRet = checkNull(rs.getString("full_ret"));
fullRet = checkNull(rs.getString("full_ret"));
//currCode = checkNull(rs.getString("curr_code"));
currCode = rs.getString("curr_code");
exchRate = rs.getDouble("exch_rate");
......@@ -397,7 +397,7 @@ public class SalesReturnFormSplit extends ActionHandlerEJB implements SalesRetur
rs = null;
// end 21/11/11 manoharan check whether to consider cr_term, ship_to_zip_code in splitcode
sql =" SELECT line_no, invoice_id, line_no__inv, item_code, quantity, net_amt, "
sql =" SELECT line_no, invoice_id, line_no__inv,line_no__invtrace,item_code, quantity, net_amt, "
+ " status, reas_code, loc_code, stk_opt, rate, lot_no, lot_sl, tax_class, "
+ " tax_chap, tax_env, unit, ret_rep_flag, eff_net_amt, conv__qty_stduom, "
+ " conv__rtuom_stduom, unit__std, quantity__stduom, rate__stduom, exp_date, "
......@@ -413,6 +413,7 @@ public class SalesReturnFormSplit extends ActionHandlerEJB implements SalesRetur
{
invoiceIdDet = checkNull(rs.getString("invoice_id"));
lineNoInv = rs.getDouble("line_no__inv");
lineNoInvtrace = rs.getDouble("line_no__invtrace");
itemCode = checkNull(rs.getString("item_code"));
quantity = rs.getDouble("quantity");
claimQuantity = rs.getDouble("claim_qty");
......@@ -448,11 +449,12 @@ public class SalesReturnFormSplit extends ActionHandlerEJB implements SalesRetur
//mfgDate = rs.getDate("mfg_date");
//unitRate = checkNull(rs.getString("unit__rate"));
packCode = checkNull(rs.getString("pack_code"));
//fullRet = checkNull(rs.getString("full_ret"));
fullRet = checkNull(rs.getString("full_ret"));
itemSerDet = checkNull(rs.getString("item_ser"));
rateClg = rs.getDouble("rate__clg");
costRate = rs.getDouble("cost_rate");
crterm = checkNull(rs.getString("cr_term"));
shiptozip = checkNull(rs.getString("ship_to_zip_code"));
// 21/11/11 manoharan check whether to consider cr_term, ship_to_zip_code in splitcode
......@@ -574,11 +576,11 @@ public class SalesReturnFormSplit extends ActionHandlerEJB implements SalesRetur
// 21/11/11 manoharan check whether to consider cr_term, ship_to_zip_code in splitcode
if (crCount > 0 )
{
tempSplitCode = itemSerDet+"@"+crterm+"@"+custCd; // **************** this need to be changed as per taro requirement
tempSplitCode = itemSerDet+"@"+crterm+"@"+custCd+"@"+invoiceIdDet+"@"+statusDet; // **************** this need to be changed as per taro requirement
}
else
{
tempSplitCode = itemSerDet;
tempSplitCode = itemSerDet+"@"+invoiceIdDet+"@"+statusDet;
}
// end 21/11/11 manoharan check whether to consider cr_term, ship_to_zip_code in splitcode
if(splitCodeWiseMap.containsKey(tempSplitCode))
......@@ -597,6 +599,7 @@ public class SalesReturnFormSplit extends ActionHandlerEJB implements SalesRetur
tempMap.put("invoice_id", invoiceIdDet);
tempMap.put("line_no__inv", ("" + lineNoInv));
tempMap.put("line_no__invtrace", ("" + lineNoInvtrace));
tempMap.put("item_code", itemCode);
tempMap.put("quantity", getReqDecimal(quantity, 3));
......@@ -666,10 +669,10 @@ public class SalesReturnFormSplit extends ActionHandlerEJB implements SalesRetur
tempMap.put("unit__rate", unitRate);
tempMap.put("pack_code", packCode);
//tempMap.put("full_ret", fullRet);
tempMap.put("full_ret", "Y");
tempMap.put("full_ret", fullRet);
/*tempMap.put("full_ret", "Y");
System.out.println("Full ret = Y");
tempMap.put("item_ser", itemSerDet);
*/tempMap.put("item_ser", itemSerDet);
if(rateClg != 0)
{
tempMap.put("rate__clg", getReqDecimal(rateClg, 4));
......@@ -936,6 +939,14 @@ public class SalesReturnFormSplit extends ActionHandlerEJB implements SalesRetur
{
xmlBuff.append("<line_no__inv/>");
}
if ( tempMap.get("line_no__invtrace") != null )
{
xmlBuff.append("<line_no__invtrace>" + (String)tempMap.get("line_no__invtrace") + "</line_no__invtrace>");
}
else
{
xmlBuff.append("<line_no__invtrace/>");
}
if ( tempMap.get("item_code") != null )
{
xmlBuff.append("<item_code>" + (String)tempMap.get("item_code") + "</item_code>");
......
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