Commit 6ec7614f authored by manohar's avatar manohar

changes to include transit quantity in purchase receipt


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91109 ce508802-f39f-4f6c-b175-0d175dae99d5
parent be29f035
...@@ -1936,7 +1936,10 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean ...@@ -1936,7 +1936,10 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean
prdCode = genericUtility.getColumnValue("prd_code" , dom1 ); prdCode = genericUtility.getColumnValue("prd_code" , dom1 );
tranId = genericUtility.getColumnValue("tran_id" , dom1); tranId = genericUtility.getColumnValue("tran_id" , dom1);
itemCode = columnValue; itemCode = columnValue;
if (tranIdLast == null || tranIdLast.trim().length() == 0)
{
tranIdLast = " ";
}
selQuery = "SELECT ITEM_SER, DESCR, UNIT, CASE WHEN LOC_TYPE__PARENT IS NULL THEN LOC_TYPE ELSE LOC_TYPE__PARENT END LOC_TYPE FROM ITEM WHERE ITEM_CODE = ? "; selQuery = "SELECT ITEM_SER, DESCR, UNIT, CASE WHEN LOC_TYPE__PARENT IS NULL THEN LOC_TYPE ELSE LOC_TYPE__PARENT END LOC_TYPE FROM ITEM WHERE ITEM_CODE = ? ";
pstmt = conn.prepareStatement(selQuery); pstmt = conn.prepareStatement(selQuery);
pstmt.setString(1,itemCode); pstmt.setString(1,itemCode);
...@@ -2025,7 +2028,9 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean ...@@ -2025,7 +2028,9 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean
//preFromDate = tsFromDate; //preFromDate = tsFromDate;
//preToDate = tsToDate; //preToDate = tsToDate;
//check if there is record in cust_stock_inv /* 07/06/09 manoharan changed as per Mitesh quantity for period + previous transit
//check if there is record in cust_stock_inv
int custInvCount = 0; int custInvCount = 0;
selQuery = " select count( 1 ) cnt " selQuery = " select count( 1 ) cnt "
+" from cust_stock_inv inv " +" from cust_stock_inv inv "
...@@ -2079,7 +2084,7 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean ...@@ -2079,7 +2084,7 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean
pstmt = null; pstmt = null;
} }
else else
{ */ {
//selQuery = "SELECT SUM(B.QUANTITY__STDUOM) PURC_RCP FROM INVOICE A, INVDET B " //selQuery = "SELECT SUM(B.QUANTITY__STDUOM) PURC_RCP FROM INVOICE A, INVDET B "
// + " WHERE A.INVOICE_ID = B.INVOICE_ID " // + " WHERE A.INVOICE_ID = B.INVOICE_ID "
// + " AND A.CUST_CODE = ? " // + " AND A.CUST_CODE = ? "
...@@ -2089,6 +2094,8 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean ...@@ -2089,6 +2094,8 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean
// + " where inv.tran_id = ? " // + " where inv.tran_id = ? "
// + " and inv.DLV_FLG = 'Y' " // + " and inv.DLV_FLG = 'Y' "
// + " and inv.INVOICE_DATE between ? and ? ) "; // + " and inv.INVOICE_DATE between ? and ? ) ";
/*
selQuery = "SELECT SUM(QUANTITY__STDUOM) PURC_RCP FROM INVDET " selQuery = "SELECT SUM(QUANTITY__STDUOM) PURC_RCP FROM INVDET "
+ " where invoice_id in " + " where invoice_id in "
+ " (select invoice_id from invoice where cust_code = ? " + " (select invoice_id from invoice where cust_code = ? "
...@@ -2096,13 +2103,20 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean ...@@ -2096,13 +2103,20 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean
+ " and invoice_id not in ( select invoice_id " + " and invoice_id not in ( select invoice_id "
+ " from cust_stock_inv " + " from cust_stock_inv "
+ " where tran_id = ? ) " + " where tran_id = ? ) "
+ " ) and item_code = ? "; + " ) and item_code = ? "; */
selQuery = "SELECT SUM(QUANTITY__STDUOM) PURC_RCP FROM INVDET "
+ " where invoice_id in "
+ " (select invoice_id from invoice where cust_code = ? "
+ " and tran_date between ? and ? ) "
+ " and item_code = ? ";
pstmt = conn.prepareStatement( selQuery ); pstmt = conn.prepareStatement( selQuery );
pstmt.setString( 1, custCode ); pstmt.setString( 1, custCode );
pstmt.setTimestamp( 2, tsFromDate ); pstmt.setTimestamp( 2, tsFromDate );
pstmt.setTimestamp( 3, tsToDate ); pstmt.setTimestamp( 3, tsToDate );
pstmt.setString( 4, tranId ); //pstmt.setString( 4, tranId );
pstmt.setString( 5, itemCode ); pstmt.setString( 4, itemCode );
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
double rcpCur =0, rcpPre = 0, totRcp = 0; double rcpCur =0, rcpPre = 0, totRcp = 0;
if (rs.next()) if (rs.next())
...@@ -2114,7 +2128,7 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean ...@@ -2114,7 +2128,7 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean
rs = null; rs = null;
pstmt = null; pstmt = null;
/*
selQuery = "SELECT SUM(QUANTITY__STDUOM) PURC_RCP FROM INVDET " selQuery = "SELECT SUM(QUANTITY__STDUOM) PURC_RCP FROM INVDET "
+ " where invoice_id in " + " where invoice_id in "
+ " ( select invoice_id " + " ( select invoice_id "
...@@ -2134,6 +2148,18 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean ...@@ -2134,6 +2148,18 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean
pstmt.setTimestamp( 3, invToDate ); pstmt.setTimestamp( 3, invToDate );
pstmt.setString( 4, tranIdLast); pstmt.setString( 4, tranIdLast);
pstmt.setString( 5, itemCode ); pstmt.setString( 5, itemCode );
*/
selQuery = "SELECT SUM(QUANTITY__STDUOM) PURC_RCP FROM INVDET "
+ " where invoice_id in "
+ " ( select invoice_id "
+ " from cust_stock_inv"
+ " where tran_id = ? "
+ " and DLV_FLG = 'N' ) "
+ " and item_code = ? ";
pstmt = conn.prepareStatement( selQuery );
pstmt.setString( 1, tranIdLast);
pstmt.setString( 2, itemCode );
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
......
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