Commit 4e1c179a authored by mjadhav's avatar mjadhav

add validation for quantity


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98662 ce508802-f39f-4f6c-b175-0d175dae99d5
parent eef90d21
......@@ -110,13 +110,15 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
java.util.Date tranDate = null;
int ctr = 0,currentFormNo=0,cnt=0,countCustRef=0,refSerCnt=0,childNodeListLength=0,invCnt=0;
double clStock=0.0,opStockDom=0.0,purRcpDom=0.0;
double opStock=0.0,purRcpQty=0.0,secSales=0.0,purcRetQty=0.0,priSales=0.0;
java.sql.Timestamp FromDate=null,ToDate=null,prdFrmDate=null,prdFrom=null,prdTo=null;
String fromDateStr ="",toDateStr="";
// boolean dateFlag=false,dateFlagTodate=false,dateFlagFrmdate=false,dateFlagstmtDate=false;
Node parentNode1 = null;
Node childNode1 = null;
int parentNodeListLength = 0;
SimpleDateFormat sdf = null;
Connection conn = null;
PreparedStatement pstmt = null,pstmt1 = null,pstmt2 = null,pstmt3 = null,pstmt4 = null,pstmt5 = null,pstmt6 = null;
......@@ -155,6 +157,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
System.out.println("childNodeName :"+childNodeName);
if (childNodeName.equalsIgnoreCase("cust_code"))
{
custCode = this.genericUtility.getColumnValue("cust_code", dom);
......@@ -213,6 +216,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
}
if (childNodeName.equalsIgnoreCase("item_ser"))
{
System.out.println("item_ser called!!!!!!");
itemSer = this.genericUtility.getColumnValue("item_ser", dom);
System.out.println("itemSer :"+itemSer);
custCode = checkNull(this.genericUtility.getColumnValue("cust_code", dom));
......@@ -249,15 +253,16 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
}//cust code
}
if(this.genericUtility.getColumnValue("item_ser", dom) != null && this.genericUtility.getColumnValue("cust_code", dom) != null)
/*if(this.genericUtility.getColumnValue("item_ser", dom) != null && this.genericUtility.getColumnValue("cust_code", dom) != null)
{
custCode = this.genericUtility.getColumnValue("cust_code", dom);
itemSer = this.genericUtility.getColumnValue("item_ser", dom);
System.out.println("custCode :"+custCode +"@itemSer :"+itemSer);
}
}*/
if(childNodeName.equalsIgnoreCase("order_type"))
{
System.out.println("order_type called!!!!");
orderType = this.genericUtility.getColumnValue("order_type", dom);
System.out.println("orderType :"+orderType);
custCode = this.genericUtility.getColumnValue("cust_code", dom);
......@@ -325,6 +330,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
if(childNodeName.equalsIgnoreCase("period"))
{
System.out.println("period called!!!!");
period = this.genericUtility.getColumnValue("period", dom);
System.out.println("period :"+period);
orderType = this.genericUtility.getColumnValue("order_type", dom);
......@@ -400,7 +406,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("ToDate :"+ToDate);
if(FromDate != null && ToDate != null)
if(FromDate != null && ToDate != null && custCode != null && orderType != null && itemSer != null)
{
sql = " SELECT count(*) as count FROM invoice invoice WHERE ( invoice.cust_code = ? ) " +
" and invoice.inv_type=? and invoice.item_ser=? and ( invoice.confirmed = 'Y' )" +
......@@ -536,12 +542,15 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
break;
case 3:
parentNodeList = dom.getElementsByTagName("Detail3");
/*parentNodeList = dom.getElementsByTagName("Detail3");
System.out.println("parentNodeList :"+parentNodeList);
parentNode = parentNodeList.item(0);
System.out.println("parentNode :"+parentNode);
childNodeList = parentNode.getChildNodes();
//valueXmlString.append("<Detail1>");
childNodeListLength = childNodeList.getLength();
System.out.println("wfValData : case 3 called!!!!");
System.out.println("childNodeListLength :"+childNodeListLength);
for (ctr = 0; ctr < childNodeListLength; ctr++)
{
childNode = childNodeList.item(ctr);
......@@ -561,12 +570,54 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
}
}
}*/
//valueXmlString.append("</Detail1>");
//NodeList parentNodeList = null;
//NodeList childNodeList = null;
//int childNodeListLength = 0;
parentNodeList = dom2.getElementsByTagName("Detail3");
parentNodeListLength = parentNodeList.getLength();
System.out.println("parentNodeListLength Detail3:::::::::"+parentNodeListLength);
for (int selectedRow = 0; selectedRow < parentNodeListLength; selectedRow++)
{
parentNode1 = parentNodeList.item(selectedRow);
childNodeList = parentNode1.getChildNodes();
childNodeListLength = childNodeList.getLength();
System.out.println("childNodeListLength::: "+ childNodeListLength+"\n");
for (int childRow = 0; childRow < childNodeListLength; childRow++)
{
childNode1 = childNodeList.item(childRow);
childNodeName = childNode1.getNodeName();
System.out.println("childNodeName :"+childNodeName);
if (childNodeName.equals("invoice_id"))
{
if(childNode1.getFirstChild()!=null)
{
invoiceId = childNode1.getFirstChild().getNodeValue();
}
System.out.println("invoiceId :"+invoiceId);
if(invoiceId == null)
{
System.out.println("Error : No data found in invoice details");
errCode = "VTEMTINV";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
}
break;
case 4:
parentNodeList = dom.getElementsByTagName("Detail4");
/* parentNodeList = dom.getElementsByTagName("Detail4");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
//valueXmlString.append("<Detail1>");
......@@ -654,8 +705,179 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
}
}*/
//valueXmlString.append("</Detail1>");
//int childNodeListLength = 0;
parentNodeList = dom2.getElementsByTagName("Detail4");
parentNodeListLength = parentNodeList.getLength();
System.out.println("parentNodeListLength Detail4:::::::::"+parentNodeListLength);
for (int selectedRow = 0; selectedRow < parentNodeListLength; selectedRow++)
{
parentNode1 = parentNodeList.item(selectedRow);
childNodeList = parentNode1.getChildNodes();
childNodeListLength = childNodeList.getLength();
System.out.println("childNodeListLength::: "+ childNodeListLength+"\n");
for (int childRow = 0; childRow < childNodeListLength; childRow++)
{
childNode1 = childNodeList.item(childRow);
childNodeName = childNode1.getNodeName();
System.out.println("childNodeName :"+childNodeName);
if (childNodeName.equals("item_code"))
{
if(childNode1.getFirstChild()!=null)
{
itemCode = childNode1.getFirstChild().getNodeValue();
}
System.out.println("itemCode :"+itemCode);
if(itemCode == null)
{
System.out.println("Error : No data found in item details");
errCode = "VTEMTITM";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
if (childNodeName.equals("cl_stock"))
{
if(childNode1.getFirstChild()!=null)
{
clStock = Double.parseDouble(childNode1.getFirstChild().getNodeValue());
}
else
{
clStock = 0.0;
}
if(clStock < 0)
{
errCode = "VTCLSTVLD";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
System.out.println("Closing Stock not be valid");
}
}
if (childNodeName.equals("op_stock"))
{
if(childNode1.getFirstChild()!=null)
{
opStock = Double.parseDouble(childNode1.getFirstChild().getNodeValue());
}
else
{
opStock = 0.0;
}
System.out.println("opStock :"+opStock);
if(opStock < 0)
{
errCode = "VTOPSTVLD";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
System.out.println("Opening Stock not be valid");
}
}
if (childNodeName.equals("purc_rcp"))
{
if(childNode1.getFirstChild()!=null)
{
purRcpQty = Double.parseDouble(childNode1.getFirstChild().getNodeValue());
}
else
{
purRcpQty = 0.0;
}
System.out.println("purRcpQty :"+purRcpQty);
if(purRcpQty < 0)
{
errCode = "VTRCPTVLD";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
System.out.println("purchase receipt not valid");
}
}
if (childNodeName.equals("sales"))
{
if(childNode1.getFirstChild()!=null)
{
secSales = Double.parseDouble(childNode1.getFirstChild().getNodeValue());
}
else
{
secSales = 0.0;
}
System.out.println("secSales :"+secSales);
if(secSales < 0)
{
errCode = "VTSALTVLD";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
System.out.println("Secondary sales not be valid");
}
}
if (childNodeName.equals("purc_ret"))
{
if(childNode1.getFirstChild()!=null)
{
purcRetQty = Double.parseDouble(childNode1.getFirstChild().getNodeValue());
}
else
{
purcRetQty = 0.0;
}
System.out.println("purcRetQty :"+purcRetQty);
if(purcRetQty < 0)
{
errCode = "VTRETVLD";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
System.out.println("purchase return not be valid");
}
}
if (childNodeName.equals("primary_sales"))
{
if(childNode1.getFirstChild()!=null)
{
priSales = Double.parseDouble(childNode1.getFirstChild().getNodeValue());
}
else
{
priSales = 0.0;
}
System.out.println("priSales :"+priSales);
if(priSales < 0)
{
errCode = "VTPRISVLD";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
System.out.println("purchase return not be valid");
}
}
}
}
break;
......@@ -809,14 +1031,14 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
Connection conn = null;
Statement stmt = null;
PreparedStatement pstmt = null,pstmt1 = null,pstmt2 = null,pstmt3 = null;
ResultSet rs = null,rs1=null,rs2=null,rs3=null;
PreparedStatement pstmt = null,pstmt1 = null,pstmt2 = null,pstmt3 = null,pstmt4 = null;
ResultSet rs = null,rs1=null,rs2=null,rs3=null,rs4=null;
String tranId="",orderType="";
String windowName="",loginSite="",invoiceId="",clStockInp ="",dlvFlag="",custCode="",siteCode="",fromdate="",itemSer="",tranIdLast="";
String todate="",varValueStr="",sql="",descrItem="";
String chgDate="",chgUser="",loginEmpCode="",chgTerm="",columnValue ="",orderTypeName="";
String custCodeHd ="",itemSerHd = "" ,siteCodeHd ="",itemCode="",unitItem="";
String mCustCode = "", itemSerDet = "", mErrCode = "";
String mCustCode = "", itemSerDet = "", mErrCode = "",lsOpStock="",lsTranId="";
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;
......@@ -829,8 +1051,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
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="";
double rcpQtmDom = 0.0,retQtyDom=0.0,opStkDom=0.0,transitQtyDom=0.0,salesQtyCal=0.0;
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;
SimpleDateFormat sdf;
ArrayList defData = null;
windowName = (new StringBuilder("w_")).append(getObjName(dom, objContext)).toString();
......@@ -851,6 +1073,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
String locality_code="";
String childNodeName = "";
String invoiceIdList = "";
double sretQtyAll=0.0,rateAll=0.0;
String sretSiteCodeAll="",sretLocCodeAll="",sretLotNoAll="",sretLotSlAll="",retRepFlagAll="";
int invCnt=0;
......@@ -1652,7 +1876,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
tranIdNew = checkNull(genericUtility.getColumnValue("tran_id",dom2));
System.out.println("tranIdNew :"+tranIdNew);
Node detail2Node = dom2.getElementsByTagName("Detail1").item(0);
custCodeHd = genericUtility.getColumnValue("cust_code", dom2);
System.out.println("custCodeHd (case 4):"+custCodeHd);
......@@ -1757,15 +1981,15 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
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);
if(tranIdNew.trim().length() == 0)
pstmt.setString(1, tranIdLast);
/*if(tranIdNew.trim().length() == 0)
{
pstmt.setString(1, tranIdLast);
}
else
{
pstmt.setString(1, tranIdNew);
}
}*/
rs = pstmt.executeQuery();
while(rs.next())
......@@ -1777,11 +2001,11 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
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");
//salesLast=rs.getDouble("sales");
//receiptLast=rs.getDouble("purc_rcp");
clStockLast=rs.getDouble("cl_stock");
returnLast=rs.getDouble("purc_ret");
rateLast=rs.getDouble("rate");
//returnLast=rs.getDouble("purc_ret");
//rateLast=rs.getDouble("rate");
lineNoCustSt=rs.getInt("line_no");
......@@ -1802,7 +2026,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
//receiptLast=GetRcpQty(custCodeHd,tranIdLast,orderType,frmDateTstmp,toDateTstmp,itemCodeLast,itemSerHd,conn);
receiptLast = GetRcpQty(custCodeHd,tranIdLast,orderType,selectedInvList,prdFrmDateTstmp,toDateTstmp,itemCodeLast,itemSerHd,conn);
receiptLast = GetRcpQty(selectedInvList,itemCodeLast,conn);
System.out.println("Receipt quantity cal for avaible transcation id :"+receiptLast);
......@@ -1819,6 +2043,9 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
transitQty=GetTransitQty(custCodeHd,orderType,itemSerHd,selectedInvList,itemCodeLast,frmDateTstmp,toDateTstmp,prdFrmDateTstmp,prdtoDateTstmp,conn);
System.out.println("transitQty quantity cal for avaible transcation id :"+transitQty);
System.out.println("--cal rate for current transcation period");
rateLast = getRate(custCodeHd,tranDate,itemCode,conn);
System.out.println("rateLast :"+rateLast);
sql = "Select descr from item "
+" where item_code = '" + itemCodeLast + "'";
......@@ -1835,6 +2062,35 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
pstmt1 = null;
/*--------------view closing stock and sales of current transcation --------------------*/
if(tranIdNew.trim().length() > 0)
{
sql= " select cl_stock , sales from cust_stock_det " +
" where tran_id=? and item_code=?";
pstmt4 = conn.prepareStatement(sql);
pstmt4.setString(1, tranIdNew);
pstmt4.setString(2, itemCodeLast);
rs4 = pstmt4.executeQuery();
if(rs4.next())
{
clStockNew=rs4.getDouble("cl_stock");
salesLast=rs4.getDouble("sales");
}
rs4.close();
rs4 = null;
pstmt4.close();
pstmt4 = null;
}
/*-----------------------------------------------------------------*/
/*-------------------Purchase Return calculation for privious or current period------------------*/
sql =" SELECT B.QUANTITY__STDUOM QUANTITY, B.ITEM_CODE ITEM_CODE, "
......@@ -1895,7 +2151,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
rs3 = pstmt3.executeQuery();
if (rs3.next())
{
invStat = rs3.getString("INV_STAT");
invStat = rs3.getString("INV_STAT");////GetRcpQty(String selectedInvList,String itemCode, Connection conn)
System.out.println("invStat :"+invStat);
invStat = ( invStat == null || invStat.trim().length() == 0 ) ? "" : invStat.trim();
if ("R".equalsIgnoreCase(retRepFlag.trim()) && "SALE".equalsIgnoreCase(invStat.trim()) )
......@@ -1918,7 +2174,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
rs2.close();
rs2 = null;
pstmt2.close();
pstmt2 = null;
pstmt2 = null;////GetRcpQty(String selectedInvList,String itemCode, Connection conn)
System.out.println("retQty :"+retQty);
System.out.println("replQty :"+replQty);
returnLast = retQty - replQty ;
......@@ -1935,7 +2191,16 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("replQty :"+replQty);
primarySales = receiptLast - returnLast + replQty;
if(receiptLast > (returnLast + replQty) )
{
primarySales = receiptLast - returnLast + replQty;
}
else
{
primarySales = receiptLast;
}
System.out.println("primarySales cal for avaible transcation id :"+primarySales);
......@@ -1977,7 +2242,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
valueXmlString.append("<purc_ret__free>").append("<![CDATA[0]]>").append("</purc_ret__free>");
valueXmlString.append("<sales>").append("<![CDATA["+salesLast+"]]>").append("</sales>");
valueXmlString.append("<cl_stock protect='0'>").append("<![CDATA["+clStockLast+"]]>").append("</cl_stock>");
valueXmlString.append("<cl_stock protect='0'>").append("<![CDATA["+clStockNew+"]]>").append("</cl_stock>");
//valueXmlString.append("<purc_rcp>").append("<![CDATA["+receiptLast+"]]>").append("</purc_rcp>");
//valueXmlString.append("<purc_ret>").append("<![CDATA["+returnLast+"]]>").append("</purc_ret>");
......@@ -2035,10 +2300,13 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
itemCode = ( ( ItemDescr )defData.get(itemPos)).lsCode;
System.out.println("itemCode :"+itemCode);
String obStock= checkNull(( ( ItemDescr )defData.get(itemPos)).lsDescr);
if(obStock.length() > 0)
lsOpStock= checkNull(( ( ItemDescr )defData.get(itemPos)).lsOpStock);
System.out.println("obStock :"+lsOpStock);
lsTranId = checkNull(( ( ItemDescr )defData.get(itemPos)).lsTranId);
System.out.println("obStock :"+lsTranId);
if(lsOpStock.length() > 0)
{
opStkItem=Double.parseDouble(obStock);
opStkItem=Double.parseDouble(lsOpStock);
}
else
{
......@@ -2080,8 +2348,11 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
pstmt.close();
pstmt = null;
rcpQty = GetRcpQty(custCodeHd,tranIdLast,orderType,selectedInvList,prdFrmDateTstmp,toDateTstmp,itemCode,itemSerHd,conn);
//rcpQty = GetRcpQty(custCodeHd,tranIdLast,orderType,selectedInvList,prdFrmDateTstmp,toDateTstmp,itemCode,itemSerHd,conn);
//rcpQty = GetRcpQty(custCodeHd,tranIdLast,orderType,selectedInvList,prdFrmDateTstmp,toDateTstmp,itemCode,itemSerHd,conn);
rcpQty = GetRcpQty(selectedInvList,itemCode,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);
......@@ -2089,6 +2360,9 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
// sretQty = GetRetQty(custCodeHd,frmDateTstmp,toDateTstmp,itemCode,siteCodeHd,itemSerHd,conn);
// System.out.println("sretQty ::"+sretQty);
System.out.println("--------calculate All purchase return which other than previous or current transcation item code---------- ");
sql =" 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 "
......@@ -2112,23 +2386,24 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
while( rs.next() )
{
sretQty = rs.getDouble("QUANTITY");
sretSiteCode = rs.getString("SITE_CODE");
sretLocCode = rs.getString("LOC_CODE");
sretLotNo = rs.getString("LOT_NO");
sretLotSl = rs.getString("LOT_SL");
retRepFlag = rs.getString("RET_REP_FLAG");
System.out.println("sretQty :"+sretQty);
System.out.println("sretSiteCode :"+sretSiteCode);
System.out.println("sretLocCode :"+sretLocCode);
System.out.println("sretLotNo :"+sretLotNo);
System.out.println("sretLotSl :"+sretLotSl);
sretQtyAll = rs.getDouble("QUANTITY");
sretSiteCodeAll = rs.getString("SITE_CODE");
sretLocCodeAll = rs.getString("LOC_CODE");
sretLotNoAll = rs.getString("LOT_NO");
sretLotSlAll = rs.getString("LOT_SL");
retRepFlagAll = rs.getString("RET_REP_FLAG");
System.out.println("sretQtyAll :"+sretQtyAll);
System.out.println("sretSiteCodeAll :"+sretSiteCodeAll);
System.out.println("sretLocCodeAll :"+sretLocCodeAll);
System.out.println("sretLotNoAll :"+sretLotNoAll);
System.out.println("sretLotSlAll :"+sretLotSlAll);
System.out.println("sretLotSlAll :"+sretLotSlAll);
retRepFlag = ( retRepFlag == null || retRepFlag.trim().length() == 0 ) ? "" : retRepFlag.trim();
System.out.println("retRepFlag :"+retRepFlag);
retRepFlagAll = ( retRepFlagAll == null || retRepFlagAll.trim().length() == 0 ) ? "" : retRepFlagAll.trim();
System.out.println("retRepFlagAll :"+retRepFlagAll);
selQuery = "SELECT INV_STAT FROM STOCK "
+ " WHERE ITEM_CODE = ? "
......@@ -2138,10 +2413,10 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
+ " AND LOT_SL = ? " ;
pstmt1 = conn.prepareStatement(selQuery);
pstmt1.setString(1,itemCode);
pstmt1.setString(2,sretSiteCode);
pstmt1.setString(3,sretLocCode);
pstmt1.setString(4,sretLotNo);
pstmt1.setString(5,sretLotSl);
pstmt1.setString(2,sretSiteCodeAll);
pstmt1.setString(3,sretLocCodeAll);
pstmt1.setString(4,sretLotNoAll);
pstmt1.setString(5,sretLotSlAll);
rs1 = pstmt1.executeQuery();
if (rs1.next())
{
......@@ -2149,12 +2424,12 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
invStat = ( invStat == null || invStat.trim().length() == 0 ) ? "" : invStat.trim();
if ("R".equalsIgnoreCase(retRepFlag.trim()) && "SALE".equalsIgnoreCase(invStat.trim()) )
{
retQty += sretQty;
retQtyAll += sretQtyAll;
}
else if ( "P".equalsIgnoreCase(retRepFlag.trim()) )
{
replQty += sretQty;
replQtyAll += sretQtyAll;
}
}
rs1.close();
......@@ -2168,9 +2443,9 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
rs = null;
pstmt.close();
pstmt = null;
System.out.println("retQty :"+retQty);
System.out.println("retQtyAll :"+retQtyAll);
System.out.println("replQty :"+replQty);
sretQty = retQty - replQty ;
sretQtyAll = retQtyAll - replQtyAll ;
System.out.println("sretQty !!!!!!:"+retQty);
System.out.println("Return quantity for not available in last or current tranaction"+"itemCode :"+itemCode +"Return Quantity :"+sretQty);
......@@ -2180,18 +2455,28 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
//GetTransitQty(String custCode, String orderType, String itemSer,String selectedInvList,java.sql.Timestamp fromDate, java.sql.Timestamp toDate,java.sql.Timestamp prdFrom, java.sql.Timestamp prdTo, Connection conn)
System.out.println("rcpQty :"+rcpQty);
System.out.println("sretQty :"+sretQty);
System.out.println("replQty :"+replQty);
System.out.println("sretQtyAll :"+sretQtyAll);
System.out.println("replQtyAll :"+replQtyAll);
if(rcpQty > (sretQtyAll + replQtyAll))
{
primarySalesAll = rcpQty - sretQtyAll + replQtyAll;
}
else
{
primarySalesAll = rcpQty;
}
primarySales = rcpQty - sretQty + replQty;
System.out.println("Primary Sales for not available in last or current tranaction"+"itemCode :"+itemCode +"primarySales :"+primarySales);
transitQty=GetTransitQty(custCodeHd,orderType,itemSerHd,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);
System.out.println("/*----------calculate for Rate------------*/");
rate = getRate(custCodeHd,tranDate,itemCode,conn);
System.out.println("/*--cal Rate for all item code which is not included for current or previous item code.---*/");
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);
......@@ -2201,17 +2486,17 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
itemMap.put("mUnit@"+lineNoItmCnt, unitItem);
itemMap.put("mlType@"+lineNoItmCnt, locTypeItem);
itemMap.put("mopStk@"+lineNoItmCnt, String.valueOf(opStkItem));
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(rcpQtyBon));
itemMap.put("mquant@"+lineNoItmCnt, String.valueOf(sretQty));
itemMap.put("retQty@"+lineNoItmCnt, String.valueOf(retQty));
itemMap.put("replQty@"+lineNoItmCnt, String.valueOf(replQty));
itemMap.put("mquant@"+lineNoItmCnt, String.valueOf(sretQtyAll));
itemMap.put("retQty@"+lineNoItmCnt, String.valueOf(retQtyAll));
itemMap.put("replQty@"+lineNoItmCnt, String.valueOf(replQtyAll));
itemMap.put("msalesQty@"+lineNoItmCnt, String.valueOf(salesQty));
itemMap.put("rate@"+lineNoItmCnt, String.valueOf(rate));
itemMap.put("rate@"+lineNoItmCnt, String.valueOf(rateAll));
itemMap.put("transitQty@"+lineNoItmCnt, String.valueOf(transitQty));
itemMap.put("transitQtyBon@"+lineNoItmCnt, String.valueOf(transitQtyBon));
itemMap.put("primarySales@"+lineNoItmCnt, String.valueOf(primarySales));
itemMap.put("primarySales@"+lineNoItmCnt, String.valueOf(primarySalesAll));
}//end of IF
......@@ -2245,7 +2530,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
//valueXmlString.append("<loc_type>").append("<![CDATA["+itemMap.get("mlType@"+i)+"]]>").append("</loc_type>");
valueXmlString.append("<rate>").append("<![CDATA["+itemMap.get("rate@"+itemDomId)+"]]>").append("</rate>");
valueXmlString.append("<op_stock protect='1'>").append("<![CDATA["+itemMap.get("mopStk@"+itemDomId)+"]]>").append("</op_stock>");
valueXmlString.append("<cl_stock protect='0'>").append("<![CDATA["+itemMap.get("mopStk@"+itemDomId)+"]]>").append("</cl_stock>");
valueXmlString.append("<cl_stock protect='0'>").append("<![CDATA[]]>").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>");
......@@ -2671,7 +2956,8 @@ 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 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
{
String invoiceId="";
double quantity = 0.0;
......@@ -2685,22 +2971,26 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("selectedInvList :"+selectedInvList);
sql = "select a.invoice_id, b.quantity__stduom from invoice a, invdet b " +
/*sql = "select a.invoice_id, b.quantity__stduom from invoice a, invdet b " +
" where a.invoice_id = b.invoice_id and a.cust_code = ? and " +
" ( a.invoice_id in (select cinv.invoice_id from cust_stock_inv cinv where " +
" cinv.tran_id = ? and cinv.DLV_FLG = 'N' ) or (a.tran_date >= ? and " +
" a.tran_date <= ? ) ) and b.item_code = ? and " +
" a.item_ser = ? and a.inv_type = ? and a.invoice_id in ("+selectedInvList+") ";
" a.item_ser = ? and a.inv_type = ? and a.invoice_id in ("+selectedInvList+") ";*/
sql = "select quantity__stduom,invoice_id from invdet where" +
" item_code=? and invoice_id in ("+selectedInvList+") ";
pstmt = conn.prepareStatement( sql );
pstmt.setString(1,custCode );
pstmt.setString(1,itemCode );
/*pstmt.setString(1,custCode );
pstmt.setString(2,tranIdLast );
pstmt.setTimestamp(3,fromDate );
pstmt.setTimestamp(4,toDate );
pstmt.setString(5,itemCode );
pstmt.setString(6,itemSer );
pstmt.setString(7,orderType );
//pstmt.setString(8,selectedInvList );
pstmt.setString(7,orderType );*/
rs = pstmt.executeQuery();
while( rs.next() )
......@@ -3233,12 +3523,13 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
{
long llCount = 0, llRowNum = 0;
String lsErrCode = null, lsCode = null, lsDescr = null, lsUnit = null, lsLocType = null,lsOpStock=null,
lsItemSer = null;
lsItemSer = null,lsTranId = null;
String sql = null;
PreparedStatement pstmt = null,pstmt1 = null;
ResultSet rs = null,rs1 = null;
ItemDescr itemDescr = null;
ArrayList defData = new ArrayList();
String itemCode="";
//lds_custstock = create nvo_datastore
//lds_custstock.reset()
//lds_custstock.dataobject = 'd_cust_stock_det_brow'
......@@ -3251,7 +3542,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("lastTranId :"+lastTranId);
System.out.println("newTranId :"+newTranId);
List <String> itemList = new ArrayList<String>();
try
{
if(lastTranId.trim().length() == 0)
......@@ -3266,7 +3557,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("newTranId :"+newTranId);
sql= "select tran_id from cust_stock where cust_code=? and item_ser=? " +
" and tran_id not in (?,?) order by tran_date desc";
" and tran_id not in (?,?) order by tran_id desc";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,custCode);
pstmt.setString(2,itemSer);
......@@ -3279,20 +3570,27 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
tranId = checkNull(rs.getString("tran_id"));
sql= "select distinct (item_code)as item_code ,op_stock from cust_stock_det where tran_id= ?";
sql= "select distinct (item_code)as item_code ,op_stock,tran_id from cust_stock_det where tran_id= ?";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, tranId);
rs1 = pstmt1.executeQuery();
while(rs1.next())
{
System.out.println("item Code :"+rs1.getString("item_code"));
itemDescr = new ItemDescr();
itemDescr.lsCode = rs1.getString("item_code");
itemDescr.lsDescr= rs1.getString("op_stock");
System.out.println("item_code >>>"+rs1.getString("item_code"));
itemCode=rs1.getString("item_code");
System.out.println("itemCode>>>>>>>>> :"+itemCode);
if(!(itemList.contains(itemCode)))
{
itemDescr = new ItemDescr();
itemDescr.lsCode = rs1.getString("item_code");
itemDescr.lsOpStock= rs1.getString("op_stock");
itemDescr.lsTranId= rs1.getString("tran_id");
defData.add( itemDescr );
System.out.println("item_code >>>"+rs1.getString("item_code"));
defData.add(itemDescr);
itemList.add(itemCode);
}
}
......@@ -3301,7 +3599,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
pstmt1.close();
pstmt1 = null;
System.out.println("Item Code which is included other than previous transcation :"+itemList);
//System.out.println("op_stock >>>"+ rs.getString("op_stock"));
......@@ -3349,6 +3647,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
public String lsUnit = null;
public String lsLocType = null;
public String lsItemSer = null;
public String lsTranId = null;
public String lsOpStock = null;
}
......
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