Commit b77b704b authored by psawant's avatar psawant

Changes in Chart of Account Master and addition of below forms:

-Site Account
-Account Cost Center
-Account Analysis
-Account Department

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@189630 ce508802-f39f-4f6c-b175-0d175dae99d5
parent a9f42467
......@@ -116,7 +116,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
// {
if (currentFormNo == 1 || "accounts".equals(formName))
{
parentNodeList = dom.getElementsByTagName("Detail1");
parentNodeList = dom.getElementsByTagName("Detail"+currentFormNo);
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength();
......@@ -318,7 +318,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
} // end case1
else if (currentFormNo == 2 || "siteaccount".equals(formName))
{
parentNodeList = dom.getElementsByTagName("Detail2");
parentNodeList = dom.getElementsByTagName("Detail"+currentFormNo);
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength();
......@@ -342,59 +342,59 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
}
else if ("site_code".equalsIgnoreCase(childNodeName))
{
String site_code = checkNull(genericUtility.getColumnValue("site_code", dom));
sql = "select count(*) as cnt from site where site_code =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, site_code);
rs = pstmt.executeQuery();
cnt = 0;
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 = "CONSSITENE";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
NodeList siteParentNode = null;
ArrayList<String> sitecodeall = new ArrayList<String>();
if ("A".equalsIgnoreCase(editFlag))
{
int ctr2 = 0;
int childNodeListLength2 = 0;
siteParentNode = dom2.getElementsByTagName("Detail2");
System.out.println("2 domm all siteParentNode = " + siteParentNode);
System.out.println("3 domm all siteParentNode = " + siteParentNode.getLength());
siteParentNode = dom2.getElementsByTagName("Detail"+currentFormNo);
for (ctr2 = 0; ctr2 < siteParentNode.getLength(); ctr2++)
{
System.out.println("4 In for Parent loop " + ctr2);
Node parentNode2 = siteParentNode.item(ctr2);
System.out.println("5 parentNode= parentNodeList.item(0) = " + parentNode2);
System.out.println();
NodeList childNodeList2 = parentNode2.getChildNodes();
System.out.println(
"6 childNodeList= parentNode.getChildNodes(); = " + childNodeList2);
System.out.println();
childNodeListLength2 = childNodeList2.getLength();
for (int ctr3 = 0; ctr3 < childNodeListLength2; ctr3++)
{
Node childNode2 = childNodeList2.item(ctr3);
System.out.println("childNode= childNodeList.item(ctr3) = " + childNode2);
System.out.println();
String childNodeName2 = childNode2.getNodeName();
System.out.println("current column " + ctr3 + " " + childNodeName2);
System.out.println();
if (childNodeName2.equalsIgnoreCase("site_code"))
{
System.out.println("Final Array " + sitecodeall);
String siteCode = checkNull(
genericUtility.getColumnValueFromNode("site_code", parentNode2))
.trim();
String siteCode = checkNull(genericUtility.getColumnValueFromNode("site_code", parentNode2)).trim();
System.out.println("Node value Site_code " + siteCode);
if (sitecodeall.contains(siteCode))
{
System.out.println("0 site_code should not be duplicate dom");
errCode = "VMACCTSRS1";
errCode = "VTDUPSITCD";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
......@@ -413,10 +413,9 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
}
}
}
}
else if (currentFormNo == 3 || "acctcostcntre".equals(formName))
{
parentNodeList = dom.getElementsByTagName("Detail3");
parentNodeList = dom.getElementsByTagName("Detail"+currentFormNo);
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength();
......@@ -456,7 +455,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, costcntrcode);
rs = pstmt.executeQuery();
cnt = 0;
if (rs.next())
{
cnt = rs.getInt("cnt");
......@@ -479,13 +478,50 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
errFields.add(childNodeName.toLowerCase());
}
}
NodeList costParentNode = null;
ArrayList<String> costcntrall = new ArrayList<String>();
if ("A".equalsIgnoreCase(editFlag))
{
int ctr3 = 0;
int childNodeListLength3 = 0;
costParentNode = dom2.getElementsByTagName("Detail"+currentFormNo);
for (ctr3 = 0; ctr3 < costParentNode.getLength(); ctr3++)
{
Node parentNode3 = costParentNode.item(ctr3);
NodeList childNodeList2 = parentNode3.getChildNodes();
childNodeListLength3 = childNodeList2.getLength();
for (int ctr4 = 0; ctr4 < childNodeListLength3; ctr4++)
{
Node childNode2 = childNodeList2.item(ctr4);
String childNodeName2 = childNode2.getNodeName();
if (childNodeName2.equalsIgnoreCase("cctr_code"))
{
String cctr_code = checkNull(genericUtility.getColumnValueFromNode("cctr_code", parentNode3)).trim();
if (costcntrall.contains(cctr_code))
{
System.out.println("0 cctr_code should not be duplicate dom");
errCode = "VMACCTSRS1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
else
{
costcntrall.add(cctr_code);
System.out.println("In Else add in array so now array " + costcntrall);
}
}
}
}
}
}
}
}
else if (currentFormNo == 4 || "acctanal".equals(formName))
{
parentNodeList = dom.getElementsByTagName("Detail4");
parentNodeList = dom.getElementsByTagName("Detail"+currentFormNo);
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength();
......@@ -499,7 +535,6 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
if (acctcode == null || acctcode.length() <= 0)
{
errCode = "VMACCT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
......@@ -511,7 +546,6 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
if (childNodeName.equalsIgnoreCase("anal_code"))
{
String analcode = checkNull(genericUtility.getColumnValue("anal_code", dom));
if (analcode == null || analcode.length() <= 0)
{
errCode = "VMANAL1";
......@@ -526,7 +560,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, analcode);
rs = pstmt.executeQuery();
cnt = 0;
if (rs.next())
{
cnt = rs.getInt("cnt");
......@@ -541,21 +575,58 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
rs.close();
rs = null;
}
if (cnt == 0)
{
errCode = "VMANAL";
errCode = "VTACCANAL";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
NodeList analParentNode = null;
ArrayList<String> acctanalall = new ArrayList<String>();
if ("A".equalsIgnoreCase(editFlag))
{
int ctr3 = 0;
int childNodeListLength3 = 0;
analParentNode = dom2.getElementsByTagName("Detail"+currentFormNo);
for (ctr3 = 0; ctr3 < analParentNode.getLength(); ctr3++)
{
Node parentNode3 = analParentNode.item(ctr3);
NodeList childNodeList2 = parentNode3.getChildNodes();
childNodeListLength3 = childNodeList2.getLength();
for (int ctr4 = 0; ctr4 < childNodeListLength3; ctr4++)
{
Node childNode2 = childNodeList2.item(ctr4);
String childNodeName2 = childNode2.getNodeName();
if (childNodeName2.equalsIgnoreCase("anal_code"))
{
String anal_code = checkNull(genericUtility.getColumnValueFromNode("anal_code", parentNode3)).trim();
if (acctanalall.contains(anal_code))
{
System.out.println("0 anal_code should not be duplicate dom");
errCode = "VTSTKALS";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
else
{
acctanalall.add(anal_code);
System.out.println("In Else add in array so now array " + acctanalall);
}
}
}
}
}
}
}
}
else if (currentFormNo == 5 || "acctdept".equals(formName))
{
parentNodeList = dom.getElementsByTagName("Detail5");
parentNodeList = dom.getElementsByTagName("Detail"+currentFormNo);
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength();
......@@ -575,7 +646,6 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
System.out.println("acctcode is not entered");
break;
}
}
if (childNodeName.equalsIgnoreCase("dept_code"))
{
......@@ -591,11 +661,11 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
}
else if (deptcode != null && deptcode.trim().length() > 0)
{
sql = "select count(*) as cnt from departments where dept_code =?";
sql = "select count(*) as cnt from department where dept_code =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, deptcode);
rs = pstmt.executeQuery();
cnt = 0;
if (rs.next())
{
cnt = rs.getInt("cnt");
......@@ -613,15 +683,55 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
if (cnt == 0)
{
errCode = "VMDEPT";
errCode = "VTDEPTNL";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
NodeList deptParentNode = null;
ArrayList<String> acctdeptall = new ArrayList<String>();
if ("A".equalsIgnoreCase(editFlag))
{
int ctr3 = 0;
int childNodeListLength3 = 0;
deptParentNode = dom2.getElementsByTagName("Detail"+currentFormNo);
for (ctr3 = 0; ctr3 < deptParentNode.getLength(); ctr3++)
{
Node parentNode3 = deptParentNode.item(ctr3);
NodeList childNodeList2 = parentNode3.getChildNodes();
childNodeListLength3 = childNodeList2.getLength();
for (int ctr4 = 0; ctr4 < childNodeListLength3; ctr4++)
{
Node childNode2 = childNodeList2.item(ctr4);
String childNodeName2 = childNode2.getNodeName();
if (childNodeName2.equalsIgnoreCase("dept_code"))
{
String dept_code = checkNull(genericUtility.getColumnValueFromNode("dept_code", parentNode3)).trim();
if (acctdeptall.contains(dept_code))
{
System.out.println("0 dept_code should not be duplicate dom");
errCode = "VMDEPTPD02";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
else
{
acctdeptall.add(dept_code);
System.out.println("In Else add in array dept so now array " + acctdeptall);
}
}
}
}
}
}
}
}
} // end switch
//Changed by Pooja S. on 13-AUG-18 End
int errListSize = errList.size();
......@@ -697,7 +807,6 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
System.out.println("testing : final errString : " + errString);
return errString;
}
//Changed by Pooja S. on 13-AUG-18
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams, String formName) throws RemoteException, ITMException
{
......@@ -756,8 +865,8 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
String ls_descr1 = "", acctgrp_descr = "", curr_code = "";
String currency_descr = "", acct_type = "";
//Changed by Pooja S. on 13-AUG-18
String sundry_type = "", group_code = "", sh_descr = "", descr = "", acct_type2 = "", descr2 = "",
sh_descr2 = "", analysisdescr = "", descr3 = "", descr4 = "";
String sh_descr = "", descr = "",
analysisdescr = "", descr4 = "";
try
{
......@@ -770,7 +879,6 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
connDriver = null;*/
// changes and commented by sarita for DBConnection on 01/06/2017 :END
sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
if (objContext != null && objContext.trim().length() > 0)
{
currentFormNo = Integer.parseInt(objContext);
......@@ -788,10 +896,10 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
//Changed by Pooja S. on 13-AUG-18
if (currentFormNo == 1 || "accounts".equals(formName))
{
parentNodeList = dom.getElementsByTagName("Detail1");
parentNodeList = dom.getElementsByTagName("Detail"+currentFormNo);
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
valueXmlString.append("<Detail1>");
valueXmlString.append("<Detail"+currentFormNo+">");
childNodeListLength = childNodeList.getLength();
do
{
......@@ -997,27 +1105,36 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
}
} // end of if block for acct_type
valueXmlString.append("</Detail1>");
valueXmlString.append("</Detail"+currentFormNo+">");
} // end of case1
//Changed by Pooja S. on 13-AUG-18 START
else if (currentFormNo == 2 || "siteaccount".equals(formName))
{
valueXmlString.append("<Detail2>");
valueXmlString.append("<Detail"+currentFormNo+">");
if ("itm_default".equalsIgnoreCase(currentColumn.trim()))
{
String site_code = checkNull(genericUtility.getColumnValue("site_code", dom));
if (site_code == null || site_code.trim().length() == 0)
{
site_code = getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
valueXmlString.append("<site_code>").append("<![CDATA[" + site_code + "]]>").append("</site_code>");
valueXmlString.append("<site_code protect = \"0\">").append("<![CDATA[" + site_code + "]]>").append("</site_code>");
}
acct_code = checkNull(genericUtility.getColumnValue("acct_code", dom));
valueXmlString.append("<acct_code protect = \"1\"><![CDATA[" + acct_code + "]]></acct_code>");
}
valueXmlString.append("</Detail2>");
valueXmlString.append("</Detail"+currentFormNo+">");
}
else if (currentFormNo == 3 || "acctcostcntre".equals(formName))
{
valueXmlString.append("<Detail3>");
if ("cctr_code".equalsIgnoreCase(currentColumn.trim()))
valueXmlString.append("<Detail"+currentFormNo+">");
if ("itm_default".equalsIgnoreCase(currentColumn.trim()))
{
acct_code=checkNull(genericUtility.getColumnValue("acct_code", dom));
valueXmlString.append("<acct_code protect = \"1\"><![CDATA[" + acct_code + "]]></acct_code>");
valueXmlString.append("<cctr_code protect = \"0\"><![CDATA[]]></cctr_code>");
}
else if ("cctr_code".equalsIgnoreCase(currentColumn.trim()))
{
String cctr_code = checkNull(genericUtility.getColumnValue("cctr_code", dom));
System.out.print("Value valueXmlString cctr_code\n [" + cctr_code + "]");
......@@ -1042,12 +1159,18 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
valueXmlString.append("<sh_descr ><![CDATA[" + sh_descr + "]]></sh_descr>");
}
}
valueXmlString.append("</Detail3>");
valueXmlString.append("</Detail"+currentFormNo+">");
}
else if (currentFormNo == 4 || "acctanal".equals(formName))
{
valueXmlString.append("<Detail4>");
if ("anal_code".equalsIgnoreCase(currentColumn.trim()))
valueXmlString.append("<Detail"+currentFormNo+">");
if ("itm_default".equalsIgnoreCase(currentColumn.trim()))
{
acct_code=checkNull(genericUtility.getColumnValue("acct_code", dom));
valueXmlString.append("<acct_code protect = \"1\"><![CDATA[" + acct_code + "]]></acct_code>");
valueXmlString.append("<anal_code protect = \"0\"><![CDATA[]]></anal_code>");
}
else if ("anal_code".equalsIgnoreCase(currentColumn.trim()))
{
String anal_code = checkNull(genericUtility.getColumnValue("anal_code", dom));
System.out.print("Value valueXmlString cctr_code\n [" + anal_code + "]");
......@@ -1071,11 +1194,17 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
valueXmlString.append("<analysis_descr ><![CDATA[" + analysisdescr + "]]></analysis_descr>");
}
}
valueXmlString.append("</Detail4>");
valueXmlString.append("</Detail"+currentFormNo+">");
}
else if (currentFormNo == 5 || "acctdept".equals(formName))
{
valueXmlString.append("<Detail5>");
valueXmlString.append("<Detail"+currentFormNo+">");
if ("itm_default".equalsIgnoreCase(currentColumn.trim()))
{
acct_code=checkNull(genericUtility.getColumnValue("acct_code", dom));
valueXmlString.append("<acct_code protect = \"1\"><![CDATA[" + acct_code + "]]></acct_code>");
valueXmlString.append("<dept_code protect = \"0\"><![CDATA[]]></dept_code>");
}
if ("dept_code".equalsIgnoreCase(currentColumn.trim()))
{
String dept_code = checkNull(genericUtility.getColumnValue("dept_code", dom));
......@@ -1092,7 +1221,6 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
if (rs.next())
{
descr4 = checkNull(rs.getString("descr"));
}
rs.close();
rs = null;
......@@ -1102,11 +1230,10 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
valueXmlString.append("<department_descr ><![CDATA[" + descr4 + "]]></department_descr>");
}
}
valueXmlString.append("</Detail5>");
valueXmlString.append("</Detail"+currentFormNo+">");
}
valueXmlString.append("</Root>");
// end of switch statement
} // end of try block
//Changed by Pooja S. on 13-AUG-18 END
catch (Exception e)
......
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