Commit f7e95687 authored by ssalve's avatar ssalve

Sarita : Committed on 08MARCH2019

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@198172 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 7d3b8928
...@@ -5,7 +5,10 @@ import java.sql.Connection; ...@@ -5,7 +5,10 @@ import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.HashMap;
import javax.ejb.Stateless; import javax.ejb.Stateless;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
...@@ -20,10 +23,9 @@ import ibase.webitm.utility.ITMException; ...@@ -20,10 +23,9 @@ import ibase.webitm.utility.ITMException;
public class EmpITConfirmationIC extends ValidatorEJB implements EmpITConfirmationICLocal,EmpITConfirmationICRemote public class EmpITConfirmationIC extends ValidatorEJB implements EmpITConfirmationICLocal,EmpITConfirmationICRemote
{ {
ibase.utility.E12GenericUtility genericUtility= new ibase.utility.E12GenericUtility(); ibase.utility.E12GenericUtility genericUtility= new ibase.utility.E12GenericUtility();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB(); ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException
{ {
Document dom = null; Document dom = null;
...@@ -52,10 +54,11 @@ public class EmpITConfirmationIC extends ValidatorEJB implements EmpITConfirmati ...@@ -52,10 +54,11 @@ public class EmpITConfirmationIC extends ValidatorEJB implements EmpITConfirmati
{ {
System.out.println(":::" + getClass().getSimpleName() + "::" + e.getMessage()); System.out.println(":::" + getClass().getSimpleName() + "::" + e.getMessage());
e.getMessage(); e.getMessage();
throw new ITMException(e);
} }
return retString; return retString;
}//End of itemchange[1] }//End of itemchange[1]
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException
{ {
...@@ -69,15 +72,17 @@ public class EmpITConfirmationIC extends ValidatorEJB implements EmpITConfirmati ...@@ -69,15 +72,17 @@ public class EmpITConfirmationIC extends ValidatorEJB implements EmpITConfirmati
String sql = "",prdcode = "", prdDescr = "",userId = "",siteDescr = "",lsProtectyn = "",accountPrd = "",actPerdDescr = "",loginSite = ""; String sql = "",prdcode = "", prdDescr = "",userId = "",siteDescr = "",lsProtectyn = "",accountPrd = "",actPerdDescr = "",loginSite = "";
String empCodeFr = "00" , empCodeTo = "ZZ"; String empCodeFr = "00" , empCodeTo = "ZZ";
AdmCommon objAdmCommon = new AdmCommon(); AdmCommon objAdmCommon = new AdmCommon();
String empcodefr = "", empFirstName = "", empLastName = "",empName = "",empcodeTo = ""; String empcodefr = "", empName = "",empcodeTo = "";
String procGroupTo = "" , procGroupToName = "";
int userLev = 0; int userLev = 0;
String type = "", prdCode = "",siteCodeFr = "",siteDescrFr = "",siteCodeTo = "",siteDescrTo = "",procGroupFrom = "",procGroupFrName = ""; String type = "", prdCode = "",siteCodeFr = "",siteDescrFr = "",siteCodeTo = "",siteDescrTo = "",procGroupFrom = "",procGroupFrName = "";
NodeList parentNodeList = null; NodeList parentNodeList = null;
NodeList childNodeList = null; NodeList childNodeList = null;
Node parentNode = null; Node parentNode = null;
Node childNode = null; Node childNode = null;
String childNodeName = "",columnValue=""; String childNodeName = "";
int childNodeListLength = 0,ctr=0,totalEmpNo=0; int childNodeListLength = 0,ctr=0,totalEmpNo=0;
String noofConfirmed = "" , noofRejected = "";
try try
{ {
...@@ -87,341 +92,97 @@ public class EmpITConfirmationIC extends ValidatorEJB implements EmpITConfirmati ...@@ -87,341 +92,97 @@ public class EmpITConfirmationIC extends ValidatorEJB implements EmpITConfirmati
currentDate = java.sql.Timestamp.valueOf(sdf1.format(today) + " 00:00:00.000"); currentDate = java.sql.Timestamp.valueOf(sdf1.format(today) + " 00:00:00.000");
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"); userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
loginSite = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode"); loginSite = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
System.out.println("currentDate is ["+currentDate+"] \t userId is ["+userId+"]"); System.out.println("currentDate is ["+currentDate+"] \t userId is ["+userId+"]");
if (objContext != null && objContext.trim().length() > 0) if (objContext != null && objContext.trim().length() > 0)
{ {
currentFormNo = Integer.parseInt(objContext); currentFormNo = Integer.parseInt(objContext);
} }
System.out.println("[EmpITConfirmationIC] [itemChanged] :currentFormNo ["+currentFormNo+"] \t Current Column ["+currentColumn+"]" ); System.out.println("[EmpITConfirmationIC] [itemChanged] :currentFormNo ["+currentFormNo+"] \t Current Column ["+currentColumn+"]" );
valueXmlString = new StringBuffer("<?xml version=\"1.0\"?><Root><header><editFlag>"); valueXmlString = new StringBuffer("<?xml version=\"1.0\"?><Root><header><editFlag>");
valueXmlString.append(editFlag).append("</editFlag></header>"); valueXmlString.append(editFlag).append("</editFlag></header>");
switch (currentFormNo) switch (currentFormNo)
{ {
case 1: case 1:
{ {
parentNodeList = dom.getElementsByTagName("Detail1"); parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0); parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
valueXmlString.append("<Detail1>"); valueXmlString.append("<Detail1>");
ctr = 0; ctr = 0;
childNodeListLength = childNodeList.getLength(); childNodeListLength = childNodeList.getLength();
do do
{ {
childNode = childNodeList.item(ctr); childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName(); System.out.println("childNodeName is ["+childNodeName+"]");
if(childNodeName.equals(currentColumn)) if(childNodeName.equals(currentColumn))
{
if(childNode.getFirstChild() != null)
{
}
}
ctr ++;
}while(ctr < childNodeListLength && ! childNodeName.equals(currentColumn));
if ("itm_default".equalsIgnoreCase(currentColumn))
{ {
sql = "select usr_lev from users where code = ?"; if(childNode.getFirstChild() != null)
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, userId);
rs = pstmt.executeQuery();
if (rs.next())
{
userLev = rs.getInt("usr_lev"); System.out.println("User Level is ["+userLev+"]");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
sql = "select code , descr from acctprd where ? between fr_date and to_date";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, currentDate);
rs = pstmt.executeQuery();
if (rs.next())
{
prdcode = rs.getString("code");
prdDescr = rs.getString("descr");
System.out.println("prdcode is ["+prdcode+"] \t prdDescr ["+prdDescr+"]");
}
if (rs != null)
{ {
rs.close();
rs = null;
} }
if (pstmt != null) }
{ ctr ++;
pstmt.close(); }while(ctr < childNodeListLength && ! childNodeName.equals(currentColumn));
pstmt = null;
}
valueXmlString.append("<acct_prd>").append("<![CDATA[" + prdcode + "]]>").append("</acct_prd>");
valueXmlString.append("<fr_prd_descr>").append("<![CDATA[" + prdDescr + "]]>").append("</fr_prd_descr>");
valueXmlString.append("<emp_code__fr>").append("<![CDATA[" + empCodeFr + "]]>").append("</emp_code__fr>");
valueXmlString.append("<emp_code__to>").append("<![CDATA[" + empCodeTo + "]]>").append("</emp_code__to>");
if(loginSite != null && loginSite.trim().length() > 0)
{
sql = "select descr from site where site_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, loginSite);
rs = pstmt.executeQuery();
if (rs.next()) if ("itm_default".equalsIgnoreCase(currentColumn))
{ {
siteDescr = rs.getString("descr"); sql = "select usr_lev from users where code = ?";
} pstmt = conn.prepareStatement(sql);
if (rs != null) pstmt.setString(1, userId);
{ rs = pstmt.executeQuery();
rs.close(); if (rs.next())
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
valueXmlString.append("<site_code__fr>").append("<![CDATA[" + loginSite + "]]>").append("</site_code__fr>");
valueXmlString.append("<site_code__to>").append("<![CDATA[" + loginSite + "]]>").append("</site_code__to>");
valueXmlString.append("<fr_site_descr>").append("<![CDATA[" + siteDescr + "]]>").append("</fr_site_descr>");
valueXmlString.append("<to_site_descr>").append("<![CDATA[" + siteDescr + "]]>").append("</to_site_descr>");
}//end of if for loginSite
valueXmlString.append("<proc_group__from>").append("<![CDATA[" + empCodeFr + "]]>").append("</proc_group__from>");
valueXmlString.append("<proc_group__to>").append("<![CDATA[" + empCodeTo + "]]>").append("</proc_group__to>");
lsProtectyn = objAdmCommon.getEnv("999999", "HRSITEPROTECTYN", conn);
if(lsProtectyn == null || lsProtectyn.trim().length() == 0)
{
lsProtectyn = "N";
}
else if((lsProtectyn != null && lsProtectyn.trim().length() > 0) && (userLev > 0))
{
valueXmlString.append("<site_code__fr protect='1'>").append("<![CDATA[]]>").append("</site_code__fr>");
valueXmlString.append("<site_code__to protect='1'>").append("<![CDATA[]]>").append("</site_code__to>");
}
}//end of itemchange for itm_default
else if("acct_prd".equalsIgnoreCase(currentColumn))
{ {
accountPrd = checkNullAndTrim(genericUtility.getColumnValue("acct_prd", dom)); userLev = rs.getInt("usr_lev"); System.out.println("User Level is ["+userLev+"]");
sql = "select descr from ACCTPRD where code = ?"; }
pstmt = conn.prepareStatement(sql); if (rs != null)
pstmt.setString(1, accountPrd);
rs = pstmt.executeQuery();
if (rs.next())
{
actPerdDescr = rs.getString("descr");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
valueXmlString.append("<fr_prd_descr>").append("<![CDATA[" + actPerdDescr + "]]>").append("</fr_prd_descr>");
}//end of itemchange for acct_prd
else if("emp_code__fr".equalsIgnoreCase(currentColumn))
{
empcodefr = checkNullAndTrim(genericUtility.getColumnValue("emp_code__fr", dom));
//Commented and added by sarita to create method to get longname on 27 SEP 2018 [START]
/* sql = "select emp_fname, emp_lname from employee where emp_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empcodefr);
rs = pstmt.executeQuery();
if (rs.next())
{
empFirstName = rs.getString("emp_fname");
empLastName = rs.getString("emp_lname");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
empName = empFirstName + " " + empLastName;*/
empName = ddfGetMastersName(empcodefr, conn); System.out.println("emp_name__fr ["+empName+"]");
//Commented and added by sarita to create method to get longname on 27 SEP 2018 [END]
valueXmlString.append("<emp_name__fr>").append("<![CDATA[" + empName + "]]>").append("</emp_name__fr>");
}//end of itemchange for emp_code__fr
else if("emp_code__to".equalsIgnoreCase(currentColumn))
{
empcodeTo = checkNullAndTrim(genericUtility.getColumnValue("emp_code__to", dom));
//Commented and added by sarita to create method to get longname on 27 SEP 2018 [START]
/*sql = "select emp_fname, emp_lname from employee where emp_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empcodeTo);
rs = pstmt.executeQuery();
if (rs.next())
{
empFirstName = rs.getString("emp_fname");
empLastName = rs.getString("emp_lname");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
empName = empFirstName + " " + empLastName;*/
empName = ddfGetMastersName(empcodeTo, conn); System.out.println("emp_name__to ["+empName+"]");
//Commented and added by sarita to create method to get longname on 27 SEP 2018 [END]
valueXmlString.append("<emp_name__to>").append("<![CDATA[" + empName + "]]>").append("</emp_name__to>");
//set Total No. of Employees using emp_code__fr and emp_code__to [START]
empcodefr = checkNullAndTrim(genericUtility.getColumnValue("emp_code__fr", dom));
System.out.println("Value of empcodeTo ["+empcodeTo+"] \t Value of empcodefr ["+empcodefr+"]");
if(empcodefr != null && empcodefr.trim().length() > 0)
{
sql = "select count(*) as cnt from employee where emp_code between ? and ? order by emp_code";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empcodefr);
pstmt.setString(2, empcodeTo);
rs = pstmt.executeQuery();
if (rs.next())
{
totalEmpNo = rs.getInt("cnt"); System.out.println("Tota No. of Employees are :: ["+totalEmpNo+"]");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
valueXmlString.append("<no_employee>").append("<![CDATA[" + totalEmpNo + "]]>").append("</no_employee>");
}
//set Total No. of Employees using emp_code__fr and emp_code__to [END]
}//end of itemchange for emp_code__to
else if("type".equalsIgnoreCase(currentColumn))
{ {
type = checkNullAndTrim(genericUtility.getColumnValue("type", dom)); rs.close();
sql = "select prd_code from parameter"; rs = null;
pstmt = conn.prepareStatement(sql); }
rs = pstmt.executeQuery(); if (pstmt != null)
if (rs.next())
{
prdCode = rs.getString("prd_code");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(("AR".equalsIgnoreCase(type)) || ("AP".equalsIgnoreCase(type)))
{
valueXmlString.append("<prd_code__arr>").append("<![CDATA[" + prdCode + "]]>").append("</prd_code__arr>");
}
}//end of itemchange for type
else if("site_code__fr".equalsIgnoreCase(currentColumn))
{ {
siteCodeFr = checkNullAndTrim(genericUtility.getColumnValue("site_code__fr", dom)); pstmt.close();
sql = "select descr from site where site_code = ?"; pstmt = null;
pstmt = conn.prepareStatement(sql); }
pstmt.setString(1, siteCodeFr);
rs = pstmt.executeQuery(); sql = "select code , descr from acctprd where ? between fr_date and to_date";
if (rs.next()) pstmt = conn.prepareStatement(sql);
{ pstmt.setTimestamp(1, currentDate);
siteDescrFr = rs.getString("descr"); rs = pstmt.executeQuery();
} if (rs.next())
if (rs != null) {
{ prdcode = checkNullAndTrim(rs.getString("code"));
rs.close(); prdDescr = checkNullAndTrim(rs.getString("descr"));
rs = null; System.out.println("prdcode is ["+prdcode+"] \t prdDescr ["+prdDescr+"]");
} }
if (pstmt != null) if (rs != null)
{ {
pstmt.close(); rs.close();
pstmt = null; rs = null;
} }
valueXmlString.append("<fr_site_descr>").append("<![CDATA[" + siteDescrFr + "]]>").append("</fr_site_descr>"); if (pstmt != null)
}//end of itemchange for site_code__fr {
else if("site_code__to".equalsIgnoreCase(currentColumn)) pstmt.close();
{ pstmt = null;
siteCodeTo = checkNullAndTrim(genericUtility.getColumnValue("site_code__to", dom)); }
sql = "select descr from site where site_code = ?"; valueXmlString.append("<acct_prd>").append("<![CDATA[" + prdcode + "]]>").append("</acct_prd>");
pstmt = conn.prepareStatement(sql); valueXmlString.append("<fr_prd_descr>").append("<![CDATA[" + prdDescr + "]]>").append("</fr_prd_descr>");
pstmt.setString(1, siteCodeTo); valueXmlString.append("<emp_code__fr>").append("<![CDATA[" + empCodeFr + "]]>").append("</emp_code__fr>");
rs = pstmt.executeQuery(); valueXmlString.append("<emp_code__to>").append("<![CDATA[" + empCodeTo + "]]>").append("</emp_code__to>");
if (rs.next())
{ if(loginSite != null && loginSite.trim().length() > 0)
siteDescrTo = rs.getString("descr");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
valueXmlString.append("<to_site_descr>").append("<![CDATA[" + siteDescrTo + "]]>").append("</to_site_descr>");
}//end of itemchange for site_code__to
else if("proc_group__from".equalsIgnoreCase(currentColumn))
{
procGroupFrom = checkNullAndTrim(genericUtility.getColumnValue("proc_group__from", dom));
sql = "select descr from gencodes where fld_name='PROC_GROUP' and fld_value = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, procGroupFrom);
rs = pstmt.executeQuery();
if (rs.next())
{
procGroupFrName = rs.getString("descr");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
valueXmlString.append("<proc_group__fr_name>").append("<![CDATA[" + procGroupFrName + "]]>").append("</proc_group__fr_name>");
}//end of itemchange for proc_group__from
else if("proc_group__to".equalsIgnoreCase(currentColumn))
{ {
String procGroupTo = ""; sql = "select descr from site where site_code = ? ";
procGroupTo = checkNullAndTrim(genericUtility.getColumnValue("proc_group__to", dom));
sql = "select descr from gencodes where fld_name='PROC_GROUP' and fld_value = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, procGroupTo); pstmt.setString(1, loginSite);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
procGroupTo = rs.getString("descr"); siteDescr = checkNullAndTrim(rs.getString("descr"));
} }
if (rs != null) if (rs != null)
{ {
...@@ -433,17 +194,216 @@ public class EmpITConfirmationIC extends ValidatorEJB implements EmpITConfirmati ...@@ -433,17 +194,216 @@ public class EmpITConfirmationIC extends ValidatorEJB implements EmpITConfirmati
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
valueXmlString.append("<proc_group__to_name>").append("<![CDATA[" + procGroupTo + "]]>").append("</proc_group__to_name>"); valueXmlString.append("<site_code__fr>").append("<![CDATA[" + loginSite + "]]>").append("</site_code__fr>");
}//end of itemchange for proc_group__to valueXmlString.append("<site_code__to>").append("<![CDATA[" + loginSite + "]]>").append("</site_code__to>");
valueXmlString.append ("</Detail1>\r\n"); valueXmlString.append("<fr_site_descr>").append("<![CDATA[" + siteDescr + "]]>").append("</fr_site_descr>");
} valueXmlString.append("<to_site_descr>").append("<![CDATA[" + siteDescr + "]]>").append("</to_site_descr>");
break; }//end of if for loginSite
}
valueXmlString.append("<proc_group__from>").append("<![CDATA[" + empCodeFr + "]]>").append("</proc_group__from>");
valueXmlString.append("<proc_group__to>").append("<![CDATA[" + empCodeTo + "]]>").append("</proc_group__to>");
lsProtectyn = objAdmCommon.getEnv("999999", "HRSITEPROTECTYN", conn);
if(lsProtectyn == null || lsProtectyn.trim().length() == 0)
{
lsProtectyn = "N";
}
else if(("Y".equalsIgnoreCase(lsProtectyn)) && (userLev > 0))
{
valueXmlString.append("<site_code__fr protect='1'>").append("<![CDATA[" + loginSite + "]]>").append("</site_code__fr>");
valueXmlString.append("<site_code__to protect='1'>").append("<![CDATA[" + loginSite + "]]>").append("</site_code__to>");
valueXmlString.append("<fr_site_descr>").append("<![CDATA[" + siteDescr + "]]>").append("</fr_site_descr>");
valueXmlString.append("<to_site_descr>").append("<![CDATA[" + siteDescr + "]]>").append("</to_site_descr>");
}
//Modified by Rohini T on 07/March/2019[Req ID: A17DSUN001][START]
totalEmpNo = getTotNoOfEmployee(prdcode, empCodeFr, empCodeTo, loginSite, loginSite, empCodeFr, empCodeTo, conn);
valueXmlString.append("<no_employee>").append("<![CDATA[" + totalEmpNo + "]]>").append("</no_employee>");
//Modified by Rohini T on 07/March/2019[Req ID: A17DSUN001][END]
}//end of itemchange for itm_default
else if("acct_prd".equalsIgnoreCase(currentColumn))
{
accountPrd = checkNullAndTrim(genericUtility.getColumnValue("acct_prd", dom));
sql = "select descr from ACCTPRD where code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, accountPrd);
rs = pstmt.executeQuery();
if (rs.next())
{
actPerdDescr = checkNullAndTrim(rs.getString("descr"));
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
valueXmlString.append("<fr_prd_descr>").append("<![CDATA[" + actPerdDescr + "]]>").append("</fr_prd_descr>");
//Added by sarita to set Total Employee Count On 25 OCT 2018[START]
empcodeTo = checkNullAndTrim(genericUtility.getColumnValue("emp_code__to", dom));
empcodefr = checkNullAndTrim(genericUtility.getColumnValue("emp_code__fr", dom));
siteCodeFr = checkNullAndTrim(genericUtility.getColumnValue("site_code__fr", dom));
siteCodeTo = checkNullAndTrim(genericUtility.getColumnValue("site_code__to", dom));
procGroupFrom = checkNullAndTrim(genericUtility.getColumnValue("proc_group__from", dom));
procGroupTo = checkNullAndTrim(genericUtility.getColumnValue("proc_group__to", dom));
System.out.println("empcodefr["+empcodefr+"] \t empcodeTo["+empcodeTo+"]\t siteCodeFr["+siteCodeFr+"]\t siteCodeTo["+siteCodeTo+"]\t procGroupFrom["+procGroupFrom+"]\t procGroupTo["+procGroupTo+"]");
totalEmpNo = getTotNoOfEmployee(accountPrd, empcodefr, empcodeTo, siteCodeFr, siteCodeTo, procGroupFrom, procGroupTo, conn);
valueXmlString.append("<no_employee>").append("<![CDATA[" + totalEmpNo + "]]>").append("</no_employee>");
//Added by sarita to set Total Employee Count On 25 OCT 2018[END]
}//end of itemchange for acct_prd
else if("emp_code__fr".equalsIgnoreCase(currentColumn))
{
empcodefr = checkNullAndTrim(genericUtility.getColumnValue("emp_code__fr", dom));
empName = ddfGetMastersName(empcodefr, conn); System.out.println("emp_name__fr1111111 ["+empName+"]");
valueXmlString.append("<emp_name__fr>").append("<![CDATA[" + empName + "]]>").append("</emp_name__fr>");
//Added by sarita to set Total Employee Count On 25 OCT 2018[START]
accountPrd = checkNullAndTrim(genericUtility.getColumnValue("acct_prd", dom));
empcodeTo = checkNullAndTrim(genericUtility.getColumnValue("emp_code__to", dom));
siteCodeFr = checkNullAndTrim(genericUtility.getColumnValue("site_code__fr", dom));
siteCodeTo = checkNullAndTrim(genericUtility.getColumnValue("site_code__to", dom));
procGroupFrom = checkNullAndTrim(genericUtility.getColumnValue("proc_group__from", dom));
procGroupTo = checkNullAndTrim(genericUtility.getColumnValue("proc_group__to", dom));
System.out.println("empcodefr["+empcodefr+"] \t empcodeTo["+empcodeTo+"]\t siteCodeFr["+siteCodeFr+"]\t siteCodeTo["+siteCodeTo+"]\t procGroupFrom["+procGroupFrom+"]\t procGroupTo["+procGroupTo+"]");
totalEmpNo = getTotNoOfEmployee(accountPrd, empcodefr, empcodeTo, siteCodeFr, siteCodeTo, procGroupFrom, procGroupTo, conn);
valueXmlString.append("<no_employee>").append("<![CDATA[" + totalEmpNo + "]]>").append("</no_employee>");
//Added by sarita to set Total Employee Count On 25 OCT 2018[END]
}//end of itemchange for emp_code__fr
else if("emp_code__to".equalsIgnoreCase(currentColumn))
{
empcodeTo = checkNullAndTrim(genericUtility.getColumnValue("emp_code__to", dom));
empName = ddfGetMastersName(empcodeTo, conn); System.out.println("emp_name__to ["+empName+"]");
valueXmlString.append("<emp_name__to>").append("<![CDATA[" + empName + "]]>").append("</emp_name__to>");
//Added by sarita to set Total Employee Count On 25 OCT 2018[START]
accountPrd = checkNullAndTrim(genericUtility.getColumnValue("acct_prd", dom));
empcodefr = checkNullAndTrim(genericUtility.getColumnValue("emp_code__fr", dom));
siteCodeFr = checkNullAndTrim(genericUtility.getColumnValue("site_code__fr", dom));
siteCodeTo = checkNullAndTrim(genericUtility.getColumnValue("site_code__to", dom));
procGroupTo = checkNullAndTrim(genericUtility.getColumnValue("proc_group__to", dom));
procGroupFrom = checkNullAndTrim(genericUtility.getColumnValue("proc_group__from", dom));
System.out.println("empcodefr["+empcodefr+"] \t empcodeTo["+empcodeTo+"]\t siteCodeFr["+siteCodeFr+"]\t siteCodeTo["+siteCodeTo+"]\t procGroupFrom["+procGroupFrom+"]\t procGroupTo["+procGroupTo+"]");
totalEmpNo = getTotNoOfEmployee(accountPrd, empcodefr, empcodeTo, siteCodeFr, siteCodeTo, procGroupFrom, procGroupTo, conn);
valueXmlString.append("<no_employee>").append("<![CDATA[" + totalEmpNo + "]]>").append("</no_employee>");
//Added by sarita to set Total Employee Count On 25 OCT 2018[END]
}//end of itemchange for emp_code__to
else if("type".equalsIgnoreCase(currentColumn))
{
type = checkNullAndTrim(genericUtility.getColumnValue("type", dom));
sql = "select prd_code from parameter";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if (rs.next())
{
prdCode = checkNullAndTrim(rs.getString("prd_code"));
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(("AR".equalsIgnoreCase(type)) || ("AP".equalsIgnoreCase(type)))
{
valueXmlString.append("<prd_code__arr>").append("<![CDATA[" + prdCode + "]]>").append("</prd_code__arr>");
}
}//end of itemchange for type
else if("site_code__fr".equalsIgnoreCase(currentColumn))
{
siteCodeFr = checkNullAndTrim(genericUtility.getColumnValue("site_code__fr", dom));
siteDescrFr = getSiteDescr(siteCodeFr, conn);
valueXmlString.append("<fr_site_descr>").append("<![CDATA[" + siteDescrFr + "]]>").append("</fr_site_descr>");
//Added by sarita to set Total Employee Count On 25 OCT 2018[START]
accountPrd = checkNullAndTrim(genericUtility.getColumnValue("acct_prd", dom));
empcodefr = checkNullAndTrim(genericUtility.getColumnValue("emp_code__fr", dom));
empcodeTo = checkNullAndTrim(genericUtility.getColumnValue("emp_code__to", dom));
siteCodeTo = checkNullAndTrim(genericUtility.getColumnValue("site_code__to", dom));
procGroupTo = checkNullAndTrim(genericUtility.getColumnValue("proc_group__to", dom));
procGroupFrom = checkNullAndTrim(genericUtility.getColumnValue("proc_group__from", dom));
System.out.println("empcodefr["+empcodefr+"] \t empcodeTo["+empcodeTo+"]\t siteCodeFr["+siteCodeFr+"]\t siteCodeTo["+siteCodeTo+"]\t procGroupFrom["+procGroupFrom+"]\t procGroupTo["+procGroupTo+"]");
totalEmpNo = getTotNoOfEmployee(accountPrd, empcodefr, empcodeTo, siteCodeFr, siteCodeTo, procGroupFrom, procGroupTo, conn);
valueXmlString.append("<no_employee>").append("<![CDATA[" + totalEmpNo + "]]>").append("</no_employee>");
//Added by sarita to set Total Employee Count On 25 OCT 2018[END]
}//end of itemchange for site_code__fr
else if("site_code__to".equalsIgnoreCase(currentColumn))
{
siteCodeTo = checkNullAndTrim(genericUtility.getColumnValue("site_code__to", dom));
siteDescrTo = getSiteDescr(siteCodeTo, conn);
valueXmlString.append("<to_site_descr>").append("<![CDATA[" + siteDescrTo + "]]>").append("</to_site_descr>");
//Added by sarita to set Total Employee Count On 25 OCT 2018[START]
accountPrd = checkNullAndTrim(genericUtility.getColumnValue("acct_prd", dom));
empcodefr = checkNullAndTrim(genericUtility.getColumnValue("emp_code__fr", dom));
empcodeTo = checkNullAndTrim(genericUtility.getColumnValue("emp_code__to", dom));
siteCodeFr = checkNullAndTrim(genericUtility.getColumnValue("site_code__fr", dom));
procGroupTo = checkNullAndTrim(genericUtility.getColumnValue("proc_group__to", dom));
procGroupFrom = checkNullAndTrim(genericUtility.getColumnValue("proc_group__from", dom));
System.out.println("empcodefr["+empcodefr+"] \t empcodeTo["+empcodeTo+"]\t siteCodeFr["+siteCodeFr+"]\t siteCodeTo["+siteCodeTo+"]\t procGroupFrom["+procGroupFrom+"]\t procGroupTo["+procGroupTo+"]");
totalEmpNo = getTotNoOfEmployee(accountPrd, empcodefr, empcodeTo, siteCodeFr, siteCodeTo, procGroupFrom, procGroupTo, conn);
valueXmlString.append("<no_employee>").append("<![CDATA[" + totalEmpNo + "]]>").append("</no_employee>");
//Added by sarita to set Total Employee Count On 25 OCT 2018[END]
}//end of itemchange for site_code__to
else if("proc_group__from".equalsIgnoreCase(currentColumn))
{
procGroupFrom = checkNullAndTrim(genericUtility.getColumnValue("proc_group__from", dom));
procGroupFrName = getProcCodeName(procGroupFrom, conn);
valueXmlString.append("<proc_group__fr_name>").append("<![CDATA[" + procGroupFrName + "]]>").append("</proc_group__fr_name>");
//Added by sarita to set Total Employee Count On 25 OCT 2018[START]
accountPrd = checkNullAndTrim(genericUtility.getColumnValue("acct_prd", dom));
empcodefr = checkNullAndTrim(genericUtility.getColumnValue("emp_code__fr", dom));
empcodeTo = checkNullAndTrim(genericUtility.getColumnValue("emp_code__to", dom));
siteCodeFr = checkNullAndTrim(genericUtility.getColumnValue("site_code__fr", dom));
siteCodeTo = checkNullAndTrim(genericUtility.getColumnValue("site_code__to", dom));
procGroupTo = checkNullAndTrim(genericUtility.getColumnValue("proc_group__to", dom));
System.out.println("empcodefr["+empcodefr+"] \t empcodeTo["+empcodeTo+"]\t siteCodeFr["+siteCodeFr+"]\t siteCodeTo["+siteCodeTo+"]\t procGroupFrom["+procGroupFrom+"]\t procGroupTo["+procGroupTo+"]");
totalEmpNo = getTotNoOfEmployee(accountPrd, empcodefr, empcodeTo, siteCodeFr, siteCodeTo, procGroupFrom, procGroupTo, conn);
valueXmlString.append("<no_employee>").append("<![CDATA[" + totalEmpNo + "]]>").append("</no_employee>");
//Added by sarita to set Total Employee Count On 25 OCT 2018[END]
}//end of itemchange for proc_group__from
else if("proc_group__to".equalsIgnoreCase(currentColumn))
{
procGroupTo = checkNullAndTrim(genericUtility.getColumnValue("proc_group__to", dom));
procGroupToName = getProcCodeName(procGroupTo, conn);
valueXmlString.append("<proc_group__to_name>").append("<![CDATA[" + procGroupToName + "]]>").append("</proc_group__to_name>");
//Added by sarita to set Total Employee Count On 25 OCT 2018[START]
accountPrd = checkNullAndTrim(genericUtility.getColumnValue("acct_prd", dom));
empcodefr = checkNullAndTrim(genericUtility.getColumnValue("emp_code__fr", dom));
empcodeTo = checkNullAndTrim(genericUtility.getColumnValue("emp_code__to", dom));
siteCodeFr = checkNullAndTrim(genericUtility.getColumnValue("site_code__fr", dom));
siteCodeTo = checkNullAndTrim(genericUtility.getColumnValue("site_code__to", dom));
procGroupFrom = checkNullAndTrim(genericUtility.getColumnValue("proc_group__from", dom));
System.out.println("empcodefr["+empcodefr+"] \t empcodeTo["+empcodeTo+"]\t siteCodeFr["+siteCodeFr+"]\t siteCodeTo["+siteCodeTo+"]\t procGroupFrom["+procGroupFrom+"]\t procGroupTo["+procGroupTo+"]");
totalEmpNo = getTotNoOfEmployee(accountPrd, empcodefr, empcodeTo, siteCodeFr, siteCodeTo, procGroupFrom, procGroupTo, conn);
valueXmlString.append("<no_employee>").append("<![CDATA[" + totalEmpNo + "]]>").append("</no_employee>");
//Added by sarita to set Total Employee Count On 25 OCT 2018[END]
}//end of itemchange for proc_group__to
valueXmlString.append ("</Detail1>\r\n");
}
break;
}
valueXmlString.append("</Root>\r\n"); valueXmlString.append("</Root>\r\n");
} // end of try block } // end of try block
catch (Exception e) catch (Exception e)
{ {
System.out.println(":::" + getClass().getSimpleName() + "::" + e.getMessage()); System.out.println(":::" + getClass().getSimpleName() + "::" + e.getMessage());
e.printStackTrace();
throw new ITMException(e); throw new ITMException(e);
} }
finally finally
...@@ -469,9 +429,12 @@ public class EmpITConfirmationIC extends ValidatorEJB implements EmpITConfirmati ...@@ -469,9 +429,12 @@ public class EmpITConfirmationIC extends ValidatorEJB implements EmpITConfirmati
catch (Exception e) catch (Exception e)
{ {
System.out.println("Exception in EJB[" + getClass().getSimpleName() + "]::itemChanged::[" + e.getMessage() + "]"); System.out.println("Exception in EJB[" + getClass().getSimpleName() + "]::itemChanged::[" + e.getMessage() + "]");
e.printStackTrace();
throw new ITMException(e);
} }
} }
return valueXmlString.toString(); return valueXmlString.toString();
}//End of itemchange[2] }//End of itemchange[2]
private String checkNullAndTrim(String input) private String checkNullAndTrim(String input)
...@@ -486,9 +449,9 @@ public class EmpITConfirmationIC extends ValidatorEJB implements EmpITConfirmati ...@@ -486,9 +449,9 @@ public class EmpITConfirmationIC extends ValidatorEJB implements EmpITConfirmati
} }
return input; return input;
}//end of method checkNullAndTrim }//end of method checkNullAndTrim
//Added by sarita to create method to get longname on 27 SEP 2018 [START] //Added by sarita to create method to get longname on 27 SEP 2018 [START]
public String ddfGetMastersName(String empCode,Connection conn) public String ddfGetMastersName(String empCode,Connection conn) throws ITMException
{ {
String longName = "",empFirstName = "", empLastName = ""; String longName = "",empFirstName = "", empLastName = "";
String sql = ""; String sql = "";
...@@ -502,8 +465,8 @@ public class EmpITConfirmationIC extends ValidatorEJB implements EmpITConfirmati ...@@ -502,8 +465,8 @@ public class EmpITConfirmationIC extends ValidatorEJB implements EmpITConfirmati
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
empFirstName = rs.getString("emp_fname"); empFirstName = checkNullAndTrim(rs.getString("emp_fname"));
empLastName = rs.getString("emp_lname"); empLastName = checkNullAndTrim(rs.getString("emp_lname"));
} }
if (rs != null) if (rs != null)
{ {
...@@ -521,9 +484,167 @@ public class EmpITConfirmationIC extends ValidatorEJB implements EmpITConfirmati ...@@ -521,9 +484,167 @@ public class EmpITConfirmationIC extends ValidatorEJB implements EmpITConfirmati
catch(Exception e) catch(Exception e)
{ {
System.out.println("Exception in EJB[" + getClass().getSimpleName() + "]::itemChanged::[" + e.getMessage() + "]"); System.out.println("Exception in EJB[" + getClass().getSimpleName() + "]::itemChanged::[" + e.getMessage() + "]");
throw new ITMException(e);
} }
return longName; return longName;
} }
//Added by sarita to create method to get longname on 27 SEP 2018 [END] //Added by sarita to create method to get longname on 27 SEP 2018 [END]
//Added by sarita to create method to get proc_group name on 23 OCT 2018 [START]
private String getProcCodeName(String procGroupCode , Connection conn) throws ITMException
{
String sql = "" , procGroupName = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
sql = "select descr from gencodes where fld_name='PROC_GROUP' and fld_value = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, procGroupCode);
rs = pstmt.executeQuery();
if (rs.next())
{
procGroupName = checkNullAndTrim(rs.getString("descr"));
}
System.out.println("proc_group code is ["+procGroupCode+"] AND \t proc_group_name is ["+procGroupName+"]");
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch(Exception e)
{
System.out.println("Exception in EJB[" + getClass().getSimpleName() + "]::itemChanged::[" + e.getMessage() + "]");
throw new ITMException(e);
}
return procGroupName;
}
//Added by sarita to create method to get proc_group name on 23 OCT 2018 [END]
//Added by sarita to create method to get Site Description on 23 OCT 2018 [START]
private String getSiteDescr(String siteCode , Connection conn) throws ITMException
{
String sql = "" , siteDescr = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
sql = "select descr from site where site_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
rs = pstmt.executeQuery();
if (rs.next())
{
siteDescr = checkNullAndTrim(rs.getString("descr"));
}
System.out.println("Site Code is ["+siteCode+"] AND \t Site Description is ["+siteDescr+"]");
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch(Exception e)
{
System.out.println("Exception in EJB[" + getClass().getSimpleName() + "]::itemChanged::[" + e.getMessage() + "]");
throw new ITMException(e);
}
return siteDescr;
}
//Added by sarita to create method to get Site Description on 23 OCT 2018 [END]
//Added by sarita to get Value of Total Number of Employee on 23 OCT 2018 [START]
private int getTotNoOfEmployee(String accountPrd , String empcodefr , String empcodeTo, String siteCodeFr, String siteCodeTo, String procGroupFrom,String procGroupTo, Connection conn) throws ITMException
{
String sql = "";
int empCount = 0;
PreparedStatement pstmt = null;
ResultSet rs = null;
//Added by sarita on 05 NOV 2018 [START]
AdmCommon objAdmCommon = new AdmCommon();
String lsAdTtax = "" , lsAdTpaid = "";
try
{
lsAdTtax = objAdmCommon.getEnv("999999","IYEAR",conn);
lsAdTpaid = objAdmCommon.getEnv("999999","IPAYABLE",conn);
System.out.println("Value of lsAdTtax ["+lsAdTtax+"] \t Value of lsAdTpaid ["+lsAdTpaid+"]");
/*sql = "select count(*) as cnt from IT_CALCHDR itcalhdr,EMPLOYEE employee "
+ "WHERE (itcalhdr.emp_code = employee.emp_code) "
+ "AND itcalhdr.acct_prd = ? "
+ "AND CASE WHEN itcalhdr.confirmed IS NULL THEN 'N' ELSE itcalhdr.confirmed END <> 'Y' "
+ "AND employee.emp_code between ? and ? "
+ "AND employee.pay_site between ? and ? "
+ "AND employee.proc_group between ? and ?";*/
sql = "select itcalhdr.acct_prd , " +
"employee.emp_code , " +
"employee.emp_fname || ' ' || employee.emp_mname || ' ' || employee.emp_lname as emp_name, " +
"employee.pay_site as site_code, " +
"employee.proc_group as proc_group, " +
"case when itcaldet1.amount is null then 0 else itcaldet1.amount end as itax, " +
"case when itcaldet2.amount is null then 0 else itcaldet2.amount end as taxpaid, " +
"(case when itcaldet1.amount is null then 0 else itcaldet1.amount end - case when itcaldet2.amount is null then 0 else itcaldet2.amount end) as itpayable " +
"from IT_CALCHDR itcalhdr, EMPLOYEE employee , IT_CALCDET itcaldet1 , IT_CALCDET itcaldet2 " +
"where (itcalhdr.emp_code = employee.emp_code) " +
"and itcalhdr.acct_prd = ? " +
"and case when itcalhdr.confirmed is null then 'N' else itcalhdr.confirmed end <> 'Y' " +
"and employee.emp_code between ? and ? " +
"and employee.pay_site between ? and ? " +
"and employee.proc_group between ? and ? " +
"and itcaldet1.emp_code = employee.emp_code " +
"and itcaldet1.acct_prd = ? " +
"and itcaldet1.ad_code = ? " +
"and itcaldet2.emp_code = employee.emp_code " +
"and itcaldet2.acct_prd = ? " +
"and itcaldet2.ad_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, accountPrd);
pstmt.setString(2, empcodefr);
pstmt.setString(3, empcodeTo);
pstmt.setString(4, siteCodeFr);
pstmt.setString(5, siteCodeTo);
pstmt.setString(6, procGroupFrom);
pstmt.setString(7, procGroupTo);
pstmt.setString(8,accountPrd);
pstmt.setString(9,lsAdTtax);
pstmt.setString(10,accountPrd);
pstmt.setString(11,lsAdTpaid);
//Added by sarita on 05 NOV 2018 [END]
rs = pstmt.executeQuery();
while (rs.next())
{
empCount++;
}
System.out.println("Tota No. of Employees are :: ["+empCount+"]");
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch(Exception e)
{
System.out.println("Exception in EJB[" + getClass().getSimpleName() + "]::getTotNoOfEmployee::[" + e.getMessage() + "]");
throw new ITMException(e);
}
return empCount;
}
//Added by sarita to get Value of Total Number of Employee on 23 OCT 2018 [END]
} }
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