Commit 5302b200 authored by smane's avatar smane

On item change of cust_code__dlv check Price List value for customer code...

On item change of cust_code__dlv  check Price List value for customer code delivery if does not found for customer code and get price list for getting rate value.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@95986 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 86e7ba4d
......@@ -563,6 +563,7 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
custCode = genericUtility.getColumnValue("cust_code",dom);
siteCode = genericUtility.getColumnValue("site_code",dom);
String tranDateStr = genericUtility.getColumnValue("tran_date",dom);
custCodeDlv = genericUtility.getColumnValue("cust_code__dlv",dom);
tsTranDate = Timestamp.valueOf(genericUtility.getValidDateString(tranDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0" ) ;
invoiceId = genericUtility.getColumnValue("invoice_id",dom);
......@@ -668,7 +669,7 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
valueXmlString.append("<ret_opt>").append("<![CDATA[" + getAbsString( retOpt ) + "]]>").append("</ret_opt>");
setNodeValue( dom, "ret_opt", getAbsString( retOpt ) );
*/
priceListClg = distCommon.getDisparams("999999","PRICE_LIST__CLG",conn);
/*priceListClg = distCommon.getDisparams("999999","PRICE_LIST__CLG",conn);//comment added by sagar on 19/08/14
if((priceListClg == null) || (priceListClg.trim().length() == 0))
{
sql =" select price_list__clg from site_customer where cust_code = ? and site_code = ?";
......@@ -699,6 +700,7 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
pstmt.close();
pstmt = null;
rs = null;
}
priceListClg = priceListClg == null ?"" : priceListClg.trim();
......@@ -707,12 +709,11 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
{
valueXmlString.append("<price_list__clg>").append("<![CDATA[" + getAbsString( priceListClg ) + "]]>").append("</price_list__clg>");
setNodeValue( dom, "price_list__clg", getAbsString( priceListClg ) );
}
} */
//reStr = itemChanged(dom, dom1, dom2, objContext, "ret_opt", editFlag, xtraParams);//comment added by sagar on 05/08/14
//Added by sagar on 05/08/14 start
valueXmlString.append("<cust_code__dlv>").append("<![CDATA[" + getAbsString( custCode ) + "]]>").append("</cust_code__dlv>");
setNodeValue( dom, "cust_code__dlv", getAbsString( custCode ) );
System.out.println(">>>>>>>>>>>>>>>Calling cust_code__dlv IC in cust code>>>>>>>>>>>>>>>>>");
reStr = itemChanged(dom, dom1, dom2, objContext, "cust_code__dlv", editFlag, xtraParams);
//Added by sagar on 05/08/14 end
pos = reStr.indexOf("<Detail1>");
......@@ -834,8 +835,9 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
else if (currentColumn.trim().equals("cust_code__dlv")) //condition added by sagar on 05/08/14
{
custCodeDlv = genericUtility.getColumnValue("cust_code__dlv",dom);
custCode = genericUtility.getColumnValue("cust_code",dom);
siteCode = genericUtility.getColumnValue("site_code",dom);
System.out.println(">>>>>>>In Itemchange of cust_code__dlv:"+custCodeDlv);
System.out.println(">>>>>>>Head.. In Itemchange of cust_code__dlv:"+custCodeDlv);
sql = " select cust_name from customer where cust_code = ?";
pstmt= conn.prepareStatement( sql );
pstmt.setString( 1, custCodeDlv);
......@@ -855,13 +857,12 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
priceList = "";
sql = " select price_list from site_customer where cust_code = ? and site_code = ?";
pstmt= conn.prepareStatement( sql );
pstmt.setString( 1, custCodeDlv);
pstmt.setString( 1, custCode);
pstmt.setString( 2, siteCode);
rs = pstmt.executeQuery();
if( rs.next() )
{
priceList = rs.getString(1);
System.out.println(">>>>>>>Found Price list in site_customer:"+priceList);
}
rs.close();
pstmt.close();
......@@ -872,19 +873,124 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
{
sql = " select price_list from customer where cust_code = ?";
pstmt= conn.prepareStatement( sql );
pstmt.setString( 1, custCodeDlv);
pstmt.setString( 1, custCode);
rs = pstmt.executeQuery();
if( rs.next() )
{
priceList = rs.getString(1);
System.out.println(">>>>>>>Found Price list in customer:"+priceList);
}
rs.close();
pstmt.close();
pstmt = null;
rs = null;
}
valueXmlString.append("<price_list>").append("<![CDATA[" + getAbsString(priceList) + "]]>").append("</price_list>");
//check price list value for customer code delivery... on 14/08/14 start
if (priceList == null || priceList.trim().length() == 0)
{
sql = " select price_list from site_customer where cust_code = ? and site_code = ?";
pstmt= conn.prepareStatement( sql );
pstmt.setString( 1, custCodeDlv);
pstmt.setString( 2, siteCode);
rs = pstmt.executeQuery();
if( rs.next() )
{
priceList = rs.getString(1);
}
rs.close();
pstmt.close();
pstmt = null;
rs = null;
if (priceList == null || priceList.trim().length() == 0)
{
sql = " select price_list from customer where cust_code = ?";
pstmt= conn.prepareStatement( sql );
pstmt.setString( 1, custCodeDlv);
rs = pstmt.executeQuery();
if( rs.next() )
{
priceList = rs.getString(1);
}
rs.close();
pstmt.close();
pstmt = null;
rs = null;
}
}
//check price list value for customer code delivery... on 14/08/14 end
}
valueXmlString.append("<price_list>").append("<![CDATA[" + getAbsString(priceList) + "]]>").append("</price_list>");
//Price List Clg value set on cust_code_dlv item change instead of cust_code, added by sagar on 19/08/14....
priceListClg = distCommon.getDisparams("999999","PRICE_LIST__CLG",conn);
if((priceListClg == null) || (priceListClg.trim().length() == 0))
{
sql =" select price_list__clg from site_customer where cust_code = ? and site_code = ?";
pstmt= conn.prepareStatement( sql );
pstmt.setString( 1, custCode );
pstmt.setString( 2, siteCode );
rs = pstmt.executeQuery();
if ( rs.next() )
{
priceListClg = rs.getString(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
priceListClg = priceListClg == null ?"" : priceListClg.trim();
if( priceListClg == null || priceListClg.trim().length() == 0 )
{
sql =" select price_list__clg from customer where cust_code = ? ";
pstmt= conn.prepareStatement( sql );
pstmt.setString( 1, custCode );
rs = pstmt.executeQuery();
if( rs.next() )
{
priceListClg = rs.getString(1);
}
rs.close();
pstmt.close();
pstmt = null;
rs = null;
//Check price_list__clg for customer code delivery ..Added by sagar on 19/08/14 ..start
if( priceListClg == null || priceListClg.trim().length() == 0 )
{
sql =" select price_list__clg from site_customer where cust_code = ? and site_code = ?";
pstmt= conn.prepareStatement( sql );
pstmt.setString( 1, custCodeDlv );
pstmt.setString( 2, siteCode );
rs = pstmt.executeQuery();
if ( rs.next() )
{
priceListClg = rs.getString(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if( priceListClg == null || priceListClg.trim().length() == 0 )
{
sql =" select price_list__clg from customer where cust_code = ? ";
pstmt= conn.prepareStatement( sql );
pstmt.setString( 1, custCodeDlv );
rs = pstmt.executeQuery();
if( rs.next() )
{
priceListClg = rs.getString(1);
}
rs.close();
pstmt.close();
pstmt = null;
rs = null;
}
}
//Check price_list__clg for customer code delivery ..Added by sagar on 19/08/14 ..end
}
priceListClg = priceListClg == null ?"" : priceListClg.trim();
}
if (priceListClg != null && priceListClg.trim().length() > 0 && !"null".equalsIgnoreCase( priceListClg.trim() ) )
{
valueXmlString.append("<price_list__clg>").append("<![CDATA[" + getAbsString( priceListClg ) + "]]>").append("</price_list__clg>");
setNodeValue( dom, "price_list__clg", getAbsString( priceListClg ) );
}
}
valueXmlString.append("</Detail1>");
break;
......@@ -1121,7 +1227,7 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
siteCode = genericUtility.getColumnValue("site_code",dom1);
tranDate = genericUtility.getColumnValue("tran_date",dom1);
custCode = genericUtility.getColumnValue("cust_code",dom1);
priceList = genericUtility.getColumnValue("price_list",dom1);
//priceList = genericUtility.getColumnValue("price_list",dom1); //comment added by sagar on 18/08/14..
sRate = genericUtility.getColumnValue( "rate", dom );
itemSer = distCommon.getItemSer(itemCode,siteCode,Timestamp.valueOf(genericUtility.getValidDateString(tranDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0"),custCode,"C",conn);
......@@ -1187,6 +1293,9 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
infoMap.put("invoice_id", invoiceId);
//infoMap.put( "line_no__invtrace", genericUtility.getColumnValue( "line_no__invtrace", dom ) );
infoMap.put( "quantity__stduom", new Double( -1 * qtyStdUom ) );
priceList=getPriceList(dom1,dom,conn);//Getting PriceList Value, method added by sagar on 19/08/14..
System.out.println(">>>>>>>>>>Check priceList for getCost Rate 1:"+priceList);
infoMap.put( "price_list", priceList);
costRate = getCostRate( infoMap, conn );
infoMap = null;
......@@ -1265,6 +1374,9 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
setNodeValue( dom, "tax_env", taxEnv );
}
}
priceList=getPriceList(dom1,dom,conn);//Getting PriceList Value, method added by sagar on 19/08/14..
System.out.println(">>>>>>>>>>Check priceList in item_code:"+priceList);
if (priceList == null || priceList.trim().length() == 0)
{
......@@ -1313,6 +1425,7 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
{
tranDate = tranDate == null ? ( new Timestamp( System.currentTimeMillis() ) ).toString() : tranDate;
rate = distCommon.pickRate(priceList,tranDate,itemCode," ","L",qtyStdUom, conn);
System.out.println(">>>>>>>>>>Check rate in item_code:"+rate);
varValue = distCommon.getPriceListType(priceList,conn);
varValue = varValue == null ?"" : varValue.trim();
......@@ -1487,6 +1600,9 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
siteCode = genericUtility.getColumnValue("site_code", dom1);
priceList = genericUtility.getColumnValue("price_list", dom1);
effAmt = getTotEffAmt( tranId, conn ) - getTotAmtForRep( dom2 );
priceList=getPriceList(dom1,dom,conn);//Getting PriceList Value, method added by sagar on 19/08/14..
System.out.println(">>>>>>>>>>Check priceList for itemValue2Quantity:"+priceList);
quantity = itemValue2Quantity(siteCode, itemCode, priceList, effAmt, conn);
if (quantity > 0)
{
......@@ -1620,8 +1736,10 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
if (!"B".equals(listType) && !"F".equals(listType))
{
tranDate = tranDate == null ? ( new Timestamp( System.currentTimeMillis() ) ).toString() : tranDate;
tranDate = tranDate == null ? ( new Timestamp( System.currentTimeMillis() ) ).toString() : tranDate;
System.out.println(">>>>>>>>>>Check priceListClg in rate:"+priceListClg);
rateClg = distCommon.pickRate(priceListClg,tranDate,itemCode," ","L",qtyStdUom, conn);
System.out.println(">>>>>>>>>>Check rateClg in rate:"+rateClg);
System.out.println("rateClg from pick rate="+rateClg);
//change by kunal on 20/AUG/13 get rateClg from pick rate method
/*if (rateClg <= 0 && priceListClg.trim().length() > 0)
......@@ -1844,12 +1962,16 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
}
if (pickLowerRate.equals("Y"))
{
priceList=getPriceList(dom1,dom,conn);//Getting PriceList Value, method added by sagar on 19/08/14..
System.out.println(">>>>>>>>>>Check priceList in line_no__inv:"+priceList);
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(">>>>>>>>>>Check priceListRate in line_no__inv:"+priceListRate);
System.out.println( "IN priceListRate :: " + priceListRate );
if (priceListRate < rate )
{
......@@ -1863,6 +1985,7 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
setNodeValue( dom, "rate", rate );
rateClg = sRateClg ;
priceListClg = genericUtility.getColumnValue("price_list__clg", dom1);//added by sagar on 19/08/14..
priceListClg = priceListClg == null ?"" : priceListClg.trim();
if (rateClg <= 0 )
{
......@@ -1871,8 +1994,9 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
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;
System.out.println(">>>>>>>>>>Check priceListClg in line_no__inv 2:"+priceListClg);
rateClg = distCommon.pickRate(priceListClg,tranDate,itemCode,lotNo,"L", quantity, conn);
System.out.println(">>>>>>>>>>Check rateClg in line_no__inv 2:"+rateClg);
if (rateClg == -1)
{
rateClg = 0 ;
......@@ -2142,6 +2266,9 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
infoMap.put("invoice_id", invoiceId);
//infoMap.put("line_no__invtrace",lineNoTrace);
infoMap.put( "quantity__stduom", new Double( -1 * quantity ) );
priceList=getPriceList(dom1,dom,conn);//Getting PriceList Value, method added by sagar on 18/08/14..
System.out.println(">>>>>>>>>>Check priceList for getCost Rate 2:"+priceList);
infoMap.put( "price_list", priceList);
costRate = getCostRate(infoMap, conn);
infoMap = null;
valueXmlString.append("<cost_rate>").append("<![CDATA[" + costRate + "]]>").append("</cost_rate>");
......@@ -2249,13 +2376,15 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
} // retReplFlag = R
else
{
System.out.println( "priceList :2 : " + priceList );
priceList=getPriceList(dom1,dom,conn);//Getting PriceList Value, method added by sagar on 19/08/14..
System.out.println(">>>>>>>>>>Check priceList in lot_no:"+priceList);
if (priceList != null && !priceList.equals("null") && priceList.trim().length() > 0)
{
tranDate = tranDate == null ? ( genericUtility.getValidDateString( new Timestamp( System.currentTimeMillis() ).toString(), genericUtility.getDBDateFormat(), genericUtility.getApplDateFormat() ) ).toString() : tranDate;
itemCode = itemCode == null ? "" : itemCode;
lotNo = lotNo == null ? "" : lotNo;
rate = distCommon.pickRate(priceList,tranDate,itemCode,lotNo,"D",qtyStdUom, conn);
System.out.println(">>>>>>>>>>Check rate in lot_no:"+rate);
System.out.println( "rate pic rate LOt NO :: " + rate );
}
}
......@@ -2279,12 +2408,16 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
if (rate <= 0)
{
rate = 0;
priceList=getPriceList(dom1,dom,conn);//Getting PriceList Value, method added by sagar on 19/08/14..
System.out.println(">>>>>>>>>>Check priceList in lot_no 2:"+priceList);
if (priceList != null && !priceList.equals("null") && priceList.trim().length() > 0)
{
tranDate = tranDate == null ? ( genericUtility.getValidDateString( new Timestamp( System.currentTimeMillis() ).toString(), genericUtility.getDBDateFormat(), genericUtility.getApplDateFormat() ) ).toString() : tranDate;
itemCode = itemCode == null ? "" : itemCode;
lotNo = lotNo == null ? "" : lotNo;
rate = distCommon.pickRate(priceList,tranDate,itemCode,lotNo,"D",qtyStdUom, conn);
System.out.println(">>>>>>>>>>Check rate in lot_no 2:"+rate);
System.out.println( "rate in If :1: " + rate );
}
}
......@@ -2297,12 +2430,16 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
}
if ( pickLowerRate != null && pickLowerRate.equals("Y"))
{
priceList=getPriceList(dom1,dom,conn);//Getting PriceList Value, method added by sagar on 19/08/14..
System.out.println(">>>>>>>>>>Check priceList in lot_no 3:"+priceList);
if (priceList !=null && priceList.trim().length() > 0)
{
tranDate = tranDate == null ? ( genericUtility.getValidDateString( new Timestamp( System.currentTimeMillis() ).toString(), genericUtility.getDBDateFormat(), genericUtility.getApplDateFormat() ) ).toString() : tranDate;
itemCode = itemCode == null ? "" : itemCode;
lotNo = lotNo == null ? "" : lotNo;
priceListRate = distCommon.pickRate(priceList,tranDate,itemCode,lotNo,"D", quantity, conn);
System.out.println(">>>>>>>>>>Check priceListRate in lot_no 3:"+priceListRate);
System.out.println( "priceListRate LOt NO :: " + priceListRate );
if (priceListRate < rate && priceListRate > 0 )
{
......@@ -2318,12 +2455,15 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
rateClg = sRateClg;
if (rateClg <= 0 )
{
priceListClg = genericUtility.getColumnValue("price_list__clg", dom1);//added by sagar on 19/08/14..
System.out.println(">>>>>>>>>>Check priceListClg in lot_no 4:"+priceListClg);
if ( priceListClg != null && priceListClg.trim().length() > 0 && !"null".equalsIgnoreCase( priceListClg.trim() ) )
{
tranDate = tranDate == null ? ( genericUtility.getValidDateString( new Timestamp( System.currentTimeMillis() ).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);
System.out.println(">>>>>>>>>>Check rateClg in lot_no 4:"+rateClg);
if (rateClg == -1)
{
rateClg = 0 ;
......@@ -4017,6 +4157,8 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
System.out.println("valueXmlString:::::"+valueXmlString.toString());
return ( valueXmlString == null || valueXmlString.toString().trim().length() == 0 ? "" : valueXmlString.toString() );
}//END OF ITEMCHANGE
public String wfValData(Document dom, Document dom1,Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{
NodeList parentNodeList = null;
......@@ -4925,12 +5067,15 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
ldTaxdate = Timestamp.valueOf(genericUtility.getValidDateString( ldTaxdateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
String lcQtystdStr = genericUtility.getColumnValue( "quantity__stduom", dom ); //dw_detedit[ii_currformno].getitemnumber(dw_detedit[ii_currformno].getrow(),"quantity__stduom")
lcQtystd = Double.parseDouble( lcQtystdStr == null || lcQtystdStr.trim().length() == 0 ? "0" : lcQtystdStr.trim() );
lsPricelist=getPriceList(dom1,dom,conn);//Getting PriceList Value, method added by sagar on 19/08/14..
System.out.println(">>>>>>>>>>Check lsPricelist in rate & rate_studom val:"+lsPricelist);
if( lsPricelist != null && lsPricelist.trim().length() > 0 && !"null".equalsIgnoreCase( lsPricelist.trim() ) )
{
//lcRateInv = i_nvo_gbf_func.gbf_pick_rate(ls_pricelist,ld_taxdate ,ls_item_code,ls_lot_no,'',lc_qtystd)
lsLotNo = lsLotNo == null ? "" : lsLotNo;
itemCode = itemCode == null ? "" : itemCode;
lcRateInv = distCommon.pickRate(lsPricelist,ldTaxdateStr,itemCode,lsLotNo,"D",lcQtystd, conn );
System.out.println(">>>>>>>>>>Check lcRateInv in rate & rate_studom val:"+lcRateInv);
}
if( lcRate < 0 )
{
......@@ -5678,7 +5823,6 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
//lineNoTrace = ( infoMap.get("line_no__invtrace") == null ? null : infoMap.get("line_no__invtrace").toString() );
qtyStdUom = Double.parseDouble( ( infoMap.get("quantity__stduom") == null ? "0" : infoMap.get("quantity__stduom").toString() ) );
if ("P".equals(retReplFlag))
{
sql = " select rate "
......@@ -5778,12 +5922,16 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
{
priceList = distCommon.getDisparams("999999","SRETCOST_PLIST",conn);
}
priceList = ( infoMap.get("price_list") == null ? null : infoMap.get("price_list").toString() ); //Added by sagar on 19/08/14
System.out.println(">>>>>>>>>>Check priceList in getCostRate:"+priceList);
if (priceList != null && !"NULLFOUND".equals(priceList) && priceList.trim().length() > 0)
{
tranDate = tranDate == null ? ( genericUtility.getValidDateString( new Timestamp( System.currentTimeMillis() ).toString(), genericUtility.getDBDateFormat(), genericUtility.getApplDateFormat() ) ).toString() : tranDate;
itemCode = itemCode == null ? "" : itemCode;
lotNo = lotNo == null ? "" : lotNo;
costRate = distCommon.pickRate(priceList,tranDate,itemCode,lotNo,"L",qtyStdUom, conn);
System.out.println(">>>>>>>>>>Check costRate in getCostRate:"+costRate);
}
}
distCommon = null;
......@@ -5959,6 +6107,7 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
itemCode = itemCode == null ? "" : itemCode;
lotNo = lotNo == null ? "" : lotNo;
rate = distCommon.pickRate(priceList, genericUtility.getValidDateString( today.toString(), genericUtility.getDBDateFormat(), genericUtility.getApplDateFormat() ), itemCode, lotNo, "D", conn);
System.out.println(">>>>>>>>>>Check rate in itemValue2Quantity:"+rate);
if (rate <= 0)
{
continue;
......@@ -6067,7 +6216,7 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
{
DistCommon distCommon = new DistCommon();
String invoiceId = null, retReplFlag = null, sql = "";
String itemCode = null;
String itemCode = null,custCode="",custCodeDlv="";
String siteCode = null;
String lotNo = null;
String priceList = null;
......@@ -6234,11 +6383,14 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
tranDate = tranDate == null ? ( genericUtility.getValidDateString( new Timestamp( System.currentTimeMillis() ).toString(), genericUtility.getDBDateFormat(), genericUtility.getApplDateFormat() ) ).toString() : tranDate;
itemCode = itemCode == null ? "" : itemCode;
lotNo = lotNo == null ? "" : lotNo;
priceList=getPriceList(dom1,dom,conn);//Getting PriceList Value, method added by sagar on 19/08/14..
System.out.println(">>>>>>>>>>Check priceList in getMinRate:"+priceList);
minRate = distCommon.pickRate(priceList,tranDate,itemCode,lotNo,"D",qtyStdUom, conn);
System.out.println(">>>>>>>>>>Check minRate in getMinRate:"+minRate);
}
ArrayList convList = null;
if ( !unitRate.equalsIgnoreCase( unitStd ) )
{
double fact = 1;
......@@ -6610,4 +6762,148 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
}
return errCode;
}
private String getPriceList(Document dom1, Document dom, Connection conn) throws ITMException
{
PreparedStatement pstmt2 = null, pstmt1 = null;
ResultSet rs2 = null, rs1 = null ;
String sql2="";
Timestamp trDate = null;
String custCode="",custCodeDlv="",tranDate="",siteCode="",itemCode="",priceList="";
try
{
System.out.println(">>>>>>>>>>>>>Calling Dom getPriceList ");
custCode = genericUtility.getColumnValue("cust_code",dom1);
custCodeDlv = genericUtility.getColumnValue("cust_code__dlv",dom1);
tranDate = genericUtility.getColumnValue("tran_date", dom1);
siteCode = genericUtility.getColumnValue("site_code",dom1);
itemCode = genericUtility.getColumnValue("item_code",dom);
System.out.println(">>>>>>>>>>>custCode:"+custCode);
System.out.println(">>>>>>>>>>>custCodeDlv:"+custCodeDlv);
System.out.println(">>>>>>>>>>>tranDate:"+tranDate);
System.out.println(">>>>>>>>>>>siteCode:"+siteCode);
System.out.println(">>>>>>>>>>>itemCode:"+itemCode);
trDate= Timestamp.valueOf(genericUtility.getValidDateString(tranDate, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
System.out.println(">>>>>>>>>Tran Date:"+tranDate);
sql2 = " select g.price_list from group_pricelist g,pricelist p where " +
" g.cust_code = ? " +
" and p.item_code = ? " +
" and (? between to_date(g.eff_from) and to_date(g.valid_upto)) ";
pstmt2 = conn.prepareStatement(sql2);
pstmt2.setString(1,custCode);
pstmt2.setString(2,itemCode);
pstmt2.setTimestamp(3,trDate);
rs2 = pstmt2.executeQuery();
if(rs2.next())
{
priceList = rs2.getString("price_list");
}
pstmt2.close();
pstmt2 = null;
rs2.close();
rs2 = null;
if(priceList == null || priceList.trim().length() == 0)
{
//sql2 = "select price_list from site_customer where site_code = ? and cust_code=?";
sql2 = "select price_list from site_customer where site_code = ? and cust_code=?";
pstmt2 = conn.prepareStatement(sql2);
pstmt2.setString(1,siteCode);
pstmt2.setString(2,custCode);
rs2 = pstmt2.executeQuery();
if(rs2.next())
{
priceList = rs2.getString(1);
if(priceList==null)
{
priceList="";
}
}
pstmt2.close();
pstmt2 = null;
rs2.close();
rs2 = null;
if(priceList == null || priceList.trim().length() == 0)
{
sql2 = "select price_list from customer where cust_code = ?";
pstmt2 = conn.prepareStatement(sql2);
pstmt2.setString(1,custCode);
rs2 = pstmt2.executeQuery();
if(rs2.next())
{
priceList = rs2.getString(1);
}
pstmt2.close();
pstmt2 = null;
rs2.close();
rs2 = null;
if(priceList == null || priceList.trim().length() == 0)
{
System.out.println(">>>>>>>>>>>in Getting priceList Null found for Customer Code:"+priceList);
sql2 = " select g.price_list from group_pricelist g,pricelist p where " +
" g.cust_code = ? " +
" and p.item_code = ? " +
" and (? between to_date(g.eff_from) and to_date(g.valid_upto)) ";
pstmt2 = conn.prepareStatement(sql2);
pstmt2.setString(1,custCodeDlv);
pstmt2.setString(2,itemCode);
pstmt2.setTimestamp(3,trDate);
rs2 = pstmt2.executeQuery();
if(rs2.next())
{
priceList = rs2.getString("price_list");
}
pstmt2.close();
pstmt2 = null;
rs2.close();
rs2 = null;
if(priceList == null || priceList.trim().length() == 0)
{
sql2 = "select price_list from site_customer where site_code = ? and cust_code=?";
pstmt2 = conn.prepareStatement(sql2);
pstmt2.setString(1,siteCode);
pstmt2.setString(2,custCodeDlv);
rs2 = pstmt2.executeQuery();
if(rs2.next())
{
priceList = rs2.getString(1);
}
pstmt2.close();
pstmt2 = null;
rs2.close();
rs2 = null;
if(priceList == null || priceList.trim().length() == 0)
{
sql2 = "select price_list from customer where cust_code = ?";
pstmt2 = conn.prepareStatement(sql2);
pstmt2.setString(1,custCodeDlv);
rs2 = pstmt2.executeQuery();
if(rs2.next())
{
priceList = rs2.getString(1);
}
pstmt2.close();
pstmt2 = null;
rs2.close();
rs2 = null;
}
}
}
}
}
if(priceList == null || priceList.trim().length() == 0)
{
priceList="";
}
}
catch(Exception e)
{
System.out.println("Exception in getPriceList:==>\n"+e.getMessage());
e.printStackTrace();
throw new ITMException( e );
}
System.out.println(">>>>return priceList:"+priceList);
return priceList;
}
}
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