Commit e66a66cb authored by mjadhav's avatar mjadhav

chages done for receipt calculation


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98728 ce508802-f39f-4f6c-b175-0d175dae99d5
parent d3f06b78
...@@ -2141,14 +2141,16 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -2141,14 +2141,16 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
//receiptLast=GetRcpQty(custCodeHd,tranIdLast,orderType,frmDateTstmp,toDateTstmp,itemCodeLast,itemSerHd,conn); //receiptLast=GetRcpQty(custCodeHd,tranIdLast,orderType,frmDateTstmp,toDateTstmp,itemCodeLast,itemSerHd,conn);
System.out.println("-------calculate Receipt quantity for availble transcaion Id--------"); System.out.println("-------calculate Receipt quantity for availble transcaion Id--------");
receiptLast=0.0; receiptLast=0.0;
receiptLast = GetRcpQty(selectedInvList,itemCodeLast,conn); //receiptLast = GetRcpQty(selectedInvList,itemCodeLast,conn);
receiptLast = GetRcpQty(custCodeHd,itemCodeLast,itemSerHd,orderType,frmDateTstmp,toDateTstmp,conn);
System.out.println("Receipt quantity cal for avaible transcation id :"+receiptLast); System.out.println("Receipt quantity cal for avaible transcation id :"+receiptLast);
//rcpBonLast = GetRcpBonQty(selectedInvList,itemCodeLast,conn) ; //rcpBonLast = GetRcpBonQty(selectedInvList,itemCodeLast,conn) ;
//System.out.println("rcpBonLast :"+rcpBonLast); //System.out.println("rcpBonLast :"+rcpBonLast);
System.out.println("-------calculate Receipt Frees quantity for availble transcaion Id--------"); System.out.println("-------calculate Receipt Frees quantity for availble transcaion Id--------");
rcpFreesLast=0.0; rcpFreesLast=0.0;
rcpFreesLast=GetFreeQty(selectedInvList,itemCodeLast,conn); //rcpFreesLast=GetFreeQty(selectedInvList,itemCodeLast,conn);
rcpFreesLast = GetFreeQty(custCodeHd,itemCodeLast,itemSerHd,orderType,frmDateTstmp,toDateTstmp,conn);
System.out.println("rcpFreesLast :"+rcpFreesLast); System.out.println("rcpFreesLast :"+rcpFreesLast);
...@@ -2504,7 +2506,10 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -2504,7 +2506,10 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
//rcpQty = GetRcpQty(custCodeHd,tranIdLast,orderType,selectedInvList,prdFrmDateTstmp,toDateTstmp,itemCode,itemSerHd,conn); //rcpQty = GetRcpQty(custCodeHd,tranIdLast,orderType,selectedInvList,prdFrmDateTstmp,toDateTstmp,itemCode,itemSerHd,conn);
System.out.println("-- calculate recipt quantity which is not available for last or current month transcation !!!"); System.out.println("-- calculate recipt quantity which is not available for last or current month transcation !!!");
rcpQty=0.0; rcpQty=0.0;
rcpQty = GetRcpQty(selectedInvList,itemCode,conn); // rcpQty = GetRcpQty(selectedInvList,itemCode,conn);
System.out.println("frmDateTstmp :"+frmDateTstmp);
System.out.println("toDateTstmp :"+toDateTstmp);
rcpQty = GetRcpQty(custCodeHd,itemCode,itemSerHd,orderType,frmDateTstmp,toDateTstmp,conn);
System.out.println("Receipt quantity for not available in last or current tranaction"+"itemCode :"+itemCode +"Receipt Quantity :"+rcpQty); System.out.println("Receipt quantity for not available in last or current tranaction"+"itemCode :"+itemCode +"Receipt Quantity :"+rcpQty);
// rcpQtyBon = GetRcpFreeQty( custCodeHd,tranIdLast,orderType,prdFrmDateTstmp, toDateTstmp,itemCode,itemSerHd, conn) ; // rcpQtyBon = GetRcpFreeQty( custCodeHd,tranIdLast,orderType,prdFrmDateTstmp, toDateTstmp,itemCode,itemSerHd, conn) ;
// System.out.println("rcpQtyBon :"+rcpQtyBon); // System.out.println("rcpQtyBon :"+rcpQtyBon);
...@@ -2513,7 +2518,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -2513,7 +2518,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
//System.out.println("rcpBonAll :"+rcpBonAll); //System.out.println("rcpBonAll :"+rcpBonAll);
System.out.println("-- calculate Recipt Frees quantity which is not available for last or current month transcation !!!"); System.out.println("-- calculate Recipt Frees quantity which is not available for last or current month transcation !!!");
rcpFreesAll=0.0; rcpFreesAll=0.0;
rcpFreesAll = GetFreeQty(selectedInvList,itemCode,conn) ; //rcpFreesAll = GetFreeQty(selectedInvList,itemCode,conn) ;
rcpFreesAll = GetFreeQty(custCodeHd,itemCode,itemSerHd,orderType,frmDateTstmp,toDateTstmp,conn);
System.out.println("rcpFreesAll :"+rcpFreesAll); System.out.println("rcpFreesAll :"+rcpFreesAll);
// sretQty = GetRetQty(custCodeHd,frmDateTstmp,toDateTstmp,itemCode,siteCodeHd,itemSerHd,conn); // sretQty = GetRetQty(custCodeHd,frmDateTstmp,toDateTstmp,itemCode,siteCodeHd,itemSerHd,conn);
...@@ -3017,49 +3023,11 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -3017,49 +3023,11 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
try try
{ {
/*sql = " SELECT SUM( iv.QUANTITY__STDUOM ) QUANTITY "
+" FROM INVDET iv "
+" WHERE iv.INVOICE_ID in ( select dtl.invoice_id "
+" from cust_stock_inv dtl "
+" where dtl.tran_id = ? " //'" + tranId.trim() +"'"
+" and dtl.dlv_flg = 'N' )"
+" AND iv.ITEM_CODE = ? ";//'" + itemCode +"'";
*/
/*sql = " SELECT SUM( iv.QUANTITY__STDUOM ) QUANTITY "
+" FROM INVDET iv "
+" WHERE iv.item_code=? and iv.INVOICE_ID in ( SELECT distinct invoice.invoice_id invoice_id " +
" FROM invoice invoice WHERE ( invoice.cust_code = ? ) and invoice.inv_type=?" +
" and invoice.item_ser=? and ( invoice.confirmed = 'Y' ) " +
" and ( (invoice.tran_date >= ?) and (invoice.tran_date <= ? ) " +
" or ((invoice.tran_date >= ? ) and (invoice.tran_date <= ? ) ) )" +
" and invoice.invoice_id not in ("+selectedInvList+") )";
*/
/*sql = " SELECT SUM( iv.QUANTITY__STDUOM ) QUANTITY "
+" FROM INVDET iv "
+" WHERE iv.item_code=? and iv.INVOICE_ID in " +
" ( SELECT distinct invoice.invoice_id invoice_id FROM invoice invoice WHERE " +
" ( invoice.cust_code = ? ) and invoice.inv_type=? and invoice.item_ser=? and " +
" ( invoice.confirmed = 'Y' ) and ( (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 WHERE cust_stock_inv.invoice_id = invoice.invoice_id and " +
" cust_stock_inv.dlv_flg = 'N' ))) and invoice.invoice_id not in ("+selectedInvList+") ) ";
*/
System.out.println("calculate transit quantity!!!!!!!!!!!"); System.out.println("calculate transit quantity!!!!!!!!!!!");
/* sql = " SELECT SUM( iv.QUANTITY__STDUOM ) QUANTITY "
+" FROM INVDET iv "
+" WHERE iv.item_code=? and iv.INVOICE_ID in " +
" ( SELECT distinct invoice.invoice_id invoice_id FROM invoice invoice WHERE " +
" ( invoice.cust_code = ? ) and invoice.inv_type=? and invoice.item_ser=? and " +
" ( invoice.confirmed = 'Y' ) and ( (invoice.tran_date >=? ) " +
" and (invoice.tran_date <= ? ) or ((invoice.tran_date >=? ) " +
" and (invoice.tran_date <= ? ) ) ) and invoice.invoice_id not in ("+selectedInvList+") ) ";*/
// transit quantity for those which are included in period also for dlv flag 'N'
sql = " select idet.QUANTITY__STDUOM,idet.invoice_id,idet.item_code from " + sql = " select idet.QUANTITY__STDUOM,idet.invoice_id,idet.item_code from " +
...@@ -3143,6 +3111,11 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -3143,6 +3111,11 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
/*-------------------------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------------------------*/
/*private double GetTransitBon(String custCode, String orderType, String itemSer,String siteCode,String selectedInvList,String itemCode,java.sql.Timestamp fromDate, java.sql.Timestamp toDate,java.sql.Timestamp prdFrom, java.sql.Timestamp prdTo, Connection conn) throws Exception /*private double GetTransitBon(String custCode, String orderType, String itemSer,String siteCode,String selectedInvList,String itemCode,java.sql.Timestamp fromDate, java.sql.Timestamp toDate,java.sql.Timestamp prdFrom, java.sql.Timestamp prdTo, Connection conn) throws Exception
...@@ -3524,7 +3497,66 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -3524,7 +3497,66 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
*/ */
//private double GetRcpQty(String custCode,String tranIdLast,String orderType,String selectedInvList, java.sql.Timestamp fromDate, java.sql.Timestamp toDate,String itemCode,String itemSer, Connection conn) throws Exception //private double GetRcpQty(String custCode,String tranIdLast,String orderType,String selectedInvList, java.sql.Timestamp fromDate, java.sql.Timestamp toDate,String itemCode,String itemSer, Connection conn) throws Exception
private double GetRcpQty(String selectedInvList,String itemCode, Connection conn) throws Exception
private double GetRcpQty(String custCode,String itemCode,String itemSer,String orderType, java.sql.Timestamp fromDate, java.sql.Timestamp toDate,Connection conn) throws Exception
{
String invoiceId="";
double quantity = 0.0;
double rcpQuantity = 0.0;
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = null;
try
{
System.out.println("@@@@@@@@@@@@@@@@");
sql = "select sum(b.quantity__stduom) qty_stduom from invoice a, invdet b "
+" where a.invoice_id = b.invoice_id "
+" and a.cust_code = ? "
+" and a.tran_date >= ? "
+" and a.tran_date <= ? "
+" and b.item_code = ? "
+" and a.item_ser = ? "
+" and a.inv_type = ? ";
pstmt = conn.prepareStatement( sql );
pstmt.setString(1,custCode);
pstmt.setTimestamp(2, fromDate );
pstmt.setTimestamp(3, toDate );
pstmt.setString(4,itemCode);
pstmt.setString(5,itemSer);
pstmt.setString(6,orderType);
rs = pstmt.executeQuery( );
if( rs.next() )
{
rcpQuantity = rs.getDouble( "qty_stduom" );
System.out.println("rcpQuantity :"+rcpQuantity);
}
else
{
rcpQuantity = 0;
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
catch(Exception exception)
{
exception.printStackTrace();
//System.out.println("Exception ::" + exception.getMessage());
throw new ITMException( exception );
}
return rcpQuantity ;
}
/*private double GetRcpQty(String selectedInvList,String itemCode, Connection conn) throws Exception
{ {
String invoiceId=""; String invoiceId="";
double quantity = 0.0; double quantity = 0.0;
...@@ -3538,25 +3570,14 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -3538,25 +3570,14 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("selectedInvList :"+selectedInvList); System.out.println("selectedInvList :"+selectedInvList);
/*sql = "select a.invoice_id, b.quantity__stduom from invoice a, invdet b " +
" where a.invoice_id = b.invoice_id and a.cust_code = ? and " +
" ( a.invoice_id in (select cinv.invoice_id from cust_stock_inv cinv where " +
" cinv.tran_id = ? and cinv.DLV_FLG = 'N' ) or (a.tran_date >= ? and " +
" a.tran_date <= ? ) ) and b.item_code = ? and " +
" a.item_ser = ? and a.inv_type = ? and a.invoice_id in ("+selectedInvList+") ";*/
sql = "select quantity__stduom,invoice_id from invdet where" + sql = "select quantity__stduom,invoice_id from invdet where" +
" item_code=? and invoice_id in ("+selectedInvList+") "; " item_code=? and invoice_id in ("+selectedInvList+") ";
pstmt = conn.prepareStatement( sql ); pstmt = conn.prepareStatement( sql );
pstmt.setString(1,itemCode ); pstmt.setString(1,itemCode );
/*pstmt.setString(1,custCode );
pstmt.setString(2,tranIdLast );
pstmt.setTimestamp(3,fromDate );
pstmt.setTimestamp(4,toDate );
pstmt.setString(5,itemCode );
pstmt.setString(6,itemSer );
pstmt.setString(7,orderType );*/
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
...@@ -3580,7 +3601,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -3580,7 +3601,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
throw new ITMException( exception ); throw new ITMException( exception );
} }
return rcpQuantity ; return rcpQuantity ;
} }*/
/*------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------*/
...@@ -3662,7 +3683,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -3662,7 +3683,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
private double GetFreeQty(String selectedInvList,String itemCode, Connection conn) throws Exception /*private double GetFreeQty(String selectedInvList,String itemCode, Connection conn) throws Exception
{ {
double quantity = 0.0; double quantity = 0.0;
...@@ -3733,7 +3754,93 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -3733,7 +3754,93 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
} }
System.out.println("freesQty :"+freesQty); System.out.println("freesQty :"+freesQty);
return freesQty ; return freesQty ;
}*/
private double GetFreeQty(String custCode,String itemCode,String itemSer,String orderType, java.sql.Timestamp fromDate, java.sql.Timestamp toDate,Connection conn) throws Exception
{
String invoiceId="",nature="";
double quantity = 0.0;
double freesQty = 0.0;
PreparedStatement pstmt = null,pstmt1 = null;
ResultSet rs = null,rs1 = null;
String sql = null;
try
{
sql = "select a.invoice_id from invoice a, invdet b "
+" where a.invoice_id = b.invoice_id "
+" and a.cust_code = ? "
+" and a.tran_date >= ? "
+" and a.tran_date <= ? "
+" and b.item_code = ? "
+" and a.item_ser = ? "
+" and a.inv_type = ? ";
pstmt = conn.prepareStatement( sql );
pstmt.setString(1,custCode);
pstmt.setTimestamp(2, fromDate );
pstmt.setTimestamp(3, toDate );
pstmt.setString(4,itemCode);
pstmt.setString(5,itemSer);
pstmt.setString(6,orderType);
rs = pstmt.executeQuery( );
while( rs.next() )
{
invoiceId = rs.getString( "invoice_id" );
nature="";
sql = "select nature,quantity__stduom from sorddet where sale_order " +
" =(select sale_order from invoice where invoice_id=?) and item_code=?";
pstmt1 = conn.prepareStatement( sql );
pstmt1.setString(1,invoiceId );
pstmt1.setString(2,itemCode );
rs1 = pstmt1.executeQuery();
while( rs1.next() )
{
quantity = rs1.getDouble("quantity__stduom");
nature=rs1.getString("nature");
System.out.println("nature :"+nature);
if(nature.equalsIgnoreCase("F"))
{
freesQty = freesQty + quantity;
System.out.println(freesQty);
}
}
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
catch(Exception exception)
{
exception.printStackTrace();
//System.out.println("Exception ::" + exception.getMessage());
throw new ITMException( exception );
} }
return freesQty ;
}
......
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