Commit 3b51cdf3 authored by mjadhav's avatar mjadhav

changes done FREES for receipt and transit


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98717 ce508802-f39f-4f6c-b175-0d175dae99d5
parent a50cf546
......@@ -409,23 +409,41 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("orderType :"+orderType);
sql= "SELECT SITE_CODE FROM SITE_CUSTOMER WHERE CUST_CODE = ? ";
pstmt5 = conn.prepareStatement(sql);
pstmt5.setString(1, custCode);
rs5 = pstmt5.executeQuery();
if(rs5.next())
{
siteCode=checkNull(rs5.getString("SITE_CODE"));
System.out.println("siteCode from site customer against cust code: :"+siteCode);
}
rs5.close();
rs5 = null;
pstmt5.close();
pstmt5 = null;
if(FromDate != null && ToDate != null && custCode != null && orderType != null && itemSer != null)
{
//sql = " SELECT count(*) as count FROM invoice invoice WHERE ( invoice.cust_code = ? ) " +
sql = " SELECT distinct (invoice_id) FROM invoice invoice WHERE ( invoice.cust_code = ? ) " +
" and invoice.inv_type=? and invoice.item_ser=? and ( invoice.confirmed = 'Y' )" +
" and invoice.site_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' ))) ";
pstmt3 = conn.prepareStatement(sql);
pstmt3.setString(1,custCode.trim());
pstmt3.setString(2,orderType.trim());
pstmt3.setString(3,itemSer.trim());
pstmt3.setTimestamp(4,FromDate);
pstmt3.setTimestamp(5,ToDate);
pstmt3.setTimestamp(6,prdFrom);
pstmt3.setTimestamp(7,prdTo);
pstmt3.setString(2,siteCode.trim());
pstmt3.setString(3,orderType.trim());
pstmt3.setString(4,itemSer.trim());
pstmt3.setTimestamp(5,FromDate);
pstmt3.setTimestamp(6,ToDate);
pstmt3.setTimestamp(7,prdFrom);
pstmt3.setTimestamp(8,prdTo);
rs3 = pstmt3.executeQuery();
while (rs3.next())
{
......@@ -1092,9 +1110,9 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
int lineNoItmCnt=0,itemResLen=0,itemPos=0,itmDetCnt=0,domID2=0;
double sretQty = 0.0,replQty=0.0,rcpQtyBon=0.0,primarySales=0.0;
double transitQtyBon = 0.0,transitQtyFrs=0.0,returnBon=0.0,returnFrs=0.0,receiptBon=0.0,receiptFrs=0.0;
String sretSiteCode = "",sretLocCode = "",sretLotNo="",sretLotSl="",retRepFlag="",selQuery="",invStat="",periodDt="";
String sretSiteCode = "",sretLocCode = "",sretLotNo="",sretLotSl="",retRepFlag="",selQuery="",invStat="",periodDt="",tranDateStr="";
double rcpQtmDom = 0.0,retQtyDom=0.0,opStkDom=0.0,transitQtyDom=0.0,salesQtyCal=0.0,clStockNew=0.0;
double retQtyAll=0.0,replQtyAll=0.0,primarySalesAll=0.0,rcpFreeAll=0.0,rcpFree=0.0,transitQtyBonLast=0.0;
double retQtyAll=0.0,replQtyAll=0.0,primarySalesAll=0.0,rcpBonAll=0.0,rcpBonLast=0.0,transitQtyBonLast=0.0,rcpFreesLast=0.0;
SimpleDateFormat sdf;
ArrayList defData = null;
windowName = (new StringBuilder("w_")).append(getObjName(dom, objContext)).toString();
......@@ -1115,7 +1133,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
String locality_code="";
String childNodeName = "",lineNoStrDom="",lineNoStr="",stockDlvFlg="",dlvFlagStock="";
String invoiceIdList = "",dlvFlagDom="";
double sretQtyAll=0.0,rateAll=0.0,sretQtyAllTot=0.0;
double sretQtyAll=0.0,rateAll=0.0,sretQtyAllTot=0.0,transitQtyFreesLast=0.0,transitQtyFrees=0.0,rcpFreesAll=0.0;
String sretSiteCodeAll="",sretLocCodeAll="",sretLotNoAll="",sretLotSlAll="",retRepFlagAll="";
int invCnt=0,dlvFlgCnt=0;
......@@ -1999,6 +2017,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
todate = genericUtility.getColumnValue("to_date",dom2);
//todate = sdf.format(currentDate).toString();
System.out.println("todate (case 4):"+todate);
tranDateStr=sdf.format(currentDate).toString();
tranDate=java.sql.Timestamp.valueOf(genericUtility.getValidDateString(tranDateStr, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");;
FromDate = java.sql.Timestamp.valueOf(genericUtility.getValidDateString(fromdate, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
System.out.println("FromDate :"+FromDate);
......@@ -2007,17 +2027,6 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
/*------------Code to get privioud month data-------------*/
/*varValue = (-1) * 1;
System.out.println("changed varValue>>>>>>>>>>>>>>>> = .. " + varValue);
if(FromDate !=null)
{
prdFrom = utilMethod.RelativeDate(FromDate,varValue);
}
System.out.println("prdFrom :"+prdFrom);*/
prdFrom = getPreviousDate(FromDate,conn);
......@@ -2081,7 +2090,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
* tranIdNew : Transaction Id of current month.
*
*/
System.out.println("Retrive Item Details data from previous month or current month !!!!");
System.out.println("Retrive Item Details data from previous month or current month which is exist in CUST_STOK_DET !!!!");
sql= "select item_code,unit,op_stock ,sales,purc_rcp,cl_stock,purc_ret,rate,line_no,transit_qty,item_ser ,purc_rcp__repl ,purc_rcp__free,purc_ret__repl,purc_ret__free,transit_qty__repl,transit_qty__free " +
" from cust_stock_det where tran_id=? ";
pstmt = conn.prepareStatement(sql);
......@@ -2104,12 +2113,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
itemCodeLast=checkNull(rs.getString("item_code"));
itemSerLast=checkNull(rs.getString("item_ser"));
unitLast=checkNull(rs.getString("unit"));
//opStockLast=rs.getDouble("op_stock");
salesLast=rs.getDouble("sales");
//receiptLast=rs.getDouble("purc_rcp");
clStockNew=rs.getDouble("cl_stock");
//returnLast=rs.getDouble("purc_ret");
//rateLast=rs.getDouble("rate");
lineNoCustSt=rs.getInt("line_no");
......@@ -2133,11 +2138,17 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
receiptLast = GetRcpQty(selectedInvList,itemCodeLast,conn);
System.out.println("Receipt quantity cal for avaible transcation id :"+receiptLast);
rcpFree = GetBonQty(selectedInvList,itemCodeLast,conn) ;
System.out.println("rcpFree :"+rcpFree);
//rcpBonLast = GetRcpBonQty(selectedInvList,itemCodeLast,conn) ;
//System.out.println("rcpBonLast :"+rcpBonLast);
rcpFreesLast=GetFreeQty(selectedInvList,itemCodeLast,conn);
System.out.println("rcpFreesLast :"+rcpFreesLast);
System.out.println("receiptLast :"+receiptLast);
System.out.println("custCodeHd :"+custCodeHd);
System.out.println("orderType :"+orderType);
System.out.println("selectedInvList :"+selectedInvList);
......@@ -2150,11 +2161,16 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
transitQty=GetTransitQty(custCodeHd,orderType,itemSerHd,siteCodeHd,selectedInvList,itemCodeLast,frmDateTstmp,toDateTstmp,prdFrmDateTstmp,prdtoDateTstmp,conn);
System.out.println("transitQty quantity cal for avaible transcation id :"+transitQty);
transitQtyBonLast=GetTransitBon(custCodeHd,orderType,itemSerHd,siteCodeHd,selectedInvList,itemCodeLast,frmDateTstmp,toDateTstmp,prdFrmDateTstmp,prdtoDateTstmp,conn);
System.out.println("transitQtyBonLast :"+transitQtyBonLast);
// transitQtyBonLast=GetTransitBon(custCodeHd,orderType,itemSerHd,siteCodeHd,selectedInvList,itemCodeLast,frmDateTstmp,toDateTstmp,prdFrmDateTstmp,prdtoDateTstmp,conn);
// System.out.println("transitQtyBonLast :"+transitQtyBonLast);
transitQtyFreesLast=GetTransitFrees(custCodeHd,orderType,itemSerHd,siteCodeHd,selectedInvList,itemCodeLast,frmDateTstmp,toDateTstmp,prdFrmDateTstmp,prdtoDateTstmp,conn);
System.out.println("transitQtyFreesLast :"+transitQtyFreesLast);
////getRate(String custCode, Timestamp fromDate,Timestamp toDate, String itemCode,String siteCode,String itemSer,String orderType,Connection conn)
System.out.println("--cal rate for current transcation period");
rateLast = getRate(custCodeHd,prdFrmDateTstmp,toDateTstmp,itemCodeLast,conn);
rateLast = getRate(custCodeHd,tranDate,itemCodeLast,conn);
System.out.println("rateLast :"+rateLast);
sql = "Select descr from item "
......@@ -2346,8 +2362,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
valueXmlString.append("<op_stock protect='1'>").append("<![CDATA["+opStockLast+"]]>").append("</op_stock>");
valueXmlString.append("<purc_rcp>").append("<![CDATA["+receiptLast+"]]>").append("</purc_rcp>");
valueXmlString.append("<purc_rcp__repl>").append("<![CDATA[0]]>").append("</purc_rcp__repl>");
valueXmlString.append("<purc_rcp__free>").append("<![CDATA["+rcpFree+"]]>").append("</purc_rcp__free>");
valueXmlString.append("<purc_rcp__repl>").append("<![CDATA["+rcpFreesLast+"]]>").append("</purc_rcp__repl>");
valueXmlString.append("<purc_rcp__free>").append("<![CDATA[0]]>").append("</purc_rcp__free>");
valueXmlString.append("<purc_ret>").append("<![CDATA["+returnLast+"]]>").append("</purc_ret>");
valueXmlString.append("<purc_ret__repl>").append("<![CDATA["+replQty+"]]>").append("</purc_ret__repl>");
......@@ -2359,8 +2375,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
//valueXmlString.append("<purc_ret>").append("<![CDATA["+returnLast+"]]>").append("</purc_ret>");
valueXmlString.append("<transit_qty>").append("<![CDATA["+transitQty+"]]>").append("</transit_qty>");
valueXmlString.append("<transit_qty__repl>").append("<![CDATA[0]]>").append("</transit_qty__repl>");
valueXmlString.append("<transit_qty__free>").append("<![CDATA["+transitQtyBonLast+"]]>").append("</transit_qty__free>");
valueXmlString.append("<transit_qty__repl>").append("<![CDATA["+transitQtyFreesLast+"]]>").append("</transit_qty__repl>");
valueXmlString.append("<transit_qty__free>").append("<![CDATA[0]]>").append("</transit_qty__free>");
valueXmlString.append("<primary_sales>").append("<![CDATA["+primarySales+"]]>").append("</primary_sales>");
valueXmlString.append("</Detail4>");
......@@ -2468,8 +2484,12 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
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) ;
// System.out.println("rcpQtyBon :"+rcpQtyBon);
rcpFreeAll = GetBonQty(selectedInvList,itemCode,conn) ;
System.out.println("rcpFreeAll :"+rcpFreeAll);
rcpBonAll = GetRcpBonQty(selectedInvList,itemCode,conn) ;
System.out.println("rcpBonAll :"+rcpBonAll);
rcpFreesAll = GetFreeQty(selectedInvList,itemCode,conn) ;
System.out.println("rcpFreesAll :"+rcpFreesAll);
// sretQty = GetRetQty(custCodeHd,frmDateTstmp,toDateTstmp,itemCode,siteCodeHd,itemSerHd,conn);
// System.out.println("sretQty ::"+sretQty);
......@@ -2589,10 +2609,17 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("Transit quantity for not available in last or current tranaction"+"itemCode :"+itemCode +"Transit Quantity :"+transitQty);
transitQtyBon=GetTransitBon(custCodeHd,orderType,itemSerHd,siteCodeHd,selectedInvList,itemCode,frmDateTstmp,toDateTstmp,prdFrmDateTstmp,prdtoDateTstmp,conn);
System.out.println("transitQtyBon :"+transitQtyBon);
transitQtyFrees=GetTransitFrees(custCodeHd,orderType,itemSerHd,siteCodeHd,selectedInvList,itemCode,frmDateTstmp,toDateTstmp,prdFrmDateTstmp,prdtoDateTstmp,conn);
System.out.println("transitQtyFrees :"+transitQtyFrees);
System.out.println("/*--cal Rate for all item code which is not included for current or previous item code.---*/");
rateAll = getRate(custCodeHd,prdFrmDateTstmp,toDateTstmp,itemCode,conn);
rateAll = getRate(custCodeHd,tranDate,itemCode,conn);
System.out.println("rateAll :"+rateAll);
System.out.println("Rate for not available in last or current tranaction"+"itemCode :"+itemCode +"rate :"+rate);
......@@ -2605,7 +2632,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
itemMap.put("mopStk@"+lineNoItmCnt, String.valueOf(opStkItem));
//itemMap.put("mopStk@"+lineNoItmCnt, String.valueOf(opStkItem));
itemMap.put("mquantRcp@"+lineNoItmCnt, String.valueOf(rcpQty));
itemMap.put("rcpQtyBon@"+lineNoItmCnt, String.valueOf(rcpFreeAll));
itemMap.put("rcpQtyBon@"+lineNoItmCnt, String.valueOf(rcpBonAll));
itemMap.put("rcpFreesAll@"+lineNoItmCnt, String.valueOf(rcpFreesAll));
itemMap.put("mquant@"+lineNoItmCnt, String.valueOf(sretQtyAllTot));
itemMap.put("retQty@"+lineNoItmCnt, String.valueOf(retQtyAll));
itemMap.put("replQty@"+lineNoItmCnt, String.valueOf(replQtyAll));
......@@ -2613,6 +2641,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
itemMap.put("rate@"+lineNoItmCnt, String.valueOf(rateAll));
itemMap.put("transitQty@"+lineNoItmCnt, String.valueOf(transitQty));
itemMap.put("transitQtyBon@"+lineNoItmCnt, String.valueOf(transitQtyBon));
itemMap.put("transitQtyFrees@"+lineNoItmCnt, String.valueOf(transitQtyFrees));
itemMap.put("primarySales@"+lineNoItmCnt, String.valueOf(primarySalesAll));
}//end of IF
......@@ -2666,8 +2695,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
valueXmlString.append("<cl_stock protect='0'>").append("<![CDATA["+itemMap.get("mopStk@"+itemDomId)+"]]>").append("</cl_stock>");
valueXmlString.append("<purc_rcp>").append("<![CDATA["+itemMap.get("mquantRcp@"+itemDomId)+"]]>").append("</purc_rcp>");
valueXmlString.append("<purc_rcp__repl>").append("<![CDATA[0]]>").append("</purc_rcp__repl>");
valueXmlString.append("<purc_rcp__free>").append("<![CDATA["+itemMap.get("rcpQtyBon@"+itemDomId)+"]]>").append("</purc_rcp__free>");
valueXmlString.append("<purc_rcp__repl>").append("<![CDATA["+itemMap.get("rcpFreesAll@"+itemDomId)+"]]>").append("</purc_rcp__repl>");
valueXmlString.append("<purc_rcp__free>").append("<![CDATA[0]]>").append("</purc_rcp__free>");
valueXmlString.append("<purc_ret>").append("<![CDATA["+itemMap.get("mquant@"+itemDomId)+"]]>").append("</purc_ret>");
......@@ -2676,8 +2705,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
valueXmlString.append("<sales>").append("<![CDATA["+itemMap.get("msalesQty@"+itemDomId)+"]]>").append("</sales>");
valueXmlString.append("<transit_qty>").append("<![CDATA["+itemMap.get("transitQty@"+itemDomId)+"]]>").append("</transit_qty>");
valueXmlString.append("<transit_qty__free>").append("<![CDATA["+itemMap.get("transitQtyBon@"+itemDomId)+"]]>").append("</transit_qty__free>");
valueXmlString.append("<transit_qty__repl>").append("<![CDATA[0]]>").append("</transit_qty__repl>");
valueXmlString.append("<transit_qty__free>").append("<![CDATA[0]]>").append("</transit_qty__free>");
valueXmlString.append("<transit_qty__repl>").append("<![CDATA["+itemMap.get("transitQtyFrees@"+itemDomId)+"]]>").append("</transit_qty__repl>");
valueXmlString.append("<primary_sales>").append("<![CDATA["+itemMap.get("primarySales@"+itemDomId)+"]]>").append("</primary_sales>");
valueXmlString.append("</Detail4>");
......@@ -2794,7 +2823,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
private double getRate(String custCode, Timestamp fromDate,Timestamp toDate, String itemCode,Connection conn)throws RemoteException,ITMException
private double getRate(String custCode, Timestamp trandate, String itemCode,Connection conn)throws RemoteException,ITMException
{
ibase.webitm.utility.GenericUtility genericUtility = new ibase.webitm.utility.GenericUtility();
//System.out.println("[CustStockEJB]Calcuating rate for the custCode :"+custCode+": tranDate :"+tranDate+": itemCode :"+itemCode+":");
......@@ -2802,7 +2831,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
PreparedStatement pstmt = null;
ResultSet rs = null;
String priceList = "",selQuery="";
java.sql.Timestamp invTranDate = null,retTranDate=null,tranDate=null;
double rate = 0.0;
try
{
......@@ -2821,17 +2850,17 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
pstmt = null;
selQuery = "select max(rate) as rate from pricelist " +
" where price_list = ? and " +
" item_code = ? and " +
" list_type = 'L' and "+
" eff_from <= ? " +
" and valid_upto >= ? ";
pstmt = conn.prepareStatement(selQuery);
pstmt.setString( 1, priceList );
pstmt.setString( 2, itemCode );
pstmt.setTimestamp(3,fromDate);
pstmt.setTimestamp(4,toDate);
pstmt.setTimestamp(3,tranDate);
pstmt.setTimestamp(4,tranDate);
rs = pstmt.executeQuery( );
if( rs.next() )
{
......@@ -3228,12 +3257,164 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
}
private double GetTransitFrees(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
{
NodeList parentNodeList=null;
NodeList childList = null;
Node parentNode=null;
Node childNode = null;
String invoiceId = null;
String dlvFlg = null ;
double transitQty = 0, quantity = 0,dlvFlgTransit=0;
PreparedStatement pstmt = null,pstmt2 = null,pstmt3 = null;
ResultSet rs = null,rs2 = null,rs3 = null;
String sql = null;
String stockDlvFlg="";
String invoiceIdArray[];
String invoiceSep="",nature="";
double freesQty=0.0;
try
{
/*-----------------------------------------------------------------------------------------------*/
// 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 " +
"invdet idet where idet.item_code= ? and idet.invoice_id in " +
" ( SELECT distinct invoice.invoice_id invoice_id FROM invoice invoice WHERE " +
" ( invoice.cust_code = ? ) and invoice.site_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+") " +
"UNION " +
" SELECT distinct cinv.invoice_id FROM CUST_STOCK_INV cinv , " +
" invoice invoice WHERE cinv.invoice_id=invoice.invoice_id and invoice.cust_code = ? " +
" and invoice.item_ser= ? and invoice.confirmed = 'Y' and " +
"CASE WHEN cinv.dlv_flg IS NULL THEN 'N' ELSE cinv.dlv_flg END='N' and " +
" cinv.invoice_id not in ("+selectedInvList+") ) ";
pstmt = conn.prepareStatement( sql );
pstmt.setString(1, itemCode);
pstmt.setString(2, custCode);
pstmt.setString(3, siteCode);
pstmt.setString(4, orderType);
pstmt.setString(5, itemSer);
pstmt.setTimestamp(6, fromDate );
pstmt.setTimestamp(7, toDate );
pstmt.setTimestamp(8, prdFrom );
pstmt.setTimestamp(9, prdTo );
pstmt.setString(10, custCode );
pstmt.setString(11, itemSer);
rs = pstmt.executeQuery();
while( rs.next() )
{
invoiceId = rs.getString("invoice_id");
stockDlvFlg="N";
sql= "select count(*) as count from cust_stock_inv where invoice_id=? and dlv_flg='Y' ";
pstmt2 = conn.prepareStatement(sql);
pstmt2.setString(1, invoiceId);
rs2 = pstmt2.executeQuery();
if(rs2.next())
{
//stockDlvFlg = checkNull(rs2.getString("dlv_flg"));
dlvFlgTransit=rs2.getInt("count");
}
rs2.close();
rs2 = null;
pstmt2.close();
pstmt2 = null;
System.out.println("stockDlvFlg >>>>"+stockDlvFlg);
//if(!(stockDlvFlg.equalsIgnoreCase("Y")))
if(dlvFlgTransit == 0)
{
/*System.out.println("transit invoice :"+invoiceId);
quantity = rs.getDouble("QUANTITY__STDUOM");
System.out.println("inv qty :"+quantity);
transitQty = transitQty + quantity;*/
if(selectedInvList.trim().length() > 0)
{
invoiceIdArray = selectedInvList.split(",");
for (int i = 0; i < invoiceIdArray.length ;i++)
{
System.out.println(invoiceIdArray[i]);
invoiceSep = invoiceIdArray[i];
invoiceId = invoiceSep.replace("'", "");
System.out.println(invoiceId);
sql = "select nature,quantity__stduom from sorddet where sale_order " +
" =(select sale_order from invoice where invoice_id=?) and item_code=?";
pstmt3 = conn.prepareStatement( sql );
pstmt3.setString(1,invoiceId );
pstmt3.setString(2,itemCode );
rs3 = pstmt3.executeQuery();
while( rs3.next() )
{
quantity = rs3.getDouble("quantity__stduom");
nature=rs3.getString("nature");
System.out.println("nature :"+nature);
if(nature.equalsIgnoreCase("F"))
{
freesQty = freesQty + quantity;
System.out.println(freesQty);
}
}
rs3.close();
rs3 = null;
pstmt3.close();
pstmt3 = null;
}
}
}
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
catch(Exception exception)
{
exception.printStackTrace();
//System.out.println("Exception ::" + exception.getMessage());
throw new ITMException( exception );
}
System.out.println("transitFreesQty for transit :"+freesQty);
return freesQty ;
}
/*-----------------------------------------------------------------------------------------------*/
/*
private double GetTransitFreeQty(String tranId, String itemCode, Connection conn) throws Exception
{
NodeList parentNodeList=null;
......@@ -3304,7 +3485,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
}
return transitFreeQty ;
}
*/
//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
......@@ -3368,7 +3549,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
/*------------------------------------------------------------------------------*/
private double GetBonQty(String selectedInvList,String itemCode, Connection conn) throws Exception
private double GetRcpBonQty(String selectedInvList,String itemCode, Connection conn) throws Exception
{
double quantity = 0.0;
......@@ -3442,6 +3623,85 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
}
private double GetFreeQty(String selectedInvList,String itemCode, Connection conn) throws Exception
{
double quantity = 0.0;
double freesQty = 0.0;
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = null;
String nature="";
String[] invoiceIdArray;
String invoiceId="",invoiceSep="";
try
{
if(selectedInvList.trim().length() > 0)
{
invoiceIdArray = selectedInvList.split(",");
for (int i = 0; i < invoiceIdArray.length ;i++)
{
System.out.println(invoiceIdArray[i]);
invoiceSep = invoiceIdArray[i];
invoiceId = invoiceSep.replace("'", "");
System.out.println(invoiceId);
sql = "select nature,quantity__stduom from sorddet where sale_order " +
" =(select sale_order from invoice where invoice_id=?) and item_code=?";
pstmt = conn.prepareStatement( sql );
pstmt.setString(1,invoiceId );
pstmt.setString(2,itemCode );
rs = pstmt.executeQuery();
while( rs.next() )
{
quantity = rs.getDouble("quantity__stduom");
nature=rs.getString("nature");
System.out.println("nature :"+nature);
if(nature.equalsIgnoreCase("F"))
{
freesQty = freesQty + quantity;
System.out.println(freesQty);
}
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
}
}
catch(Exception exception)
{
exception.printStackTrace();
//System.out.println("Exception ::" + exception.getMessage());
throw new ITMException( exception );
}
System.out.println("freesQty :"+freesQty);
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