Commit 282dbaa5 authored by akhokar's avatar akhokar

Migration of Employee Wise PayStructure

Migration of PayrollPost payroll/Arrears create payable vouchers
Migration and implementation of LogWriter

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@197634 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 7699f7b6
This source diff could not be displayed because it is too large. You can view the blob instead.
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import java.sql.Timestamp;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.ITMException;
public class EmployeeAdIC extends ValidatorEJB implements EmployeeAdICLocal,EmployeeAdICRemote {
E12GenericUtility genericUtility = new E12GenericUtility();
AdmCommon admCommon= new AdmCommon();
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("::: EmployeeAdIC ::"+ e.getMessage());
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
{
String adCode="";
String mtype="";
String mval="";
String mval3="";
String empCode="";
String effDateStr="" , expDateStr="";
Timestamp effDate= null;
Timestamp expDate= null;
String refType="";
String refNo="";
String balOpt="";
String paySite="";
String confirmed="";
long cnt = 0;
Connection conn = null;
String userId="";
int currentFormNo=0;
NodeList parentNodeList = null;
Node parentNode = null;
NodeList childNodeList = null;
Node childNode = null;
String childNodeName = "";
int childNodeLength = 0;
int ctr=0;
String childNodeValue = null;
String sql="";
PreparedStatement pstmt = null;
ResultSet rs = null;
String errCode = "",msgType= "";
ArrayList<String> errList = new ArrayList<String>();
ArrayList<String> errFields = new ArrayList<String>();
String errorType = "";
String errString="",loginSite="";
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
try {
conn = getConnection();
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
loginSite = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
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();
for(ctr = 0; ctr < childNodeLength; ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
System.out.println(">>>>>> childNodeName: "+childNodeName);
if(childNode.getFirstChild()!= null)
{
childNodeValue = childNode.getFirstChild().getNodeValue();
}
//--------------Validation for Ad code starts here---------------
if(childNodeName.equalsIgnoreCase("ad_code"))
{
adCode = checkNull(genericUtility.getColumnValue("ad_code", dom));
sql= "select count(*) as count from allwdedn where ad_code = ?";
pstmt= conn.prepareStatement(sql);
pstmt.setString(1,adCode);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getLong("count");
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt == 0)
{
errCode = "VMADC1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
msgType = errorType(conn, errCode);
if (msgType.equalsIgnoreCase("E"))
{
break;
}
}
else
{
sql="select type from allwdedn where ad_code = ?";
pstmt= conn.prepareStatement(sql);
pstmt.setString(1,adCode);
rs = pstmt.executeQuery();
if(rs.next())
{
mtype = checkNull(rs.getString("type"));
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if("S".equalsIgnoreCase(mtype))
{
errCode = "VMAD2";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
msgType = errorType(conn, errCode);
if (msgType.equalsIgnoreCase("E"))
{
break;
}
}
}
}
//--------------Validation for ad code Ends here----------------------------------
//--------------Validation for Effective Date starts here-------------------------
else if(childNodeName.equalsIgnoreCase("eff_date"))
{
effDateStr= genericUtility.getColumnValue("eff_date",dom);
effDate = Timestamp.valueOf(genericUtility.getValidDateString(effDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
if(effDate == null)
{
errCode = "VTDATE11";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
msgType = errorType(conn, errCode);
if (msgType.equalsIgnoreCase("E"))
{
break;
}
}
}
//--------------Validation for Effective Date Ends here----------------------------
//--------------Validation for Expiry Date starts here--------------------------
else if(childNodeName.equalsIgnoreCase("exp_date"))
{
effDateStr = checkNull(genericUtility.getColumnValue("eff_date",dom));
effDate = Timestamp.valueOf(genericUtility.getValidDateString(effDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
expDateStr = checkNull(genericUtility.getColumnValue("exp_date",dom));
expDate = Timestamp.valueOf(genericUtility.getValidDateString(expDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
if(expDate == null)
{
errCode = "VTDATE11";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
msgType = errorType(conn, errCode);
if (msgType.equalsIgnoreCase("E"))
{
break;
}
}
else if(effDate.after(expDate))
{
errCode = "VMEXPDATE";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
msgType = errorType(conn, errCode);
if (msgType.equalsIgnoreCase("E"))
{
break;
}
}
else
{
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
adCode = checkNull(genericUtility.getColumnValue("ad_code", dom));
if("E".equalsIgnoreCase(editFlag))
{
cnt = 0;
sql = "select count(*) as count from employee_ad where emp_code = ? and ad_code = ? "
+ "and eff_date = ? and exp_date = ?";
pstmt= conn.prepareStatement(sql);
pstmt.setString(1,empCode);
pstmt.setString(2,adCode);
pstmt.setTimestamp(3,effDate);
pstmt.setTimestamp(4,expDate);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getLong("count");
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt == 0)
{
errCode = admCommon.gfValPayrollPrd("E", empCode, adCode, expDateStr, conn);
if(errCode != null && errCode.trim().length() > 0)
{
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
msgType = errorType(conn, errCode);
if (msgType.equalsIgnoreCase("E"))
{
break;
}
}
}
}
if((errCode == null) || (errCode.trim().length() == 0))
{
if(!("E".equalsIgnoreCase(editFlag)))
{
sql = "select count(*) as count from employee_ad where emp_code = ? and ad_code = ? "
+ "and eff_date > ? and eff_date <= ?";
pstmt= conn.prepareStatement(sql);
pstmt.setString(1,empCode);
pstmt.setString(2,adCode);
pstmt.setTimestamp(3,effDate);
pstmt.setTimestamp(4,expDate);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getLong("count");
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt > 0)
{
errCode = "VTDATE15";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
msgType = errorType(conn, errCode);
if (msgType.equalsIgnoreCase("E"))
{
break;
}
}
else
{
sql = "select count(*) as count from employee_ad where emp_code = ? and ad_code = ?"
+ "and eff_date <= ? and exp_date >= ? and eff_date <> ? and exp_date <> ?";
pstmt= conn.prepareStatement(sql);
pstmt.setString(1,empCode);
pstmt.setString(2,adCode);
pstmt.setTimestamp(3,expDate);
pstmt.setTimestamp(4,expDate);
pstmt.setTimestamp(5,effDate);
pstmt.setTimestamp(6,expDate);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getLong("count");
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt > 0)
{
errCode = "VTDATE15";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
msgType = errorType(conn, errCode);
if (msgType.equalsIgnoreCase("E"))
{
break;
}
}
}
}
}
}
}
//--------------Validation for Expiry Date Ends here--------------------------
//--------------Validation for Reference Type Starts here--------------------------
else if(childNodeName.equalsIgnoreCase("ref_type"))
{
refType= checkNull(genericUtility.getColumnValue("ref_type", dom));
if(!("O".equalsIgnoreCase(refType)) && !("L".equalsIgnoreCase(refType)))
{
errCode = "VTREF1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
msgType = errorType(conn, errCode);
if (msgType.equalsIgnoreCase("E"))
{
break;
}
}
else if("L".equalsIgnoreCase(refType))
{
refNo= checkNull(genericUtility.getColumnValue("ref_no", dom));
empCode= checkNull(genericUtility.getColumnValue("emp_code", dom));
sql = "select count(*) as count from loans where loan_no = ? and emp_code = ? ";
pstmt= conn.prepareStatement(sql);
pstmt.setString(1,refNo);
pstmt.setString(2,empCode);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getLong("count");
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt == 0)
{
errCode = "VTLOAN3";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
msgType = errorType(conn, errCode);
if (msgType.equalsIgnoreCase("E"))
{
break;
}
}
}
else if("O".equalsIgnoreCase(refType))
{
adCode= checkNull(genericUtility.getColumnValue("ad_code", dom));
sql="select bal_opt from allwdedn where ad_code = ?";
pstmt= conn.prepareStatement(sql);
pstmt.setString(1,adCode);
rs = pstmt.executeQuery();
if(rs.next())
{
balOpt = checkNull(rs.getString("bal_opt"));
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if("C".equalsIgnoreCase(balOpt))
{
errCode = "VTCONS";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
msgType = errorType(conn, errCode);
if (msgType.equalsIgnoreCase("E"))
{
break;
}
}
}
}
//--------------Validation for Reference Type Ends here--------------------------
//--------------Validation for Employee Code Starts here--------------------------
else if(childNodeName.equalsIgnoreCase("emp_code"))
{
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
sql = "select count(*) as count from employee where emp_code = ?";
pstmt= conn.prepareStatement(sql);
pstmt.setString(1,empCode);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getLong("count");
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt == 0)
{
errCode = "VMEMP1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
msgType = errorType(conn, errCode);
if (msgType.equalsIgnoreCase("E"))
{
break;
}
}
else
{
sql = "select pay_site, nvl(status , ' ') as status from employee where emp_code = ?";
pstmt= conn.prepareStatement(sql);
pstmt.setString(1,empCode);
rs = pstmt.executeQuery();
if(rs.next())
{
paySite = checkNull(rs.getString("pay_site"));
mval3 = checkNull(rs.getString("status"));
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if((mval3 != null) && ("S".equalsIgnoreCase(mval3)))
{
errCode = "VTPAYSTR01";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
msgType = errorType(conn, errCode);
if (msgType.equalsIgnoreCase("E"))
{
break;
}
}
else
{
effDateStr = genericUtility.getColumnValue("eff_date", dom);
effDate = Timestamp.valueOf(genericUtility.getValidDateString(effDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
errCode = admCommon.gbfEmp(empCode, effDate, paySite, loginSite, conn);
if(errCode != null && errCode.trim().length() > 0)
{
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
msgType = errorType(conn, errCode);
if (msgType.equalsIgnoreCase("E"))
{
break;
}
}
}
}
}
//--------------Validation for Employee Code Ends here--------------------------
//--------------Validation for Confirmed Starts here--------------------------
else if(childNodeName.equalsIgnoreCase("confirmed"))
{
mval = admCommon.getEnv("999999", "EMP_AD_APRV", conn);
if("NULLFOUND".equalsIgnoreCase(mval) || ("N".equalsIgnoreCase(mval)))
{
confirmed = checkNull(genericUtility.getColumnValue("confirmed", dom));
}
if(confirmed == null || !("Y".equalsIgnoreCase(confirmed)))
{
errCode = "VTPAYSTR02";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
msgType = errorType(conn, errCode);
if (msgType.equalsIgnoreCase("E"))
{
break;
}
}
}
//--------------Validation for Confirmed Ends here--------------------------
//--------------Validation for Amount Starts here--------------------------
else if(childNodeName.equalsIgnoreCase("amount") || childNodeName.equalsIgnoreCase("min_basic") ||
childNodeName.equalsIgnoreCase("max_basic") || childNodeName.equalsIgnoreCase("min_amt") ||
childNodeName.equalsIgnoreCase("max_amt"))
{
Double amount = Double.parseDouble(genericUtility.getColumnValue(childNodeName, dom));
System.out.println("Amount :::::::" + amount);
if(amount < 0)
{
errCode = "VTAMT01";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
msgType = errorType(conn, errCode);
if (msgType.equalsIgnoreCase("E"))
{
break;
}
}
}
//--------------Validation for Amount Ends here--------------------------
}
break;
}
int errListSize = errList.size();
System.out.println("errListSize::::::::::"+errListSize);
int count = 0;
String errFldName = null;
if (errList != null && errListSize > 0)
{
for (count = 0; count < errListSize; count++)
{
errCode = errList.get(count);
errFldName = errFields.get(count);
System.out.println(" testing :errCode .:" + errCode);
errString = getErrorString(errFldName, errCode, userId);
System.out.println("errString>>>>>>>>>"+errString);
errorType = errorType(conn, errCode);
if (errString.length() > 0)
{
String bifurErrString = errString.substring(errString.indexOf("<Errors>") + 8, errString.indexOf("<trace>"));
bifurErrString = bifurErrString + errString.substring(errString.indexOf("</trace>") + 8, errString.indexOf("</Errors>"));
errStringXml.append(bifurErrString);
errString = "";
}
if (errorType.equalsIgnoreCase("E"))
{
break;
}
}
errList.clear();
errList = null;
errFields.clear();
errFields = null;
errStringXml.append("</Errors> </Root> \r\n");
}
else
{
errStringXml = new StringBuffer("");
}
}
}
catch (Exception e)
{
System.out.println("::: EmployeeAdIC ::"+ e.getMessage());
e.getMessage();
throw new ITMException(e);
}
finally
{
try
{
if (conn != null)
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
conn.close();
conn = null;
}
}
catch (Exception d)
{
d.printStackTrace();
throw new ITMException(d);
}
}
errString = errStringXml.toString();
System.out.println("testing : final errString : " + errString);
return errString;
}
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException
{
Document dom = null;
Document domhr = null;
Document domAll = null;
String retString="";
try
{
System.out.println("************** Inside itemChanged method ****************");
System.out.println("xmlString: "+xmlString+" \nxmlString1: "+xmlString1+" \nxmlString2: "+xmlString2+" \nxtraParams: "+xtraParams);
if(xmlString != null && xmlString.trim().length() > 0)
{
dom = genericUtility.parseString(xmlString);
}
if(xmlString1 != null && xmlString1.trim().length() > 0)
{
domhr = genericUtility.parseString(xmlString1);
}
if(xmlString2 != null && xmlString2.trim().length() > 0)
{
domAll = genericUtility.parseString(xmlString2);
}
retString = itemChanged(dom,domhr,domAll,objContext,currentColumn,editFlag,xtraParams);
System.out.println("retString::::::::::"+retString);
}
catch(Exception e)
{
System.out.println(":::" + getClass().getSimpleName() + "::"+ e.getMessage());
e.getMessage();
}
return retString;
}
public String itemChanged(Document dom, Document dom1, Document dom2,String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException
{
long cnt = 0;
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null ;
int childNodeListLength = 0;
String empCode = "", paySite = "";
String effDateStr="",todayDate ="", expDate="";
Timestamp todayTm= null;
String refType="",refNo="", login_emp_code="";
String confirmed="";
Timestamp joinDate = null, effDate = null;
String adCode = "", descr ="" ,ls_empad_aprv= "",prop_yn="";
String sql = "";
int currentFormNo=0,ctr=0;
StringBuffer valueXmlString = new StringBuffer();
NodeList parentNodeList = null;
NodeList childNodeList = null;
Node parentNode = null;
Node childNode = null;
String childNodeName = null, columnValue = "", loginSiteCode = "",loginEmpCode="";
SimpleDateFormat sdf = null;
String entryMode = "E";
try
{
conn = getConnection();
sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
if(objContext != null && objContext.trim().length()>0)
{
currentFormNo = Integer.parseInt(objContext);
}
loginSiteCode = this.genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
loginEmpCode = this.genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode");
empCode = this.genericUtility.getValueFromXTRA_PARAMS(xtraParams, "emp_code");
System.out.println("[EmployeeAdIC] [itemChanged] :currentFormNo ....." +currentFormNo+" currentColumn: "+currentColumn);
valueXmlString = new StringBuffer("<?xml version=\"1.0\"?><Root><header><editFlag>");
valueXmlString.append(editFlag).append("</editFlag></header>");
switch (currentFormNo)
{
case 1:
{
todayDate = sdf.format(new java.util.Date());
todayTm = Timestamp.valueOf(genericUtility.getValidDateString(todayDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
valueXmlString.append("<Detail1>");
childNodeListLength = childNodeList.getLength();
do
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
ctr++;
}
while ((ctr < childNodeListLength) && (!childNodeName.equals(currentColumn)));
if(currentColumn.trim().equalsIgnoreCase("itm_default"))
{
System.out.println("Inside itm_default::::");
System.out.println("empCode in itm_default::::"+ empCode );
valueXmlString.append("<emp_code>").append("<![CDATA["+empCode+"]]>").append("</emp_code>");
expDate = admCommon.getEnv("999999", "AD_EXPDATE", conn);
System.out.println("Expiry Date ::::::" + expDate);
expDate = genericUtility.getValidDateString(expDate,"dd-MM-yy",genericUtility.getApplDateFormat());
System.out.println("Final Expiry Date ::::::" + expDate);
valueXmlString.append("<exp_date>").append("<![CDATA["+expDate+"]]>").append("</exp_date>");
effDateStr = this.genericUtility.getValueFromXTRA_PARAMS(xtraParams, "eff_date");
if((effDateStr == null || effDateStr.trim().length() == 0) && "E".equalsIgnoreCase(entryMode))
{
effDateStr = todayDate;
effDate=todayTm;
System.out.println("effDateStr :::::"+ effDateStr +" effDate :::::"+ effDate);
cnt = 0;
sql = "select date_join from employee where emp_code= ?";
pstmt= conn.prepareStatement(sql);
pstmt.setString(1,empCode);
rs = pstmt.executeQuery();
if(rs.next())
{
joinDate = rs.getTimestamp("date_join");
System.out.println("joinDate:::::"+ joinDate);
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(joinDate != null)
{
sql = "select count(*) as count from employee_ad where emp_code = ? and eff_date > ?";
pstmt= conn.prepareStatement(sql);
pstmt.setString(1,empCode);
pstmt.setTimestamp(2,joinDate);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getLong("count");
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt == 0)
{
effDate= joinDate;
effDateStr= sdf.format(joinDate);
}
}
cnt = 0;
}
valueXmlString.append("<eff_date>").append("<![CDATA["+effDateStr+"]]>").append("</eff_date>");
sql = "select pay_site,date_join from employee where emp_code = ?";
pstmt= conn.prepareStatement(sql);
pstmt.setString(1,empCode);
rs = pstmt.executeQuery();
if(rs.next())
{
paySite= checkNull(rs.getString("pay_site"));
joinDate= rs.getTimestamp("date_join");
System.out.println("paySite:::::"+ paySite);
System.out.println("joinDate:::::"+ joinDate);
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(joinDate != null && effDate != null)
{
if(joinDate.after(effDate))
{
effDate= joinDate;
effDateStr= sdf.format(joinDate);
valueXmlString.append("<eff_date>").append("<![CDATA["+effDateStr+"]]>").append("</eff_date>");
}
}
valueXmlString.append("<pay_site>").append("<![CDATA["+paySite+"]]>").append("</pay_site>");
valueXmlString.append("<ref_type protect=\"0\" ><![CDATA[").append(refType).append("]]></ref_type>\r\n");
valueXmlString.append("<ref_no protect=\"0\" ><![CDATA[").append(refNo).append("]]></ref_no>\r\n");
ls_empad_aprv = admCommon.getEnv("999999", "EMP_AD_APRV", conn);
System.out.println("ls_empad_aprv:::::"+ ls_empad_aprv);
if("NULLFOUND".equalsIgnoreCase(ls_empad_aprv) || ("N".equalsIgnoreCase(ls_empad_aprv)))
{
valueXmlString.append("<confirmed>").append("<![CDATA["+"Y"+"]]>").append("</confirmed>");
valueXmlString.append("<conf_date>").append("<![CDATA["+todayDate+"]]>").append("</conf_date>");
valueXmlString.append("<emp_code__aprv>").append("<![CDATA["+loginEmpCode+"]]>").append("</emp_code__aprv>");
}
}
else if(currentColumn.trim().equalsIgnoreCase("itm_defaultedit"))
{
System.out.println("Inside itm_defaultedit:::::");
effDateStr = checkNull(genericUtility.getColumnValue("eff_date", dom));
refType = checkNull(genericUtility.getColumnValue("ref_type", dom));
refNo = checkNull(genericUtility.getColumnValue("ref_no", dom));
valueXmlString.append("<eff_date protect=\"1\" >").append("<![CDATA["+effDateStr+"]]>").append("</eff_date>");
if("O".equalsIgnoreCase(refType) || "L".equalsIgnoreCase(refType))
{
valueXmlString.append("<ref_type protect=\"0\" ><![CDATA[").append(refType).append("]]></ref_type>\r\n");
valueXmlString.append("<ref_no protect=\"0\" ><![CDATA[").append(refNo).append("]]></ref_no>\r\n");
}
else
{
valueXmlString.append("<ref_type protect=\"1\" ><![CDATA[").append(refType).append("]]></ref_type>\r\n");
valueXmlString.append("<ref_no protect=\"1\" ><![CDATA[").append(refNo).append("]]></ref_no>\r\n");
}
ls_empad_aprv = admCommon.getEnv("999999", "EMP_AD_APRV", conn);
if("NULLFOUND".equalsIgnoreCase(ls_empad_aprv) || ("N".equalsIgnoreCase(ls_empad_aprv)))
{
valueXmlString.append("<confirmed>").append("<![CDATA["+"Y"+"]]>").append("</confirmed>");
valueXmlString.append("<conf_date>").append("<![CDATA["+todayDate+"]]>").append("</conf_date>");
valueXmlString.append("<emp_code__aprv>").append("<![CDATA["+loginEmpCode+"]]>").append("</emp_code__aprv>");
}
else if("Y".equalsIgnoreCase(ls_empad_aprv))
{
valueXmlString.append("<confirmed>").append("<![CDATA["+"N"+"]]>").append("</confirmed>");
valueXmlString.append("<conf_date>").append("<![CDATA[]]>").append("</conf_date>");
valueXmlString.append("<emp_code__aprv>").append("<![CDATA[]]>").append("</emp_code__aprv>");
}
}
else if(currentColumn.trim().equalsIgnoreCase("ad_code"))
{
System.out.println("Inside ad_code:::::");
adCode= checkNull(genericUtility.getColumnValue("ad_code", dom));
sql = "Select descr,prop_yn from allwdedn where ad_code = ?";
pstmt= conn.prepareStatement(sql);
pstmt.setString(1,adCode);
rs = pstmt.executeQuery();
if(rs.next())
{
descr= checkNull(rs.getString("descr"));
prop_yn= checkNull(rs.getString("prop_yn"));
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
valueXmlString.append("<allwdedn_descr>").append("<![CDATA["+descr+"]]>").append("</allwdedn_descr>");
valueXmlString.append("<prop_yn>").append("<![CDATA["+prop_yn+"]]>").append("</prop_yn>");
}
else if(currentColumn.trim().equalsIgnoreCase("emp_code"))
{
System.out.println("Inside emp_code:::::");
empCode= checkNull(genericUtility.getColumnValue("emp_code", dom));
effDateStr= checkNull(genericUtility.getColumnValue("eff_date", dom));
effDateStr = todayDate;
effDate=todayTm;
System.out.println("effDateStr:::::"+ effDateStr + " effDate:::::" + effDate);
sql = "select pay_site,date_join from employee where emp_code = ?";
pstmt= conn.prepareStatement(sql);
pstmt.setString(1,empCode);
rs = pstmt.executeQuery();
if(rs.next())
{
paySite= checkNull(rs.getString("pay_site"));
joinDate= rs.getTimestamp("date_join");
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
cnt = 0;
if(joinDate != null)
{
sql = "select count(*) as count from employee_ad where emp_code = ? and eff_date > ?";
pstmt= conn.prepareStatement(sql);
pstmt.setString(1,empCode);
pstmt.setTimestamp(2,joinDate);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getLong("count");
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt == 0)
{
effDate= joinDate;
effDateStr= sdf.format(joinDate);
}
if(joinDate != null && effDate != null)
{
if(joinDate.after(effDate))
{
effDate= joinDate;
effDateStr= sdf.format(joinDate);
valueXmlString.append("<eff_date>").append("<![CDATA["+effDateStr+"]]>").append("</eff_date>");
}
}
}
valueXmlString.append("<pay_site>").append("<![CDATA["+paySite+"]]>").append("</pay_site>");
}
}
valueXmlString.append("</Detail1>");
break;
}
valueXmlString.append("</Root>");
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if (conn != null)
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
conn.close();
conn = null;
}
}
catch(Exception ex)
{
System.out.println("Exception in EJB[EmployeeAdIC]::itemChanged::["+ ex.getMessage() + "]");
}
}
System.out.println("valueXmlString::::"+ valueXmlString);
return valueXmlString.toString();
}
private String errorType(Connection conn, String errorCode) throws ITMException
{
String msgType = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
String sql = "SELECT MSG_TYPE FROM MESSAGES WHERE MSG_NO = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, errorCode);
rs = pstmt.executeQuery();
if (rs.next())
{
msgType = rs.getString("MSG_TYPE");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception ex)
{
ex.printStackTrace();
throw new ITMException(ex);
}
finally
{
try
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
}
return msgType;
}
private String checkNull(String input)
{
return input == null ? "" : input;
}
}
\ No newline at end of file
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
import javax.ejb.Local;
import org.w3c.dom.Document;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
@Local
public interface EmployeeAdICLocal extends ValidatorLocal {
@Override
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException, ITMException;
@Override
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException, ITMException;
@Override
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException;
@Override
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException;
}
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
import java.sql.Connection;
import javax.ejb.Remote;
import org.w3c.dom.Document;
import ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException;
@Remote
public interface EmployeeAdICRemote extends ValidatorRemote {
@Override
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException, ITMException;
@Override
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException, ITMException;
@Override
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException;
@Override
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException;
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
import javax.ejb.Local;
import ibase.webitm.utility.ITMException;
@Local
public interface PayrollPostAccPrcLocal extends ibase.webitm.ejb.ProcessLocal//, EJBObject
{
public String process() throws RemoteException,ITMException;
public String process(String xmlString, String xmlString2,String windowName, String xtraParams) throws RemoteException,ITMException;
public String getData(String xmlString, String xmlString2,String windowName, String xtraParams) throws RemoteException,ITMException;
}
\ No newline at end of file
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
import javax.ejb.Remote;
import ibase.webitm.utility.ITMException;
@Remote
public interface PayrollPostAccPrcRemote extends ibase.webitm.ejb.ProcessRemote//, EJBObject
{
public String process() throws RemoteException,ITMException;
public String process(String xmlString, String xmlString2,String windowName, String xtraParams) throws RemoteException,ITMException;
public String getData(String xmlString, String xmlString2,String windowName, String xtraParams) throws RemoteException,ITMException;
}
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