Commit 104e632e authored by caluka's avatar caluka

get previous tranid items and display item description order


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@100165 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 5f138d26
......@@ -27,6 +27,7 @@ import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
......@@ -52,6 +53,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
static java.sql.Timestamp prdtoDateTmstmp =null;
static String custCodeStatic="";
static String countryCode="";
static int graceTransitDays=0;
public String wfValData() throws RemoteException,ITMException
{
......@@ -120,7 +122,9 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
String fromDateStr ="",toDateStr="",custTypeDom="";
String loginSiteCode="",periodStatus="",editSatus="";
String salePer="",countryCode1="",empCode="",positionCode="";
int pohelpCnt=0,empCnt=0;
String invoiceDateStr="",dlvFlg="",transitGraceDaysStr="",positionCodeStr="",positionCode1="";
String loginEmpCode="",loginPosCode="",sysDate="";
int pohelpCnt=0,empCnt=0,transitGraceDays=0,positionCnt=0;
int ctr = 0,currentFormNo=0,cnt=0,countCustRef=0,refSerCnt=0,childNodeListLength=0,invCnt=0,clStockInteger=0;
int custstockCnt=0,custstockCnt1=0;
double clStock=0.0,opStockDom=0.0,purRcpDom=0.0;
......@@ -128,14 +132,16 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
Date frmdate = null,todate = null;
java.util.Date tranDate = null;
java.sql.Timestamp FromDate=null,ToDate=null,prdFrmDate=null,prdFrom=null,prdTo=null,stmtDateTmstp=null;
java.sql.Timestamp validUptoDate=null,regDateNew=null,entryStartDt=null,entryEndDt=null;
Timestamp dbSysDate= null;
Boolean isOrdType = false;
Boolean isClStockInt= true;
Boolean isSecSales= true,isSecSalesNeg=true;
Boolean isSecSales= true,isSecSalesNeg=true,isInvList=true;
// boolean dateFlag=false,dateFlagTodate=false,dateFlagFrmdate=false,dateFlagstmtDate=false;
Node parentNode1 = null;
Node childNode1 = null;
int parentNodeListLength = 0,transitCnt=0,siteCnt=0;;
int parentNodeListLength = 0,transitCnt=0,siteCnt=0,entryCnt=0;
SimpleDateFormat sdf = null;
Connection conn = null;
PreparedStatement pstmt = null,pstmt1 = null,pstmt2 = null,pstmt3 = null,pstmt4 = null,pstmt5 = null,pstmt6 = null;
......@@ -144,19 +150,27 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
ConnDriver connDriver = new ConnDriver();
Date currentDate = new Date();
// ArrayList<String> refNoList = new ArrayList<String>();
Date currentDateval = new Date();
ArrayList errList = new ArrayList();
ArrayList errItemList = new ArrayList();
ArrayList salNegitiveErrItemList = new ArrayList();
ArrayList errFields = new ArrayList();
ArrayList errInvList = new ArrayList();
ArrayList positionList = new ArrayList();
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
try
{
System.out.println("CustStockGWTIC : wfValData called!!!!");
SimpleDateFormat sdf2 = new SimpleDateFormat(genericUtility.getApplDateFormat());
sysDate = sdf2.format(currentDateval.getTime());
dbSysDate = Timestamp.valueOf(genericUtility.getValidDateString(sysDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
System.out.println("dbSysDate>>>>>>>"+dbSysDate);
sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
conn = connDriver.getConnectDB("DriverITM");
DistCommon distCommon = new DistCommon();
userId = getValueFromXTRA_PARAMS(xtraParams, "loginCode");
loginSiteCode = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginSiteCode"));
loginEmpCode = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode"));
System.out.println("userId :"+userId);
if ((objContext != null) && (objContext.trim().length() > 0))
{
......@@ -249,7 +263,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
else if(itemSer != null && itemSer.trim().length() > 0 )
/*else if(itemSer != null && itemSer.trim().length() > 0 )
{
sql = "select count(*) from customer_series where item_ser =? and cust_code =?";
pstmt = conn.prepareStatement(sql);
......@@ -273,7 +287,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
}//cust code
*/
}
if(childNodeName.equalsIgnoreCase("order_type"))
{
......@@ -384,9 +398,16 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
}
else
{
sql = "select count(*) from period_tbl where prd_code=? ";
//sql = "select count(*) from period_tbl where prd_code=? ";
sql = "select count(*) from period_appl a,period_tbl b " +
"where a.ref_code=a.prd_tblno and a.prd_tblno=b.prd_tblno " +
"and a.site_code=? AND b.prd_code = ? " +
"and b.prd_tblno=? " +
"AND case when a.type is null then 'X' else a.type end='S' ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,period.trim());
pstmt.setString(1,loginSiteCode.trim());
pstmt.setString(2,period.trim());
pstmt.setString(3,countryCode+"_"+itemSer.trim());
rs = pstmt.executeQuery();
if (rs.next())
{
......@@ -404,21 +425,63 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
errFields.add(childNodeName.toLowerCase());
}else
{
sql= " select FR_DATE,TO_DATE from period_tbl where "
+ "prd_code = ? ";
/*sql= " select FR_DATE,TO_DATE from period_tbl where "
+ "prd_code = ? ";*/
sql = "select b.FR_DATE as FR_DATE,b.TO_DATE as TO_DATE " +
//",b.entry_start_dt as entry_start_dt" +
//",b.entry_end_dt as entry_end_dt" +
" from period_appl a,period_tbl b " +
"where a.ref_code=a.prd_tblno and a.prd_tblno=b.prd_tblno " +
"and a.site_code=? AND b.prd_code = ? " +
"and b.prd_tblno=? " +
"AND case when a.type is null then 'X' else a.type end='S' ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, period);
pstmt.setString(1,loginSiteCode.trim());
pstmt.setString(2,period.trim());
pstmt.setString(3,countryCode+"_"+itemSer.trim());
rs = pstmt.executeQuery();
if(rs.next())
{
FromDate = rs.getTimestamp("FR_DATE");
ToDate = rs.getTimestamp("TO_DATE");
//entryStartDt = rs.getTimestamp("entry_start_dt");
//entryEndDt = rs.getTimestamp("entry_end_dt");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(!"V".equalsIgnoreCase(editSatus))
{
/*sql = "select count(*) from period_appl a,period_tbl b " +
"where a.ref_code=a.prd_tblno and a.prd_tblno=b.prd_tblno " +
"and a.site_code=? AND b.prd_code = ? " +
"and b.prd_tblno=? " +
"AND case when a.type is null then 'X' else a.type end='S' and " +
" ? between entry_start_dt and entry_end_dt";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,loginSiteCode.trim());
pstmt.setString(2,period.trim());
pstmt.setString(3,countryCode+"_"+itemSer.trim());
pstmt.setTimestamp(4, dbSysDate);
rs = pstmt.executeQuery();
if (rs.next())
{
entryCnt = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(entryCnt == 0)
{
System.out.println("Error :Period not exist in period_tbl master start and end date ");
errCode = "VMINVPRDST";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}*/
sql = "select count(*) from cust_stock where status='S' " +
"and cust_code=? and from_date=? and to_date =?";
pstmt = conn.prepareStatement(sql);
......@@ -442,6 +505,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
errFields.add(childNodeName.toLowerCase());
}
}
if("A".equalsIgnoreCase(editSatus))
{
sql = "select count(*) from cust_stock where " +
......@@ -473,13 +538,18 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
"and org.pos_code=orgcust.pos_code and org.table_no=orgcust.table_no " +
"and orgcust.cust_code=cust.cust_code and cust.stan_code=stn.stan_code" +
" and custser.cust_code=cust.cust_code and custser.black_listed !='Y' " +
"and custser.item_ser=org.table_no AND orgcust.pos_code =? " +
//"and custser.item_ser=org.table_no " +
" AND orgcust.pos_code =? " +
"AND org.table_no =? " +
"and org.version_id in (select max(version_id) from org_structure ) " +
" AND (cust.SH_NAME LIKE upper(?) or cust.cust_code LIKE upper(?) " +
"OR cust.cust_name LIKE upper(?)) " +
"and state.count_code=? " +
"and state.state_code=stn.state_code " +
"and ( ? BETWEEN orgcust.EFF_DATE and orgcust.VALID_UPTO )"+
"and ( ? BETWEEN orgcust.EFF_DATE and orgcust.VALID_UPTO ) "+
"and custser.item_ser in(select item_ser from itemser where grp_code=? and item_ser<>case when grp_code is null then '.' else grp_code end " +
"union all select item_ser from itemser where item_ser=? and item_ser<>case when grp_code is null then '.' else grp_code end) "+
"order by stn.descr asc";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,positionCode);
......@@ -488,6 +558,10 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
pstmt.setString(4,custCode+"%");
pstmt.setString(5,custCode+"%");
pstmt.setString(6,countryCode1);
pstmt.setTimestamp(7,FromDate);
pstmt.setTimestamp(8,ToDate);
pstmt.setString(9,itemSer);
pstmt.setString(10,itemSer);
rs = pstmt.executeQuery();
/* sql="select count(*) " +
......@@ -593,8 +667,44 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
}
if(childNodeName.equalsIgnoreCase("pos_code"))
{
positionCode = this.genericUtility.getColumnValue("pos_code",dom);
System.out.println("positionCode validation");
//positionCode = this.genericUtility.getColumnValue("pos_code",dom);
loginEmpCode = this.genericUtility.getColumnValue("emp_code",dom);
sql = "select pos_code from employee where emp_code=? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,loginEmpCode);
rs = pstmt.executeQuery();
if (rs.next())
{
loginPosCode = checkNull(rs.getString("pos_code")).trim();
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql ="SELECT trim(A.POS_CODE) as pos_code FROM ORG_STRUCTURE A ,EMPLOYEE C" +
" WHERE A.VERSION_ID IN(SELECT MAX(VERSION_ID) FROM ORG_STRUCTURE D) " +
"AND A.EMP_CODE(+)=C.EMP_CODE " +
"AND A.POS_CODE IN(SELECT C.POS_CODE FROM ORG_STRUCTURE C START WITH C.POS_CODE=? " +
" CONNECT BY PRIOR C.POS_CODE=C.POS_CODE__REPTO " +
"AND C.VERSION_ID =(SELECT MAX(VERSION_ID) " +
"FROM ORG_STRUCTURE E) ) ORDER BY LEVEL_NO";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,loginPosCode);
rs = pstmt.executeQuery();
while (rs.next())
{
positionCodeStr = checkNull(rs.getString("pos_code")).trim();
positionList.add(positionCodeStr);
}
System.out.println("loginPosCode@@@@@@@@["+loginPosCode+"]");
System.out.println("positionList>>>>>>"+positionList);
if(!positionList.contains(loginPosCode))
{
System.out.println("position code is not exist in ORG_STRUCTURE");
errCode = "VTPOSCODE";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
......@@ -702,32 +812,77 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
parentNodeList = dom2.getElementsByTagName("Detail2");
parentNodeListLength = parentNodeList.getLength();
System.out.println("parentNodeListLength Detail2:::::::::"+parentNodeListLength);
stmtDateStr = this.genericUtility.getColumnValue("stmt_date",dom2);
Timestamp stmtDate = Timestamp.valueOf(genericUtility.getValidDateString(stmtDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
transitGraceDaysStr = dist.getDisparams("999999","GRACE_DAYS_TRINV",conn);
System.out.println("transitGraceDays.." + transitGraceDaysStr);
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++)
{
parentNode1 = parentNodeList.item(selectedRow);
childNodeList = parentNode1.getChildNodes();
childNodeListLength = childNodeList.getLength();
System.out.println("childNodeListLength::: " + childNodeListLength + "\n");
isInvList = true;
for (int childRow = 0; childRow < childNodeListLength; childRow++)
{
childNode1 = childNodeList.item(childRow);
childNodeName = childNode1.getNodeName();
System.out.println("childNodeName :" + childNodeName);
if (childNodeName.equals("invoice_id"))
{
childNode1 = childNodeList.item(childRow);
childNodeName = childNode1.getNodeName();
System.out.println("childNodeName :"+childNodeName);
if (childNodeName.equals("invoice_id"))
if (childNode1.getFirstChild() != null)
{
if(childNode1.getFirstChild()!=null)
invoiceId = childNode1.getFirstChild().getNodeValue();
}
System.out.println("invoiceId :" + invoiceId);
if (isInvList == false && !errInvList.contains(invoiceId))
{
System.out.println("Add invoiceId>>>>>>>" + invoiceId);
errInvList.add(invoiceId.trim());
}
}
if (childNodeName.equals("dlv_flg"))
{
if (childNode1.getFirstChild() != null)
{
dlvFlg = childNode1.getFirstChild().getNodeValue();
}
System.out.println("dlvFlg :" + dlvFlg);
}
if (childNodeName.equals("invoice_date"))
{
if (childNode1.getFirstChild() != null)
{
invoiceDateStr = childNode1.getFirstChild().getNodeValue();
}
System.out.println("invoiceDateStr :" + invoiceDateStr);
validUptoDate = Timestamp.valueOf(genericUtility.getValidDateString(invoiceDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
if (("NULLFOUND".equalsIgnoreCase(transitGraceDaysStr) || transitGraceDaysStr == null
|| transitGraceDaysStr.trim().length() == 0 )&& "N".equalsIgnoreCase(dlvFlg) )
{
errCode = "VTGRCDAYS";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
} else if("N".equalsIgnoreCase(dlvFlg))
{
transitGraceDays = Integer.parseInt(transitGraceDaysStr);
graceTransitDays = Integer.parseInt(transitGraceDaysStr);
regDateNew = utilMethod.RelativeDate(stmtDate, -transitGraceDays);
if (validUptoDate.before(regDateNew))
{
invoiceId = childNode1.getFirstChild().getNodeValue();
errCode = "VTINVOCDT";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
isInvList = false;
}
System.out.println("invoiceId :"+invoiceId);
}
}
}
}
break;
......@@ -954,10 +1109,20 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
errFldName = (String)errFields.get(cnt);
errString = getErrorString(errFldName, errCode, userId);
errorType = errorType(conn, errCode);
System.out.println("errString>>>>>>>"+errString);
System.out.println("errItemList>>>>>>"+errItemList);
System.out.println("negitive list>>>>"+salNegitiveErrItemList);
if(errItemList.size()>0 && errString.length() > 0)
if(errInvList.size()>0 && errString.length() > 0)
{
String begPart = errString.substring( 0, errString.indexOf("]]></description>") );
String mainStr="";
for(int i=0;i<errInvList.size();i++)
{
mainStr=mainStr+ errInvList.get(i)+",";
}
String endPart=errString.substring( errString.indexOf("]]></description>"), errString.length() );
mainStr=graceTransitDays+" for following Invoices "+mainStr.substring(0,mainStr.length()-1);
errString = begPart+mainStr + endPart;
}else if(errItemList.size()>0 && errString.length() > 0)
{
String begPart = errString.substring( 0, errString.indexOf("]]></description>") );
String mainStr="";
......@@ -966,9 +1131,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
mainStr=mainStr+ errItemList.get(i)+",";
}
System.out.println("mainStr>>>>>>>>"+mainStr);
String endPart=errString.substring( errString.indexOf("]]></description>"), errString.length() );
System.out.println("endPart>>>>>"+endPart);
mainStr=" for following Items "+mainStr.substring(0,mainStr.length()-1);
errString = begPart+mainStr + endPart;
......@@ -981,9 +1144,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
mainStr=mainStr+ salNegitiveErrItemList.get(i)+",";
}
System.out.println("mainStr>>>>>>>>"+mainStr);
String endPart=errString.substring( errString.indexOf("]]></description>"), errString.length() );
System.out.println("endPart>>>>>"+endPart);
mainStr=" for following Items "+mainStr.substring(0,mainStr.length()-1);
errString = begPart+mainStr + endPart;
}
......@@ -992,15 +1153,11 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
{
String bifurErrString = errString.substring(errString.indexOf("<Errors>") +
8, errString.indexOf("<trace>"));
System.out.println("bifurErrString>>>>>>>>>>"+bifurErrString);
bifurErrString = bifurErrString +
errString.substring(errString.indexOf("</trace>") +
8, errString.indexOf("</Errors>"));
System.out.println("bifurErrString@@@@@@@@@@@@"+bifurErrString);
errStringXml.append(bifurErrString);
System.out.println("errStringXml@@@@@@@"+errStringXml.toString());
System.out.println("errStringXml$$$$$$$$$$"+errStringXml.toString());
errString = "";
}
......@@ -1149,7 +1306,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
String toDateStr="",fromDateStr="",sretunTranId="",tranIdItem="",invoiceIdStr="";
String startForm="", netAmtFinal="",netAmtStr="",countryIemSer="",priceList="";
String confirmed="",status="",errString="",empCode="",positionCode="",empName="";
String positionDescr="";
String positionDescr="",resultItemSer="";
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,totRcpQtyAll=0.0;
double sretQty = 0.0,replQty=0.0,rcpQtyBon=0.0,primarySales=0.0,transitQtyAll=0.0;
......@@ -1194,7 +1351,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
Timestamp tranDtTstmp = null,frmDateTstmp=null,toDateTstmp=null,orderDtTstmp=null;
Timestamp fromDatetmstmp=null,previousDay=null,frmDate1=null;
Timestamp thirdMonthDay=null,thirdMonthFrDt=null;
Boolean isClStockInt=true,isDouble= true,isTableNo=false,isCustomer=false;
Timestamp entryStartDt=null,entryEndDt=null;
Boolean isClStockInt=true,isDouble= true,isTableNo=false,isCustomer=false,isPreviusItem=false;
SimpleDateFormat sdf;
ArrayList defData = null;
windowName = (new StringBuilder("w_")).append(getObjName(dom, objContext)).toString();
......@@ -1263,7 +1421,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
rs1 = pstmt1.executeQuery();
if(rs1.next())
{
countryCode=checkNull(rs1.getString("count_code"));
countryCode=checkNull(rs1.getString("count_code")).trim();
System.out.println("countryCode >>> :"+countryCode);
}
rs1.close();
......@@ -1329,7 +1487,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("toDateStr>>>>"+toDateStr);
System.out.println("tranDateEdit>>>>"+tranDateEdit);
System.out.println("print@@@@@@@@"+sdf.format(tranDateEdit).toString());
sql= " select FR_DATE,TO_DATE from period_tbl where "
/* sql= " select FR_DATE,TO_DATE from period_tbl where "
+ "prd_code = ? and prd_tblno =? ";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, rs.getString("PRD_CODE"));
......@@ -1343,7 +1501,32 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
pstmt1 = null;*/
sql = "select b.FR_DATE as FR_DATE,b.TO_DATE as TO_DATE " +
//",b.entry_start_dt as entry_start_dt" +
// ",b.entry_end_dt as entry_end_dt" +
" from period_appl a,period_tbl b " +
"where a.ref_code=a.prd_tblno and a.prd_tblno=b.prd_tblno " +
"and a.site_code=? AND b.prd_code = ? " +
"and b.prd_tblno=? " +
"AND case when a.type is null then 'X' else a.type end='S' ";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1,loginSiteCode);
pstmt1.setString(2,rs.getString("PRD_CODE"));
pstmt1.setString(3, countryCode.trim()+"_"+rs.getString("ITEM_SER").trim());
rs1 = pstmt1.executeQuery();
if(rs1.next())
{
FromDate = rs1.getTimestamp("FR_DATE");
ToDate = rs1.getTimestamp("TO_DATE");
//entryStartDt = rs1.getTimestamp("entry_start_dt");
//entryEndDt = rs1.getTimestamp("entry_end_dt");
}
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
sql= " select descr from itemser where item_ser = ?";
pstmt1 = conn.prepareStatement(sql);
......@@ -1485,8 +1668,20 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
valueXmlString.append("<pos_code protect='1'>").append("<![CDATA["+rs.getString("POS_CODE")+"]]>").append("</pos_code>");
valueXmlString.append("<emp_name>").append("<![CDATA["+empName+"]]>").append("</emp_name>");
valueXmlString.append("<position_descr>").append("<![CDATA["+positionDescr+"]]>").append("</position_descr>");
//country_code
/*if(entryStartDt !=null)
{
valueXmlString.append("<entry_start_dt protect='1'>").append("<![CDATA["+sdf.format(entryStartDt).toString()+"]]>").append("</entry_start_dt>");
}else
{
valueXmlString.append("<entry_start_dt protect='1'>").append("<![CDATA[]]>").append("</entry_start_dt>");
}
if(entryEndDt != null)
{
valueXmlString.append("<entry_end_dt protect='1'>").append("<![CDATA["+sdf.format(entryEndDt).toString()+"]]>").append("</entry_end_dt>");
}else
{
valueXmlString.append("<entry_end_dt protect='1'>").append("<![CDATA[]]>").append("</entry_end_dt>");
}*/
}
rs.close();
rs = null;
......@@ -1580,14 +1775,24 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("countryIemSer@@@@@@@@@"+countryIemSer);
//Start added by chandrashekar on 18-jan-2016
sql = "select b.FR_DATE as fr_date,b.TO_DATE as to_date,prd_code from period_appl a,period_tbl b " +
"where a.ref_code=a.prd_tblno and a.prd_tblno=b.prd_tblno " +
"and a.site_code=? " +
//" AND b.prd_code = ? " +
"and b.prd_tblno=? " +
"AND case when a.type is null then 'X' else a.type end='S' ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,loginSiteCode);
//pstmt.setString(2,period.trim());
pstmt.setString(2,countryIemSer);
sql = "SELECT fr_date,prd_code,to_date FROM period_tbl WHERE prd_tblno" +
/*sql = "SELECT fr_date,prd_code,to_date FROM period_tbl WHERE prd_tblno" +
" IN(SELECT PRD_TBLNO FROM PERIOD_APPL WHERE SITE_CODE=? AND REF_CODE=? AND PRD_TBLNO =? ) " +
"and CASE WHEN prd_closed IS NULL THEN 'N' ELSE prd_closed END='N' " ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, loginSiteCode);
pstmt.setString(2, countryIemSer);
pstmt.setString(3, countryIemSer);
pstmt.setString(3, countryIemSer);*/
rs = pstmt.executeQuery();
if (rs.next())
{
......@@ -1614,16 +1819,31 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("fromDateStr>>>>"+fromDateStr);
System.out.println("toDateStr>>>>"+toDateStr);
sql= " select FR_DATE,TO_DATE from period_tbl where "
+ "prd_code = ? and prd_tblno=? ";
/*sql= " select FR_DATE,TO_DATE from period_tbl where "
+ "prd_code = ? and prd_tblno=? ";*/
sql = "select b.FR_DATE as FR_DATE,b.TO_DATE as TO_DATE" +
//",b.entry_start_dt as entry_start_dt" +
// ",b.entry_end_dt as entry_end_dt" +
" from period_appl a,period_tbl b " +
"where a.ref_code=a.prd_tblno and a.prd_tblno=b.prd_tblno " +
"and a.site_code=? AND b.prd_code = ? " +
"and b.prd_tblno=? " +
"AND case when a.type is null then 'X' else a.type end='S' ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,loginSiteCode);
pstmt.setString(2,period.trim());
pstmt.setString(3,countryIemSer);
/*pstmt = conn.prepareStatement(sql);
pstmt.setString(1, period);
pstmt.setString(2, countryIemSer);
pstmt.setString(2, countryIemSer);*/
rs = pstmt.executeQuery();
if(rs.next())
{
FromDate = rs.getTimestamp("FR_DATE");
ToDate = rs.getTimestamp("TO_DATE");
ToDate = rs.getTimestamp("TO_DATE");
//entryStartDt = rs.getTimestamp("entry_start_dt");
//entryEndDt = rs.getTimestamp("entry_end_dt");
}
rs.close();
rs = null;
......@@ -1779,6 +1999,20 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
valueXmlString.append("<pos_code>").append("<![CDATA["+positionCode+"]]>").append("</pos_code>");
valueXmlString.append("<emp_name>").append("<![CDATA["+empName+"]]>").append("</emp_name>");
valueXmlString.append("<position_descr>").append("<![CDATA["+positionDescr+"]]>").append("</position_descr>");
/*if(entryStartDt !=null)
{
valueXmlString.append("<entry_start_dt protect='1'>").append("<![CDATA[" + sdf.format(entryStartDt).toString() + "]]>").append("</entry_start_dt>");
}else
{
valueXmlString.append("<entry_start_dt protect='1'>").append("<![CDATA[]]>").append("</entry_start_dt>");
}
if(entryEndDt !=null)
{
valueXmlString.append("<entry_end_dt protect='1'>").append("<![CDATA[" + sdf.format(entryEndDt).toString() + "]]>").append("</entry_end_dt>");
}else
{
valueXmlString.append("<entry_end_dt protect='1'>").append("<![CDATA[]]>").append("</entry_end_dt>");
}*/
valueXmlString.append("</Detail1>\r\n");
}
......@@ -1815,7 +2049,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
pstmt.close();
pstmt = null;
sql= " SELECT ITEM_SER FROM CUSTOMER_SERIES WHERE CUST_CODE = ? and sales_pers= ?";
/* sql= " SELECT ITEM_SER FROM CUSTOMER_SERIES WHERE CUST_CODE = ? and sales_pers= ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCode);
pstmt.setString(2, spCode);
......@@ -1828,7 +2062,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
rs.close();
rs = null;
pstmt.close();
pstmt = null;
pstmt = null;*/
System.out.println("itemSer :"+itemSer);
......@@ -1929,19 +2163,20 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("tranIdLast (case 1):" + tranIdLast);
//Change by chandra shekar on 26-10-2015
//Start added by chandra shekar on 07-jan-2016
sql= "select pos_code from org_structure_cust where cust_code=? ";
/*sql= "select pos_code from org_structure_cust where cust_code=? " +
" and version_id in (select max(version_id) from org_structure) ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCode);
rs = pstmt.executeQuery();
if(rs.next())
{
positionCode=checkNull(rs.getString("pos_code"));
positionCode=checkNull(rs.getString("pos_code")).trim();
System.out.println("positionCode at employee item change :"+positionCode);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
pstmt = null;*/
//End added by chandra shekar on 07-jan-2016
valueXmlString.append("<Detail1 domID='1' objContext='1'>");
......@@ -1963,7 +2198,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
valueXmlString.append("<pos_code>").append("<![CDATA["+positionCode+"]]>").append("</pos_code>");
valueXmlString.append("</Detail1>");
}
if(currentColumn.trim().equals("prd_code"))
/*if(currentColumn.trim().equals("prd_code"))
{
period = checkNull(genericUtility.getColumnValue("prd_code",dom));
......@@ -2033,7 +2268,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
valueXmlString.append("<pophelp_frmdt>").append("<![CDATA["+fromDateStr+"]]>").append("</pophelp_frmdt>");
valueXmlString.append("<pophelp_todt>").append("<![CDATA["+toDateStr+"]]>").append("</pophelp_todt>");
valueXmlString.append("</Detail1>");
}
}*/
//Start added by chandrashekar on 07-jan-2016
/*if(currentColumn.trim().equals("emp_code"))
{
......@@ -2325,23 +2560,23 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("itm_default called for case 2");
tranIdLast = checkNull(genericUtility.getColumnValue("tran_id__last",dom1));
System.out.println("tranIdLast2(case 3) :"+tranIdLast);
System.out.println("tranIdLast2(case 2) :"+tranIdLast);
tranIdNew = checkNull(genericUtility.getColumnValue("tran_id",dom1));
System.out.println("tranIdNew(case 3) :"+tranIdNew);
System.out.println("tranIdNew(case 2) :"+tranIdNew);
custCode = genericUtility.getColumnValue("cust_code", dom1);
System.out.println("custCode(case 3) :"+custCode);
System.out.println("custCode(case 2) :"+custCode);
fromdate = genericUtility.getColumnValue("from_date", dom1);
System.out.println("fromdate@@@@@@@@@@@ :"+fromdate);
todate= genericUtility.getColumnValue("to_date", dom1);
System.out.println("todate (case 3):"+todate);
System.out.println("todate (case 2):"+todate);
itemSer = genericUtility.getColumnValue("item_ser", dom1);
System.out.println("itemSer (case 3):"+itemSer);
System.out.println("itemSer (case 2):"+itemSer);
siteCodeHd = genericUtility.getColumnValue("site_code", dom1);
System.out.println("siteCodeHd (case 3):"+siteCodeHd);
System.out.println("siteCodeHd (case 2):"+siteCodeHd);
orderType = genericUtility.getColumnValue("order_type", dom1);
System.out.println("orderType (case 3):"+orderType);
System.out.println("orderType (case 2):"+orderType);
period = genericUtility.getColumnValue("prd_code", dom1);
System.out.println("period (case 3):"+period);
System.out.println("period (case 2):"+period);
custCodeStatic=custCode;
editFlag = (editFlag != null) ? editFlag : genericUtility.getColumnValue("edit_status", dom1);
......@@ -2381,7 +2616,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
pstmt.close();
pstmt = null;
System.out.println("tranIdNew(case 3) :"+tranIdNew);
resultItemSer=getItemSerList(itemSer,conn);
if(tranIdNew.trim().length() > 0)
{
......@@ -2456,10 +2691,10 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
pstmt1 = null;
netAmt=0;
sql= "select quantity__stduom,rate__stduom " +
"from invoice_trace where invoice_id=? and item_ser__prom=?";
" from invoice_trace where invoice_id=? and item_ser__prom in ("+resultItemSer+") ";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, invoiceId);
pstmt1.setString(2, itemSer);
//pstmt1.setString(2, itemSer);
rs1 = pstmt1.executeQuery();
while(rs1.next())
{
......@@ -2550,10 +2785,11 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("prdFrom :"+prdFrom);
sql= " select FR_DATE,TO_DATE from period where ? "
+ " between FR_DATE and TO_DATE";
/*sql= " select FR_DATE,TO_DATE from period_tbl where PRD_TBLNO = ? and ? "
+ " between FR_DATE and TO_DATE ";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, prdFrom);
pstmt.setString(1, countryCode+"_"+itemSer.trim());
pstmt.setTimestamp(2, prdFrom);
rs = pstmt.executeQuery();
if(rs.next())
{
......@@ -2563,8 +2799,33 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
rs.close();
rs = null;
pstmt.close();
pstmt = null;*/
sql = "select b.FR_DATE as FR_DATE,b.TO_DATE as TO_DATE,b.entry_start_dt as entry_start_dt" +
",b.entry_end_dt as entry_end_dt" +
" from period_appl a,period_tbl b " +
"where a.ref_code=a.prd_tblno and a.prd_tblno=b.prd_tblno " +
"and a.site_code=? " +
//"AND b.prd_code = ? " +
"and b.prd_tblno=? " +
"AND case when a.type is null then 'X' else a.type end='S' and " +
" ? between b.FR_DATE and b.TO_DATE ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,loginSiteCode);
//pstmt.setString(2,rs.getString("PRD_CODE"));
pstmt.setString(2, countryCode+"_"+itemSer.trim());
pstmt.setTimestamp(3, prdFrom);
rs = pstmt.executeQuery();
if(rs.next())
{
prdFrom = rs.getTimestamp("FR_DATE");
prdTo = rs.getTimestamp("TO_DATE");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("prdFrom :"+prdFrom);
System.out.println("prdTo :"+prdTo);
......@@ -2583,7 +2844,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
" and ( invoice.cust_code = ? ) " +
//"and invoice.site_code =? " +
"and invoice.inv_type=?" +
" and itrace.item_ser__prom=? and " +
" and itrace.item_ser__prom in ("+resultItemSer+") and " +
" ( invoice.confirmed = 'Y' ) and ( (invoice.tran_date >= ? ) " +
" and (invoice.tran_date <= ? ) or " +
" ((invoice.tran_date >= ? ) and (invoice.tran_date <= ? ) ) " +
......@@ -2593,35 +2854,35 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
" UNION " +
" SELECT distinct cinv.invoice_id ," +
" cinv.INVOICE_DATE,cinv.DLV_FLG ,cinv.net_amt ,'' as tran_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.inv_type=? and invoice.confirmed = 'Y'" +
" invoice invoice,invoice_trace itrace WHERE cinv.invoice_id=invoice.invoice_id and " +
" itrace.invoice_id=cinv.invoice_id and " +
" invoice.cust_code = ? and itrace.item_ser__prom in ("+resultItemSer+") " +
" and invoice.inv_type=? and invoice.confirmed = 'Y'" +
" and CASE WHEN cinv.dlv_flg IS NULL THEN 'N' ELSE cinv.dlv_flg END='N' "+
" UNION "+
"select '' as invoice_id ,srn.tran_date,'N' as DLV_FLG,sdet.net_amt,sdet.tran_id as tran_id " +
"from sreturn srn,sreturndet sdet where srn.tran_id=sdet.tran_id " +
//"and srn.site_code= ? " +
"and srn.item_ser=? " +
"and srn.item_ser in ("+resultItemSer+") " +
"and srn.tran_date >= ? and srn.tran_date <= ? " +
"and sdet.ret_rep_flag in ('P') and srn.cust_code=? and srn.confirmed='Y' ORDER BY invoice_date";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCode);
//pstmt.setString(2, siteCodeHd);
pstmt.setString(2, orderType);
pstmt.setString(3, itemSer);
pstmt.setTimestamp(4, FromDate);
pstmt.setTimestamp(5, ToDate);
pstmt.setTimestamp(6, prdFrom);
pstmt.setTimestamp(7, prdTo);
pstmt.setString(8, custCode);
pstmt.setString(9, itemSer);
pstmt.setString(10, orderType);
//pstmt.setString(12, siteCodeHd);
pstmt.setString(11, itemSer);
pstmt.setTimestamp(12, FromDate);
pstmt.setTimestamp(13, ToDate);
pstmt.setString(14, custCode);
//pstmt.setString(3, itemSer);
pstmt.setTimestamp(3, FromDate);
pstmt.setTimestamp(4, ToDate);
pstmt.setTimestamp(5, prdFrom);
pstmt.setTimestamp(6, prdTo);
pstmt.setString(7, custCode);
//pstmt.setString(9, itemSer);
pstmt.setString(8, orderType);
//pstmt.setString(11, itemSer);
pstmt.setTimestamp(9, FromDate);
pstmt.setTimestamp(10, ToDate);
pstmt.setString(11, custCode);
rs = pstmt.executeQuery();
while(rs.next())
{
......@@ -2693,10 +2954,10 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("dlvFlgCnt ####"+dlvFlgCnt);
netAmt=0.0;
sql= "select quantity__stduom,rate__stduom from invoice_trace where invoice_id=? and item_ser__prom=?";
sql= "select quantity__stduom,rate__stduom from invoice_trace where invoice_id=? and item_ser__prom in ("+resultItemSer+") ";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, invoiceId);
pstmt1.setString(2, itemSer);
//pstmt1.setString(2, itemSer);
rs1 = pstmt1.executeQuery();
while(rs1.next())
{
......@@ -2829,7 +3090,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
}
System.out.println("case 3 valueXmlString :"+valueXmlString);
System.out.println("case 2 valueXmlString :"+valueXmlString);
break;
......@@ -2953,21 +3214,21 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
Node detail2Node = dom2.getElementsByTagName("Detail1").item(0);
custCodeHd = genericUtility.getColumnValue("cust_code", dom1);
System.out.println("custCodeHd (case 4):"+custCodeHd);
System.out.println("custCodeHd (case 3):"+custCodeHd);
itemSerHd = genericUtility.getColumnValueFromNode("item_ser",detail2Node);
System.out.println("itemSerHd (case 4) :"+itemSerHd);
System.out.println("itemSerHd (case 3) :"+itemSerHd);
siteCodeHd = genericUtility.getColumnValue("site_code", dom1);
System.out.println("siteCodeHd (case 4) :"+siteCodeHd);
System.out.println("siteCodeHd (case 3) :"+siteCodeHd);
tranIdLastHd = genericUtility.getColumnValue("tran_id__last", dom1);
System.out.println("mTranIdLast (case 4) :"+tranIdLastHd);
System.out.println("mTranIdLast (case 3) :"+tranIdLastHd);
orderType = genericUtility.getColumnValue("order_type", dom1);
System.out.println("orderType (case 4) :"+orderType);
System.out.println("orderType (case 3) :"+orderType);
tranDateHd = genericUtility.getColumnValue("tran_date",dom1);
System.out.println("tranDateHd (case 4) :"+tranDateHd);
System.out.println("tranDateHd (case 3) :"+tranDateHd);
fromdate = genericUtility.getColumnValue("from_date",dom1);
System.out.println("fromdate (case 4) :"+fromdate);
System.out.println("fromdate (case 3) :"+fromdate);
todate = genericUtility.getColumnValue("to_date",dom1);
System.out.println("todate (case 4):"+todate);
System.out.println("todate (case 3):"+todate);
editFlag = (editFlag != null) ? editFlag : genericUtility.getColumnValue("edit_status", dom1);
......@@ -2984,10 +3245,11 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
prdFrom = getPreviousDate(frmDateTstmp,conn);
System.out.println("prdFrom :"+prdFrom);
sql= " select FR_DATE,TO_DATE from period where ? "
+ " between FR_DATE and TO_DATE";
/*sql= " select FR_DATE,TO_DATE from period_tbl where PRD_TBLNO = ? and ? "
+ " between FR_DATE and TO_DATE ";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, prdFrom);
pstmt.setString(1, countryCode+"_"+itemSerHd.trim());
pstmt.setTimestamp(2, prdFrom);
rs = pstmt.executeQuery();
if(rs.next())
{
......@@ -2997,7 +3259,32 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
rs.close();
rs = null;
pstmt.close();
pstmt = null;
pstmt = null;*/
sql = "select b.FR_DATE as FR_DATE,b.TO_DATE as TO_DATE,b.entry_start_dt as entry_start_dt" +
",b.entry_end_dt as entry_end_dt" +
" from period_appl a,period_tbl b " +
"where a.ref_code=a.prd_tblno and a.prd_tblno=b.prd_tblno " +
"and a.site_code=? " +
//"AND b.prd_code = ? " +
"and b.prd_tblno=? " +
"AND case when a.type is null then 'X' else a.type end='S' and " +
"? between b.FR_DATE and b.TO_DATE ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,loginSiteCode);
//pstmt.setString(2,rs.getString("PRD_CODE"));
pstmt.setString(2, countryCode+"_"+itemSerHd.trim());
pstmt.setTimestamp(3, prdFrom);
rs = pstmt.executeQuery();
if(rs.next())
{
prdFrmDateTstmp = rs.getTimestamp("FR_DATE");
prdtoDateTstmp = rs.getTimestamp("TO_DATE");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("prdFrmDateTstmp :"+prdFrmDateTstmp);
System.out.println("prdtoDateTstmp :"+prdtoDateTstmp);
......@@ -3046,7 +3333,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("tranIdNew!!!!!!!!!!!!!!!! :"+tranIdNew);
currentTranId=tranIdNew;
itemSerHd=getItemSerList(itemSerHd,conn);
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 ,loc_type " +
" from cust_stock_det where tran_id=? ";*/
......@@ -3245,7 +3532,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("salesOrg>>>>>"+salesOrg);
if(receiptLast >= 0)
{
{ isPreviusItem=false;
isPreviusItem=isExistItem(itemCodeLast,tranIdLast,conn);
valueXmlString.append( "<Detail3 dbID='' domID='"+itmDetCnt+"' objContext='"+currentFormNo+"' selected='N'>\r\n" );
if(tranIdNew.length() > 0)
......@@ -3279,7 +3567,15 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
{
valueXmlString.append("<rate__org>").append("<![CDATA["+getRequiredDecimal(rateOrg,2)+"]]>").append("</rate__org>");
}
valueXmlString.append("<op_stock protect='1'>").append("<![CDATA["+(long)Math.round(opStockLast)+"]]>").append("</op_stock>");
//valueXmlString.append("<op_stock protect='1'>").append("<![CDATA["+(long)Math.round(opStockLast)+"]]>").append("</op_stock>");
if(isPreviusItem || "V".equalsIgnoreCase(editFlag))
{
valueXmlString.append("<op_stock protect='1'>").append("<![CDATA["+(long)Math.round(opStockLast)+"]]>").append("</op_stock>");
}else
{
valueXmlString.append("<op_stock >").append("<![CDATA["+(long)Math.round(opStockLast)+"]]>").append("</op_stock>");
}
valueXmlString.append("<purc_rcp>").append("<![CDATA["+(long)Math.round((receiptLast))+"]]>").append("</purc_rcp>");
valueXmlString.append("<purc_rcp__repl>").append("<![CDATA["+(long)Math.round(returnReciptRepl)+"]]>").append("</purc_rcp__repl>");
......@@ -3350,15 +3646,23 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("------retrive Item data which is not exist in last month or current moth transcation !!!!");
defData = getItemFromCust(custCodeHd,itemSerHd,siteCodeHd,orderType,frmDateTstmp,toDateTstmp,prdFrmDateTstmp,prdtoDateTstmp,tranIdLast,tranIdNew,selectedInvList,conn);
itemResLen = defData.size();
System.out.println("itemResLen : "+itemResLen);
System.out.println("itemResLen before : "+defData.size());
//Add prevous items
defData=addPreviousItems(itemListLast,defData,tranIdLast,conn);
//Add prevous items
itemResLen = defData.size();
System.out.println("itemResLen after: "+itemResLen);
if(defData.size()>0)
{
Collections.sort(defData, ItemDescr.ItemNameComparator);
}
for(itemPos = 0; itemPos < itemResLen; itemPos++ )
{
itemCode = ( ( ItemDescr )defData.get(itemPos)).lsCode;
System.out.println("itemCode :"+itemCode);
System.out.println("itemCode @@@@@:"+itemCode);
lsOpStock= checkNull(( ( ItemDescr )defData.get(itemPos)).lsOpStock);
System.out.println("obStock :"+lsOpStock);
lsTranId = checkNull(( ( ItemDescr )defData.get(itemPos)).lsTranId);
......@@ -3592,7 +3896,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
{
itmDetCnt++;
lineNoCustSt = lineNoCustSt + 1;
isPreviusItem=false;
isPreviusItem=isExistItem(itemMap.get("itemCode@"+itemDomId),tranIdLast,conn);
valueXmlString.append( "<Detail3 dbID='' domID='"+itmDetCnt+"' objContext='"+currentFormNo+"' selected='N'>\r\n" );
......@@ -3619,8 +3924,15 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
valueXmlString.append("<unit>").append("<![CDATA["+itemMap.get("mUnit@"+itemDomId)+"]]>").append("</unit>");
valueXmlString.append("<loc_type>").append("<![CDATA["+itemMap.get("mlType@"+itemDomId)+"]]>").append("</loc_type>");
valueXmlString.append("<rate>").append("<![CDATA["+(long)Math.round(Double.parseDouble(itemMap.get("rate@"+itemDomId).toString()))+"]]>").append("</rate>");
//valueXmlString.append("<op_stock protect='1'>").append("<![CDATA["+itemMap.get("mopStk@"+itemDomId)+"]]>").append("</op_stock>");
valueXmlString.append("<op_stock protect='1'>").append("<![CDATA["+(long)Math.round(Double.parseDouble(itemMap.get("mopStk@"+itemDomId).toString()))+"]]>").append("</op_stock>");
//valueXmlString.append("<op_stock protect='1'>").append("<![CDATA["+(long)Math.round(Double.parseDouble(itemMap.get("mopStk@"+itemDomId).toString()))+"]]>").append("</op_stock>");
if(isPreviusItem || "V".equalsIgnoreCase(editFlag))
{
valueXmlString.append("<op_stock protect='1'>").append("<![CDATA["+(long)Math.round(Double.parseDouble(itemMap.get("mopStk@"+itemDomId).toString()))+"]]>").append("</op_stock>");
}else
{
valueXmlString.append("<op_stock >").append("<![CDATA["+(long)Math.round(Double.parseDouble(itemMap.get("mopStk@"+itemDomId).toString()))+"]]>").append("</op_stock>");
}
if("V".equalsIgnoreCase(editFlag))
{
valueXmlString.append("<cl_stock protect='1'>").append("<![CDATA[0]]>").append("</cl_stock>");
......@@ -3678,7 +3990,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
//comented code
//coding for those item code which is other than previos item code,end
System.out.println("itemchanged : case 4 :valueXmlString :"+valueXmlString);
System.out.println("itemchanged : case 3 :valueXmlString :"+valueXmlString);
/*//Change by chandra shekar on 27-10-2015
valueXmlStringSort=sortItemDom(dom2, sortItem,conn,valueXmlString);
valueXmlString = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root>\r\n<Header>\r\n<editFlag>");
......@@ -4006,7 +4318,6 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
}
return valueXmlString.toString();
}//itemChanged()
private double getRate(String custCode, Timestamp trandate, String itemCode,Connection conn)throws RemoteException,ITMException
{
ibase.webitm.utility.GenericUtility genericUtility = new ibase.webitm.utility.GenericUtility();
......@@ -6160,6 +6471,7 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
String itemCode="",invItemCode="";
String clStock="0.0";
String rate="0.0",rateOrg="0.0";
String itemDescription="";
//lds_custstock = create nvo_datastore
//lds_custstock.reset()
//lds_custstock.dataobject = 'd_cust_stock_det_brow'
......@@ -6253,7 +6565,7 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
" invoice.invoice_id=itrace.invoice_id and ( invoice.cust_code = ? ) " +
//" and invoice.site_code =? " +
"and invoice.inv_type=? and " +
" itrace.item_ser__prom=? and ( invoice.confirmed = 'Y' ) and" +
" itrace.item_ser__prom in ("+itemSer+") 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 " +
......@@ -6261,8 +6573,10 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
" cust_stock_inv.dlv_flg = 'N' )) ) " +
" 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.inv_type = ? and invoice.item_ser= ? " +
" invoice invoice,invoice_trace invtrace WHERE cinv.invoice_id=invoice.invoice_id " +
" and invtrace.invoice_id=cinv.invoice_id and " +
" invoice.cust_code = ? and invoice.inv_type = ? " +
" and invtrace.item_ser__prom in ("+itemSer+") " +
"and invoice.confirmed = 'Y' and CASE WHEN cinv.dlv_flg IS NULL " +
"THEN 'N' ELSE cinv.dlv_flg END='N') " +
"and item.item_code=invdet.item_code "+
......@@ -6272,7 +6586,7 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
"where srn.tran_id=sdet.tran_id " +
"and item.item_code=sdet.item_code " +
//"and srn.site_code= ? " +
" and srn.item_ser=? " +
" and srn.item_ser in ("+itemSer+") " +
"and srn.tran_date >= ? and srn.tran_date <= ? " +
"and sdet.ret_rep_flag in('P') " +
"and srn.cust_code=? order by descr ";
......@@ -6283,19 +6597,19 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
pstmt.setString(1, custCode);
//pstmt.setString(2, siteCode);
pstmt.setString(2, orderType);
pstmt.setString(3, itemSer);
pstmt.setTimestamp(4, frmDateTstmp);
pstmt.setTimestamp(5, toDateTstmp);
pstmt.setTimestamp(6, prdFrDateTstmp);
pstmt.setTimestamp(7, prdToDateTstmp);
pstmt.setString(8, custCode);
pstmt.setString(9, orderType);
pstmt.setString(10, itemSer);
//pstmt.setString(3, itemSer);
pstmt.setTimestamp(3, frmDateTstmp);
pstmt.setTimestamp(4, toDateTstmp);
pstmt.setTimestamp(5, prdFrDateTstmp);
pstmt.setTimestamp(6, prdToDateTstmp);
pstmt.setString(7, custCode);
pstmt.setString(8, orderType);
//pstmt.setString(10, itemSer);
//pstmt.setString(12, siteCode);//start added by chandrashekar
pstmt.setString(11, itemSer);
pstmt.setTimestamp(12, frmDateTstmp);
pstmt.setTimestamp(13, toDateTstmp);
pstmt.setString(14, custCode);
//pstmt.setString(11, itemSer);
pstmt.setTimestamp(9, frmDateTstmp);
pstmt.setTimestamp(10, toDateTstmp);
pstmt.setString(11, custCode);
rs = pstmt.executeQuery();
while( rs.next() )
......@@ -6324,7 +6638,26 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
pstmt1.close();
pstmt1 = null;
sql= " select descr from item where item_code = ?";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, invItemCode);
rs1 = pstmt1.executeQuery();
if(rs1.next())
{
itemDescription=checkNull(rs1.getString("descr"));
}
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
itemDescr = new ItemDescr();
itemDescr.setItemCode(invItemCode);
itemDescr.setLsOpStock(clStock);
itemDescr.setLsrateold(rate);
itemDescr.setLsrateorgold(rateOrg);
itemDescr.setItemDescription(itemDescription);
itemDescr.lsCode = invItemCode;
itemDescr.lsOpStock= clStock;
itemDescr.lsrateold= rate;
......@@ -6357,7 +6690,7 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
return defData;
}
private class ItemDescr
/*private class ItemDescr
{
public String lsCode = null;
public String lsDescr = null;
......@@ -6368,9 +6701,143 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
public String lsOpStock = null;
public String lsrateold = null;
public String lsrateorgold = null;
}
}*/
private static class ItemDescr
{
public String lsCode = null;
public String lsDescr = null;
public String lsUnit = null;
public String lsLocType = null;
public String lsItemSer = null;
public String lsTranId = null;
public String lsOpStock = null;
public String lsrateold = null;
public String lsrateorgold = null;
public String ItemDescription = null;
public void setItemCode(String lsCode)
{
this.lsCode=lsCode;
}
public String getItemCode()
{
return this.lsCode;
}
public String getLsCode()
{
return lsCode;
}
public void setLsCode(String lsCode)
{
this.lsCode = lsCode;
}
public String getLsDescr()
{
return lsDescr;
}
public void setLsDescr(String lsDescr)
{
this.lsDescr = lsDescr;
}
public String getLsUnit()
{
return lsUnit;
}
public void setLsUnit(String lsUnit)
{
this.lsUnit = lsUnit;
}
public String getLsLocType()
{
return lsLocType;
}
public void setLsLocType(String lsLocType)
{
this.lsLocType = lsLocType;
}
public String getLsItemSer()
{
return lsItemSer;
}
public void setLsItemSer(String lsItemSer)
{
this.lsItemSer = lsItemSer;
}
public String getLsTranId()
{
return lsTranId;
}
public void setLsTranId(String lsTranId)
{
this.lsTranId = lsTranId;
}
public String getLsOpStock()
{
return lsOpStock;
}
public void setLsOpStock(String lsOpStock)
{
this.lsOpStock = lsOpStock;
}
public String getLsrateold()
{
return lsrateold;
}
public void setLsrateold(String lsrateold)
{
this.lsrateold = lsrateold;
}
public String getLsrateorgold()
{
return lsrateorgold;
}
public void setLsrateorgold(String lsrateorgold)
{
this.lsrateorgold = lsrateorgold;
}
public String getItemDescription()
{
return ItemDescription;
}
public void setItemDescription(String itemDescription)
{
ItemDescription = itemDescription;
}
public static Comparator<ItemDescr> ItemNameComparator = new Comparator<ItemDescr>()
{
public int compare(ItemDescr s1, ItemDescr s2) {
String itemCode1 = s1.getItemDescription();
String itemCode2 = s2.getItemDescription();
return itemCode1.compareTo(itemCode2);
}
};
}
private String getObjName(Document dom2,String objContext)
{
Node elementName = null, parentNode = null;
......@@ -6913,7 +7380,7 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
" invoice invoice,invoice_trace itrace " +
" where invoice.invoice_id=itrace.invoice_id AND invoice.cust_code = ? " +
//" and invoice.site_code = ? " +
" and invoice.inv_type=? and itrace.item_ser__prom=? "+
" and invoice.inv_type=? and itrace.item_ser__prom in("+itemSer+") "+
//" and invoice.tran_date between ? and ? " +
" AND itrace.RATE__STDUOM>0 "
+ " and itrace.item_code = ? and itrace.invoice_id in("+selectedInvList+") " ;
......@@ -6923,7 +7390,7 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
" invoice invoice,invoice_trace itrace " +
" where invoice.invoice_id=itrace.invoice_id AND invoice.cust_code = ? " +
//" and invoice.site_code = ? " +
" and invoice.inv_type=? and itrace.item_ser__prom=? "
" and invoice.inv_type=? and itrace.item_ser__prom in("+itemSer+") "
+ //" and invoice.tran_date between ? and ? " +
" AND itrace.RATE__STDUOM>0 "
+ " and itrace.item_code = ? and itrace.invoice_id in("+transitInvList+") " ;
......@@ -6933,10 +7400,10 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
pstmt.setString( 1, custCode );
//pstmt.setString( 2, siteCode );
pstmt.setString( 2, orderType );
pstmt.setString( 3, itemSer);
//pstmt.setString( 3, itemSer);
//pstmt.setTimestamp( 5, fromDate );
//pstmt.setTimestamp( 6, toDate );
pstmt.setString( 4, itenmCode );
pstmt.setString( 3, itenmCode );
rs = pstmt.executeQuery();
double rcpCur =0, rcpPre = 0, totRcp = 0;
while (rs.next())
......@@ -7100,14 +7567,14 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
+ " AND A.TRAN_DATE <= ? "
+ " AND B.ITEM_CODE = ? "
//+ " AND A.SITE_CODE = ? "
+" and a.item_ser = ? ";
+" and a.item_ser in ("+itemSer+") ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,custCode);
pstmt.setTimestamp(2,fromDate );
pstmt.setTimestamp(3,toDate );
pstmt.setString(4,itemCode);
//pstmt.setString(5,siteCode);
pstmt.setString(5,itemSer);
//pstmt.setString(5,itemSer);
rs = pstmt.executeQuery();
while( rs.next() )
{
......@@ -7225,7 +7692,7 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
" invoice invoice,invoice_trace itrace " +
" where invoice.invoice_id=itrace.invoice_id AND invoice.cust_code = ? " +
//" and invoice.site_code = ? " +
" and invoice.inv_type=? and itrace.item_ser__prom=? "
" and invoice.inv_type=? and itrace.item_ser__prom in ("+itemSer+") "
+ " and invoice.tran_date between ? and ? AND itrace.RATE__STDUOM>0 "
+ " and itrace.item_code = ? and itrace.invoice_id in("+selectedInvList+") " ;
// "group by itrace.RATE__STDUOM ";
......@@ -7235,7 +7702,7 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
" invoice invoice,invoice_trace itrace " +
" where invoice.invoice_id=itrace.invoice_id AND invoice.cust_code = ? " +
//" and invoice.site_code = ? " +
" and invoice.inv_type=? and itrace.item_ser__prom=? "
" and invoice.inv_type=? and itrace.item_ser__prom in ("+itemSer+") "
+ " and invoice.tran_date between ? and ? AND itrace.RATE__STDUOM>0 "
+ " and itrace.item_code = ? and itrace.invoice_id in("+transitInvList+") " ;
// "group by itrace.RATE__STDUOM ";
......@@ -7252,10 +7719,10 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
pstmt.setString( 1, custCode );
//pstmt.setString( 2, siteCode );
pstmt.setString( 2, orderType );
pstmt.setString( 3, itemSer);
pstmt.setTimestamp( 4, fromDate );
pstmt.setTimestamp( 5, toDate );
pstmt.setString( 6, itenmCode );
//pstmt.setString( 3, itemSer);
pstmt.setTimestamp( 3, fromDate );
pstmt.setTimestamp( 4, toDate );
pstmt.setString( 5, itenmCode );
rs = pstmt.executeQuery();
double rcpCur =0, rcpPre = 0, totRcp = 0;
while (rs.next())
......@@ -7312,12 +7779,12 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
" (select invoice_id,sum(quantity) totfreeQty,sum(rate),sum(quantity)*sum(rate) as totFreeValue " +
"from ( select invoice.invoice_id as invoice_id,0 quantity, max(rate__stduom) " +
"rate from invoice invoice,invoice_trace itrace where invoice.invoice_id= Itrace.invoice_id " +
"and invoice.invoice_id in("+selectedInvList+") and item_code='"+itemCode+"' and itrace.item_ser__prom='"+itemSer+"'" +
"and invoice.invoice_id in("+selectedInvList+") and item_code='"+itemCode+"' and itrace.item_ser__prom in ("+itemSer+") " +
" and invoice.inv_type='"+orderType+"' and rate__stduom>0 group by invoice.invoice_id " +
"union all" +
" select invoice.invoice_id as invoice_id,quantity__stduom quantity, 0 rate from " +
"invoice invoice,invoice_trace itrace where invoice.invoice_id= Itrace.invoice_id and " +
"invoice.invoice_id in("+selectedInvList+") and item_code='"+itemCode+"' and itrace.item_ser__prom='"+itemSer+"'" +
"invoice.invoice_id in("+selectedInvList+") and item_code='"+itemCode+"' and itrace.item_ser__prom in ("+itemSer+") " +
" and invoice.inv_type='"+orderType+"' and rate__stduom=0 ) group by invoice_id ) HAVING sum(totFreeValue) >0 AND sum(totfreeQty)>0 " ;
}else if("T".equalsIgnoreCase(quantityFlag))
......@@ -7327,12 +7794,12 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
" (select invoice_id,sum(quantity) totfreeQty,sum(rate),sum(quantity)*sum(rate) as totFreeValue " +
"from ( select invoice.invoice_id as invoice_id,0 quantity, max(rate__stduom) " +
"rate from invoice invoice,invoice_trace itrace where invoice.invoice_id= Itrace.invoice_id " +
"and invoice.invoice_id in("+transitInvList+") and item_code='"+itemCode+"' and itrace.item_ser__prom='"+itemSer+"'" +
"and invoice.invoice_id in("+transitInvList+") and item_code='"+itemCode+"' and itrace.item_ser__prom in ("+itemSer+") " +
" and invoice.inv_type='"+orderType+"' and rate__stduom>0 group by invoice.invoice_id " +
"union all" +
" select invoice.invoice_id as invoice_id,quantity__stduom quantity, 0 rate from " +
"invoice invoice,invoice_trace itrace where invoice.invoice_id= Itrace.invoice_id and " +
"invoice.invoice_id in("+transitInvList+") and item_code='"+itemCode+"' and itrace.item_ser__prom='"+itemSer+"'" +
"invoice.invoice_id in("+transitInvList+") and item_code='"+itemCode+"' and itrace.item_ser__prom in ("+itemSer+")" +
" and invoice.inv_type='"+orderType+"' and rate__stduom=0 ) group by invoice_id ) HAVING sum(totFreeValue) >0 AND sum(totfreeQty)>0 " ;
}
......@@ -7437,5 +7904,174 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
DecimalFormat decFormat = new DecimalFormat(fmtStr);
return decFormat.format(actVal);
}
public String getItemSerList(String itemser, Connection conn)
{
String itemSerGrpValue="",itemSerSplit="",resultItemSer="";
PreparedStatement pstmt = null,pstmt2 = null,pstmt3 = null;
ResultSet rs = null,rs2 = null,rs3 = null;
String sql = null;
try
{
sql= " select item_ser from itemser where grp_code=? and item_ser<>case when grp_code is null then '.' else grp_code end " +
"union all " +
"select item_ser from itemser where item_ser=? and item_ser<>case when grp_code is null then '.' else grp_code end";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemser);
pstmt.setString(2, itemser);
rs = pstmt.executeQuery();
while(rs.next())
{
itemSerGrpValue=checkNull(rs.getString("item_ser")).trim();
itemSerSplit=itemSerSplit+"'"+itemSerGrpValue+"',";
}
rs.close();
rs = null;
pstmt.close();
resultItemSer = itemSerSplit.substring(0, itemSerSplit.length() - 1);
//resultItemSer = itemSerSplit.substring(1, itemSerSplit.length() - 2);
System.out.println("resultItemSer>>>>>"+resultItemSer);
}
catch(Exception exception)
{
exception.printStackTrace();
try
{
throw new ITMException( exception );
} catch (ITMException e)
{
e.printStackTrace();
}
}
return resultItemSer;
}
private ArrayList addPreviousItems(List<String> itemListLast,ArrayList defData,String tranIdLast, Connection conn)
{
String sql = null;
PreparedStatement pstmt = null,pstmt1 = null;
ResultSet rs = null,rs1 = null;
ItemDescr itemDescr = null;
ArrayList previousItem = new ArrayList();
String itemCode="",clStock="",rate="",rateOrg="",previousItems="";
String itemDescription="";
try
{
for(int itemPos = 0; itemPos < defData.size(); itemPos++ )
{
previousItems = ( ( ItemDescr )defData.get(itemPos)).lsCode;
System.out.println("class items"+previousItems);
previousItem.add(previousItems);
}
sql = " select item_code,cl_stock,CASE WHEN rate IS NULL THEN 0 ELSE rate END as rate," +
" CASE WHEN rate__org IS NULL THEN 0 ELSE rate__org END as rate__org from " +
"cust_stock_det where tran_id=? ";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, tranIdLast);
rs1 = pstmt1.executeQuery();
while(rs1.next())
{
itemCode = rs1.getString("item_code");
clStock = rs1.getString("cl_stock");
rate = rs1.getString("rate");
rateOrg = rs1.getString("rate__org");
if(!itemListLast.contains(itemCode) && !previousItem.contains(itemCode))
{
sql= " select descr from item where item_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode);
rs = pstmt.executeQuery();
if(rs.next())
{
itemDescription=checkNull(rs.getString("descr"));
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
itemDescr = new ItemDescr();
itemDescr.setItemCode(itemCode);
itemDescr.setLsOpStock(clStock);
itemDescr.setLsrateold(rate);
itemDescr.setLsrateorgold(rateOrg);
itemDescr.setItemDescription(itemDescription);
/*itemDescr.lsCode = itemCode;
itemDescr.lsOpStock= clStock;
itemDescr.lsrateold= rate;
itemDescr.lsrateorgold= rateOrg;*/
defData.add(itemDescr);
//itemListLast.add(itemCode);
}
}
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
}catch(Exception exception)
{
exception.printStackTrace();
try
{
throw new ITMException( exception );
} catch (ITMException e)
{
e.printStackTrace();
}
}
// TODO Auto-generated method stub
return defData;
}
public boolean isExistItem(String itemCode,String tranIdLast,Connection conn)
{
boolean isItemFound=true;
String sql = "";
int itemCnt=0;
PreparedStatement pstmt = null,pstmt1 = null;
ResultSet rs = null,rs1 = null;
ItemDescr itemDescr = null;
ArrayList previousItem = new ArrayList();
try
{
sql = " select count(*) from cust_stock_det where tran_id=? and item_code= ?";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, tranIdLast);
pstmt1.setString(2, itemCode);
rs1 = pstmt1.executeQuery();
if(rs1.next())
{
itemCnt = rs1.getInt(1);
System.out.println("inside if@@@@");
}
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
if(itemCnt==0)
{
isItemFound=false;
}else
{
isItemFound=true;
}
}catch(Exception exception)
{
exception.printStackTrace();
try
{
throw new ITMException( exception );
} catch (ITMException e)
{
e.printStackTrace();
}
}
System.out.println("isItemFound>>>>>"+isItemFound);
return isItemFound;
}
}
\ No newline at end of file
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