Commit f2901d21 authored by mnair's avatar mnair

Updated changes in ItemAcctDetrIC

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@183974 ce508802-f39f-4f6c-b175-0d175dae99d5
parent d70a454e
package ibase.webitm.ejb.fin;
package ibase.webitm.ejb.fin;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
......@@ -19,881 +19,238 @@ import ibase.webitm.utility.ITMException;
@Stateless
public class ItemAcctDetrIC extends ValidatorEJB implements
ItemAcctDetrICLocal, ItemAcctDetrICRemote
{
E12GenericUtility genericUtility = new E12GenericUtility();
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{
Document dom = null;
Document dom1 = null;
Document dom2 = null;
String retString = "";
try{
if(xmlString != null && xmlString.trim().length() > 0)
{
dom = genericUtility.parseString(xmlString);
}
if(xmlString1 != null && xmlString1.trim().length() > 0)
{
dom1 = genericUtility.parseString(xmlString1);
}
if(xmlString2 != null && xmlString2.trim().length() > 0)
{
dom2 = genericUtility.parseString(xmlString2);
}
retString = wfValData(dom,dom1,dom2,objContext,editFlag,xtraParams);
System.out.println("retString:::"+retString);
}
catch(Exception e){
System.out.println("Exception : ItemAcctDetrIC.java : wfValData(String xmlString) : ==>\n"+e.getMessage());
throw new ITMException(e);
}
return retString;
}
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null ;
int cnt=0,ctr=0,childNodeLength = 0;
int currentFormNo=0;
NodeList parentNodeList = null;
Node parentNode = null;
NodeList childNodeList = null;
Node childNode = null;
String childNodeName = "",itemSer="",itemCode="",grpCode="",finEntity="",active="",tranCat="",cctrCode="",acctCode="",sql="";
String errString="",errCode="",errorType="",userId="";
ArrayList <String> errList = new ArrayList<String>();
ArrayList <String>errFields = new ArrayList <String> ();
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
try{
conn = getConnection();
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
System.out.println("user ID form XtraParam : "+userId +"Edit Flag -->>: "+editFlag);
if(objContext != null && objContext.trim().length()>0)
{
currentFormNo = Integer.parseInt(objContext);
System.out.println("currentFormNo:::"+currentFormNo);
switch(currentFormNo)
{
case 1:{
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength();
System.out.println("childNodeLength>>"+childNodeLength);
for(ctr = 0; ctr < childNodeLength; ctr++)
{
System.out.println("childNode>>"+childNode);
childNode = childNodeList.item(ctr);
System.out.println("childNode>>"+childNode);
childNodeName = childNode.getNodeName();
System.out.println("childNodeName>>"+childNodeName);
//Item_ser
if("item_ser".equalsIgnoreCase(childNodeName))
{
itemSer = genericUtility.getColumnValue("item_ser",dom).trim();
System.out.println("item_ser>>>>>"+itemSer);
if(itemSer == null || (itemSer.trim().length() == 0))
{
System.out.println("NULL ITEM SER!");
errCode = "VMNULLSER";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
else
{
sql ="select count(*) as cnt from itemser where item_ser=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemSer);
System.out.println("itemSer"+itemSer);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("cnt");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (cnt == 0)
{
System.out.println("Item ser entered does not exist, please enter valid item ser !");
errCode = "VITEMSER";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}//end of else
}// end of if block for item_ser
//Item_code
else if("item_code".equalsIgnoreCase(childNodeName))
{
itemCode = genericUtility.getColumnValue("item_code",dom).trim();
System.out.println("item_code>>>>>"+itemCode);
if(itemCode != null && itemCode.trim().length() > 0)
{
sql = "select count(*) as cnt from item where item_code =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
if(cnt == 0)
{
errCode = "VMITEM1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
//Grp_Code
else if("grp_code".equalsIgnoreCase(childNodeName))
{
grpCode = genericUtility.getColumnValue("grp_code",dom).trim();
System.out.println("grp_code>>>>>"+grpCode);
if(grpCode == null || grpCode.trim().length() == 0)
{
System.out.println("NULL GROUP CODE!");
errCode = "NULLGRPCODE";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
//Acct_Code
else if("acct_code__sal".equalsIgnoreCase(childNodeName))
{
acctCode=genericUtility.getColumnValue("acct_code__sal",dom).trim();
if(acctCode != null && acctCode.trim().length() > 0)
{
cnt = getAccountDetail(acctCode,conn);
System.out.println("acct_code__sal["+cnt+"]");
if(cnt == 0)
{
errCode = "VMACCT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if("acct_code__dis".equalsIgnoreCase(childNodeName))
{
acctCode=genericUtility.getColumnValue("acct_code__dis",dom).trim();
if(acctCode != null && acctCode.trim().length() > 0)
{
cnt = getAccountDetail(acctCode,conn);
System.out.println("acct_code__dis["+cnt+"]");
if(cnt == 0)
{
errCode = "VMACCT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if("acct_code__depr".equalsIgnoreCase(childNodeName))
{
acctCode=genericUtility.getColumnValue("acct_code__depr",dom).trim();
if(acctCode != null && acctCode.trim().length() > 0)
{
cnt = getAccountDetail(acctCode,conn);
System.out.println("acct_code__depr["+cnt+"]");
if(cnt == 0)
{
errCode = "VMACCT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if("acct_code__acc_depr".equalsIgnoreCase(childNodeName))
{
acctCode=genericUtility.getColumnValue("acct_code__acc_depr",dom).trim();
if(acctCode != null && acctCode.trim().length() > 0)
{
cnt = getAccountDetail(acctCode,conn);
System.out.println("acct_code__acc_depr["+cnt+"]");
if(cnt == 0)
{
errCode = "VMACCT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if("acct_code__depr_wb".equalsIgnoreCase(childNodeName))
{
acctCode=genericUtility.getColumnValue("acct_code__depr_wb",dom).trim();
if(acctCode != null && acctCode.trim().length() > 0)
{
cnt = getAccountDetail(acctCode,conn);
System.out.println("acct_code__depr_wb["+cnt+"]");
if(cnt == 0)
{
errCode = "VMACCT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if("acct_code__fa".equalsIgnoreCase(childNodeName))
{
acctCode=genericUtility.getColumnValue("acct_code__fa",dom).trim();
if(acctCode != null && acctCode.trim().length() > 0)
{
cnt = getAccountDetail(acctCode,conn);
System.out.println("acct_code__fa["+cnt+"]");
if(cnt == 0)
{
errCode = "VMACCT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if("acct_code__pl".equalsIgnoreCase(childNodeName))
{
acctCode=genericUtility.getColumnValue("acct_code__pl",dom).trim();
if(acctCode != null && acctCode.trim().length() > 0)
{
cnt = getAccountDetail(acctCode,conn);
System.out.println("acct_code__pl["+cnt+"]");
if(cnt == 0)
{
errCode = "VMACCT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if("acct_code__in".equalsIgnoreCase(childNodeName))
{
acctCode=genericUtility.getColumnValue("acct_code__in",dom).trim();
if(acctCode != null && acctCode.trim().length() > 0)
{
cnt = getAccountDetail(acctCode,conn);
System.out.println("acct_code__in["+cnt+"]");
if(cnt == 0)
{
errCode = "VMACCT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if("acct_code__pr".equalsIgnoreCase(childNodeName))
{
acctCode=genericUtility.getColumnValue("acct_code__pr",dom).trim();
if(acctCode != null && acctCode.trim().length() > 0)
{
cnt = getAccountDetail(acctCode,conn);
System.out.println("acct_code__pr["+cnt+"]");
if(cnt == 0)
{
errCode = "VMACCT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if("acct_code__ph".equalsIgnoreCase(childNodeName))
{
acctCode=genericUtility.getColumnValue("acct_code__ph",dom).trim();
if(acctCode != null && acctCode.trim().length() > 0)
{
cnt = getAccountDetail(acctCode,conn);
System.out.println("acct_code__ph["+cnt+"]");
if(cnt == 0)
{
errCode = "VMACCT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if("acct_code__ap".equalsIgnoreCase(childNodeName))
{
acctCode=genericUtility.getColumnValue("acct_code__ap",dom).trim();
if(acctCode != null && acctCode.trim().length() > 0)
{
cnt = getAccountDetail(acctCode,conn);
System.out.println("acct_code__ap["+cnt+"]");
if(cnt == 0)
{
errCode = "VMACCT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if("acct_code__reco".equalsIgnoreCase(childNodeName))
{
acctCode=genericUtility.getColumnValue("acct_code__reco",dom).trim();
if(acctCode != null && acctCode.trim().length() > 0)
{
cnt = getAccountDetail(acctCode,conn);
System.out.println("acct_code__reco["+cnt+"]");
if(cnt == 0)
{
errCode = "VMACCT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if("acct_code__wp".equalsIgnoreCase(childNodeName))
{
acctCode=genericUtility.getColumnValue("acct_code__wp",dom).trim();
if(acctCode != null && acctCode.trim().length() > 0)
{
cnt = getAccountDetail(acctCode,conn);
System.out.println("acct_code__wp["+cnt+"]");
if(cnt == 0)
{
errCode = "VMACCT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if("acct_code__oh".equalsIgnoreCase(childNodeName))
{
acctCode=genericUtility.getColumnValue("acct_code__oh",dom).trim();
if(acctCode != null && acctCode.trim().length() > 0)
{
cnt = getAccountDetail(acctCode,conn);
System.out.println("acct_code__oh["+cnt+"]");
if(cnt == 0)
{
errCode = "VMACCT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if("acct_code__ciss".equalsIgnoreCase(childNodeName))
{
acctCode=genericUtility.getColumnValue("acct_code__ciss",dom).trim();
if(acctCode != null && acctCode.trim().length() > 0)
{
cnt = getAccountDetail(acctCode,conn);
System.out.println("acct_code__ciss["+cnt+"]");
if(cnt == 0)
{
errCode = "VMACCT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if("acct_code__wp_rcp".equalsIgnoreCase(childNodeName))
{
acctCode=genericUtility.getColumnValue("acct_code__wp_rcp",dom).trim();
if(acctCode != null && acctCode.trim().length() > 0)
{
cnt = getAccountDetail(acctCode,conn);
System.out.println("acct_code__wp_rcp["+cnt+"]");
if(cnt == 0)
{
errCode = "VMACCT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if("acct_code__qc_sample".equalsIgnoreCase(childNodeName))
{
acctCode=genericUtility.getColumnValue("acct_code__qc_sample",dom).trim();
if(acctCode != null && acctCode.trim().length() > 0)
{
cnt = getAccountDetail(acctCode,conn);
System.out.println("acct_code__qc_sample["+cnt+"]");
if(cnt == 0)
{
errCode = "VMACCT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if("acct_code__yld_loss".equalsIgnoreCase(childNodeName))
{
acctCode=genericUtility.getColumnValue("acct_code__yld_loss",dom).trim();
if(acctCode != null && acctCode.trim().length() > 0)
{
cnt = getAccountDetail(acctCode,conn);
System.out.println("acct_code__yld_loss["+cnt+"]");
if(cnt == 0)
{
errCode = "VMACCT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if("acct_code__yld_gain".equalsIgnoreCase(childNodeName))
{
acctCode=genericUtility.getColumnValue("acct_code__yld_gain",dom).trim();
if(acctCode != null && acctCode.trim().length() > 0)
{
cnt = getAccountDetail(acctCode,conn);
System.out.println("acct_code__yld_gain["+cnt+"]");
if(cnt == 0)
{
errCode = "VMACCT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if("acct_code__arev".equalsIgnoreCase(childNodeName))
{
acctCode=genericUtility.getColumnValue("acct_code__arev",dom).trim();
if(acctCode != null && acctCode.trim().length() > 0)
{
cnt = getAccountDetail(acctCode,conn);
System.out.println("acct_code__arev["+cnt+"]");
if(cnt == 0)
{
errCode = "VMACCT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if("acct_code__crrev".equalsIgnoreCase(childNodeName))
{
acctCode=genericUtility.getColumnValue("acct_code__crrev",dom).trim();
if(acctCode != null && acctCode.trim().length() > 0)
{
cnt = getAccountDetail(acctCode,conn);
System.out.println("acct_code__crrev["+cnt+"]");
if(cnt == 0)
{
errCode = "VMACCT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if("acct_code__tot_ar".equalsIgnoreCase(childNodeName))
{
acctCode=genericUtility.getColumnValue("acct_code__tot_ar",dom).trim();
if(acctCode != null && acctCode.trim().length() > 0)
{
cnt = getAccountDetail(acctCode,conn);
System.out.println("acct_code__tot_ar["+cnt+"]");
if(cnt == 0)
{
errCode = "VMACCT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if("acct_code__inrev".equalsIgnoreCase(childNodeName))
{
acctCode=genericUtility.getColumnValue("acct_code__inrev",dom).trim();
if(acctCode != null && acctCode.trim().length() > 0)
{
cnt = getAccountDetail(acctCode,conn);
System.out.println("acct_code__inrev["+cnt+"]");
if(cnt == 0)
{
errCode = "VMACCT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
//Cctr_Code
else if("cctr_code__sal".equalsIgnoreCase(childNodeName))
{
cctrCode=genericUtility.getColumnValue("cctr_code__sal",dom).trim();
if(cctrCode != null && cctrCode.trim().length() > 0)
{
cnt = getCostCtrDetail(cctrCode,conn);
System.out.println("cctr_code__sal["+cnt+"]");
if(cnt == 0)
{
errCode = "VMCCTR";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if("cctr_code__dis".equalsIgnoreCase(childNodeName))
{
cctrCode=genericUtility.getColumnValue("cctr_code__dis",dom).trim();
if(cctrCode != null && cctrCode.trim().length() > 0)
{
cnt = getCostCtrDetail(cctrCode,conn);
System.out.println("cctr_code__dis["+cnt+"]");
if(cnt == 0)
{
errCode = "VMCCTR";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if("cctr_code__depr".equalsIgnoreCase(childNodeName))
{
cctrCode=genericUtility.getColumnValue("cctr_code__depr",dom).trim();
if(cctrCode != null && cctrCode.trim().length() > 0)
{
cnt = getCostCtrDetail(cctrCode,conn);
System.out.println("cctr_code__depr["+cnt+"]");
if(cnt == 0)
{
errCode = "VMCCTR";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if("cctr_code__acc_depr".equalsIgnoreCase(childNodeName))
{
cctrCode=genericUtility.getColumnValue("cctr_code__acc_depr",dom).trim();
if(cctrCode != null && cctrCode.trim().length() > 0)
{
cnt = getCostCtrDetail(cctrCode,conn);
System.out.println("cctr_code__acc_depr["+cnt+"]");
if(cnt == 0)
{
errCode = "VMCCTR";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if("cctr_code__depr_wb".equalsIgnoreCase(childNodeName))
{
cctrCode=genericUtility.getColumnValue("cctr_code__depr_wb",dom).trim();
if(cctrCode != null && cctrCode.trim().length() > 0)
{
cnt = getCostCtrDetail(cctrCode,conn);
System.out.println("cctr_code__depr_wb["+cnt+"]");
if(cnt == 0)
{
errCode = "VMCCTR";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if("cctr_code__fa".equalsIgnoreCase(childNodeName))
{
cctrCode=genericUtility.getColumnValue("cctr_code__fa",dom).trim();
if(cctrCode != null && cctrCode.trim().length() > 0)
{
cnt = getCostCtrDetail(cctrCode,conn);
System.out.println("cctr_code__fa["+cnt+"]");
if(cnt == 0)
{
errCode = "VMCCTR";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if("cctr_code__pl".equalsIgnoreCase(childNodeName))
{
cctrCode=genericUtility.getColumnValue("cctr_code__pl",dom).trim();
if(cctrCode != null && cctrCode.trim().length() > 0)
{
cnt = getCostCtrDetail(cctrCode,conn);
System.out.println("cctr_code__pl["+cnt+"]");
if(cnt == 0)
{
errCode = "VMCCTR";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if("cctr_code__in".equalsIgnoreCase(childNodeName))
{
cctrCode=genericUtility.getColumnValue("cctr_code__in",dom).trim();
if(cctrCode != null && cctrCode.trim().length() > 0)
{
cnt = getCostCtrDetail(cctrCode,conn);
System.out.println("cctr_code__in["+cnt+"]");
if(cnt == 0)
{
errCode = "VMCCTR";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if("cctr_code__pr".equalsIgnoreCase(childNodeName))
{
cctrCode=genericUtility.getColumnValue("cctr_code__pr",dom).trim();
if(cctrCode != null && cctrCode.trim().length() > 0)
{
E12GenericUtility genericUtility = new E12GenericUtility();
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{
cnt = getCostCtrDetail(cctrCode,conn);
System.out.println("cctr_code__pr["+cnt+"]");
if(cnt == 0)
Document dom = null;
Document dom1 = null;
Document dom2 = null;
String retString = "";
try{
if(xmlString != null && xmlString.trim().length() > 0)
{
errCode = "VMCCTR";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
dom = genericUtility.parseString(xmlString);
}
else if("cctr_code__ph".equalsIgnoreCase(childNodeName))
{
cctrCode=genericUtility.getColumnValue("cctr_code__ph",dom).trim();
if(cctrCode != null && cctrCode.trim().length() > 0)
{
cnt = getCostCtrDetail(cctrCode,conn);
System.out.println("cctr_code__ph["+cnt+"]");
if(cnt == 0)
if(xmlString1 != null && xmlString1.trim().length() > 0)
{
errCode = "VMCCTR";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
dom1 = genericUtility.parseString(xmlString1);
}
else if("cctr_code__ap".equalsIgnoreCase(childNodeName))
{
cctrCode=genericUtility.getColumnValue("cctr_code__ap",dom).trim();
if(cctrCode != null && cctrCode.trim().length() > 0)
{
cnt = getCostCtrDetail(cctrCode,conn);
System.out.println("cctr_code__ap["+cnt+"]");
if(cnt == 0)
if(xmlString2 != null && xmlString2.trim().length() > 0)
{
errCode = "VMCCTR";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
dom2 = genericUtility.parseString(xmlString2);
}
else if("cctr_code__recp".equalsIgnoreCase(childNodeName))
{
cctrCode=genericUtility.getColumnValue("cctr_code__recp",dom).trim();
if(cctrCode != null && cctrCode.trim().length() > 0)
{
cnt = getCostCtrDetail(cctrCode,conn);
System.out.println("cctr_code__recp["+cnt+"]");
if(cnt == 0)
{
errCode = "VMCCTR";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
retString = wfValData(dom,dom1,dom2,objContext,editFlag,xtraParams);
System.out.println("retString:::"+retString);
}
catch(Exception e){
System.out.println("Exception : ItemAcctDetrIC.java : wfValData(String xmlString) : ==>\n"+e.getMessage());
throw new ITMException(e);
}
return retString;
}
else if("cctr_code__wp".equalsIgnoreCase(childNodeName))
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{
cctrCode=genericUtility.getColumnValue("cctr_code__wp",dom).trim();
if(cctrCode != null && cctrCode.trim().length() > 0)
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null ;
int cnt=0,ctr=0,childNodeLength = 0;
int currentFormNo=0;
NodeList parentNodeList = null;
Node parentNode = null;
NodeList childNodeList = null;
Node childNode = null;
String childNodeName = "",itemSer="",itemCode="",grpCode="",finEntity="",active="",tranCat="",cctrCode="",acctCode="",sql="";
String errString="",errCode="",errorType="",userId="";
ArrayList <String> errList = new ArrayList<String>();
ArrayList <String>errFields = new ArrayList <String> ();
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
try{
conn = getConnection();
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
System.out.println("user ID form XtraParam : "+userId +"Edit Flag -->>: "+editFlag);
if(objContext != null && objContext.trim().length()>0)
{
cnt = getCostCtrDetail(cctrCode,conn);
System.out.println("cctr_code__wp["+cnt+"]");
if(cnt == 0)
currentFormNo = Integer.parseInt(objContext);
System.out.println("currentFormNo:::"+currentFormNo);
switch(currentFormNo)
{
errCode = "VMCCTR";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if("cctr_code__oh".equalsIgnoreCase(childNodeName))
case 1:{
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength();
System.out.println("childNodeLength>>"+childNodeLength);
for(ctr = 0; ctr < childNodeLength; ctr++)
{
cctrCode=genericUtility.getColumnValue("cctr_code__oh",dom).trim();
if(cctrCode != null && cctrCode.trim().length() > 0)
System.out.println("childNode>>"+childNode);
childNode = childNodeList.item(ctr);
System.out.println("childNode>>"+childNode);
childNodeName = childNode.getNodeName();
System.out.println("childNodeName>>"+childNodeName);
//Item_ser
if("item_ser".equalsIgnoreCase(childNodeName))
{
cnt = getCostCtrDetail(cctrCode,conn);
System.out.println("cctr_code__oh["+cnt+"]");
if(cnt == 0)
itemSer = genericUtility.getColumnValue("item_ser",dom);
System.out.println("item_ser>>>>>"+itemSer);
if(itemSer == null || itemSer.trim().length() == 0)
{
errCode = "VMCCTR";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
itemSer = " ";
System.out.println("Item ser["+itemSer+"]");
}
}
else if("cctr_code__ciss".equalsIgnoreCase(childNodeName))
{
cctrCode=genericUtility.getColumnValue("cctr_code__ciss",dom).trim();
if(cctrCode != null && cctrCode.trim().length() > 0)
else
{
cnt = getCostCtrDetail(cctrCode,conn);
System.out.println("cctr_code__ciss["+cnt+"]");
if(cnt == 0)
sql ="select count(*) as cnt from itemser where item_ser = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemSer);
rs = pstmt.executeQuery();
System.out.println("Item ser["+itemSer+"]");
if (rs.next())
{
errCode = "VMCCTR";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
cnt = rs.getInt("cnt");
System.out.println("Count["+cnt+"]");
}
else if("ctr_code__wp_rcp".equalsIgnoreCase(childNodeName))
{
cctrCode=genericUtility.getColumnValue("ctr_code__wp_rcp",dom).trim();
if(cctrCode != null && cctrCode.trim().length() > 0)
{
cnt = getCostCtrDetail(cctrCode,conn);
System.out.println("ctr_code__wp_rcp["+cnt+"]");
if(cnt == 0)
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (cnt == 0)
{
errCode = "VMCCTR";
System.out.println("Item ser entered does not exist, please enter valid item ser !");
errCode = "VITEMSER";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if("cctr_code__qc_sample".equalsIgnoreCase(childNodeName))
}//end of else if
}// end of if block for item_ser
//Item_code
else if("item_code".equalsIgnoreCase(childNodeName))
{
cctrCode=genericUtility.getColumnValue("cctr_code__qc_sample",dom).trim();
if(cctrCode != null && cctrCode.trim().length() > 0)
itemCode = genericUtility.getColumnValue("item_code",dom);
System.out.println("item_code>>>>>"+itemCode);
if(itemCode != null && itemCode.trim().length() > 0)
{
cnt = getCostCtrDetail(cctrCode,conn);
System.out.println("cctr_code__qc_sample["+cnt+"]");
if(cnt == 0)
sql = "select count(*) as cnt from item where item_code =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode);
rs = pstmt.executeQuery();
System.out.println("Item code["+itemCode+"]");
if (rs.next())
{
errCode = "VMCCTR";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
cnt = rs.getInt("cnt");
System.out.println("Count["+cnt+"]");
}
else if("cctr_code__yld_loss".equalsIgnoreCase(childNodeName))
{
cctrCode=genericUtility.getColumnValue("cctr_code__yld_loss",dom).trim();
if(cctrCode != null && cctrCode.trim().length() > 0)
{
cnt = getCostCtrDetail(cctrCode,conn);
System.out.println("cctr_code__yld_loss["+cnt+"]");
if(cnt == 0)
if(pstmt != null)
{
errCode = "VMCCTR";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
pstmt.close();
pstmt = null;
}
else if("cctr_code__yld_gain".equalsIgnoreCase(childNodeName))
{
cctrCode=genericUtility.getColumnValue("cctr_code__yld_gain",dom).trim();
if(cctrCode != null && cctrCode.trim().length() > 0)
{
cnt = getCostCtrDetail(cctrCode,conn);
System.out.println("cctr_code__yld_gain["+cnt+"]");
if(cnt == 0)
if(rs != null)
{
errCode = "VMCCTR";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
rs.close();
rs = null;
}
else if("cctr_code__arev".equalsIgnoreCase(childNodeName))
{
cctrCode=genericUtility.getColumnValue("cctr_code__arev",dom).trim();
if(cctrCode != null && cctrCode.trim().length() > 0)
{
cnt = getCostCtrDetail(cctrCode,conn);
System.out.println("cctr_code__arev["+cnt+"]");
if(cnt == 0)
{
errCode = "VMCCTR";
System.out.println("Item code entered does not exist, please enter valid item code !");
errCode = "VMITEM1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if("cctr_code__crrev".equalsIgnoreCase(childNodeName))
{
cctrCode=genericUtility.getColumnValue("cctr_code__crrev",dom).trim();
if(cctrCode != null && cctrCode.trim().length() > 0)
//Grp_Code
else if("grp_code".equalsIgnoreCase(childNodeName))
{
cnt = getCostCtrDetail(cctrCode,conn);
System.out.println("cctr_code__crrev["+cnt+"]");
if(cnt == 0)
grpCode = genericUtility.getColumnValue("grp_code",dom);
System.out.println("grp_code>>>>>"+grpCode);
if(grpCode == null || grpCode.trim().length() == 0)
{
errCode = "VMCCTR";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
grpCode = " ";
System.out.println("Group code["+grpCode+"]");
}
}
}
else if("cctr_code__tot_ar".equalsIgnoreCase(childNodeName))
{
cctrCode=genericUtility.getColumnValue("cctr_code__tot_ar",dom).trim();
if(cctrCode != null && cctrCode.trim().length() > 0)
//Acct_Code
else if("acct_code__sal".equalsIgnoreCase(childNodeName) || "acct_code__dis".equalsIgnoreCase(childNodeName)
||"acct_code__depr".equalsIgnoreCase(childNodeName) || "acct_code__acc_depr".equalsIgnoreCase(childNodeName)
||"acct_code__depr_wb".equalsIgnoreCase(childNodeName) || " acct_code__fa".equalsIgnoreCase(childNodeName)
||"acct_code__pl".equalsIgnoreCase(childNodeName) || "acct_code__in".equalsIgnoreCase(childNodeName)
||"acct_code__pr".equalsIgnoreCase(childNodeName) || "acct_code__ph".equalsIgnoreCase(childNodeName)
||"acct_code__ap".equalsIgnoreCase(childNodeName) || "acct_code__reco".equalsIgnoreCase(childNodeName)
||"acct_code__wp".equalsIgnoreCase(childNodeName) || "acct_code__oh".equalsIgnoreCase(childNodeName)
||"acct_code__ciss".equalsIgnoreCase(childNodeName) || "acct_code__wp_rcp".equalsIgnoreCase(childNodeName)
||"acct_code__qc_sample".equalsIgnoreCase(childNodeName) || "acct_code__yld_loss".equalsIgnoreCase(childNodeName)
||"acct_code__yld_gain".equalsIgnoreCase(childNodeName) || "acct_code__arev".equalsIgnoreCase(childNodeName)
||"acct_code__crrev".equalsIgnoreCase(childNodeName) || "acct_code__tot_ar".equalsIgnoreCase(childNodeName)
||"acct_code__inrev".equalsIgnoreCase(childNodeName))
{
acctCode=genericUtility.getColumnValue("acct_code__sal",dom);
System.out.println("Account code>>>>>"+acctCode);
if(acctCode != null && acctCode.trim().length() > 0)
{
cnt = getCostCtrDetail(cctrCode,conn);
System.out.println("cctr_code__tot_ar["+cnt+"]");
cnt = getAccountDetail(acctCode,conn);
System.out.println("Count["+cnt+"]");
if(cnt == 0)
{
errCode = "VMCCTR";
System.out.println("Account code entered does not exist, please enter valid account code !");
errCode = "VMACCT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if("cctr_code__inrev".equalsIgnoreCase(childNodeName))
{
cctrCode=genericUtility.getColumnValue("cctr_code__inrev",dom).trim();
//Cctr_Code
else if("cctr_code__sal".equalsIgnoreCase(childNodeName) || "cctr_code__dis".equalsIgnoreCase(childNodeName)
||"cctr_code__depr".equalsIgnoreCase(childNodeName) || "cctr_code__acc_depr".equalsIgnoreCase(childNodeName)
||"cctr_code__depr_wb".equalsIgnoreCase(childNodeName) || " cctr_code__fa".equalsIgnoreCase(childNodeName)
||"cctr_code__pl".equalsIgnoreCase(childNodeName) || "cctr_code__in".equalsIgnoreCase(childNodeName)
||"cctr_code__pr".equalsIgnoreCase(childNodeName) || "cctr_code__ph".equalsIgnoreCase(childNodeName)
||"cctr_code__ap".equalsIgnoreCase(childNodeName) || "cctr_code__reco".equalsIgnoreCase(childNodeName)
||"cctr_code__wp".equalsIgnoreCase(childNodeName) || "cctr_code__oh".equalsIgnoreCase(childNodeName)
||"cctr_code__ciss".equalsIgnoreCase(childNodeName) || "ctr_code__wp_rcp".equalsIgnoreCase(childNodeName)
||"cctr_code__qc_sample".equalsIgnoreCase(childNodeName) || "cctr_code__yld_loss".equalsIgnoreCase(childNodeName)
||"cctr_code__yld_gain".equalsIgnoreCase(childNodeName) || "cctr_code__arev".equalsIgnoreCase(childNodeName)
||"cctr_code__crrev".equalsIgnoreCase(childNodeName) || "cctr_code__tot_ar".equalsIgnoreCase(childNodeName)
||"cctr_code__inrev".equalsIgnoreCase(childNodeName))
{
cctrCode=genericUtility.getColumnValue("cctr_code__sal",dom);
System.out.println("CostCenter code>>>>>"+cctrCode);
if(cctrCode != null && cctrCode.trim().length() > 0)
{
cnt = getCostCtrDetail(cctrCode,conn);
System.out.println("cctr_code__inrev["+cnt+"]");
System.out.println("Count["+cnt+"]");
if(cnt == 0)
{
System.out.println("CostCenter code entered does not exist, please enter valid CostCenter code !");
errCode = "VMCCTR";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
......@@ -901,7 +258,7 @@ ItemAcctDetrICLocal, ItemAcctDetrICRemote
//Fin_entity
else if("fin_entity".equalsIgnoreCase(childNodeName))
{
finEntity = genericUtility.getColumnValue("fin_entity",dom).trim();
finEntity = genericUtility.getColumnValue("fin_entity",dom);
System.out.println("fin_entity>>>>>"+finEntity);
if(finEntity != null && finEntity.trim().length() > 0)
......@@ -910,10 +267,12 @@ ItemAcctDetrICLocal, ItemAcctDetrICRemote
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,finEntity);
rs=pstmt.executeQuery();
System.out.println("Fin Entity["+finEntity+"]");
if(rs.next())
{
cnt = rs.getInt("cnt");
System.out.println("Count["+cnt+"]");
}
if(rs!=null)
......@@ -930,6 +289,7 @@ ItemAcctDetrICLocal, ItemAcctDetrICRemote
if(cnt == 0)
{
System.out.println("Finance entity entered does not exist, please enter valid Finance entity!");
errCode="VMFENTY1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
......@@ -939,7 +299,7 @@ ItemAcctDetrICLocal, ItemAcctDetrICRemote
//Tran_cat
else if("tran_cat".equalsIgnoreCase(childNodeName))
{
tranCat = genericUtility.getColumnValue("tran_cat",dom).trim();
tranCat = genericUtility.getColumnValue("tran_cat",dom);
System.out.println("tran_cat>>>>>"+tranCat);
if(tranCat != null && tranCat.trim().length()>0)
......@@ -948,12 +308,16 @@ ItemAcctDetrICLocal, ItemAcctDetrICRemote
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,tranCat);
rs=pstmt.executeQuery();
System.out.println("Tran Cat["+tranCat+"]");
if(rs.next())
{
cnt=rs.getInt("cnt");
System.out.println("Count["+cnt+"]");
if(cnt == 0)
{
System.out.println("Entered Transaction Category not found in Transaction Cat master!!");
errCode="VMTRNCAT";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
......@@ -964,6 +328,8 @@ ItemAcctDetrICLocal, ItemAcctDetrICRemote
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,tranCat);
rs=pstmt.executeQuery();
System.out.println("Tran Cat["+tranCat+"]");
if(rs.next())
{
active = rs.getString("active");
......@@ -971,18 +337,19 @@ ItemAcctDetrICLocal, ItemAcctDetrICRemote
if("N".equalsIgnoreCase(active))
{
System.out.println("Entered Transaction Category not active in Transaction Category master!!");
errCode="VMTRNCAT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}//end of else
}
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}//end of if
}
}//end of tran cat
}//end of for loop
}//end of case 1
......@@ -1111,7 +478,7 @@ ItemAcctDetrICLocal, ItemAcctDetrICRemote
E12GenericUtility genericUtility = new E12GenericUtility();
try{
conn = getConnection();
//sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
if(objContext != null && objContext.trim().length()>0)
{
currentFormNo = Integer.parseInt(objContext);
......@@ -1139,8 +506,9 @@ ItemAcctDetrICLocal, ItemAcctDetrICRemote
ctr ++;
}while(ctr < childNodeListLength && ! childNodeName.equals(currentColumn));
if(currentColumn.trim().equalsIgnoreCase("itm_default"))
if("itm_default".equalsIgnoreCase(currentColumn.trim()))
{
System.out.println("INSIDE itm_default : ");
itemCode = checkNull(genericUtility.getColumnValue("item_code", dom));
grpCode = checkNull(genericUtility.getColumnValue("group_code", dom));
tranType = checkNull(genericUtility.getColumnValue("tran_type", dom));
......@@ -1149,8 +517,9 @@ ItemAcctDetrICLocal, ItemAcctDetrICRemote
valueXmlString.append("<tran_type protect='0'>").append("<![CDATA["+ tranType + " ]]>").append("</tran_type>");
}
if(currentColumn.trim().equalsIgnoreCase("itm_default_edit"))
if("itm_default_edit".equalsIgnoreCase(currentColumn.trim()))
{
System.out.println("INSIDE itm_default_edit : ");
itemCode = checkNull(genericUtility.getColumnValue("item_code", dom));
grpCode = checkNull(genericUtility.getColumnValue("group_code", dom));
tranType = checkNull(genericUtility.getColumnValue("tran_type", dom));
......@@ -1159,89 +528,94 @@ ItemAcctDetrICLocal, ItemAcctDetrICRemote
valueXmlString.append("<tran_type protect='1'>").append("<![CDATA["+ tranType + " ]]>").append("</tran_type>");
}
if( currentColumn.trim().equalsIgnoreCase( "item_ser" ) )
if("item_ser".equalsIgnoreCase(currentColumn.trim()))
{
sql ="select descr from itemser where item_ser=?";
itemSer = checkNull(genericUtility.getColumnValue("item_ser", dom));
sql ="select descr from itemser where item_ser = ?";
pstmt =conn.prepareStatement(sql);
pstmt.setString(1, descr);
pstmt.setString(1, itemSer);
rs = pstmt.executeQuery();
if(rs.next())
{
itemSer=rs.getString("item_ser");
System.out.println("Item ser>>>>>>"+itemSer);
descr=rs.getString("descr");
System.out.println("Item ser descr>>>>>>"+descr);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
valueXmlString.append("<item_ser>").append("<![CDATA[" + itemSer + "]]>").append("</item_ser>");
//valueXmlString.append("<item_ser>").append("<![CDATA[" + itemSer + "]]>").append("</item_ser>");
valueXmlString.append("<itemser_descr>").append("<![CDATA[" + descr + "]]>").append("</itemser_descr>");
}
if( currentColumn.trim().equalsIgnoreCase( "item_code" ) )
if("item_code".equalsIgnoreCase(currentColumn.trim()))
{
itemCode = checkNull(genericUtility.getColumnValue("item_code", dom));
sql ="select descr from item where item_code=?";
pstmt =conn.prepareStatement(sql);
pstmt.setString(1, descr);
pstmt.setString(1, itemCode);
rs = pstmt.executeQuery();
if(rs.next())
{
itemCode=rs.getString("item_code");
System.out.println("Item code>>>>>>"+itemCode);
descr=rs.getString("descr");
System.out.println("Item code descr>>>>>>"+descr);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
valueXmlString.append("<item_code>").append("<![CDATA[" + itemCode + "]]>").append("</item_code>");
//valueXmlString.append("<item_code>").append("<![CDATA[" + itemCode + "]]>").append("</item_code>");
valueXmlString.append("<item_descr>").append("<![CDATA[" + descr + "]]>").append("</item_descr>");
}
//acct_code__sal is not present in the accounts table
if( currentColumn.trim().equalsIgnoreCase( "acct_code__sal" ) )
if("acct_code__sal".equalsIgnoreCase(currentColumn.trim()))
{
sql ="select descr from accounts where acct_code__sal=?";
acctCodeSal = checkNull(genericUtility.getColumnValue("acct_code__sal", dom));
sql ="select descr from accounts where acct_code=?";
pstmt =conn.prepareStatement(sql);
pstmt.setString(1, descr);
pstmt.setString(1, acctCodeSal);
rs = pstmt.executeQuery();
if(rs.next())
{
acctCodeSal=rs.getString("acct_code__sal");
System.out.println("Acct Code sal>>>>>>"+acctCodeSal);
descr=rs.getString("descr");
System.out.println("Acct Code sal descr>>>>>>"+descr);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
valueXmlString.append("<acct_code__sal>").append("<![CDATA[" + acctCodeSal + "]]>").append("</acct_code__sal>");
//valueXmlString.append("<acct_code__sal>").append("<![CDATA[" + acctCodeSal + "]]>").append("</acct_code__sal>");
valueXmlString.append("<accounts_descr>").append("<![CDATA[" + descr + "]]>").append("</accounts_descr>");
}
//acct_code__dis is not present in the accounts table
if( currentColumn.trim().equalsIgnoreCase( "acct_code__dis" ) )
if("acct_code__dis".equalsIgnoreCase(currentColumn.trim()))
{
sql ="select descr from accounts where acct_code__dis=?";
acctCodeDis = checkNull(genericUtility.getColumnValue("acct_code__sal", dom));
sql ="select descr from accounts where acct_code=?";
pstmt =conn.prepareStatement(sql);
pstmt.setString(1, descr);
pstmt.setString(1, acctCodeDis);
rs = pstmt.executeQuery();
if(rs.next())
{
acctCodeDis=rs.getString("acct_code__dis");
System.out.println("Acct Code Dis>>>>>>"+acctCodeDis);
descr=rs.getString("descr");
System.out.println("Acct Code Dis descr>>>>>>"+descr);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
valueXmlString.append("<acct_code__dis>").append("<![CDATA[" + acctCodeDis + "]]>").append("</acct_code__dis>");
//valueXmlString.append("<acct_code__dis>").append("<![CDATA[" + acctCodeDis + "]]>").append("</acct_code__dis>");
valueXmlString.append("<descr>").append("<![CDATA[" + descr + "]]>").append("</descr>");
}
}//end of case 1
......@@ -1349,7 +723,7 @@ ItemAcctDetrICLocal, ItemAcctDetrICRemote
ResultSet rs = null;
String sql="";
int count=0;
System.out.println("Inside getAccountDetail method!!!!!!!!!!!!!!");
try{
sql ="select count(*) as cnt from accounts where acct_code= ? ";
pstmt = conn.prepareStatement(sql);
......@@ -1406,7 +780,7 @@ ItemAcctDetrICLocal, ItemAcctDetrICRemote
ResultSet rs = null;
String sql="";
int count=0;
System.out.println("Inside getCostCtrDetail method!!!!!!!!!!!!!!");
try{
if(cctrCode != null && cctrCode.trim().length() > 0)
{
......
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