Commit be29f035 authored by manohar's avatar manohar

Changes to disable calculation if cust_stock_mode is other than S, C and A,...

Changes to disable calculation if cust_stock_mode is other than S, C and A, also change in porcp and transit calculation


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91108 ce508802-f39f-4f6c-b175-0d175dae99d5
parent c5e99198
......@@ -1106,7 +1106,7 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean
String custCode = null,rSiteCode = null, locCode = null, lotNo = null, lotSl = null, retRepFlag = null;
java.sql.Timestamp preFromDate = null, preToDate = null;
java.sql.Timestamp invFromDate = null, invToDate = null;
ibase.webitm.ejb.sys.UtilMethods utilMethods = null;
try
{
ibase.webitm.utility.GenericUtility genericUtility = ibase.webitm.utility.GenericUtility.getInstance();
......@@ -1639,7 +1639,7 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean
stmt = conn.prepareStatement( selQuery );
stmt.setTimestamp( 1, java.sql.Timestamp.valueOf( genericUtility.getValidDateString( columnValue , getApplDateFormat() , getDBDateFormat()) + " 00:00:00.000" ) );
stmt.setTimestamp( 1, java.sql.Timestamp.valueOf( genericUtility.getValidDateString( columnValue , getApplDateFormat() , getDBDateFormat()) + " 00:00:00.000" ) );
stmt.setTimestamp( 2, java.sql.Timestamp.valueOf( genericUtility.getValidDateString( columnValue , getApplDateFormat() , getDBDateFormat()) + " 00:00:00.000" ) );
rs = stmt.executeQuery();
if (rs.next())
{
......@@ -1928,7 +1928,7 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean
//// 31/01/09 manoharan commented and aded new code as per ITM
//// 31/01/09 manoharan ITM changes ////////////////////////////////////////////////////////////////////////////////////////////////////
ibase.webitm.ejb.sys.UtilMethods utilMethods = ibase.webitm.ejb.sys.UtilMethods.getInstance();
utilMethods = ibase.webitm.ejb.sys.UtilMethods.getInstance();
custCode = genericUtility.getColumnValue("cust_code" , dom1);
siteCode = genericUtility.getColumnValue("site_code" , dom1);
tranDate = genericUtility.getColumnValue("tran_date" , dom1 );
......@@ -1958,279 +1958,333 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean
pstmt.close();
rs = null;
pstmt = null;
String fromDate = genericUtility.getColumnValue("from_date" , dom1 );
java.sql.Timestamp tsfromDate = java.sql.Timestamp.valueOf( genericUtility.getValidDateString( fromDate , getApplDateFormat() , getDBDateFormat()) + " 00:00:00.000" );
java.sql.Timestamp tsprevDate = utilMethods.RelativeDate(tsfromDate, -1);
SimpleDateFormat sdtApplDate = new SimpleDateFormat(getApplDateFormat());
String prevDate = sdtApplDate.format(tsprevDate);
//
if ("S".equals(stockMode.trim()) || "A".equals(stockMode.trim()) || "C".equals(stockMode.trim()) )
{
String fromDate = genericUtility.getColumnValue("from_date" , dom1 );
java.sql.Timestamp tsfromDate = java.sql.Timestamp.valueOf( genericUtility.getValidDateString( fromDate , getApplDateFormat() , getDBDateFormat()) + " 00:00:00.000" );
selQuery = "SELECT SUM(DET.CL_STOCK) AS OP_STOCK FROM CUST_STOCK HDR, CUST_STOCK_DET DET "
+ " WHERE HDR.TRAN_ID = DET.TRAN_ID "
+ " AND HDR.CUST_CODE = ? "
+ " AND HDR.SITE_CODE = ? "
+ " AND HDR.TO_DATE = ? "
+ " AND DET.ITEM_CODE = ? ";
pstmt = conn.prepareStatement(selQuery);
pstmt.setString(1,custCode);
pstmt.setString(2,siteCode);
pstmt.setTimestamp(3,tsprevDate);
pstmt.setString(4,itemCode);
rs = pstmt.executeQuery();
if (rs.next())
{
opStock = rs.getString("OP_STOCK");
if (opStock == null)
{
opStock = "0";
}
java.sql.Timestamp tsprevDate = utilMethods.RelativeDate(tsfromDate, -1);
valueXmlString.append("<op_stock>").append(opStock).append("</op_stock>\r\n");
}
rs.close();
pstmt.close();
rs = null;
pstmt = null;
//System.out.println("opStock [" +opStock+ "]");
String invListString = "";
selQuery = "SELECT FR_DATE, TO_DATE FROM PERIOD WHERE ? BETWEEN FR_DATE AND TO_DATE" ;
pstmt = conn.prepareStatement(selQuery);
pstmt.setTimestamp(1,tsprevDate);
rs = pstmt.executeQuery();
if (rs.next())
{
preFromDate = rs.getTimestamp("FR_DATE");
preToDate = rs.getTimestamp("TO_DATE");
invFromDate = preFromDate;
invToDate = preToDate;
//next line commented as not needed by alam on 190308
//invListString = GetInvList( tranId, preFromDate, preToDate, conn);
}
rs.close();
pstmt.close();
rs = null;
pstmt = null;
fromDate = genericUtility.getColumnValue("from_date" , dom1 );
java.sql.Timestamp tsFromDate = java.sql.Timestamp.valueOf( genericUtility.getValidDateString( fromDate , getApplDateFormat() , getDBDateFormat()) + " 00:00:00.000" );
String toDate = genericUtility.getColumnValue("to_date" , dom1 );
java.sql.Timestamp tsToDate = java.sql.Timestamp.valueOf( genericUtility.getValidDateString( toDate , getApplDateFormat() , getDBDateFormat()) + " 00:00:00.000" );
preFromDate = tsFromDate;
preToDate = tsToDate;
//check if there is record in cust_stock_inv
int custInvCount = 0;
selQuery = " select count( 1 ) cnt "
+" from cust_stock_inv inv "
+" where inv.tran_id = ? "
+" and inv.DLV_FLG = 'Y' "
+" and inv.INVOICE_DATE between ? and ? ";
pstmt = conn.prepareStatement( selQuery );
pstmt.setString( 1, tranId );
pstmt.setTimestamp( 2, invFromDate );
pstmt.setTimestamp( 3, invToDate );
rs = pstmt.executeQuery();
if (rs.next())
{
custInvCount = rs.getInt( "cnt" );
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
//end check
if ( custInvCount == 0 )
{
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 <= ? ";
}
else
{
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.INVOICE_ID IN ( select inv.invoice_id "
+ " from cust_stock_inv inv "
+ " where inv.tran_id = ? "
+ " and inv.DLV_FLG = 'Y' "
+ " and inv.INVOICE_DATE between ? and ? ) ";
}
SimpleDateFormat sdtApplDate = new SimpleDateFormat(getApplDateFormat());
String prevDate = sdtApplDate.format(tsprevDate);
selQuery = "SELECT SUM(DET.CL_STOCK) AS OP_STOCK FROM CUST_STOCK HDR, CUST_STOCK_DET DET "
+ " WHERE HDR.TRAN_ID = DET.TRAN_ID "
+ " AND HDR.CUST_CODE = ? "
+ " AND HDR.SITE_CODE = ? "
+ " AND HDR.TO_DATE = ? "
+ " AND DET.ITEM_CODE = ? ";
pstmt = conn.prepareStatement( selQuery );
if ( custInvCount == 0 )
{
pstmt = conn.prepareStatement(selQuery);
pstmt.setString(1,custCode);
pstmt.setString(2,itemCode);
pstmt.setTimestamp(3,tsFromDate);
pstmt.setTimestamp(4,tsToDate);
}
else
{
pstmt.setString( 1, custCode );
pstmt.setString( 2, itemCode );
pstmt.setString( 3, tranId );
pstmt.setTimestamp( 4, invFromDate );
pstmt.setTimestamp( 5, invToDate );
}
rs = pstmt.executeQuery();
if (rs.next())
{
purcRcp = rs.getString("PURC_RCP");
if (purcRcp == null)
pstmt.setString(2,siteCode);
pstmt.setTimestamp(3,tsprevDate);
pstmt.setString(4,itemCode);
rs = pstmt.executeQuery();
if (rs.next())
{
opStock = rs.getString("OP_STOCK");
if (opStock == null)
{
opStock = "0";
}
valueXmlString.append("<op_stock>").append(opStock).append("</op_stock>\r\n");
}
rs.close();
pstmt.close();
rs = null;
pstmt = null;
//System.out.println("opStock [" +opStock+ "]");
String invListString = "";
selQuery = "SELECT FR_DATE, TO_DATE FROM PERIOD WHERE ? BETWEEN FR_DATE AND TO_DATE" ;
pstmt = conn.prepareStatement(selQuery);
pstmt.setTimestamp(1,tsprevDate);
rs = pstmt.executeQuery();
if (rs.next())
{
preFromDate = rs.getTimestamp("FR_DATE");
preToDate = rs.getTimestamp("TO_DATE");
invFromDate = preFromDate;
invToDate = preToDate;
//next line commented as not needed by alam on 190308
//invListString = GetInvList( tranId, preFromDate, preToDate, conn);
}
rs.close();
pstmt.close();
rs = null;
pstmt = null;
fromDate = genericUtility.getColumnValue("from_date" , dom1 );
java.sql.Timestamp tsFromDate = java.sql.Timestamp.valueOf( genericUtility.getValidDateString( fromDate , getApplDateFormat() , getDBDateFormat()) + " 00:00:00.000" );
String toDate = genericUtility.getColumnValue("to_date" , dom1 );
java.sql.Timestamp tsToDate = java.sql.Timestamp.valueOf( genericUtility.getValidDateString( toDate , getApplDateFormat() , getDBDateFormat()) + " 00:00:00.000" );
//preFromDate = tsFromDate;
//preToDate = tsToDate;
//check if there is record in cust_stock_inv
int custInvCount = 0;
selQuery = " select count( 1 ) cnt "
+" from cust_stock_inv inv "
+" where inv.tran_id = ? ";
// +" and inv.DLV_FLG = 'Y' "
// +" and inv.INVOICE_DATE between ? and ? ";
pstmt = conn.prepareStatement( selQuery );
pstmt.setString( 1, tranId );
// pstmt.setTimestamp( 2, invFromDate );
// pstmt.setTimestamp( 3, invToDate );
rs = pstmt.executeQuery();
if (rs.next())
{
purcRcp = "0";
custInvCount = rs.getInt( "cnt" );
}
purReceipt = purcRcp;
valueXmlString.append("<purc_rcp>").append(purcRcp).append("</purc_rcp>\r\n");
}
rs.close();
pstmt.close();
rs = null;
pstmt = null;
//System.out.println("purcRcp [" +purcRcp+ "]");
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 = ? ";
rs.close();
rs = null;
pstmt.close();
pstmt = null;
//end check
pstmt = conn.prepareStatement(selQuery);
pstmt.setString(1,custCode);
pstmt.setTimestamp(2,preFromDate);
pstmt.setTimestamp(3,preToDate);
pstmt.setString(4,itemCode);
rs = pstmt.executeQuery();
retQty = 0;
replQty = 0;
selQuery = "SELECT INV_STAT FROM STOCK "
+ " WHERE ITEM_CODE = ? "
+ " AND SITE_CODE = ? "
+ " AND LOC_CODE = ? "
+ " AND LOT_NO = ? "
+ " AND LOT_SL = ? " ;
pstmt1 = conn.prepareStatement(selQuery);
while (rs.next())
{
quantity = rs.getDouble("QUANTITY");
rSiteCode = rs.getString("SITE_CODE");
locCode = rs.getString("LOC_CODE");
lotNo = rs.getString("LOT_NO");
lotSl = rs.getString("LOT_SL");
retRepFlag = rs.getString("RET_REP_FLAG");
retRepFlag = ( retRepFlag == null || retRepFlag.trim().length() == 0 ) ? "" : retRepFlag.trim();
pstmt1.setString(1,itemCode);
pstmt1.setString(2,rSiteCode);
pstmt1.setString(3,locCode);
pstmt1.setString(4,lotNo);
pstmt1.setString(5,lotSl);
rs1 = pstmt1.executeQuery();
if (rs1.next())
if ( custInvCount == 0 )
{
invStat = rs1.getString("INV_STAT");
invStat = ( invStat == null || invStat.trim().length() == 0 ) ? "" : invStat.trim();
if ("R".equalsIgnoreCase(retRepFlag.trim()) && "SALE".equalsIgnoreCase(invStat.trim()) )
{
retQty += quantity;
}
else if ( "P".equalsIgnoreCase(retRepFlag.trim()) )
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 <= ? ";
pstmt = conn.prepareStatement( selQuery );
pstmt.setString(1,custCode);
pstmt.setString(2,itemCode);
pstmt.setTimestamp(3,tsFromDate);
pstmt.setTimestamp(4,tsToDate);
rs = pstmt.executeQuery();
if (rs.next())
{
purcRcp = rs.getString("PURC_RCP");
if (purcRcp == null)
{
purcRcp = "0";
}
purReceipt = purcRcp;
valueXmlString.append("<purc_rcp>").append(purcRcp).append("</purc_rcp>\r\n");
}
rs.close();
pstmt.close();
rs = null;
pstmt = null;
}
else
{
//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.INVOICE_ID IN ( select inv.invoice_id "
// + " from cust_stock_inv inv "
// + " where inv.tran_id = ? "
// + " and inv.DLV_FLG = 'Y' "
// + " and inv.INVOICE_DATE between ? and ? ) ";
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 invoice_id not in ( select invoice_id "
+ " from cust_stock_inv "
+ " where tran_id = ? ) "
+ " ) and item_code = ? ";
pstmt = conn.prepareStatement( selQuery );
pstmt.setString( 1, custCode );
pstmt.setTimestamp( 2, tsFromDate );
pstmt.setTimestamp( 3, tsToDate );
pstmt.setString( 4, tranId );
pstmt.setString( 5, itemCode );
rs = pstmt.executeQuery();
double rcpCur =0, rcpPre = 0, totRcp = 0;
if (rs.next())
{
rcpCur = rs.getDouble("PURC_RCP");
}
rs.close();
pstmt.close();
rs = null;
pstmt = null;
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 = 'Y' "
+ " and INVOICE_DATE between ? and ? "
+ " union all "
+ " select preinv.invoice_id "
+ " from cust_stock_inv preinv "
+ " where preinv.tran_id = ? "
+ " and preinv.DLV_FLG = 'N' ) "
+ " and item_code = ? ";
pstmt = conn.prepareStatement( selQuery );
pstmt.setString( 1, tranId );
pstmt.setTimestamp( 2, invFromDate );
pstmt.setTimestamp( 3, invToDate );
pstmt.setString( 4, tranIdLast);
pstmt.setString( 5, itemCode );
rs = pstmt.executeQuery();
if (rs.next())
{
rcpPre = rs.getDouble("PURC_RCP");
}
rs.close();
pstmt.close();
rs = null;
pstmt = null;
utilMethods = ibase.webitm.ejb.sys.UtilMethods.getInstance();
totRcp = rcpCur + rcpPre;
purcRcp = utilMethods.getReqDecString(totRcp,2);
utilMethods = null;
purReceipt = purcRcp;
valueXmlString.append("<purc_rcp>").append(purcRcp).append("</purc_rcp>\r\n");
}
//System.out.println("purcRcp [" +purcRcp+ "]");
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 = ? ";
pstmt = conn.prepareStatement(selQuery);
pstmt.setString(1,custCode);
pstmt.setTimestamp(2,preFromDate);
pstmt.setTimestamp(3,preToDate);
pstmt.setString(4,itemCode);
rs = pstmt.executeQuery();
retQty = 0;
replQty = 0;
selQuery = "SELECT INV_STAT FROM STOCK "
+ " WHERE ITEM_CODE = ? "
+ " AND SITE_CODE = ? "
+ " AND LOC_CODE = ? "
+ " AND LOT_NO = ? "
+ " AND LOT_SL = ? " ;
pstmt1 = conn.prepareStatement(selQuery);
while (rs.next())
{
quantity = rs.getDouble("QUANTITY");
rSiteCode = rs.getString("SITE_CODE");
locCode = rs.getString("LOC_CODE");
lotNo = rs.getString("LOT_NO");
lotSl = rs.getString("LOT_SL");
retRepFlag = rs.getString("RET_REP_FLAG");
retRepFlag = ( retRepFlag == null || retRepFlag.trim().length() == 0 ) ? "" : retRepFlag.trim();
pstmt1.setString(1,itemCode);
pstmt1.setString(2,rSiteCode);
pstmt1.setString(3,locCode);
pstmt1.setString(4,lotNo);
pstmt1.setString(5,lotSl);
rs1 = pstmt1.executeQuery();
if (rs1.next())
{
replQty += quantity;
invStat = rs1.getString("INV_STAT");
invStat = ( invStat == null || invStat.trim().length() == 0 ) ? "" : invStat.trim();
if ("R".equalsIgnoreCase(retRepFlag.trim()) && "SALE".equalsIgnoreCase(invStat.trim()) )
{
retQty += quantity;
}
else if ( "P".equalsIgnoreCase(retRepFlag.trim()) )
{
replQty += quantity;
}
}
rs1.close();
rs1 = null;
}
pstmt1.close();
pstmt1 = null;
rs.close();
pstmt.close();
rs = null;
pstmt = null;
quantity = retQty - replQty ;
valueXmlString.append("<purc_ret>").append(quantity).append("</purc_ret>\r\n");
//System.out.println("purc_ret [" +quantity+ "]");
transitQty = 0;
transitFlg = genericUtility.getColumnValue("transit_flag" , dom1);
if ( transitFlg == null || transitFlg.trim().length() == 0)
{
transitFlg = "N";
}
rs1.close();
rs1 = null;
if ("N".equalsIgnoreCase(transitFlg))
{
transitQty = GetTransitQty( tranId, itemCode, conn );
}
transitQtyStr = transitQty + "";
}
pstmt1.close();
pstmt1 = null;
rs.close();
pstmt.close();
rs = null;
pstmt = null;
quantity = retQty - replQty ;
valueXmlString.append("<purc_ret>").append(quantity).append("</purc_ret>\r\n");
//System.out.println("purc_ret [" +quantity+ "]");
transitQty = 0;
transitFlg = genericUtility.getColumnValue("transit_flag" , dom1);
if ( transitFlg == null || transitFlg.trim().length() == 0)
{
transitFlg = "N";
}
if ("N".equalsIgnoreCase(transitFlg))
{
transitQty = GetTransitQty( tranId, itemCode, conn );
valueXmlString.append("<transit_qty protect = '1'>").append(transitQty).append("</transit_qty>\r\n");
//System.out.println("transitQty [" +transitQty+ "]");
prdCode = genericUtility.getColumnValue("prd_code" , dom1);
/* 27/03/09 commented as not yet implemented as told by KB full scan
selQuery = "SELECT SUM(D.QUANTITY) QUANTITY FROM SORDER H, SORDDET D "
+ " WHERE D.SALE_ORDER = H.SALE_ORDER "
+ " AND H.CUST_CODE = ? "
+ " AND H.SITE_CODE = ? "
+ " AND H.UDF__STR2 = ? "
+ " AND D.ITEM_CODE__ORD = ? " ;
pstmt = conn.prepareStatement(selQuery);
pstmt.setString(1,custCode);
pstmt.setString(2,siteCode);
pstmt.setString(3,prdCode);
pstmt.setString(4,itemCode);
rs = pstmt.executeQuery();
if ( rs.next() )
{
quantity = rs.getDouble( "QUANTITY" );
adhocReplQty = quantity + "";
valueXmlString.append("<adhoc_repl_qty>").append( quantity ).append("</adhoc_repl_qty>\r\n");
}
rs.close();
pstmt.close();
rs = null;
pstmt = null;
*/
//System.out.println("adhoc_repl_qty [" +quantity+ "]");
selQuery = "SELECT ITEM_CODE__REF ,DESCR FROM CUSTOMERITEM "
+ " WHERE CUST_CODE = ? "
+ " AND ITEM_CODE = ? ";
pstmt = conn.prepareStatement(selQuery);
pstmt.setString(1,custCode);
pstmt.setString(2,itemCode);
rs = pstmt.executeQuery();
if (rs.next())
{
String custItemRef = rs.getString("ITEM_CODE__REF");
String custItemRefDescr = rs.getString("DESCR");
valueXmlString.append("<cust_item__ref>").append(custItemRef).append("</cust_item__ref>\r\n");
valueXmlString.append("<cust_item_ref_descr><![CDATA[").append(custItemRefDescr).append("]]></cust_item_ref_descr>\r\n");
}
rs.close();
pstmt.close();
rs = null;
pstmt = null;
/////End 31/01/09 manoharan ///////////////////////////////////////////////////////////
}
transitQtyStr = transitQty + "";
valueXmlString.append("<transit_qty protect = '1'>").append(transitQty).append("</transit_qty>\r\n");
//System.out.println("transitQty [" +transitQty+ "]");
prdCode = genericUtility.getColumnValue("prd_code" , dom1);
/* 27/03/09 commented as not yet implemented as told by KB full scan
selQuery = "SELECT SUM(D.QUANTITY) QUANTITY FROM SORDER H, SORDDET D "
+ " WHERE D.SALE_ORDER = H.SALE_ORDER "
+ " AND H.CUST_CODE = ? "
+ " AND H.SITE_CODE = ? "
+ " AND H.UDF__STR2 = ? "
+ " AND D.ITEM_CODE__ORD = ? " ;
pstmt = conn.prepareStatement(selQuery);
pstmt.setString(1,custCode);
pstmt.setString(2,siteCode);
pstmt.setString(3,prdCode);
pstmt.setString(4,itemCode);
rs = pstmt.executeQuery();
if ( rs.next() )
{
quantity = rs.getDouble( "QUANTITY" );
adhocReplQty = quantity + "";
valueXmlString.append("<adhoc_repl_qty>").append( quantity ).append("</adhoc_repl_qty>\r\n");
}
rs.close();
pstmt.close();
rs = null;
pstmt = null;
*/
//System.out.println("adhoc_repl_qty [" +quantity+ "]");
selQuery = "SELECT ITEM_CODE__REF ,DESCR FROM CUSTOMERITEM "
+ " WHERE CUST_CODE = ? "
+ " AND ITEM_CODE = ? ";
pstmt = conn.prepareStatement(selQuery);
pstmt.setString(1,custCode);
pstmt.setString(2,itemCode);
rs = pstmt.executeQuery();
if (rs.next())
{
String custItemRef = rs.getString("ITEM_CODE__REF");
String custItemRefDescr = rs.getString("DESCR");
valueXmlString.append("<cust_item__ref>").append(custItemRef).append("</cust_item__ref>\r\n");
valueXmlString.append("<cust_item_ref_descr><![CDATA[").append(custItemRefDescr).append("]]></cust_item_ref_descr>\r\n");
}
rs.close();
pstmt.close();
rs = null;
pstmt = null;
/////End 31/01/09 manoharan ///////////////////////////////////////////////////////////
}
else if (currentColumn.trim().equalsIgnoreCase("op_stock"))
......@@ -2285,131 +2339,148 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean
//genericUtility.serializeDom( dom );
//genericUtility.serializeDom( dom1 );
//genericUtility.serializeDom( dom2 );
System.out.println( "This is the changed jar at 08/04/09 2:09 pm" );
DecimalFormat df = new DecimalFormat();
df.applyPattern("##.00");
if (!currentColumn.trim().equals("item_code"))
if ("S".equals(stockMode.trim()) || "A".equals(stockMode.trim()) || "C".equals(stockMode.trim()) )
{
opStock = genericUtility.getColumnValue("op_stock", dom );//,formNo);
System.out.println( "This is the changed jar at 08/04/09 2:09 pm" );
//Changed by Dayanand on 8/25/2008 [Change the transit quantity calculation]start (reqId DI89SUN082)
purReceipt = genericUtility.getColumnValue("purc_rcp", dom);
//purReceipt = genericUtility.getColumnValue("cust_purc_rcp", dom);
}
if( ! currentColumn.trim().equals( "item_code" ) )
{
sales = genericUtility.getColumnValue("sales", dom );//,formNo);
clStks = genericUtility.getColumnValue("cl_stock", dom );//,formNo);
}
if( !currentColumn.trim().equals("item_code"))
{
adhocReplQty = genericUtility.getColumnValue( "adhoc_repl_qty", dom );
transitQtyStr = genericUtility.getColumnValue( "transit_qty", dom );
}
if (opStock == null || opStock.equalsIgnoreCase( "null" ) || opStock.trim().length() == 0 )
{
opStock = "0";
}
if (clStks == null || clStks.equalsIgnoreCase( "null" ) || clStks.trim().length() == 0 )
{
clStks = "0";
}
if (sales == null || sales.equalsIgnoreCase( "null" ) || sales.trim().length() == 0 )
{
sales = "0";
}
if (purReceipt == null || purReceipt.equalsIgnoreCase( "null" ) || purReceipt.trim().length() == 0 )
{
purReceipt = "0";
}
if (adjQty == null || adjQty.equalsIgnoreCase( "null" ) || adjQty.trim().length() == 0 )
{
adjQty = "0";
}
if (purReturn == null || purReturn.equalsIgnoreCase( "null" ) || purReturn.trim().length() == 0 )
{
purReturn = "0";
}
//System.out.println( "opStock [" + opStock + "]" );
//System.out.println( "clStks [" + clStks + "]" );
//System.out.println( "sales [" + sales + "]" );
//System.out.println( "cust_purc_rcp ["+purReceipt+ "]" );
//System.out.println( "shb transitFlg [" + transitFlg + "]" );
transitFlg = genericUtility.getColumnValue( "transit_flag", dom1 );
if ( transitFlg == null || transitFlg.trim().length() == 0)
{
transitFlg = "N";
}
if ( transitFlg.equalsIgnoreCase( "N" ) )
{
if (stockMode.trim().equals("S") )
DecimalFormat df = new DecimalFormat();
df.applyPattern("##.00");
if (!currentColumn.trim().equals("item_code"))
{
if( ! currentColumn.trim().equals( "item_code" ) )
{
sales = genericUtility.getColumnValue("sales",dom); //, formNo, domID);
}
if (sales == null || sales.equalsIgnoreCase( "null" ) || sales.trim().length() == 0 )
{
sales = "0";
}
clStk = Double.parseDouble( opStock )
+ Double.parseDouble( purReceipt )
- Double.parseDouble( transitQtyStr )
- Double.parseDouble( sales )
+ Double.parseDouble( adjQty )
- Double.parseDouble( purReturn )
- Double.parseDouble( adhocReplQty );
valueXmlString.append("<cl_stock>").append(clStk).append("</cl_stock>\r\n");
clStks = clStk + "";
}
else if (stockMode.trim().equals("C") || stockMode.trim().equals("A") )
{
opStock = genericUtility.getColumnValue("op_stock", dom );//,formNo);
clStks = genericUtility.getColumnValue("cl_stock",dom );//, formNo);//, domID);
if (opStock == null || opStock.equalsIgnoreCase( "null" ) || opStock.trim().length() == 0 )
{
opStock = "0";
}
if (purReceipt == null || purReceipt.equalsIgnoreCase( "null" ) || purReceipt.trim().length() == 0 )
{
purReceipt = "0";
}
if (transitQtyStr == null || transitQtyStr.equalsIgnoreCase( "null" ) || transitQtyStr.trim().length() == 0 )
{
transitQtyStr = "0";
}
if (clStks == null || clStks.equalsIgnoreCase( "null" ) || clStks.trim().length() == 0 )
{
clStks = "0";
}
if (adjQty == null || adjQty.equalsIgnoreCase( "null" ) || adjQty.trim().length() == 0 )
{
adjQty = "0";
}
if (purReturn == null || purReturn.equalsIgnoreCase( "null" ) || purReturn.trim().length() == 0 )
{
purReturn = "0";
}
if (adhocReplQty == null || adhocReplQty.equalsIgnoreCase( "null" ) || adhocReplQty.trim().length() == 0 )
//Changed by Dayanand on 8/25/2008 [Change the transit quantity calculation]start (reqId DI89SUN082)
purReceipt = genericUtility.getColumnValue("purc_rcp", dom);
//purReceipt = genericUtility.getColumnValue("cust_purc_rcp", dom);
}
if( ! currentColumn.trim().equals( "item_code" ) )
{
sales = genericUtility.getColumnValue("sales", dom );//,formNo);
clStks = genericUtility.getColumnValue("cl_stock", dom );//,formNo);
}
if( !currentColumn.trim().equals("item_code"))
{
adhocReplQty = genericUtility.getColumnValue( "adhoc_repl_qty", dom );
transitQtyStr = genericUtility.getColumnValue( "transit_qty", dom );
}
if (opStock == null || opStock.equalsIgnoreCase( "null" ) || opStock.trim().length() == 0 )
{
opStock = "0";
}
if (clStks == null || clStks.equalsIgnoreCase( "null" ) || clStks.trim().length() == 0 )
{
clStks = "0";
}
if (sales == null || sales.equalsIgnoreCase( "null" ) || sales.trim().length() == 0 )
{
sales = "0";
}
if (purReceipt == null || purReceipt.equalsIgnoreCase( "null" ) || purReceipt.trim().length() == 0 )
{
purReceipt = "0";
}
if (adjQty == null || adjQty.equalsIgnoreCase( "null" ) || adjQty.trim().length() == 0 )
{
adjQty = "0";
}
if (purReturn == null || purReturn.equalsIgnoreCase( "null" ) || purReturn.trim().length() == 0 )
{
purReturn = "0";
}
//System.out.println( "opStock [" + opStock + "]" );
//System.out.println( "clStks [" + clStks + "]" );
//System.out.println( "sales [" + sales + "]" );
//System.out.println( "cust_purc_rcp ["+purReceipt+ "]" );
//System.out.println( "shb transitFlg [" + transitFlg + "]" );
transitFlg = genericUtility.getColumnValue( "transit_flag", dom1 );
if ( transitFlg == null || transitFlg.trim().length() == 0)
{
transitFlg = "N";
}
if ( transitFlg.equalsIgnoreCase( "N" ) )
{
if (stockMode.trim().equals("S") )
{
adhocReplQty = "0";
}
saless = Double.parseDouble( opStock )
if( ! currentColumn.trim().equals( "item_code" ) )
{
sales = genericUtility.getColumnValue("sales",dom); //, formNo, domID);
}
if (sales == null || sales.equalsIgnoreCase( "null" ) || sales.trim().length() == 0 )
{
sales = "0";
}
clStk = Double.parseDouble( opStock )
+ Double.parseDouble( purReceipt )
- Double.parseDouble( transitQtyStr )
- Double.parseDouble( clStks )
- Double.parseDouble( transitQtyStr )
- Double.parseDouble( sales )
+ Double.parseDouble( adjQty )
- Double.parseDouble( purReturn )
- Double.parseDouble( adhocReplQty );
valueXmlString.append("<sales>").append(saless).append("</sales>\r\n");
sales = saless + "";
String salesStr = sales;//genericUtility.getColumnValue( "sales", dom );
valueXmlString.append("<cl_stock>").append(clStk).append("</cl_stock>\r\n");
clStks = clStk + "";
}
else if (stockMode.trim().equals("C") || stockMode.trim().equals("A") )
{
clStks = genericUtility.getColumnValue("cl_stock",dom );//, formNo);//, domID);
if (opStock == null || opStock.equalsIgnoreCase( "null" ) || opStock.trim().length() == 0 )
{
opStock = "0";
}
if (purReceipt == null || purReceipt.equalsIgnoreCase( "null" ) || purReceipt.trim().length() == 0 )
{
purReceipt = "0";
}
if (transitQtyStr == null || transitQtyStr.equalsIgnoreCase( "null" ) || transitQtyStr.trim().length() == 0 )
{
transitQtyStr = "0";
}
if (clStks == null || clStks.equalsIgnoreCase( "null" ) || clStks.trim().length() == 0 )
{
clStks = "0";
}
if (adjQty == null || adjQty.equalsIgnoreCase( "null" ) || adjQty.trim().length() == 0 )
{
adjQty = "0";
}
if (purReturn == null || purReturn.equalsIgnoreCase( "null" ) || purReturn.trim().length() == 0 )
{
purReturn = "0";
}
if (adhocReplQty == null || adhocReplQty.equalsIgnoreCase( "null" ) || adhocReplQty.trim().length() == 0 )
{
adhocReplQty = "0";
}
saless = Double.parseDouble( opStock )
+ Double.parseDouble( purReceipt )
- Double.parseDouble( transitQtyStr )
- Double.parseDouble( clStks )
+ Double.parseDouble( adjQty )
- Double.parseDouble( purReturn )
- Double.parseDouble( adhocReplQty );
valueXmlString.append("<sales>").append(saless).append("</sales>\r\n");
sales = saless + "";
String salesStr = sales;//genericUtility.getColumnValue( "sales", dom );
double transitQntty = 0.0;
transitQntty = Double.parseDouble( opStock )
+ Double.parseDouble( purReceipt )
- Double.parseDouble( salesStr )
- Double.parseDouble( clStks )
+ Double.parseDouble( adjQty )
- Double.parseDouble( purReturn )
- Double.parseDouble( adhocReplQty );
valueXmlString.append("<transit_qty protect = '1'>").append(transitQntty).append("</transit_qty>\r\n");
}
}
else
{
String salesStr = genericUtility.getColumnValue( "sales", dom );
double transitQntty = 0.0;
transitQntty = Double.parseDouble( opStock )
+ Double.parseDouble( purReceipt )
......@@ -2419,64 +2490,52 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean
- Double.parseDouble( purReturn )
- Double.parseDouble( adhocReplQty );
valueXmlString.append("<transit_qty protect = '1'>").append(transitQntty).append("</transit_qty>\r\n");
//transitQty = transitQntty + "";
}
/* 09/02/09 commented by manoharan
//Changed by Dayanand on 01/01/08 [ Calculate transQty] start (reqId DI78SUN073)
//transQty = df.format(new Float(Float.parseFloat( opStock ) + Float.parseFloat( purReceipt ) - Float.parseFloat( sales )- Float.parseFloat( clStks )));
transQty = df.format(new Float(Float.parseFloat( opStock ) + Float.parseFloat( purReceipt ) - Float.parseFloat( sales )- Float.parseFloat( clStks )));
//System.out.println( "transQty[" + transQty + "]" );
//Changed by Dayanand on 03/01/08 [ If transit quantity < 0 set 0 else set transQty]start
if ( Float.parseFloat( transQty )< 0)
{
valueXmlString.append("<transit_qty>").append( "0" ).append("</transit_qty>\r\n");
}
else
{
valueXmlString.append("<transit_qty>").append( transQty ).append("</transit_qty>\r\n");
}
//Changed by Dayanand on 03/01/08 [ If transit quantity < 0 set 0 else set transQty]end
//Changed by Dayanand on 01/01/08 [ Calculate transQty] end (reqId DI78SUN073)
*/
//System.out.println( "opStock::" + opStock );
if ( opStock != null && opStock.length() > 0 && !opStock.equalsIgnoreCase( "null" ) )
{
opValue = df.format(new Float( Float.parseFloat( opStock ) * rateValue ));
}
//System.out.println( "clStks::" + clStks );
if ( clStks != null && clStks.length() > 0 && !clStks.equalsIgnoreCase( "null" ) )
{
clValue = df.format(new Float(Float.parseFloat( clStks ) * rateValue));
}
//System.out.println( "sales::" + sales );
if ( sales != null && sales.length() > 0 && !sales.equalsIgnoreCase( "null") )
{
salesValue = df.format(new Float(Float.parseFloat(String.valueOf( sales )) * rateValue));
}
//System.out.println( "purReceipt::" + purReceipt );
if ( purReceipt != null && purReceipt.length() > 0 && !purReceipt.equalsIgnoreCase( "null" ) )
{
purValue = df.format(new Float( Float.parseFloat( purReceipt ) * rateValue));
}
valueXmlString.append("<op_value>").append(opValue).append("</op_value>\r\n");
valueXmlString.append("<cl_value>").append(clValue).append("</cl_value>\r\n");
valueXmlString.append("<sales_value>").append(salesValue).append("</sales_value>\r\n");
valueXmlString.append("<pur_value>").append(purValue).append("</pur_value>\r\n");
}
else
{
String salesStr = genericUtility.getColumnValue( "sales", dom );
double transitQntty = 0.0;
transitQntty = Double.parseDouble( opStock )
+ Double.parseDouble( purReceipt )
- Double.parseDouble( salesStr )
- Double.parseDouble( clStks )
+ Double.parseDouble( adjQty )
- Double.parseDouble( purReturn )
- Double.parseDouble( adhocReplQty );
valueXmlString.append("<transit_qty protect = '1'>").append(transitQntty).append("</transit_qty>\r\n");
//transitQty = transitQntty + "";
}
/* 09/02/09 commented by manoharan
//Changed by Dayanand on 01/01/08 [ Calculate transQty] start (reqId DI78SUN073)
//transQty = df.format(new Float(Float.parseFloat( opStock ) + Float.parseFloat( purReceipt ) - Float.parseFloat( sales )- Float.parseFloat( clStks )));
transQty = df.format(new Float(Float.parseFloat( opStock ) + Float.parseFloat( purReceipt ) - Float.parseFloat( sales )- Float.parseFloat( clStks )));
//System.out.println( "transQty[" + transQty + "]" );
//Changed by Dayanand on 03/01/08 [ If transit quantity < 0 set 0 else set transQty]start
if ( Float.parseFloat( transQty )< 0)
{
valueXmlString.append("<transit_qty>").append( "0" ).append("</transit_qty>\r\n");
}
else
{
valueXmlString.append("<transit_qty>").append( transQty ).append("</transit_qty>\r\n");
}
//Changed by Dayanand on 03/01/08 [ If transit quantity < 0 set 0 else set transQty]end
//Changed by Dayanand on 01/01/08 [ Calculate transQty] end (reqId DI78SUN073)
*/
//System.out.println( "opStock::" + opStock );
if ( opStock != null && opStock.length() > 0 && !opStock.equalsIgnoreCase( "null" ) )
{
opValue = df.format(new Float( Float.parseFloat( opStock ) * rateValue ));
}
//System.out.println( "clStks::" + clStks );
if ( clStks != null && clStks.length() > 0 && !clStks.equalsIgnoreCase( "null" ) )
{
clValue = df.format(new Float(Float.parseFloat( clStks ) * rateValue));
}
//System.out.println( "sales::" + sales );
if ( sales != null && sales.length() > 0 && !sales.equalsIgnoreCase( "null") )
{
salesValue = df.format(new Float(Float.parseFloat(String.valueOf( sales )) * rateValue));
}
//System.out.println( "purReceipt::" + purReceipt );
if ( purReceipt != null && purReceipt.length() > 0 && !purReceipt.equalsIgnoreCase( "null" ) )
{
purValue = df.format(new Float( Float.parseFloat( purReceipt ) * rateValue));
}
valueXmlString.append("<op_value>").append(opValue).append("</op_value>\r\n");
valueXmlString.append("<cl_value>").append(clValue).append("</cl_value>\r\n");
valueXmlString.append("<sales_value>").append(salesValue).append("</sales_value>\r\n");
valueXmlString.append("<pur_value>").append(purValue).append("</pur_value>\r\n");
valueXmlString.append("</Detail>\r\n");
break;
}//switch (currentFormNo)
......
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