Commit ef7d8b13 authored by cshah's avatar cshah

DI1HSUN011 : added sitecode condition for select quantity


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91612 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 7a0d7e2f
......@@ -1358,6 +1358,41 @@ public class CustStock extends ValidatorEJB //implements SessionBean
}
valueXmlString.append("</Detail>\r\n");
break;
//case 2 added by chandni : for itemchange for invoice_id
case 2:
valueXmlString.append("<Detail>\r\n");
if ( currentColumn.trim().equals("invoice_id") )
{
String invoiceId ="";
java.sql.Date invoiceDate = null;
double netAmt = 0.0;
java.text.SimpleDateFormat dtf = new SimpleDateFormat( getApplDateFormat() );
invoiceId = getColumnValue("invoice_id",dom, formNo);
selQuery = "select tran_date ,net_amt from invoice where invoice_id = '"+invoiceId+"' " ;
stmt = conn.createStatement();
System.out.println("selQuery [" +selQuery+ "]");
rs = stmt.executeQuery(selQuery);
if (rs.next())
{
invoiceDate = rs.getDate("tran_date");
netAmt = rs.getDouble("net_amt");
valueXmlString.append( "<invoice_date>" ).append( dtf.format(invoiceDate)).append( "</invoice_date>\r\n" );
valueXmlString.append("<net_amt>").append(netAmt).append("</net_amt>\r\n");
}
rs.close();
rs = null;
if (stmt != null)
{
stmt.close();
stmt = null;
}
}
valueXmlString.append("</Detail>\r\n");
break;
//ended by chandni
case 3:
valueXmlString.append("<Detail>\r\n");
selQuery = "SELECT VAR_VALUE FROM DISPARM WHERE PRD_CODE = '999999' AND VAR_NAME = 'CUST_STOCK_MODE'";
......@@ -1500,6 +1535,7 @@ public class CustStock extends ValidatorEJB //implements SessionBean
//TAKING PREV TRANSACTION CLOSING BALANCE
selQuery = "SELECT CL_STOCK FROM CUST_STOCK_DET WHERE TRAN_ID = '"+tranIdLast+"' AND ITEM_CODE = '"+itemCode+"'";
stmt = conn.createStatement();
rs = stmt.executeQuery(selQuery);
if (rs.next())
......@@ -1545,8 +1581,13 @@ public class CustStock extends ValidatorEJB //implements SessionBean
stmt = conn.createStatement();
System.out.println("selQuery [" +selQuery+ "]");
rs = stmt.executeQuery(selQuery);*/
//commented by chandni 21-mar-2012
/*
selQuery = "SELECT SUM(B.QUANTITY__STDUOM) purc_rcp FROM INVOICE A, INVDET B WHERE A.INVOICE_ID = B.INVOICE_ID AND A.CUST_CODE = '" + custCode + "' AND (A.TRAN_DATE >= '"+ldtFromDate+"' AND A.TRAN_DATE <= '" +toDate+ "') AND B.ITEM_CODE = '" + itemCode + "' ";
*/
// added site_code condition by chandni 21-mar-2012
selQuery = "SELECT SUM(B.QUANTITY__STDUOM) purc_rcp FROM INVOICE A, INVDET B WHERE A.INVOICE_ID = B.INVOICE_ID AND A.CUST_CODE = '" + custCode + "' AND (A.TRAN_DATE >= '"+ldtFromDate+"' AND A.TRAN_DATE <= '" +toDate+ "') AND B.ITEM_CODE = '" + itemCode + "' AND A.SITE_CODE = '"+siteCode+"'";
// endded by chandni
stmt = conn.createStatement();
System.out.println("selQuery [" +selQuery+ "]");
rs = stmt.executeQuery(selQuery);
......@@ -1757,11 +1798,14 @@ public class CustStock extends ValidatorEJB //implements SessionBean
java.sql.Timestamp tsFromDate = java.sql.Timestamp.valueOf( genericUtility.getValidDateString( fromDate , getApplDateFormat() , getDBDateFormat()) + " 00:00:00.000" );
String toDate = getColumnValue("to_date" , dom1 );
java.sql.Timestamp tsToDate = java.sql.Timestamp.valueOf( genericUtility.getValidDateString( toDate , getApplDateFormat() , getDBDateFormat()) + " 00:00:00.000" );
// commented by chandni 21-mar-2012
/*
selQuery = "SELECT SUM(B.QUANTITY__STDUOM)PURC_RCP FROM INVOICE A, INVDET B "
+ " WHERE A.INVOICE_ID = B.INVOICE_ID"
+ " AND A.CUST_CODE = ? "
+ " AND B.ITEM_CODE = ? "
+ " AND ( (A.TRAN_DATE >= ? AND A.TRAN_DATE <= ?) ";
if ( invListString.trim().length() > 0 )
{
selQuery += " OR A.INVOICE_ID IN (" + invListString + ")" ;
......@@ -1773,6 +1817,28 @@ public class CustStock extends ValidatorEJB //implements SessionBean
pstmt.setString(2,itemCode);
pstmt.setTimestamp(3,tsFromDate);
pstmt.setTimestamp(4,tsToDate);
*/
// added site_code condition by chandni 21-mar-2012
selQuery = "SELECT SUM(B.QUANTITY__STDUOM)PURC_RCP FROM INVOICE A, INVDET B "
+ " WHERE A.INVOICE_ID = B.INVOICE_ID"
+ " AND A.CUST_CODE = ? "
+ " AND B.ITEM_CODE = ? "
+ " AND A.SITE_CODE = ? "
+ " AND ( (A.TRAN_DATE >= ? AND A.TRAN_DATE <= ?) ";
if ( invListString.trim().length() > 0 )
{
selQuery += " OR A.INVOICE_ID IN (" + invListString + ")" ;
}
selQuery += ")" ;
pstmt = conn.prepareStatement(selQuery);
pstmt.setString(1,custCode);
pstmt.setString(2,itemCode);
pstmt.setString(3,siteCode);
pstmt.setTimestamp(4,tsFromDate);
pstmt.setTimestamp(5,tsToDate);
// ended by chandni
rs = pstmt.executeQuery();
if (rs.next())
{
......@@ -1789,6 +1855,8 @@ public class CustStock extends ValidatorEJB //implements SessionBean
rs = null;
pstmt = null;
System.out.println("purcRcp [" +purcRcp+ "]");
// commented by chandni 21-mar-2012
/*
selQuery = "SELECT B.QUANTITY__STDUOM QUANTITY, B.ITEM_CODE ITEM_CODE, "
+ " A.SITE_CODE SITE_CODE, B.LOC_CODE LOC_CODE, "
+ " B.LOT_NO LOT_NO, B.LOT_SL LOT_SL, B.RET_REP_FLAG RET_REP_FLAG "
......@@ -1804,6 +1872,26 @@ public class CustStock extends ValidatorEJB //implements SessionBean
pstmt.setTimestamp(2,preFromDate);
pstmt.setTimestamp(3,preToDate);
pstmt.setString(4,itemCode);
*/
// added site_code condition by chandni 21-mar-2012
selQuery = "SELECT B.QUANTITY__STDUOM QUANTITY, B.ITEM_CODE ITEM_CODE, "
+ " A.SITE_CODE SITE_CODE, B.LOC_CODE LOC_CODE, "
+ " B.LOT_NO LOT_NO, B.LOT_SL LOT_SL, B.RET_REP_FLAG RET_REP_FLAG "
+ " FROM SRETURN A, SRETURNDET B "
+ " WHERE A.TRAN_ID = B.TRAN_ID "
+ " AND A.CUST_CODE = ? "
+ " AND A.TRAN_DATE >= ? "
+ " AND A.TRAN_DATE <= ? "
+ " AND B.ITEM_CODE = ? "
+ " AND A.SITE_CODE = ? ";
pstmt = conn.prepareStatement(selQuery);
pstmt.setString(1,custCode);
pstmt.setTimestamp(2,preFromDate);
pstmt.setTimestamp(3,preToDate);
pstmt.setString(4,itemCode);
pstmt.setString(5,siteCode);
rs = pstmt.executeQuery();
retQty = 0;
replQty = 0;
......
......@@ -1828,7 +1828,8 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean
selQuery = "SELECT ITEM_CODE FROM CUSTOMERITEM WHERE ITEM_CODE__REF = ? AND CUST_CODE = ? ";
stmt = conn.prepareStatement( selQuery );
stmt.setString( 1, columnValue );
stmt.setString( 1, custCode );
//stmt.setString( 1, custCode );
stmt.setString( 2, custCode ); // changes done by chandni 21-mar-2012
//System.out.println("selQuery [" +selQuery+ "]");
rs = stmt.executeQuery();
if (rs.next())
......@@ -1943,6 +1944,8 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean
PreparedStatement purcPstmt = null;
//selQuery = "SELECT SUM(B.QUANTITY__STDUOM) purc_rcp FROM INVOICE A, INVDET B WHERE A.INVOICE_ID = B.INVOICE_ID AND A.CUST_CODE = '" + custCode + "' AND (A.TRAN_DATE >= '"+ldtFromDate+"' AND A.TRAN_DATE <= '" +toDate+ "') AND B.ITEM_CODE = '" + itemCode + "' ";
// commented by chandni 21-mar-2012
/*
selQuery = "SELECT SUM(B.QUANTITY__STDUOM) purc_rcp 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 = ? ";
//stmt = conn.createStatement();
......@@ -1953,6 +1956,19 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean
purcPstmt.setTimestamp( 3, java.sql.Timestamp.valueOf( genericUtility.getValidDateString( toDate , getApplDateFormat() , getDBDateFormat()) + " 00:00:00.000" ) );
purcPstmt.setString( 4, itemCode );
*/
// added site_code condition by chandni 21-mar-2012
selQuery = "SELECT SUM(B.QUANTITY__STDUOM) purc_rcp 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.SITE_CODE = ?";
//stmt = conn.createStatement();
//System.out.println("selQuery [" +selQuery+ "]");
purcPstmt = conn.prepareStatement( selQuery );
purcPstmt.setString( 1, custCode );
purcPstmt.setTimestamp( 2, java.sql.Timestamp.valueOf( genericUtility.getValidDateString( ldtFromDate , getApplDateFormat() , getDBDateFormat()) + " 00:00:00.000" ) );
purcPstmt.setTimestamp( 3, java.sql.Timestamp.valueOf( genericUtility.getValidDateString( toDate , getApplDateFormat() , getDBDateFormat()) + " 00:00:00.000" ) );
purcPstmt.setString( 4, itemCode );
purcPstmt.setString( 5, siteCode );
// endded by chandni
rs = purcPstmt.executeQuery();
//rs = stmt.executeQuery(selQuery);
if (rs.next())
......@@ -2155,8 +2171,8 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean
+ " from cust_stock_inv "
+ " where tran_id = ? ) "
+ " ) and item_code = ? "; */
selQuery = "SELECT SUM(QUANTITY__STDUOM) PURC_RCP FROM INVDET "
// commented by chandni 21-mar-2012
/* 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 ? ) "
......@@ -2168,6 +2184,22 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean
pstmt.setTimestamp( 3, tsToDate );
//pstmt.setString( 4, tranId );
pstmt.setString( 4, itemCode );
*/
// added site_code condition by chandni 21-mar-2012
selQuery = "SELECT SUM(QUANTITY__STDUOM) PURC_RCP FROM INVDET "
+ " where invoice_id in "
+ " (select invoice_id from invoice where cust_code = ? and site_code =? "
+ " and tran_date between ? and ? ) "
+ " and item_code = ? ";
pstmt = conn.prepareStatement( selQuery );
pstmt.setString( 1, custCode );
pstmt.setString( 2, siteCode );
pstmt.setTimestamp( 3, tsFromDate );
pstmt.setTimestamp( 4, tsToDate );
//pstmt.setString( 4, tranId );
pstmt.setString( 5, itemCode );
// endded by chandni
rs = pstmt.executeQuery();
double rcpCur =0, rcpPre = 0, totRcp = 0;
if (rs.next())
......@@ -2231,6 +2263,8 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean
}
//System.out.println("purcRcp [" +purcRcp+ "]");
// commented by chandni 21-mar-2012
/*
selQuery = "SELECT B.QUANTITY__STDUOM QUANTITY, B.ITEM_CODE ITEM_CODE, "
+ " A.SITE_CODE SITE_CODE, B.LOC_CODE LOC_CODE, "
+ " B.LOT_NO LOT_NO, B.LOT_SL LOT_SL, B.RET_REP_FLAG RET_REP_FLAG "
......@@ -2251,6 +2285,31 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean
pstmt.setTimestamp( 3, tsToDate );
// end 11/09/09 manoharan
pstmt.setString(4,itemCode);
*/
// added site_code condition by chandni 21-mar-2012
selQuery =" SELECT B.QUANTITY__STDUOM QUANTITY, B.ITEM_CODE ITEM_CODE, "
+ " A.SITE_CODE SITE_CODE, B.LOC_CODE LOC_CODE, "
+ " B.LOT_NO LOT_NO, B.LOT_SL LOT_SL, B.RET_REP_FLAG RET_REP_FLAG "
+ " FROM SRETURN A, SRETURNDET B "
+ " WHERE A.TRAN_ID = B.TRAN_ID "
+ " AND A.CUST_CODE = ? "
+ " AND A.TRAN_DATE >= ? "
+ " AND A.TRAN_DATE <= ? "
+ " AND B.ITEM_CODE = ? "
+ " AND A.SITE_CODE = ? ";
pstmt = conn.prepareStatement(selQuery);
pstmt.setString(1,custCode);
// 11/09/09 manoharan sales return for the period code in header
// only to be considered
//pstmt.setTimestamp(2,preFromDate);
//pstmt.setTimestamp(3,preToDate);
pstmt.setTimestamp( 2, tsFromDate );
pstmt.setTimestamp( 3, tsToDate );
// end 11/09/09 manoharan
pstmt.setString(4,itemCode);
pstmt.setString(5,siteCode);
// endded by chandni
rs = pstmt.executeQuery();
retQty = 0;
replQty = 0;
......
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