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;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import javax.ejb.Stateless;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
......@@ -20,7 +23,6 @@ import ibase.webitm.utility.ITMException;
public class EmpITConfirmationIC extends ValidatorEJB implements EmpITConfirmationICLocal,EmpITConfirmationICRemote
{
ibase.utility.E12GenericUtility genericUtility= new ibase.utility.E12GenericUtility();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
......@@ -52,6 +54,7 @@ public class EmpITConfirmationIC extends ValidatorEJB implements EmpITConfirmati
{
System.out.println(":::" + getClass().getSimpleName() + "::" + e.getMessage());
e.getMessage();
throw new ITMException(e);
}
return retString;
}//End of itemchange[1]
......@@ -69,15 +72,17 @@ public class EmpITConfirmationIC extends ValidatorEJB implements EmpITConfirmati
String sql = "",prdcode = "", prdDescr = "",userId = "",siteDescr = "",lsProtectyn = "",accountPrd = "",actPerdDescr = "",loginSite = "";
String empCodeFr = "00" , empCodeTo = "ZZ";
AdmCommon objAdmCommon = new AdmCommon();
String empcodefr = "", empFirstName = "", empLastName = "",empName = "",empcodeTo = "";
String empcodefr = "", empName = "",empcodeTo = "";
String procGroupTo = "" , procGroupToName = "";
int userLev = 0;
String type = "", prdCode = "",siteCodeFr = "",siteDescrFr = "",siteCodeTo = "",siteDescrTo = "",procGroupFrom = "",procGroupFrName = "";
NodeList parentNodeList = null;
NodeList childNodeList = null;
Node parentNode = null;
Node childNode = null;
String childNodeName = "",columnValue="";
String childNodeName = "";
int childNodeListLength = 0,ctr=0,totalEmpNo=0;
String noofConfirmed = "" , noofRejected = "";
try
{
......@@ -112,7 +117,7 @@ public class EmpITConfirmationIC extends ValidatorEJB implements EmpITConfirmati
do
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
childNodeName = childNode.getNodeName(); System.out.println("childNodeName is ["+childNodeName+"]");
if(childNodeName.equals(currentColumn))
{
if(childNode.getFirstChild() != null)
......@@ -149,8 +154,8 @@ public class EmpITConfirmationIC extends ValidatorEJB implements EmpITConfirmati
rs = pstmt.executeQuery();
if (rs.next())
{
prdcode = rs.getString("code");
prdDescr = rs.getString("descr");
prdcode = checkNullAndTrim(rs.getString("code"));
prdDescr = checkNullAndTrim(rs.getString("descr"));
System.out.println("prdcode is ["+prdcode+"] \t prdDescr ["+prdDescr+"]");
}
if (rs != null)
......@@ -177,7 +182,7 @@ public class EmpITConfirmationIC extends ValidatorEJB implements EmpITConfirmati
if (rs.next())
{
siteDescr = rs.getString("descr");
siteDescr = checkNullAndTrim(rs.getString("descr"));
}
if (rs != null)
{
......@@ -203,11 +208,17 @@ public class EmpITConfirmationIC extends ValidatorEJB implements EmpITConfirmati
{
lsProtectyn = "N";
}
else if((lsProtectyn != null && lsProtectyn.trim().length() > 0) && (userLev > 0))
else if(("Y".equalsIgnoreCase(lsProtectyn)) && (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>");
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))
{
......@@ -218,7 +229,7 @@ public class EmpITConfirmationIC extends ValidatorEJB implements EmpITConfirmati
rs = pstmt.executeQuery();
if (rs.next())
{
actPerdDescr = rs.getString("descr");
actPerdDescr = checkNullAndTrim(rs.getString("descr"));
}
if (rs != null)
{
......@@ -231,90 +242,56 @@ public class EmpITConfirmationIC extends ValidatorEJB implements EmpITConfirmati
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));
//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]
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));
//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]
//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));
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;
}
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>");
}
//set Total No. of Employees using emp_code__fr and emp_code__to [END]
//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))
{
......@@ -324,7 +301,7 @@ public class EmpITConfirmationIC extends ValidatorEJB implements EmpITConfirmati
rs = pstmt.executeQuery();
if (rs.next())
{
prdCode = rs.getString("prd_code");
prdCode = checkNullAndTrim(rs.getString("prd_code"));
}
if (rs != null)
{
......@@ -345,95 +322,77 @@ public class EmpITConfirmationIC extends ValidatorEJB implements EmpITConfirmati
else if("site_code__fr".equalsIgnoreCase(currentColumn))
{
siteCodeFr = checkNullAndTrim(genericUtility.getColumnValue("site_code__fr", dom));
sql = "select descr from site where site_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCodeFr);
rs = pstmt.executeQuery();
if (rs.next())
{
siteDescrFr = rs.getString("descr");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
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));
sql = "select descr from site where site_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCodeTo);
rs = pstmt.executeQuery();
if (rs.next())
{
siteDescrTo = rs.getString("descr");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
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));
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;
}
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))
{
String procGroupTo = "";
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.setString(1, procGroupTo);
rs = pstmt.executeQuery();
if (rs.next())
{
procGroupTo = rs.getString("descr");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
valueXmlString.append("<proc_group__to_name>").append("<![CDATA[" + procGroupTo + "]]>").append("</proc_group__to_name>");
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");
}
......@@ -444,6 +403,7 @@ public class EmpITConfirmationIC extends ValidatorEJB implements EmpITConfirmati
catch (Exception e)
{
System.out.println(":::" + getClass().getSimpleName() + "::" + e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
finally
......@@ -469,9 +429,12 @@ public class EmpITConfirmationIC extends ValidatorEJB implements EmpITConfirmati
catch (Exception e)
{
System.out.println("Exception in EJB[" + getClass().getSimpleName() + "]::itemChanged::[" + e.getMessage() + "]");
e.printStackTrace();
throw new ITMException(e);
}
}
return valueXmlString.toString();
}//End of itemchange[2]
private String checkNullAndTrim(String input)
......@@ -488,7 +451,7 @@ public class EmpITConfirmationIC extends ValidatorEJB implements EmpITConfirmati
}//end of method checkNullAndTrim
//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 sql = "";
......@@ -502,8 +465,8 @@ public class EmpITConfirmationIC extends ValidatorEJB implements EmpITConfirmati
rs = pstmt.executeQuery();
if (rs.next())
{
empFirstName = rs.getString("emp_fname");
empLastName = rs.getString("emp_lname");
empFirstName = checkNullAndTrim(rs.getString("emp_fname"));
empLastName = checkNullAndTrim(rs.getString("emp_lname"));
}
if (rs != null)
{
......@@ -521,9 +484,167 @@ public class EmpITConfirmationIC extends ValidatorEJB implements EmpITConfirmati
catch(Exception e)
{
System.out.println("Exception in EJB[" + getClass().getSimpleName() + "]::itemChanged::[" + e.getMessage() + "]");
throw new ITMException(e);
}
return longName;
}
//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