Commit 371680b2 authored by mjadhav's avatar mjadhav

changes done for transit qty


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98736 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 95d7ec7c
......@@ -803,7 +803,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
itemCode = childNode1.getFirstChild().getNodeValue();
}
System.out.println("itemCode :"+itemCode);
if(itemCode == null)
System.out.println("itemCode.trim().length() :"+itemCode);
if(itemCode.trim().length() == 0)
{
System.out.println("Error : No data found in item details");
errCode = "VTEMTITM";
......@@ -823,7 +824,14 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
{
clStock = 0.0;
}
System.out.println("clStock :"+clStock);
if(clStock == 0)
{
errCode = "VTCLSZERO";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
System.out.println("Closing Stock cannot be zero");
}
if(clStock < 0)
{
errCode = "VTCLSTVLD";
......@@ -1111,7 +1119,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
String descr = "", locTypeItem = "",tranIdLastHd="",tranDateHd="",tranIdNew="",tranCode="",tranName="",lrNo="",stockMode="";
String itemCodeLast ="" , unitLast = "",descrLast="",custName="",itemSerName="",spCode ="",itemSerLast="";
double opStockLast=0.0,sales=0.0,transitQty=0.0,salesLast=0.0,receiptLast=0.0,clStockLast=0.0,returnLast=0.0,rateLast=0.0,salesQty=0.0,clStock=0.0;
double netAmt=0.0,opStkItem=0.0,retQty = 0.0,rcpQty=0.0,rate=0.0,adjQty=0.0,adhocQty=0.0;;
double netAmt=0.0,opStkItem=0.0,retQty = 0.0,rcpQty=0.0,rate=0.0,adjQty=0.0,adhocQty=0.0,totRcpQtyAll=0.0;
Date invDate=null,frmDate=null,toDate=null,stmtDate=null,lrDate=null;
java.sql.Timestamp ToDate = null,FromDate=null,compDate=null,prdFrom=null,prdTo=null,tranDate=null,prvToDt=null;
Timestamp tranDtTstmp = null,frmDateTstmp=null,toDateTstmp=null,orderDtTstmp=null;
......@@ -1142,7 +1150,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,transitQtyFreesLast=0.0,transitQtyFrees=0.0,rcpFreesAll=0.0;
double sretQtyAll=0.0,rateAll=0.0,sretQtyAllTot=0.0,transitQtyFreesLast=0.0,transitQtyFrees=0.0,rcpFreesAll=0.0,totReceiptLast=0.0;
String sretSiteCodeAll="",sretLocCodeAll="",sretLotNoAll="",sretLotSlAll="",retRepFlagAll="";
int invCnt=0,dlvFlgCnt=0;
......@@ -2142,7 +2150,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("-------calculate Receipt quantity for availble transcaion Id--------");
receiptLast=0.0;
//receiptLast = GetRcpQty(selectedInvList,itemCodeLast,conn);
receiptLast = GetRcpQty(custCodeHd,itemCodeLast,itemSerHd,orderType,frmDateTstmp,toDateTstmp,conn);
receiptLast = GetRcpQty(custCodeHd,itemCodeLast,itemSerHd,orderType,siteCodeHd,frmDateTstmp,toDateTstmp,conn);
System.out.println("Receipt quantity cal for avaible transcation id :"+receiptLast);
//rcpBonLast = GetRcpBonQty(selectedInvList,itemCodeLast,conn) ;
......@@ -2167,8 +2175,13 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("-------calculate Transit quantity for availble transcaion Id--------");
transitQty=0.0;
transitQty=GetTransitQty(custCodeHd,orderType,itemSerHd,siteCodeHd,selectedInvList,itemCodeLast,frmDateTstmp,toDateTstmp,prdFrmDateTstmp,prdtoDateTstmp,conn);
transitQty=GetTransitQty(tranIdLast,itemCodeLast,conn);
//transitQty=GetTransitQty(custCodeHd,orderType,itemSerHd,siteCodeHd,selectedInvList,itemCodeLast,frmDateTstmp,toDateTstmp,prdFrmDateTstmp,prdtoDateTstmp,conn);
System.out.println("transitQty quantity cal for avaible transcation id :"+transitQty);
System.out.println("receiptLast :"+receiptLast);
System.out.println("transitQty :"+transitQty);
totReceiptLast=receiptLast + transitQty;
System.out.println("totReceiptLast :"+totReceiptLast);
// transitQtyBonLast=GetTransitBon(custCodeHd,orderType,itemSerHd,siteCodeHd,selectedInvList,itemCodeLast,frmDateTstmp,toDateTstmp,prdFrmDateTstmp,prdtoDateTstmp,conn);
// System.out.println("transitQtyBonLast :"+transitQtyBonLast);
......@@ -2381,7 +2394,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
valueXmlString.append("<rate>").append("<![CDATA["+rateLast+"]]>").append("</rate>");
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>").append("<![CDATA["+totReceiptLast+"]]>").append("</purc_rcp>");
valueXmlString.append("<purc_rcp__repl>").append("<![CDATA["+rcpFreesLast+"]]>").append("</purc_rcp__repl>");
valueXmlString.append("<purc_rcp__free>").append("<![CDATA[0.0]]>").append("</purc_rcp__free>");
......@@ -2509,7 +2522,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
// rcpQty = GetRcpQty(selectedInvList,itemCode,conn);
System.out.println("frmDateTstmp :"+frmDateTstmp);
System.out.println("toDateTstmp :"+toDateTstmp);
rcpQty = GetRcpQty(custCodeHd,itemCode,itemSerHd,orderType,frmDateTstmp,toDateTstmp,conn);
rcpQty = GetRcpQty(custCodeHd,itemCode,itemSerHd,orderType,siteCodeHd,frmDateTstmp,toDateTstmp,conn);
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);
......@@ -2649,7 +2662,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("--calculate Transit Quantoty which is not included for current or previous month transcation------");
transitQty=0.0;
transitQty=GetTransitQty(custCodeHd,orderType,itemSerHd,siteCodeHd,selectedInvList,itemCode,frmDateTstmp,toDateTstmp,prdFrmDateTstmp,prdtoDateTstmp,conn);
transitQty=GetTransitQty(tranIdLast,itemCode,conn);
//transitQty=GetTransitQty(custCodeHd,orderType,itemSerHd,siteCodeHd,selectedInvList,itemCode,frmDateTstmp,toDateTstmp,prdFrmDateTstmp,prdtoDateTstmp,conn);
System.out.println("Transit quantity for not available in last or current tranaction"+"itemCode :"+itemCode +"Transit Quantity :"+transitQty);
//transitQtyBon=0.0;
......@@ -2662,7 +2676,10 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("/*--cal Rate for all item code which is not included for current or previous item code.---*/");
System.out.println("rcpQty :"+rcpQty);
System.out.println("transitQty :"+transitQty);
totRcpQtyAll =rcpQty + transitQty;
System.out.println("totRcpQtyAll :"+totRcpQtyAll);
rateAll=0.0;
rateAll = getRate(custCodeHd,tranDate,itemCode,conn);
......@@ -2677,7 +2694,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
itemMap.put("mlType@"+lineNoItmCnt, locTypeItem);
itemMap.put("mopStk@"+lineNoItmCnt, String.valueOf(opStkItem));
//itemMap.put("mopStk@"+lineNoItmCnt, String.valueOf(opStkItem));
itemMap.put("mquantRcp@"+lineNoItmCnt, String.valueOf(rcpQty));
itemMap.put("mquantRcp@"+lineNoItmCnt, String.valueOf(totRcpQtyAll));
itemMap.put("rcpQtyBon@"+lineNoItmCnt, String.valueOf(rcpBonAll));
itemMap.put("rcpFreesAll@"+lineNoItmCnt, String.valueOf(rcpFreesAll));
itemMap.put("mquant@"+lineNoItmCnt, String.valueOf(sretQtyAllTot));
......@@ -3007,7 +3024,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
}
return invoiceListString ;
}
private double GetTransitQty(String custCode, String orderType, String itemSer,String siteCode,String selectedInvList,String itenmCode,java.sql.Timestamp fromDate, java.sql.Timestamp toDate,java.sql.Timestamp prdFrom, java.sql.Timestamp prdTo, Connection conn) throws Exception
/*private double GetTransitQty(String custCode, String orderType, String itemSer,String siteCode,String selectedInvList,String itenmCode,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;
......@@ -3109,10 +3126,65 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
return transitQty ;
}
*/
private double GetTransitQty(String tranId, String itemCode, 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;
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = null;
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 +"'";
pstmt = conn.prepareStatement( sql );
pstmt.setString( 1, tranId );
pstmt.setString( 2, itemCode );
rs = pstmt.executeQuery();
if ( rs.next() )
{
quantity = rs.getDouble("QUANTITY");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
transitQty = quantity;
}
catch(Exception exception)
{
exception.printStackTrace();
//System.out.println("Exception ::" + exception.getMessage());
throw new ITMException( exception );
}
return transitQty ;
}
......@@ -3499,9 +3571,9 @@ 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 itemCode,String itemSer,String orderType, java.sql.Timestamp fromDate, java.sql.Timestamp toDate,Connection conn) throws Exception
private double GetRcpQty(String custCode,String itemCode,String itemSer,String orderType,String siteCode, java.sql.Timestamp fromDate, java.sql.Timestamp toDate,Connection conn) throws Exception
{
String invoiceId="";
String invoiceId="",selQuery="";
double quantity = 0.0;
double rcpQuantity = 0.0;
PreparedStatement pstmt = null;
......@@ -3511,16 +3583,15 @@ private double GetRcpQty(String custCode,String itemCode,String itemSer,String o
try
{
System.out.println("@@@@@@@@@@@@@@@@");
sql = "select sum(b.quantity__stduom) qty_stduom from invoice a, invdet b "
+" where a.invoice_id = b.invoice_id "
+" where a.invoice_id = b.invoice_id and a.confirmed='Y' "
+" and a.cust_code = ? "
+" and a.tran_date >= ? "
+" and a.tran_date <= ? "
+" and b.item_code = ? "
+" and a.item_ser = ? "
+" and a.inv_type = ? ";
+" and a.inv_type = ? "
+" and a.site_code = ? ";
pstmt = conn.prepareStatement( sql );
pstmt.setString(1,custCode);
......@@ -3529,6 +3600,7 @@ private double GetRcpQty(String custCode,String itemCode,String itemSer,String o
pstmt.setString(4,itemCode);
pstmt.setString(5,itemSer);
pstmt.setString(6,orderType);
pstmt.setString(7,siteCode);
rs = pstmt.executeQuery( );
if( rs.next() )
{
......@@ -3544,6 +3616,11 @@ private double GetRcpQty(String custCode,String itemCode,String itemSer,String o
pstmt.close();
pstmt = null;
}
catch(Exception exception)
{
......
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