Commit 0db3cb2e authored by jshinde's avatar jshinde

Src merged in head from dis branch-ibase3-webitm-dis5-12-121-29

Chnages done as hold quantity is not transefer while confirming the distribution reciept.-Saurabh[26/10/16]


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@103834 ce508802-f39f-4f6c-b175-0d175dae99d5
parent ce1bc746
...@@ -523,13 +523,17 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -523,13 +523,17 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
}*/ }*/
//Added by azhar[24/10/16|Start]
/*sql = "select count(*) from cust_stock where status='S' " +
"and cust_code=? and from_date=? and to_date =?";*/
sql = "select count(*) from cust_stock where status='S' " + sql = "select count(*) from cust_stock where status='S' " +
"and cust_code=? and from_date=? and to_date =?"; "and cust_code=? and from_date=? and to_date =? and item_ser = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,custCode); pstmt.setString(1,custCode);
pstmt.setTimestamp(2,FromDate); pstmt.setTimestamp(2,FromDate);
pstmt.setTimestamp(3,ToDate); pstmt.setTimestamp(3,ToDate);
pstmt.setString(4, itemSer);
//Added by azhar[24/10/16|End]
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
...@@ -551,12 +555,17 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -551,12 +555,17 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
if("A".equalsIgnoreCase(editSatus)) if("A".equalsIgnoreCase(editSatus))
{ {
//Added by Azhar[25/10/16|Start]
//sql = "select count(*) from cust_stock where " +
// " cust_code=? and from_date=? and to_date =?";
sql = "select count(*) from cust_stock where " + sql = "select count(*) from cust_stock where " +
" cust_code=? and from_date=? and to_date =?"; " cust_code=? and from_date=? and to_date =? and item_ser = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,custCode); pstmt.setString(1,custCode);
pstmt.setTimestamp(2,FromDate); pstmt.setTimestamp(2,FromDate);
pstmt.setTimestamp(3,ToDate); pstmt.setTimestamp(3,ToDate);
pstmt.setString(4, itemSer);
//Added by Azhar[25/10/16|End]
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
...@@ -2784,7 +2793,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -2784,7 +2793,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
{ {
calCriItemSerList.add(arrStr[i].trim()); calCriItemSerList.add(arrStr[i].trim());
} }
sql= "select item_ser from sales_pers where sales_pers=?"; /*sql= "select item_ser from sales_pers where sales_pers=?";
pstmt1 = conn.prepareStatement(sql); pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, loginEmpCode ); pstmt1.setString(1, loginEmpCode );
rs1 = pstmt1.executeQuery(); rs1 = pstmt1.executeQuery();
...@@ -2797,8 +2806,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -2797,8 +2806,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
rs1 = null; rs1 = null;
pstmt1.close(); pstmt1.close();
pstmt1 = null; pstmt1 = null;
*/
if(calCriItemSerList.contains(salesItemSer.trim())) if(calCriItemSerList.contains(itemSer.trim()))
{ {
isItemSer=true; isItemSer=true;
} }
...@@ -2902,7 +2911,16 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -2902,7 +2911,16 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
pstmt1 = null;*/ pstmt1 = null;*/
netAmt=0; netAmt=0;
sql= "select quantity__stduom,rate__stduom " + sql= "select quantity__stduom,rate__stduom " +
" from invoice_trace where invoice_id=? and item_ser__prom in ("+resultItemSer+") "; " from invoice_trace where invoice_id=? ";
if(isItemSer)
{
sql=sql+ " and ( item_ser__prom in (" + resultItemSer + ") OR((item_ser__prom,ITEM_CODE) "
+ " IN (select item_ser,item_code from item_credit_perc WHERE item_ser NOT IN (" + resultItemSer + "))) ) " ;
}else
{
sql=sql+" and ( item_ser__prom in (" + resultItemSer + ")) ";
}
//"and item_ser__prom in ("+resultItemSer+") ";
pstmt1 = conn.prepareStatement(sql); pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, invoiceId); pstmt1.setString(1, invoiceId);
//pstmt1.setString(2, itemSer); //pstmt1.setString(2, itemSer);
...@@ -3140,11 +3158,17 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -3140,11 +3158,17 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
//" and( itrace.item_ser__prom in ("+resultItemSer+") OR((itrace.item_ser__prom,itrace.ITEM_CODE) " + //" and( itrace.item_ser__prom in ("+resultItemSer+") OR((itrace.item_ser__prom,itrace.ITEM_CODE) " +
//" IN (select item_ser,item_code from item_credit_perc WHERE item_ser NOT IN ("+resultItemSer+") )) ) "+ //" IN (select item_ser,item_code from item_credit_perc WHERE item_ser NOT IN ("+resultItemSer+") )) ) "+
sql=sql+" and ( invoice.confirmed = 'Y' ) and ( (invoice.tran_date >= ? ) " + sql=sql+" and ( invoice.confirmed = 'Y' ) and ( (invoice.tran_date >= ? ) " +
" and (invoice.tran_date <= ? ) or " + " and (invoice.tran_date <= ? ) " +
" ((invoice.tran_date >= ? ) and (invoice.tran_date <= ? ) ) " + /**
" and(exists (SELECT cust_stock_inv.invoice_id FROM cust_stock_inv cust_stock_inv " + * The lines are commented
* to avoid duplicate Invoice.
* */
// "or " +
// " ((invoice.tran_date >= ? ) and (invoice.tran_date <= ? ) ) " +
" and( not exists (SELECT cust_stock_inv.invoice_id FROM cust_stock_inv cust_stock_inv " +
" WHERE cust_stock_inv.invoice_id = invoice.invoice_id and " + " WHERE cust_stock_inv.invoice_id = invoice.invoice_id and " +
" cust_stock_inv.dlv_flg = 'N' )))" + " cust_stock_inv.dlv_flg = 'N' ))" +
")" +
" UNION " + " UNION " +
" SELECT distinct cinv.invoice_id ," + " SELECT distinct cinv.invoice_id ," +
" cinv.INVOICE_DATE,cinv.DLV_FLG ,cinv.net_amt ,'' as tran_id FROM CUST_STOCK_INV cinv , " + " cinv.INVOICE_DATE,cinv.DLV_FLG ,cinv.net_amt ,'' as tran_id FROM CUST_STOCK_INV cinv , " +
...@@ -3162,6 +3186,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -3162,6 +3186,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
//" and itrace.item_ser__prom in ("+resultItemSer+") " + //" and itrace.item_ser__prom in ("+resultItemSer+") " +
//" and invoice.inv_type=? " + //" and invoice.inv_type=? " +
sql=sql+" and invoice.confirmed = 'Y'" + sql=sql+" and invoice.confirmed = 'Y'" +
" AND invoice.TRAN_DATE <= ? " + //VALLABH KADAM
" and CASE WHEN cinv.dlv_flg IS NULL THEN 'N' ELSE cinv.dlv_flg END='N' "+ " and CASE WHEN cinv.dlv_flg IS NULL THEN 'N' ELSE cinv.dlv_flg END='N' "+
" UNION "+ " UNION "+
"select '' as invoice_id ,srn.tran_date,'N' as DLV_FLG,srn.net_amt,sdet.tran_id as tran_id " + "select '' as invoice_id ,srn.tran_date,'N' as DLV_FLG,srn.net_amt,sdet.tran_id as tran_id " +
...@@ -3190,15 +3215,16 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -3190,15 +3215,16 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
//pstmt.setString(3, itemSer); //pstmt.setString(3, itemSer);
pstmt.setTimestamp(2, FromDate); pstmt.setTimestamp(2, FromDate);
pstmt.setTimestamp(3, ToDate); pstmt.setTimestamp(3, ToDate);
pstmt.setTimestamp(4, prdFrom); //pstmt.setTimestamp(4, prdFrom);
pstmt.setTimestamp(5, prdTo); //pstmt.setTimestamp(5, prdTo);
pstmt.setString(6, custCode); pstmt.setString(4, custCode);
pstmt.setTimestamp(5, ToDate);
//pstmt.setString(9, itemSer); //pstmt.setString(9, itemSer);
//pstmt.setString(8, orderType); //pstmt.setString(8, orderType);
//pstmt.setString(11, itemSer); //pstmt.setString(11, itemSer);
pstmt.setTimestamp(7, FromDate); pstmt.setTimestamp(6, FromDate);
pstmt.setTimestamp(8, ToDate); pstmt.setTimestamp(7, ToDate);
pstmt.setString(9, custCode); pstmt.setString(8, custCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while(rs.next()) while(rs.next())
{ {
...@@ -3270,7 +3296,16 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -3270,7 +3296,16 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("dlvFlgCnt ####"+dlvFlgCnt); System.out.println("dlvFlgCnt ####"+dlvFlgCnt);
netAmt=0.0; netAmt=0.0;
sql= "select quantity__stduom,rate__stduom from invoice_trace where invoice_id=? and item_ser__prom in ("+resultItemSer+") "; sql= "select quantity__stduom,rate__stduom from invoice_trace where invoice_id=? ";
if(isItemSer)
{
sql=sql+ " and ( item_ser__prom in (" + resultItemSer + ") OR((item_ser__prom,ITEM_CODE) "
+ " IN (select item_ser,item_code from item_credit_perc WHERE item_ser NOT IN (" + resultItemSer + "))) ) " ;
}else
{
sql=sql+" and ( item_ser__prom in (" + resultItemSer + ")) ";
}
//and item_ser__prom in ("+resultItemSer+") ";
pstmt1 = conn.prepareStatement(sql); pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, invoiceId); pstmt1.setString(1, invoiceId);
//pstmt1.setString(2, itemSer); //pstmt1.setString(2, itemSer);
...@@ -3942,6 +3977,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -3942,6 +3977,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("-------calculate Primary Sales for availble transcaion Id--------"); System.out.println("-------calculate Primary Sales for availble transcaion Id--------");
primarySales=0.0; primarySales=0.0;
System.out.println(""); System.out.println("");
/* Commented by manoj dtd 26/10/2016 to set actual value of primary sales
if(receiptLast > (sretQtyAllTot) ) if(receiptLast > (sretQtyAllTot) )
{ {
primarySales = receiptLast - (sretQtyAllTot); primarySales = receiptLast - (sretQtyAllTot);
...@@ -3949,7 +3985,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -3949,7 +3985,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
else else
{ {
primarySales = receiptLast; primarySales = receiptLast;
} }*/
primarySales = receiptLast - (sretQtyAllTot);
System.out.println("primarySales cal for avaible transcation id :"+primarySales); System.out.println("primarySales cal for avaible transcation id :"+primarySales);
salesLast=opStockLast+(receiptLast)+returnReciptRepl-billRetQty-clStockNew; salesLast=opStockLast+(receiptLast)+returnReciptRepl-billRetQty-clStockNew;
...@@ -4206,6 +4243,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -4206,6 +4243,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
transitQtyBon=0.0; transitQtyBon=0.0;
System.out.println("--calculate primary sales which is not included for current or previous month transcation------"); System.out.println("--calculate primary sales which is not included for current or previous month transcation------");
primarySalesAll=0.0; primarySalesAll=0.0;
/*
Commented by Manoj dtd 26/10/2016 to set Actual Primary Sales
if(rcpQtyAll > (sretQtyAllTot )) if(rcpQtyAll > (sretQtyAllTot ))
{ {
primarySalesAll = rcpQtyAll - (sretQtyAllTot ); primarySalesAll = rcpQtyAll - (sretQtyAllTot );
...@@ -4213,7 +4252,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -4213,7 +4252,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
else else
{ {
primarySalesAll = rcpQtyAll; primarySalesAll = rcpQtyAll;
} }*/
primarySalesAll= rcpQtyAll - (sretQtyAllTot );
System.out.println("Primary Sales for not available in last or current tranaction"+"itemCode :"+itemCode +"primarySales :"+primarySalesAll); System.out.println("Primary Sales for not available in last or current tranaction"+"itemCode :"+itemCode +"primarySales :"+primarySalesAll);
System.out.println("--calculate Transit Quantoty which is not included for current or previous month transcation------"); System.out.println("--calculate Transit Quantoty which is not included for current or previous month transcation------");
...@@ -4773,7 +4813,33 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -4773,7 +4813,33 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
rs1 = null; rs1 = null;
pstmt1.close(); pstmt1.close();
pstmt1 = null; pstmt1 = null;
rateAll = discmn.pickRate(priceList,sysDate,itemCode1,conn); //Added by saurabh to get rate from DDF_PICK_MAX_RATE fuction[18/10/16|Start]
//rateAll = discmn.pickRate(priceList,sysDate,itemCode1,conn);
sysDate = genericUtility.getValidDateString( sysDate , getApplDateFormat() , getDBDateFormat());
sql = "SELECT DDF_PICK_MAX_SLAB_RATE( ?, TO_DATE( ? , ? ), ? ) FROM DUAL ";
pstmt = conn.prepareStatement( sql );
pstmt.setString( 1, priceList );
pstmt.setString( 2, sysDate );
pstmt.setString( 3, getDBDateFormat() );
pstmt.setString( 4, itemCode1 );
rs = pstmt.executeQuery();
if (rs.next())
{
rateAll = rs.getDouble(1);
System.out.println("rateAll-----------> [" +rateAll+ "]");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
rateAll=getRequiredDcml(rateAll,3);
//Added by saurabh to get rate from DDF_PICK_MAX_RATE fuction[18/10/16|end]
System.out.println("rateAll>>>>>"+rateAll); System.out.println("rateAll>>>>>"+rateAll);
closingValue=closingValue+formulaValue*rateAll; closingValue=closingValue+formulaValue*rateAll;
closingValue=getRequiredDcml(closingValue,3); closingValue=getRequiredDcml(closingValue,3);
...@@ -4782,6 +4848,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -4782,6 +4848,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
}else }else
{ {
calRate=getOpeningRate(orderTypeHeader,itemSerHeaderSplit,selectedInvList,rcpQtmDom,itemCode1,prdtoDateTmstmp,prdFromoDateTmstmp,custCodeStatic,conn); calRate=getOpeningRate(orderTypeHeader,itemSerHeaderSplit,selectedInvList,rcpQtmDom,itemCode1,prdtoDateTmstmp,prdFromoDateTmstmp,custCodeStatic,conn);
calRate=getRequiredDcml(calRate,3);
closingValue=clStock*calRate; closingValue=clStock*calRate;
} }
if(clStock>0) if(clStock>0)
...@@ -5059,7 +5126,33 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -5059,7 +5126,33 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
pstmt1.close(); pstmt1.close();
pstmt1 = null; pstmt1 = null;
rateAll=0.0; rateAll=0.0;
rateAll = discmn.pickRate(priceList,sysDate,itemCode,conn); //Added by saurabh to get rate from DDF_PICK_MAX_RATE fuction[18/10/16|Start]
//rateAll = discmn.pickRate(priceList,sysDate,itemCode1,conn);
sysDate = genericUtility.getValidDateString( sysDate , getApplDateFormat() , getDBDateFormat());
sql = "SELECT DDF_PICK_MAX_SLAB_RATE( ?, TO_DATE( ? , ? ), ? ) FROM DUAL ";
pstmt = conn.prepareStatement( sql );
pstmt.setString( 1, priceList );
pstmt.setString( 2, sysDate );
pstmt.setString( 3, getDBDateFormat() );
pstmt.setString( 4, itemCode );
rs = pstmt.executeQuery();
if (rs.next())
{
rateAll = rs.getFloat(1);
System.out.println("rateAll-----------> [" +rateAll+ "]");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
rateAll=getRequiredDcml(rateAll,3);
//Added by saurabh to get rate from DDF_PICK_MAX_RATE fuction[18/10/16|end]
System.out.println("rateAll>>>>"+rateAll); System.out.println("rateAll>>>>"+rateAll);
if(opStock !=null && opStock.trim().length() >0) if(opStock !=null && opStock.trim().length() >0)
{ {
...@@ -7188,8 +7281,6 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String ...@@ -7188,8 +7281,6 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
return defData; return defData;
} }
private ArrayList getItemFromInv( String invoiceList, Connection conn ) private ArrayList getItemFromInv( String invoiceList, Connection conn )
{ {
long llCount = 0, llRowNum = 0; long llCount = 0, llRowNum = 0;
...@@ -7392,7 +7483,10 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String ...@@ -7392,7 +7483,10 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
"and sdet.ret_rep_flag in('P') " + "and sdet.ret_rep_flag in('P') " +
"and srn.cust_code=? order by descr ";*/ "and srn.cust_code=? order by descr ";*/
sql = "select distinct item_code,descr from(SELECT distinct invoice.invoice_id invoice_id," + sql = //commented and added by saurabh as per Manoj sir suggestion[10/10/16|Start]
//"select distinct item_code,descr from(SELECT distinct invoice.invoice_id invoice_id," +
"select distinct item_code,descr from(SELECT distinct " +
//commented and added by saurabh as per Manoj sir suggestion[10/10/16|end]
"item.item_code,item.descr descr FROM invoice invoice ," + "item.item_code,item.descr descr FROM invoice invoice ," +
"invoice_trace itrace,item item WHERE invoice.invoice_id=itrace.invoice_id and " + "invoice_trace itrace,item item WHERE invoice.invoice_id=itrace.invoice_id and " +
"itrace.item_code=item.item_code and invoice.cust_code = ? " ; "itrace.item_code=item.item_code and invoice.cust_code = ? " ;
...@@ -7408,12 +7502,16 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String ...@@ -7408,12 +7502,16 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
//" and ( itrace.item_ser__prom in ("+itemSer+") OR((itrace.item_ser__prom,itrace.ITEM_CODE) IN (select item_ser,item_code from item_credit_perc WHERE item_ser NOT IN("+itemSer+") )) )" + //" and ( itrace.item_ser__prom in ("+itemSer+") OR((itrace.item_ser__prom,itrace.ITEM_CODE) IN (select item_ser,item_code from item_credit_perc WHERE item_ser NOT IN("+itemSer+") )) )" +
sql=sql+" and ( invoice.confirmed = 'Y' ) and" + sql=sql+" and ( invoice.confirmed = 'Y' ) and" +
" ( (invoice.tran_date >=?) and (invoice.tran_date <= ? ) " + " ( (invoice.tran_date >=?) and (invoice.tran_date <= ? ) " +
"or ((invoice.tran_date >=? ) and (invoice.tran_date <= ? ) ) " + //"or ((invoice.tran_date >=? ) and (invoice.tran_date <= ? ) ) " +
"and(exists (SELECT cust_stock_inv.invoice_id FROM cust_stock_inv cust_stock_inv,invoice invoice " + //commented and added by saurabh as per Manoj sir suggestion[10/10/16|Start]
" WHERE cust_stock_inv.invoice_id = invoice.invoice_id and " + //" and(not exists (SELECT cust_stock_inv.invoice_id FROM cust_stock_inv cust_stock_inv,invoice invoice " +
" cust_stock_inv.dlv_flg = 'N' )) ) " + //" WHERE cust_stock_inv.invoice_id = invoice.invoice_id and " +
//" cust_stock_inv.dlv_flg = 'N' ))" +
" ) " +
//commented and added by saurabh as per Manoj sir suggestion[10/10/16|Start]
" UNION " + " UNION " +
" SELECT distinct cinv.invoice_id,item.item_code,item.descr descr FROM CUST_STOCK_INV cinv ," + //" SELECT distinct cinv.invoice_id,item.item_code,item.descr descr FROM CUST_STOCK_INV cinv ," +
" SELECT distinct item.item_code,item.descr descr FROM CUST_STOCK_INV cinv ," +
" invoice invoice,invoice_trace invtrace ,item item WHERE cinv.invoice_id=invoice.invoice_id " + " invoice invoice,invoice_trace invtrace ,item item WHERE cinv.invoice_id=invoice.invoice_id " +
" and invtrace.invoice_id=cinv.invoice_id and " + " and invtrace.invoice_id=cinv.invoice_id and " +
" invoice.cust_code = ? and invtrace.item_code=item.item_code " ; " invoice.cust_code = ? and invtrace.item_code=item.item_code " ;
...@@ -7426,8 +7524,9 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String ...@@ -7426,8 +7524,9 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
} }
//" and invoice.inv_type = ? " + //" and invoice.inv_type = ? " +
//" and invtrace.item_ser__prom in ("+itemSer+") " + //" and invtrace.item_ser__prom in ("+itemSer+") " +
sql=sql+" and invoice.confirmed = 'Y' and CASE WHEN cinv.dlv_flg IS NULL " + sql=sql+" and invoice.confirmed = 'Y' and invoice.tran_date <=? " +
"THEN 'N' ELSE cinv.dlv_flg END='N') " + " and CASE WHEN cinv.dlv_flg IS NULL " +
"THEN 'N' ELSE cinv.dlv_flg END='N' " +
"UNION "+ "UNION "+
"select distinct sdet.item_code,item.descr as descr " + "select distinct sdet.item_code,item.descr as descr " +
"from sreturn srn,sreturndet sdet ,item item " + "from sreturn srn,sreturndet sdet ,item item " +
...@@ -7446,7 +7545,7 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String ...@@ -7446,7 +7545,7 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
} }
//"and ( item.item_ser in ("+itemSer+") OR((item.item_ser,item.ITEM_CODE) IN (select item_ser,item_code from item_credit_perc WHERE item_ser NOT IN("+itemSer+") )) ) " + //"and ( item.item_ser in ("+itemSer+") OR((item.item_ser,item.ITEM_CODE) IN (select item_ser,item_code from item_credit_perc WHERE item_ser NOT IN("+itemSer+") )) ) " +
sql=sql+" and sdet.ret_rep_flag in('R','P') " + sql=sql+" and sdet.ret_rep_flag in('R','P') " +
"and srn.cust_code=? "; "and srn.cust_code=? )";
...@@ -7457,16 +7556,17 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String ...@@ -7457,16 +7556,17 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
//pstmt.setString(3, itemSer); //pstmt.setString(3, itemSer);
pstmt.setTimestamp(2, frmDateTstmp); pstmt.setTimestamp(2, frmDateTstmp);
pstmt.setTimestamp(3, toDateTstmp); pstmt.setTimestamp(3, toDateTstmp);
pstmt.setTimestamp(4, prdFrDateTstmp); //pstmt.setTimestamp(4, prdFrDateTstmp);
pstmt.setTimestamp(5, prdToDateTstmp); //pstmt.setTimestamp(5, prdToDateTstmp);
pstmt.setString(6, custCode); pstmt.setString(4, custCode);
pstmt.setTimestamp(5, toDateTstmp);
//pstmt.setString(8, orderType); //pstmt.setString(8, orderType);
//pstmt.setString(10, itemSer); //pstmt.setString(10, itemSer);
//pstmt.setString(12, siteCode);//start added by chandrashekar //pstmt.setString(12, siteCode);//start added by chandrashekar
//pstmt.setString(11, itemSer); //pstmt.setString(11, itemSer);
pstmt.setTimestamp(7, frmDateTstmp); pstmt.setTimestamp(6, frmDateTstmp);
pstmt.setTimestamp(8, toDateTstmp); pstmt.setTimestamp(7, toDateTstmp);
pstmt.setString(9, custCode); pstmt.setString(8, custCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while( rs.next() ) while( rs.next() )
...@@ -8730,8 +8830,10 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String ...@@ -8730,8 +8830,10 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
} }
//" and ( itrace.item_ser__prom in ("+itemSer+") OR((itrace.item_ser__prom,itrace.ITEM_CODE) IN (select item_ser,item_code from item_credit_perc WHERE item_ser NOT IN("+itemSer+") )) ) " + //" and ( itrace.item_ser__prom in ("+itemSer+") OR((itrace.item_ser__prom,itrace.ITEM_CODE) IN (select item_ser,item_code from item_credit_perc WHERE item_ser NOT IN("+itemSer+") )) ) " +
//" and invoice.inv_type='"+orderType+"' " + //" and invoice.inv_type='"+orderType+"' " +
sql=sql+" and rate__stduom<=0.001 ) group by invoice_id ) HAVING sum(totFreeValue) >0 AND sum(totfreeQty)>0 " ; //commented and added by saurabh for reciept bonus issue[10/10/16|Start]
//sql=sql+" and rate__stduom<=0.001 ) group by invoice_id ) HAVING sum(totFreeValue) >0 AND sum(totfreeQty)>0 " ;
sql=sql+" and rate__stduom<=0.001 ) group by invoice_id ) HAVING sum(totfreeQty)>0 " ;
//commented and added by saurabh for reciept bonus issue[10/10/16|end]
}else if("T".equalsIgnoreCase(quantityFlag)) }else if("T".equalsIgnoreCase(quantityFlag))
{ {
...@@ -8764,8 +8866,10 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String ...@@ -8764,8 +8866,10 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
} }
//" and ( itrace.item_ser__prom in ("+itemSer+") OR((itrace.item_ser__prom,itrace.ITEM_CODE) IN (select item_ser,item_code from item_credit_perc WHERE item_ser NOT IN("+itemSer+") )) ) " + //" and ( itrace.item_ser__prom in ("+itemSer+") OR((itrace.item_ser__prom,itrace.ITEM_CODE) IN (select item_ser,item_code from item_credit_perc WHERE item_ser NOT IN("+itemSer+") )) ) " +
//" and invoice.inv_type='"+orderType+"' " + //" and invoice.inv_type='"+orderType+"' " +
sql=sql+" and rate__stduom<=0.001 ) group by invoice_id ) HAVING sum(totFreeValue) >0 AND sum(totfreeQty)>0 " ; //commented and added by saurabh for reciept bonus issue[10/10/16|Start]
//sql=sql+" and rate__stduom<=0.001 ) group by invoice_id ) HAVING sum(totFreeValue) >0 AND sum(totfreeQty)>0 " ;
sql=sql+" and rate__stduom<=0.001 ) group by invoice_id ) HAVING sum(totfreeQty)>0 " ;
//commented and added by saurabh for reciept bonus issue[10/10/16|end]
} }
pstmt = conn.prepareStatement( sql ); pstmt = conn.prepareStatement( sql );
...@@ -8952,9 +9056,17 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String ...@@ -8952,9 +9056,17 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
String sql = null; String sql = null;
try try
{ {
/* Changed by Manoj dtd 26/10/2016 to get all items of groupcode
sql= " select item_ser from itemser where grp_code=? and item_ser<>case when grp_code is null then '.' else grp_code end " + sql= " select item_ser from itemser where grp_code=? and item_ser<>case when grp_code is null then '.' else grp_code end " +
"union all " + "union all " +
"select item_ser from itemser where item_ser=? and item_ser<>case when grp_code is null then '.' else grp_code end"; "select item_ser from itemser where item_ser=? and item_ser<>case when grp_code is null then '.' else grp_code end";
*/
sql= " select distinct item_ser from" +
"(select item_ser from itemser where grp_code=? " +
"union all " +
"select item_ser from itemser where item_ser=?) ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemser); pstmt.setString(1, itemser);
pstmt.setString(2, itemser); pstmt.setString(2, itemser);
...@@ -9262,6 +9374,7 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String ...@@ -9262,6 +9374,7 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
double openingRate=0.0,rateStd=0.0; double openingRate=0.0,rateStd=0.0;
PreparedStatement pstmt = null,pstmt1 = null; PreparedStatement pstmt = null,pstmt1 = null;
ResultSet rs = null,rs1 = null; ResultSet rs = null,rs1 = null;
String sysDate="";
try try
{ {
Date currentDate = new Date(); Date currentDate = new Date();
...@@ -9345,7 +9458,32 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String ...@@ -9345,7 +9458,32 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
rs1 = null; rs1 = null;
pstmt1.close(); pstmt1.close();
pstmt1 = null; pstmt1 = null;
openingRate = discmn.pickRate(priceList, sysDatetemp, itemCode, conn); //Commented by Manoj dtd 26/10/2016
//openingRate = discmn.pickRate(priceList, sysDatetemp, itemCode, conn);
//Changed by Manoj dtd 26/10/2016
sysDate = genericUtility.getValidDateString( sysDate , getApplDateFormat() , getDBDateFormat());
sql = "SELECT DDF_PICK_MAX_SLAB_RATE( ?, TO_DATE( ? , ? ), ? ) FROM DUAL ";
pstmt1 = conn.prepareStatement( sql );
pstmt1.setString( 1, priceList );
pstmt1.setString( 2, sysDate );
pstmt1.setString( 3, getDBDateFormat() );
pstmt1.setString( 4, itemCode );
rs1 = pstmt1.executeQuery();
if (rs1.next())
{
openingRate = rs.getDouble(1);
System.out.println("openingRate-----------> [" +openingRate+ "]");
}
if (rs1 != null)
{
rs1.close();
rs1 = null;
}
if (pstmt1 != null)
{
pstmt1.close();
pstmt1 = null;
}
} }
} }
......
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