Commit d39209ed authored by caluka's avatar caluka

Add new item provision and entry_start_dt,entry_end_dt condition added for entry


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@100370 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 1677c8e1
...@@ -20,6 +20,7 @@ import java.rmi.RemoteException; ...@@ -20,6 +20,7 @@ import java.rmi.RemoteException;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement; import java.sql.Statement;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.text.DecimalFormat; import java.text.DecimalFormat;
...@@ -34,12 +35,15 @@ import java.util.List; ...@@ -34,12 +35,15 @@ import java.util.List;
import javax.ejb.Stateless; import javax.ejb.Stateless;
import org.apache.xerces.dom.AttributeMap;
import org.w3c.dom.Attr; import org.w3c.dom.Attr;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
import org.w3c.dom.CDATASection;
@Stateless @Stateless
public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,CustStockGWTICRemote //implements SessionBean public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,CustStockGWTICRemote //implements SessionBean
...@@ -438,8 +442,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -438,8 +442,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
/*sql= " select FR_DATE,TO_DATE from period_tbl where " /*sql= " select FR_DATE,TO_DATE from period_tbl where "
+ "prd_code = ? ";*/ + "prd_code = ? ";*/
sql = "select b.FR_DATE as FR_DATE,b.TO_DATE as TO_DATE " + sql = "select b.FR_DATE as FR_DATE,b.TO_DATE as TO_DATE " +
//",b.entry_start_dt as entry_start_dt" + ",b.entry_start_dt as entry_start_dt" +
//",b.entry_end_dt as entry_end_dt" + ",b.entry_end_dt as entry_end_dt" +
" from period_appl a,period_tbl b " + " from period_appl a,period_tbl b " +
"where a.ref_code=a.prd_tblno and a.prd_tblno=b.prd_tblno " + "where a.ref_code=a.prd_tblno and a.prd_tblno=b.prd_tblno " +
"and a.site_code=? AND b.prd_code = ? " + "and a.site_code=? AND b.prd_code = ? " +
...@@ -454,8 +458,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -454,8 +458,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
{ {
FromDate = rs.getTimestamp("FR_DATE"); FromDate = rs.getTimestamp("FR_DATE");
ToDate = rs.getTimestamp("TO_DATE"); ToDate = rs.getTimestamp("TO_DATE");
//entryStartDt = rs.getTimestamp("entry_start_dt"); entryStartDt = rs.getTimestamp("entry_start_dt");
//entryEndDt = rs.getTimestamp("entry_end_dt"); entryEndDt = rs.getTimestamp("entry_end_dt");
} }
rs.close(); rs.close();
rs = null; rs = null;
...@@ -464,7 +468,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -464,7 +468,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
if(!"V".equalsIgnoreCase(editSatus)) if(!"V".equalsIgnoreCase(editSatus))
{ {
/*sql = "select count(*) from period_appl a,period_tbl b " + sql = "select count(*) from period_appl a,period_tbl b " +
"where a.ref_code=a.prd_tblno and a.prd_tblno=b.prd_tblno " + "where a.ref_code=a.prd_tblno and a.prd_tblno=b.prd_tblno " +
"and a.site_code=? AND b.prd_code = ? " + "and a.site_code=? AND b.prd_code = ? " +
"and b.prd_tblno=? " + "and b.prd_tblno=? " +
...@@ -490,7 +494,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -490,7 +494,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
errCode = "VMINVPRDST"; errCode = "VMINVPRDST";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
}*/ }
sql = "select count(*) from cust_stock where status='S' " + sql = "select count(*) from cust_stock where status='S' " +
"and cust_code=? and from_date=? and to_date =?"; "and cust_code=? and from_date=? and to_date =?";
...@@ -860,7 +864,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -860,7 +864,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("dlvFlg :" + dlvFlg); System.out.println("dlvFlg :" + dlvFlg);
} }
/*if (childNodeName.equals("invoice_date")) if (childNodeName.equals("invoice_date"))
{ {
if (childNode1.getFirstChild() != null) if (childNode1.getFirstChild() != null)
{ {
...@@ -868,14 +872,15 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -868,14 +872,15 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
} }
System.out.println("invoiceDateStr :" + invoiceDateStr); System.out.println("invoiceDateStr :" + invoiceDateStr);
if(invoiceDateStr !=null && invoiceDateStr.trim().length()>0)
{
validUptoDate = Timestamp.valueOf(genericUtility.getValidDateString(invoiceDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0"); validUptoDate = Timestamp.valueOf(genericUtility.getValidDateString(invoiceDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
if (("NULLFOUND".equalsIgnoreCase(transitGraceDaysStr) || transitGraceDaysStr == null if (("NULLFOUND".equalsIgnoreCase(transitGraceDaysStr) || transitGraceDaysStr == null || transitGraceDaysStr.trim().length() == 0) && "N".equalsIgnoreCase(dlvFlg))
|| transitGraceDaysStr.trim().length() == 0 )&& "N".equalsIgnoreCase(dlvFlg) )
{ {
errCode = "VTGRCDAYS"; errCode = "VTGRCDAYS";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} else if("N".equalsIgnoreCase(dlvFlg)) } else if ("N".equalsIgnoreCase(dlvFlg))
{ {
transitGraceDays = Integer.parseInt(transitGraceDaysStr); transitGraceDays = Integer.parseInt(transitGraceDaysStr);
graceTransitDays = Integer.parseInt(transitGraceDaysStr); graceTransitDays = Integer.parseInt(transitGraceDaysStr);
...@@ -888,8 +893,9 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -888,8 +893,9 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
isInvList = false; isInvList = false;
} }
} }
}
}*/ }
} }
} }
...@@ -920,12 +926,21 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -920,12 +926,21 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
} }
System.out.println("itemCode :"+itemCode); System.out.println("itemCode :"+itemCode);
System.out.println("itemCode.trim().length() :"+itemCode); System.out.println("itemCode.trim().length() :"+itemCode);
if(itemCode.trim().length() == 0) if(itemCode == null || itemCode.trim().length() == 0)
//if(itemCode.trim().length() == 0)
{ {
System.out.println("Error : No data found in item details"); System.out.println("Error : No data found in item details");
errCode = "VTEMTITM"; errCode = "VTEMTITM";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
}else
{
errCode = isExist("item","item_code",itemCode,conn);
if( "FALSE".equalsIgnoreCase(errCode ))
{
errCode = "VMITMNOTEX";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
} }
System.out.println("isClStockInt>>>>>>"+isClStockInt); System.out.println("isClStockInt>>>>>>"+isClStockInt);
if(isClStockInt == false && !errItemList.contains(itemCode)) if(isClStockInt == false && !errItemList.contains(itemCode))
...@@ -939,6 +954,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -939,6 +954,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
salNegitiveErrItemList.add(itemCode.trim()); salNegitiveErrItemList.add(itemCode.trim());
}*/ }*/
} }
}
if (childNodeName.equals("cl_stock")) if (childNodeName.equals("cl_stock"))
...@@ -953,7 +969,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -953,7 +969,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
clStock = 0; clStock = 0;
} }
System.out.println("clStock :"+clStock); System.out.println("clStock :"+clStock);
if(childNode1.getFirstChild()!=null)
{
isClStockInt= isNumberValidDate( childNode1.getFirstChild().getNodeValue()); isClStockInt= isNumberValidDate( childNode1.getFirstChild().getNodeValue());
System.out.println("isClStockInt>>>>>>>>"+isClStockInt); System.out.println("isClStockInt>>>>>>>>"+isClStockInt);
System.out.println("itemCode>>>>>>"+itemCode); System.out.println("itemCode>>>>>>"+itemCode);
...@@ -964,6 +981,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -964,6 +981,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
System.out.println("Closing Stock not be Integer"); System.out.println("Closing Stock not be Integer");
} }
}
/*if(clStock == 0) /*if(clStock == 0)
{ {
errCode = "VTCLSZERO"; errCode = "VTCLSZERO";
...@@ -1094,8 +1112,9 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -1094,8 +1112,9 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
} //}
}
} }
break; break;
...@@ -1316,7 +1335,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -1316,7 +1335,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
String toDateStr="",fromDateStr="",sretunTranId="",tranIdItem="",invoiceIdStr=""; String toDateStr="",fromDateStr="",sretunTranId="",tranIdItem="",invoiceIdStr="";
String startForm="", netAmtFinal="",netAmtStr="",countryIemSer="",priceList=""; String startForm="", netAmtFinal="",netAmtStr="",countryIemSer="",priceList="";
String confirmed="",status="",errString="",empCode="",positionCode="",empName=""; String confirmed="",status="",errString="",empCode="",positionCode="",empName="";
String positionDescr="",resultItemSer=""; String positionDescr="",resultItemSer="",opStock="";
String reStr="";
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 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 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; double sretQty = 0.0,replQty=0.0,rcpQtyBon=0.0,primarySales=0.0,transitQtyAll=0.0;
...@@ -1345,11 +1365,13 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -1345,11 +1365,13 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
double invQtystdm=0.0,invRatestdm=0.0; double invQtystdm=0.0,invRatestdm=0.0;
double quantityStd=0.0,rateStd=0.0,salesOrg=0.0; double quantityStd=0.0,rateStd=0.0,salesOrg=0.0;
double opValue=0.0,salesValue=0.0,clValue=0.0,openingValue=0.0,salesValueCal=0.0; double opValue=0.0,salesValue=0.0,clValue=0.0,openingValue=0.0,salesValueCal=0.0;
double grossSecondaryRateCal=0.0,grosSalesValueCal=0.0; double grossSecondaryRateCal=0.0,grosSalesValueCal=0.0,opStockQty=0.0;
int netValue=0,decimalNumber=0; int netValue=0,decimalNumber=0;
int lineNoCustSt=0,currentFormNo = 0,varValue=0,domID3=0,sreturnCnt=0; int lineNoCustSt=0,currentFormNo = 0,varValue=0,domID3=0,sreturnCnt=0;
int lineNoItmCnt=0,itemResLen=0,itemPos=0,itmDetCnt=0,domID2=0; int lineNoItmCnt=0,itemResLen=0,itemPos=0,itmDetCnt=0,domID2=0;
int invCnt=0,dlvFlgCnt=0,siteCustCnt=0; int invCnt=0,dlvFlgCnt=0,siteCustCnt=0;
int parentNodeListLength = 0,lineNo=0;
int pos=0;
Date invDate=null,frmDate=null,toDate=null,stmtDate=null,lrDate=null; Date invDate=null,frmDate=null,toDate=null,stmtDate=null,lrDate=null;
Date RelativeDate=null; Date RelativeDate=null;
Date nextMonthDate=null; Date nextMonthDate=null;
...@@ -3634,7 +3656,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -3634,7 +3656,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
{ isPreviusItem=false; { isPreviusItem=false;
isPreviusItem=isExistItem(itemCodeLast,tranIdLast,conn); isPreviusItem=isExistItem(itemCodeLast,tranIdLast,conn);
valueXmlString.append( "<Detail3 dbID='' domID='"+itmDetCnt+"' objContext='"+currentFormNo+"' selected='N'>\r\n" ); valueXmlString.append( "<Detail3 dbID='' domID='"+itmDetCnt+"' objContext='"+currentFormNo+"' selected='Y'>\r\n" );
if(tranIdNew.length() > 0) if(tranIdNew.length() > 0)
{ {
valueXmlString.append("<attribute pkNames=\"\" selected=\"Y\" updateFlag=\"E\" status=\"O\" />"); valueXmlString.append("<attribute pkNames=\"\" selected=\"Y\" updateFlag=\"E\" status=\"O\" />");
...@@ -4002,7 +4024,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -4002,7 +4024,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
isPreviusItem=isExistItem(itemMap.get("itemCode@"+itemDomId),tranIdLast,conn); isPreviusItem=isExistItem(itemMap.get("itemCode@"+itemDomId),tranIdLast,conn);
openingValue=0; openingValue=0;
valueXmlString.append( "<Detail3 dbID='' domID='"+itmDetCnt+"' objContext='"+currentFormNo+"' selected='N'>\r\n" ); valueXmlString.append( "<Detail3 dbID='' domID='"+itmDetCnt+"' objContext='"+currentFormNo+"' selected='Y'>\r\n" );
/* if(tranIdLast.trim().length() == 0 && tranIdNew.trim().length() > 0 ) /* if(tranIdLast.trim().length() == 0 && tranIdNew.trim().length() > 0 )
{ {
...@@ -4168,19 +4190,78 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -4168,19 +4190,78 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
secondarySales = Double.parseDouble(genericUtility.getColumnValue("sales",dom)); secondarySales = Double.parseDouble(genericUtility.getColumnValue("sales",dom));
System.out.println("SECONDARYsales :"+secondarySales); System.out.println("SECONDARYsales :"+secondarySales);
String itemSerIC = genericUtility.getColumnValue("item_ser",dom); //String itemSerIC = genericUtility.getColumnValue("item_ser",dom);
if(genericUtility.getColumnValue("rate_old",dom) !=null && genericUtility.getColumnValue("rate_old",dom).trim().length()>0)
{
rateOld = Double.parseDouble(genericUtility.getColumnValue("rate_old",dom)); rateOld = Double.parseDouble(genericUtility.getColumnValue("rate_old",dom));
}else
{
rateOld=0.0;
}
if(genericUtility.getColumnValue("rate_org_old",dom) !=null && genericUtility.getColumnValue("rate_org_old",dom).trim().length()>0)
{
rateOrgOld = Double.parseDouble(genericUtility.getColumnValue("rate_org_old",dom)); rateOrgOld = Double.parseDouble(genericUtility.getColumnValue("rate_org_old",dom));
}else
{
rateOrgOld=0.0;
}
if(genericUtility.getColumnValue("rcp_value",dom) !=null && genericUtility.getColumnValue("rcp_value",dom).trim().length()>0)
{
rcpValue = Double.parseDouble(genericUtility.getColumnValue("rcp_value",dom)); rcpValue = Double.parseDouble(genericUtility.getColumnValue("rcp_value",dom));
}else
{
rcpValue=0.0;
}
if(genericUtility.getColumnValue("repl_value",dom) !=null && genericUtility.getColumnValue("repl_value",dom).trim().length()>0)
{
replValue = Double.parseDouble(genericUtility.getColumnValue("repl_value",dom)); replValue = Double.parseDouble(genericUtility.getColumnValue("repl_value",dom));
}else
{
replValue=0.0;
}
if(genericUtility.getColumnValue("sret_vale",dom) !=null && genericUtility.getColumnValue("sret_vale",dom).trim().length()>0)
{
retValue = Double.parseDouble(genericUtility.getColumnValue("sret_vale",dom)); retValue = Double.parseDouble(genericUtility.getColumnValue("sret_vale",dom));
}else
{
retValue=0.0;
}
if(genericUtility.getColumnValue("cm_invoice",dom) !=null && genericUtility.getColumnValue("cm_invoice",dom).trim().length()>0)
{
cmQuantity1 = Double.parseDouble(genericUtility.getColumnValue("cm_invoice",dom)); cmQuantity1 = Double.parseDouble(genericUtility.getColumnValue("cm_invoice",dom));
}else
{
cmQuantity1=0.0;
}
if(genericUtility.getColumnValue("cm_value",dom) !=null && genericUtility.getColumnValue("cm_value",dom).trim().length()>0)
{
cmValue1 = Double.parseDouble(genericUtility.getColumnValue("cm_value",dom)); cmValue1 = Double.parseDouble(genericUtility.getColumnValue("cm_value",dom));
}else
{
cmValue1=0.0;
}
if(genericUtility.getColumnValue("secondary_value",dom) !=null && genericUtility.getColumnValue("secondary_value",dom).trim().length()>0)
{
secondarySalesValue = Double.parseDouble(genericUtility.getColumnValue("secondary_value",dom)); secondarySalesValue = Double.parseDouble(genericUtility.getColumnValue("secondary_value",dom));
}else
{
secondarySalesValue=0.0;
}
if(genericUtility.getColumnValue("formula_value",dom) !=null && genericUtility.getColumnValue("formula_value",dom).trim().length()>0)
{
formulaValue = Double.parseDouble(genericUtility.getColumnValue("formula_value",dom)); formulaValue = Double.parseDouble(genericUtility.getColumnValue("formula_value",dom));
}else
{
formulaValue=0.0;
}
if(genericUtility.getColumnValue("free_value",dom) !=null && genericUtility.getColumnValue("free_value",dom).trim().length()>0)
{
rcpFreeValue = Double.parseDouble(genericUtility.getColumnValue("free_value",dom)); rcpFreeValue = Double.parseDouble(genericUtility.getColumnValue("free_value",dom));
}else
{
rcpFreeValue=0.0;
}
System.out.println("rateOld@@@@@@@@"+rateOld); System.out.println("rateOld@@@@@@@@"+rateOld);
System.out.println("rateOrgOld@@@@@@@@"+rateOrgOld); System.out.println("rateOrgOld@@@@@@@@"+rateOrgOld);
...@@ -4482,7 +4563,160 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -4482,7 +4563,160 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
} }
} }
System.out.println("case 4 valueXmlString :"+valueXmlString); if (currentColumn.trim().equalsIgnoreCase("itm_default_add"))
{
System.out.println("itm_default_add called");
Node detail1Node = dom2.getElementsByTagName("Detail2").item(0);
tranIdNew = checkNull(genericUtility.getColumnValueFromNode("tran_id", detail1Node));
System.out.println("tranIdNew for add new record>>>"+tranIdNew);
NodeList parentList = dom2.getElementsByTagName("Detail3");
parentNodeListLength = parentList.getLength();
System.out.println((new StringBuilder("parentNodeListLength[")).append(parentNodeListLength).append("]").toString());
for (int prntCtr = 0; prntCtr < parentNodeListLength; prntCtr++)
{
Node parentNode1 = parentList.item(prntCtr);
AttributeMap attrMap = (AttributeMap) parentNode1.getAttributes();
System.out.println("[" + prntCtr + "] Node domID [" + attrMap.getNamedItem("domID").getLocalName() + ":" + attrMap.getNamedItem("domID").getNodeValue() + "]");
lineNo = Integer.parseInt(attrMap.getNamedItem("domID").getNodeValue());
System.out.println("lineNo----" + lineNo);
}
System.out.println("dom id> before>>>>"+lineNo);
lineNoStrDom = " " + lineNo;
lineNoStrDom = lineNoStrDom.substring(lineNoStrDom.length() - 3);
System.out.println("lineNoStrDom for add new record" + lineNoStrDom);
//itmDetCnt++;
//System.out.println("itmDetCnt>>After>>>"+itmDetCnt);
valueXmlString.append("<Detail3 domID='" + lineNo + "' objContext=\"3\" selected=\"Y\">\r\n");
valueXmlString.append("<attribute selected=\"Y\" updateFlag=\"A\" status=\"N\" pkNames=\"\" />\r\n");
valueXmlString.append("<tran_id><![CDATA["+ tranIdNew+"]]></tran_id>");
valueXmlString.append("<line_no>").append("<![CDATA["+lineNoStrDom+"]]>").append("</line_no>");
valueXmlString.append("<item_code protect='0'>").append("<![CDATA[]]>").append("</item_code>");
valueXmlString.append("<item_ser>").append("<![CDATA[]]>").append("</item_ser>");
valueXmlString.append("<descr>").append("<![CDATA[]]>").append("</descr>");
valueXmlString.append("<unit>").append("<![CDATA[]]>").append("</unit>");
valueXmlString.append("<loc_type>").append("<![CDATA[]]>").append("</loc_type>");
valueXmlString.append("<rate>").append("<![CDATA["+0+"]]>").append("</rate>");
valueXmlString.append("<rate__org>").append("<![CDATA["+0+"]]>").append("</rate__org>");
valueXmlString.append("<op_stock protect='0'>").append("<![CDATA["+0+"]]>").append("</op_stock>");
valueXmlString.append("<purc_rcp>").append("<![CDATA["+0+"]]>").append("</purc_rcp>");
valueXmlString.append("<purc_rcp__repl>").append("<![CDATA["+0+"]]>").append("</purc_rcp__repl>");
valueXmlString.append("<purc_rcp__free>").append("<![CDATA["+0+"]]>").append("</purc_rcp__free>");
valueXmlString.append("<purc_ret>").append("<![CDATA["+0+"]]>").append("</purc_ret>");
valueXmlString.append("<purc_ret__repl>").append("<![CDATA[0]]>").append("</purc_ret__repl>");
valueXmlString.append("<purc_ret__free>").append("<![CDATA["+0+"]]>").append("</purc_ret__free>");
valueXmlString.append("<sales>").append("<![CDATA["+0+"]]>").append("</sales>");
valueXmlString.append("<cl_stock>").append("<![CDATA["+0+"]]>").append("</cl_stock>");
valueXmlString.append("<transit_qty>").append("<![CDATA["+0+"]]>").append("</transit_qty>");
valueXmlString.append("<transit_qty__repl>").append("<![CDATA["+0+"]]>").append("</transit_qty__repl>");
valueXmlString.append("<transit_qty__free>").append("<![CDATA["+0+"]]>").append("</transit_qty__free>");
valueXmlString.append("<primary_sales>").append("<![CDATA["+0+"]]>").append("</primary_sales>");
valueXmlString.append("<chg_user>").append("<![CDATA["+chgUser+"]]>").append("</chg_user>");
valueXmlString.append("<chg_term>").append("<![CDATA["+chgTerm+"]]>").append("</chg_term>");
valueXmlString.append("<chg_date>").append("<![CDATA["+sdf.format(currentDate)+"]]>").append("</chg_date>");
valueXmlString.append("<rate_old>").append("<![CDATA["+0+"]]>").append("</rate_old>");
valueXmlString.append("<rate_org_old>").append("<![CDATA["+0+"]]>").append("</rate_org_old>");
valueXmlString.append("<rcp_value>").append("<![CDATA["+0+"]]>").append("</rcp_value>");
valueXmlString.append("<repl_value>").append("<![CDATA["+0+"]]>").append("</repl_value>");
valueXmlString.append("<cm_invoice>").append("<![CDATA["+0+"]]>").append("</cm_invoice>");
valueXmlString.append("<cm_value>").append("<![CDATA["+0+"]]>").append("</cm_value>");
valueXmlString.append("<secondary_value>").append("<![CDATA["+0+"]]>").append("</secondary_value>");
valueXmlString.append("<formula_value>").append("<![CDATA["+0+"]]>").append("</formula_value>");
valueXmlString.append("<free_value>").append("<![CDATA["+0.0+"]]>").append("</free_value>");
valueXmlString.append("<sret_vale>").append("<![CDATA["+0+"]]>").append("</sret_vale>");
valueXmlString.append("<sales__org>").append("<![CDATA["+0+"]]>").append("</sales__org>");
valueXmlString.append("<pur_value>").append("<![CDATA["+0+"]]>").append("</pur_value>");
valueXmlString.append("<op_value>").append("<![CDATA["+0+"]]>").append("</op_value>");
valueXmlString.append("<sales_value>").append("<![CDATA["+0+"]]>").append("</sales_value>");
valueXmlString.append("<cl_value>").append("<![CDATA["+0+"]]>").append("</cl_value>");
valueXmlString.append("</Detail3>");
}
if (currentColumn.trim().equalsIgnoreCase("item_code"))
{
System.out.println("item_code item change called");
itemCode = genericUtility.getColumnValue("item_code",dom);
clStockInp = genericUtility.getColumnValue("cl_stock",dom);
sql = "Select descr, unit, loc_type ,sale_rate from item "
+" where item_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,itemCode);
rs = pstmt.executeQuery( );
if( rs.next() )
{
descrItem = rs.getString( "descr" );
unitItem = rs.getString( "unit" );
locTypeItem = rs.getString( "loc_type");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
valueXmlString.append("<Detail3>\r\n");
valueXmlString.append("<item_code>").append("<![CDATA["+itemCode+"]]>").append("</item_code>");
valueXmlString.append("<descr>").append("<![CDATA["+descrItem+"]]>").append("</descr>");
valueXmlString.append("<unit>").append("<![CDATA["+unitItem+"]]>").append("</unit>");
valueXmlString.append("<loc_type>").append("<![CDATA["+locTypeItem+"]]>").append("</loc_type>");
valueXmlString.append("<cl_value>").append("<![CDATA["+clStockInp+"]]>").append("</cl_value>");
valueXmlString.append("</Detail3>");
}
if (currentColumn.trim().equalsIgnoreCase("op_stock"))
{
opStock = genericUtility.getColumnValue("op_stock",dom);
itemCode = genericUtility.getColumnValue("item_code",dom);
clStockInp=genericUtility.getColumnValue("cl_stock",dom);
clStock = Double.parseDouble(genericUtility.getColumnValue("cl_stock",dom));
rcpQtmDom = Double.parseDouble(genericUtility.getColumnValue("purc_rcp",dom));
rcpReplQtmDom = Double.parseDouble(genericUtility.getColumnValue("purc_rcp__repl",dom));
rcpFreeQtmDom = Double.parseDouble(genericUtility.getColumnValue("purc_rcp__free",dom));
retQtyDom = Double.parseDouble(genericUtility.getColumnValue("purc_ret",dom));
retQtyFreeDom = Double.parseDouble(genericUtility.getColumnValue("purc_ret__repl",dom));
System.out.println("op_stock item change called>>>"+opStock);
sql = "select price_list from customer where cust_code =? ";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, custCodeStatic );
rs1 = pstmt1.executeQuery();
if (rs1.next())
{
priceList = checkNull(rs1.getString("price_list"));
System.out.println("priceList edit :" + priceList);
}
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
rateAll=0.0;
rateAll = discmn.pickRate(priceList,sysDate,itemCode,conn);
System.out.println("rateAll>>>>"+rateAll);
if(opStock !=null && opStock.trim().length() >0)
{
opStockQty = Double.parseDouble(opStock);
}
else
{
opStockQty = 0.0;
}
valueXmlString.append("<Detail3>\r\n");
valueXmlString.append("<op_stock>").append("<![CDATA["+(long) Math.round(opStockQty)+"]]>").append("</op_stock>");
valueXmlString.append("<rate_old>").append("<![CDATA["+rateAll+"]]>").append("</rate_old>");
valueXmlString.append("<rate_org_old>").append("<![CDATA["+rateAll+"]]>").append("</rate_org_old>");
//closing item change called
setNodeValue( dom, "cl_stock", clStockInp );
reStr=itemChanged(dom,dom1, dom2, objContext,"cl_stock",editFlag,xtraParams);
pos = reStr.indexOf("<Detail3>");
reStr = reStr.substring(pos + 9);
pos = reStr.indexOf("</Detail3>");
reStr = reStr.substring(0,pos);
valueXmlString.append(reStr);
valueXmlString.append("</Detail3>");
}
System.out.println("case 3 valueXmlString :"+valueXmlString);
break; break;
...@@ -6903,7 +7137,8 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String ...@@ -6903,7 +7137,8 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
public String lsrateorgold = null; public String lsrateorgold = null;
}*/ }*/
private static class ItemDescr //private static class ItemDescr
public static class ItemDescr
{ {
public String lsCode = null; public String lsCode = null;
public String lsDescr = null; public String lsDescr = null;
...@@ -8296,5 +8531,53 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String ...@@ -8296,5 +8531,53 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
} }
return value; return value;
} }
private String isExist(String table, String field, String value,Connection conn) throws SQLException
{
String sql = "",retStr="";
PreparedStatement pstmt = null;
ResultSet rs = null ;
int cnt=0;
sql = " SELECT COUNT(1) FROM "+ table + " WHERE " + field + " = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,value);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if( cnt > 0)
{
retStr = "TRUE";
}
if( cnt == 0 )
{
retStr = "FALSE";
}
System.out.println("@@@@ isexist["+value+"]:::["+retStr+"]:::["+cnt+"]");
return retStr;
}
private static void setNodeValue( Document dom, String nodeName, String nodeVal ) throws Exception
{
Node tempNode = dom.getElementsByTagName( nodeName ).item(0);
if( tempNode != null )
{
if( tempNode.getFirstChild() == null )
{
CDATASection cDataSection = dom.createCDATASection( nodeVal );
tempNode.appendChild( cDataSection );
}
else
{
tempNode.getFirstChild().setNodeValue(nodeVal);
}
}
tempNode = null;
}
} }
\ 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