Commit b8f50835 authored by mjadhav's avatar mjadhav

separate free and chargable quantity


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98762 ce508802-f39f-4f6c-b175-0d175dae99d5
parent c4d6d76a
......@@ -1125,11 +1125,11 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
Timestamp tranDtTstmp = null,frmDateTstmp=null,toDateTstmp=null,orderDtTstmp=null;
int lineNoCustSt=0,currentFormNo = 0,varValue=0,domID3=0;
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 sretQty = 0.0,replQty=0.0,rcpQtyBon=0.0,primarySales=0.0,transitQtyAll=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="",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,rcpBonAll=0.0,rcpBonLast=0.0,transitQtyBonLast=0.0,rcpFreesLast=0.0;
double retQtyAll=0.0,transitCharQty=0.0,replQtyAll=0.0,primarySalesAll=0.0,rcpBonAll=0.0,rcpBonLast=0.0,transitQtyBonLast=0.0,rcpFreesLast=0.0,rcpChargableQty=0.0;
SimpleDateFormat sdf;
ArrayList defData = null;
windowName = (new StringBuilder("w_")).append(getObjName(dom, objContext)).toString();
......@@ -1150,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,totReceiptLast=0.0;
double sretQtyAll=0.0,rateAll=0.0,rcpQtyAll=0.0,sretQtyAllTot=0.0,transitCharQtyAll=0.0,transitQtyFreesLast=0.0,transitQtyFrees=0.0,rcpFreesAll=0.0,totReceiptLast=0.0,rcpChargableLast=0.0;
String sretSiteCodeAll="",sretLocCodeAll="",sretLotNoAll="",sretLotSlAll="",retRepFlagAll="";
int invCnt=0,dlvFlgCnt=0;
......@@ -1743,7 +1743,9 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("prdFrmDateTstmp :"+prdFrmDateTstmp);
prdtoDateTstmp = prdTo;
System.out.println("prdtoDateTstmp :"+prdtoDateTstmp);
//1)consider invoice which is based on period
//2)cosider transit invoice.
//3)Union query included for transit invoice not exist in previous month
sql = " SELECT distinct invoice.invoice_id invoice_id, " +
" invoice.tran_date as invoice_date ,'N' as DLV_FLG ,invoice.net_amt " +
......@@ -2043,7 +2045,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
//tranDate=java.sql.Timestamp.valueOf(genericUtility.getValidDateString(tranDateStr, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");;
/*---calculate previous month from input value period,start---*/
/*---calculate previous month from input value period,start------------------------------*/
frmDateTstmp = java.sql.Timestamp.valueOf(genericUtility.getValidDateString(fromdate, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
System.out.println("frmDateTstmp :"+frmDateTstmp);
......@@ -2075,7 +2077,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("prdFrmDateTstmp :"+prdFrmDateTstmp);
System.out.println("prdtoDateTstmp :"+prdtoDateTstmp);
/*-------------------------END----------------------------------------*/
/*-------------------------END------------------------------------------------------------------*/
sql= " SELECT TRAN_ID FROM CUST_STOCK WHERE CUST_CODE = ? " +
......@@ -2148,7 +2150,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
//System.out.println("toDateTstmp :"+toDateTstmp);
/*---------------Receipt Quantity Calculation(start)------------------------------------------------*/
//receiptLast=GetRcpQty(custCodeHd,tranIdLast,orderType,frmDateTstmp,toDateTstmp,itemCodeLast,itemSerHd,conn);
System.out.println("-------calculate Receipt quantity for availble transcaion Id--------");
......@@ -2169,6 +2171,12 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
rcpFreesLast = GetFreeQty(custCodeHd,orderType,itemSerHd,siteCodeHd,selectedInvList,itemCodeLast,frmDateTstmp,toDateTstmp,prdFrmDateTstmp,prdtoDateTstmp,conn);
System.out.println("rcpFreesLast :"+rcpFreesLast);
rcpChargableLast=0.0;
rcpChargableLast = receiptLast - rcpFreesLast;
System.out.println("rcpChargableLast :"+rcpChargableLast);
/*------------------------------------------------------------------------------------------------------------------*
System.out.println("custCodeHd :"+custCodeHd);
System.out.println("orderType :"+orderType);
......@@ -2198,6 +2206,10 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
transitQtyFreesLast=GetTransitFrees(custCodeHd,orderType,itemSerHd,siteCodeHd,selectedInvList,itemCodeLast,frmDateTstmp,toDateTstmp,prdFrmDateTstmp,prdtoDateTstmp,conn);
System.out.println("transitQtyFreesLast :"+transitQtyFreesLast);
transitCharQty=0.0;
transitCharQty = transitQty - transitQtyFreesLast;
System.out.println("transitCharQty :"+transitCharQty);
////getRate(String custCode, Timestamp fromDate,Timestamp toDate, String itemCode,String siteCode,String itemSer,String orderType,Connection conn)
System.out.println("tranDate :"+tranDate);
System.out.println("-------calculate Rate for availble transcaion Id--------");
......@@ -2402,7 +2414,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["+rcpChargableLast+"]]>").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>");
......@@ -2415,7 +2427,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
//valueXmlString.append("<purc_rcp>").append("<![CDATA["+receiptLast+"]]>").append("</purc_rcp>");
//valueXmlString.append("<purc_ret>").append("<![CDATA["+returnLast+"]]>").append("</purc_ret>");
valueXmlString.append("<transit_qty>").append("<![CDATA["+transitQty+"]]>").append("</transit_qty>");
valueXmlString.append("<transit_qty>").append("<![CDATA["+transitCharQty+"]]>").append("</transit_qty>");
valueXmlString.append("<transit_qty__repl>").append("<![CDATA["+transitQtyFreesLast+"]]>").append("</transit_qty__repl>");
valueXmlString.append("<transit_qty__free>").append("<![CDATA[0.0]]>").append("</transit_qty__free>");
valueXmlString.append("<primary_sales>").append("<![CDATA["+primarySales+"]]>").append("</primary_sales>");
......@@ -2526,6 +2538,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
pstmt = null;
/*------------------------------RECEIPT QUANTITY CALCULATION-----------------------------------------------------*/
//rcpQty = GetRcpQty(custCodeHd,tranIdLast,orderType,selectedInvList,prdFrmDateTstmp,toDateTstmp,itemCode,itemSerHd,conn);
//rcpQty = GetRcpQty(custCodeHd,tranIdLast,orderType,selectedInvList,prdFrmDateTstmp,toDateTstmp,itemCode,itemSerHd,conn);
System.out.println("-- calculate recipt quantity which is not available for last or current month transcation !!!");
......@@ -2534,9 +2548,9 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("frmDateTstmp :"+frmDateTstmp);
System.out.println("toDateTstmp :"+toDateTstmp);
//rcpQty = GetRcpQty(custCodeHd,itemCode,itemSerHd,orderType,siteCodeHd,frmDateTstmp,toDateTstmp,conn);
rcpQty = GetRcpQty(custCodeHd,orderType,itemSerHd,siteCodeHd,selectedInvList,itemCode,frmDateTstmp,toDateTstmp,prdFrmDateTstmp,prdtoDateTstmp,conn);
System.out.println("Receipt quantity for not available in last or current tranaction"+"itemCode :"+itemCode +"Receipt Quantity :"+rcpQty);
rcpQtyAll=0.0;
rcpQtyAll = GetRcpQty(custCodeHd,orderType,itemSerHd,siteCodeHd,selectedInvList,itemCode,frmDateTstmp,toDateTstmp,prdFrmDateTstmp,prdtoDateTstmp,conn);
System.out.println("Receipt quantity for not available in last or current tranaction"+"itemCode :"+itemCode +"Receipt Quantity :"+rcpQtyAll);
// rcpQtyBon = GetRcpFreeQty( custCodeHd,tranIdLast,orderType,prdFrmDateTstmp, toDateTstmp,itemCode,itemSerHd, conn) ;
// System.out.println("rcpQtyBon :"+rcpQtyBon);
//rcpBonAll=0.0;
......@@ -2549,6 +2563,17 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
rcpFreesAll = GetFreeQty(custCodeHd,orderType,itemSerHd,siteCodeHd,selectedInvList,itemCode,frmDateTstmp,toDateTstmp,prdFrmDateTstmp,prdtoDateTstmp,conn);
System.out.println("rcpFreesAll :"+rcpFreesAll);
rcpChargableQty=0.0;
rcpChargableQty = rcpQtyAll - rcpFreesAll;
System.out.println("rcpChargableQty :"+rcpChargableQty);
/*------------------------------------------------------------------------------------------------------------------------*/
// sretQty = GetRetQty(custCodeHd,frmDateTstmp,toDateTstmp,itemCode,siteCodeHd,itemSerHd,conn);
// System.out.println("sretQty ::"+sretQty);
......@@ -2650,9 +2675,9 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("retQtyAll :"+retQtyAll);
System.out.println("replQty :"+replQty);
sretQtyAllTot= retQtyAll - replQtyAll ;
System.out.println("sretQty !!!!!!:"+retQty);
System.out.println("sretQtyAllTot !!!!!!:"+sretQtyAllTot);
System.out.println("Return quantity for not available in last or current tranaction"+"itemCode :"+itemCode +"Return Quantity :"+sretQtyAll);
System.out.println("Return quantity for not available in last or current tranaction"+"itemCode :"+itemCode +"Return Quantity :"+sretQtyAllTot);
transitQty=0.0;
transitQtyBon=0.0;
......@@ -2675,10 +2700,10 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("Primary Sales for not available in last or current tranaction"+"itemCode :"+itemCode +"primarySales :"+primarySales);
System.out.println("--calculate Transit Quantoty which is not included for current or previous month transcation------");
transitQty=0.0;
transitQtyAll=0.0;
//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);
transitQtyAll=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 :"+transitQtyAll);
//transitQtyBon=0.0;
//transitQtyBon=GetTransitBon(custCodeHd,orderType,itemSerHd,siteCodeHd,selectedInvList,itemCode,frmDateTstmp,toDateTstmp,prdFrmDateTstmp,prdtoDateTstmp,conn);
......@@ -2688,6 +2713,11 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
transitQtyFrees=GetTransitFrees(custCodeHd,orderType,itemSerHd,siteCodeHd,selectedInvList,itemCode,frmDateTstmp,toDateTstmp,prdFrmDateTstmp,prdtoDateTstmp,conn);
System.out.println("transitQtyFrees :"+transitQtyFrees);
transitCharQtyAll = 0.0;
transitCharQtyAll = transitQtyAll - transitQtyFrees;
System.out.println("transitCharQtyAll :"+transitCharQtyAll);
System.out.println("/*--cal Rate for all item code which is not included for current or previous item code.---*/");
System.out.println("rcpQty :"+rcpQty);
......@@ -2708,7 +2738,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(rcpChargableQty));
itemMap.put("rcpQtyBon@"+lineNoItmCnt, String.valueOf(rcpBonAll));
itemMap.put("rcpFreesAll@"+lineNoItmCnt, String.valueOf(rcpFreesAll));
itemMap.put("mquant@"+lineNoItmCnt, String.valueOf(sretQtyAllTot));
......@@ -2716,7 +2746,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
itemMap.put("replQty@"+lineNoItmCnt, String.valueOf(replQtyAll));
itemMap.put("msalesQty@"+lineNoItmCnt, String.valueOf(salesQty));
itemMap.put("rate@"+lineNoItmCnt, String.valueOf(rateAll));
itemMap.put("transitQty@"+lineNoItmCnt, String.valueOf(transitQty));
itemMap.put("transitQty@"+lineNoItmCnt, String.valueOf(transitCharQtyAll));
itemMap.put("transitQtyBon@"+lineNoItmCnt, String.valueOf(transitQtyBon));
itemMap.put("transitQtyFrees@"+lineNoItmCnt, String.valueOf(transitQtyFrees));
itemMap.put("primarySales@"+lineNoItmCnt, String.valueOf(primarySalesAll));
......@@ -2934,8 +2964,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
selQuery = "select max(rate) as rate from pricelist " +
" where price_list = ? and " +
" item_code = ? and " +
" list_type = 'L' and "+
" eff_from <= ? " +
" eff_from <= ? " +
" and valid_upto >= ? ";
pstmt = conn.prepareStatement(selQuery);
pstmt.setString( 1, priceList );
......@@ -3380,7 +3409,7 @@ private double GetTransitQty(String tranId, String itemCode, Connection conn) th
// transit quantity for those which are included in period also for dlv flag 'N'
System.out.println("----calculate Transit Frees Quantity------------------");
sql = " select idet.QUANTITY__STDUOM,idet.invoice_id,idet.item_code from " +
sql = " select distinct idet.invoice_id 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=? " +
......@@ -3675,7 +3704,7 @@ private double GetRcpQty(String custCode, String orderType, String itemSer,Strin
sql = " select idet.QUANTITY__STDUOM,idet.invoice_id,idet.item_code from " +
sql = " select idet.invoice_id ,idet.QUANTITY__STDUOM 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=? " +
......@@ -3709,10 +3738,10 @@ private double GetRcpQty(String custCode, String orderType, String itemSer,Strin
while( rs.next() )
{
invoiceId = rs.getString("invoice_id");
quantity = rs.getDouble("QUANTITY__STDUOM");
System.out.println("inv qty :"+quantity);
rcpQuantity = rcpQuantity + quantity;
System.out.println("invoiceId :"+invoiceId);
quantity = rs.getDouble("QUANTITY__STDUOM");
System.out.println("inv qty :"+quantity);
rcpQuantity = rcpQuantity + quantity;
}
rs.close();
......@@ -3789,7 +3818,7 @@ private double GetRcpQty(String custCode, String orderType, String itemSer,Strin
/*------------------------------------------------------------------------------*/
private double GetRcpBonQty(String selectedInvList,String itemCode, Connection conn) throws Exception
/*private double GetRcpBonQty(String selectedInvList,String itemCode, Connection conn) throws Exception
{
double quantity = 0.0;
......@@ -3860,7 +3889,7 @@ private double GetRcpQty(String custCode, String orderType, String itemSer,Strin
}
System.out.println("bonusQty :"+bonusQty);
return bonusQty ;
}
}*/
......@@ -4050,9 +4079,9 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
// transit quantity for those which are included in period also for dlv flag 'N'
System.out.println("----calculate Transit Frees Quantity------------------");
System.out.println("----calculate Receipt Frees Quantity------------------");
sql = " select idet.QUANTITY__STDUOM,idet.invoice_id,idet.item_code from " +
sql = " select distinct idet.invoice_id 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=? " +
......@@ -4089,28 +4118,7 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
System.out.println("invoiceId :"+invoiceId);
//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 " +
......@@ -4136,16 +4144,7 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
pstmt3.close();
pstmt3 = null;
//}
//}
//}
}
rs.close();
rs = null;
......@@ -4160,7 +4159,7 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
//System.out.println("Exception ::" + exception.getMessage());
throw new ITMException( exception );
}
System.out.println("transitFreesQty for transit :"+freesQty);
System.out.println(" Receipt Frees :"+freesQty);
return freesQty ;
}
......@@ -4173,7 +4172,7 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
/*
private double GetRcpFreeQty(String custCode,String tranIdLast,String orderType, java.sql.Timestamp fromDate, java.sql.Timestamp toDate,String itemCode,String itemSer, Connection conn) throws Exception
......@@ -4254,11 +4253,11 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
return rcpFreeQuantity ;
}
*/
/*
private double GetRetQty(String custCodeHd,java.sql.Timestamp frmDateTstmp, java.sql.Timestamp toDateTstmp,String itemCode,String siteCodeHd,String itemSerHd, Connection conn) throws Exception
{
......@@ -4366,7 +4365,7 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
return sretQty ;
}
*/
......
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