Commit d06c2c00 authored by sghate's avatar sghate

Updated component on 14/02/2020

StatusChangeConfirm.java
StatusChangeIC.java


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@216628 ce508802-f39f-4f6c-b175-0d175dae99d5
parent aa7318a3
......@@ -28,25 +28,35 @@ public class StatusChangeConfirm extends ActionHandlerEJB implements StatusChang
String retString = "";
Connection conn = null;
boolean isError = false;
try
{
conn = getConnection();
retString = gbfPostLogic(tranId,xtraParams,forcedFlag,conn);
System.out.println("returning String from StatusChangeConfirm :confirm():==>[" + retString + "]");
if(retString == null || retString.trim().length() == 0)
//Modified by shital on 14/02/2020 [Start]
/*if(retString == null || retString.trim().length() == 0)
{
isError = false;
retString = itmDBAccessEJB.getErrorString("", "VTINVCONF3", "", "", conn);
return retString;
}
else
{
isError = true;
}*/
if(retString != null && retString.trim().length() > 0 && retString.indexOf("VTINVCONF3")<0)
{
conn.rollback();
}
else
{
conn.commit();
retString = itmDBAccessEJB.getErrorString("","VTINVCONF3" , "", "", conn);
}
//Modified by shital on 14/02/2020 [End]
}
catch(Exception e)
{
......@@ -58,9 +68,9 @@ public class StatusChangeConfirm extends ActionHandlerEJB implements StatusChang
{
try
{
if(conn != null)
if(conn != null) //Modified by shital on 14/02/2020
{
if(isError)
/*if(isError)
{
conn.rollback();
System.out.println("Connection rollback");
......@@ -70,7 +80,7 @@ public class StatusChangeConfirm extends ActionHandlerEJB implements StatusChang
conn.commit();
System.out.println("Connection committed");
}
}*/
conn.close();
conn = null;
}
......@@ -107,32 +117,32 @@ public class StatusChangeConfirm extends ActionHandlerEJB implements StatusChang
String chgTerm = "";
String termId = "" , confirm = "",tranDateStr ="";
ArrayList tranIdList = new ArrayList();
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
System.out.println("Inside Post Logic Method..!!!!");
sdf =new SimpleDateFormat(genericUtility.getApplDateFormat());
userId = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"));
chgTerm = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "termId"));
loginEmpCode = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode"));
runMode = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "runMode"));
System.out.println("userId["+userId+"]\t chgTerm["+chgTerm+"]\t loginEmpCode["+loginEmpCode+"]\t runMode["+runMode+"]");
tranIdList = GenericUtility.getInstance().getTokenList(tranId, ":");
System.out.println("tranIdList:::::::::::"+tranIdList);
lsEmpCode = (String) tranIdList.get(0);
tranDateStr = (String) tranIdList.get(1);
System.out.println("empCode:::::::::"+lsEmpCode);
System.out.println("tranIdStr:::::::::"+tranDateStr);
if(tranDateStr != null && tranDateStr.trim().length() > 0)
{
ldTranDate = java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(tranDateStr,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()));
}
System.out.println("ldTranDate:::::::::=="+ldTranDate);
sql = "select case when confirm is null then 'N' else confirm end as confirm ,"
+ " tran_id ,"
+ " remarks "
......@@ -177,12 +187,12 @@ public class StatusChangeConfirm extends ActionHandlerEJB implements StatusChang
else if("X".equalsIgnoreCase(confirm))
{
errString = itmDBAccessEJB.getErrorString("", "VTEMPSTS02", userId, "", conn);
return errString;
//return errString;
}
else
{
errString = itmDBAccessEJB.getErrorString("", "VTMCONF1", userId, "", conn);
return errString;
//return errString;
}
if(errString == null || errString.trim().length() == 0)
......@@ -240,6 +250,7 @@ public class StatusChangeConfirm extends ActionHandlerEJB implements StatusChang
pstmt = null;
}
liCnt = 0;
if(liCnt > 0)
{
liCnt = 0;
......@@ -254,24 +265,26 @@ public class StatusChangeConfirm extends ActionHandlerEJB implements StatusChang
pstmt.setString(1, tranId);
cnt = pstmt.executeUpdate();
if(cnt > 0)
{
System.out.println("Data Updated in obj_sign_trans table..");
}
{
System.out.println("Data Updated in obj_sign_trans table..");
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
else
/*else //Commented by shital on 14/02/2020
{
errString = itmDBAccessEJB.getErrorString("", "DS000", userId, "", conn);
}
}*/
}
else
/*else
{
errString = itmDBAccessEJB.getErrorString("", "DS000", userId, "", conn);
}
}*/ //Commented by shital on 14/02/2020
int cnt1 = 0;
sql = "update wf_prc_status "
+ "set "
+ "process_status = 3, "
......@@ -281,11 +294,11 @@ public class StatusChangeConfirm extends ActionHandlerEJB implements StatusChang
+ "and process_status < 3";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
int cnt1 = pstmt.executeUpdate();
cnt1 = pstmt.executeUpdate();
if(cnt1 > 0)
{
System.out.println("Data Updated in wf_prc_status table..");
}
{
System.out.println("Data Updated in wf_prc_status table..");
}
if(pstmt != null)
{
pstmt.close();
......@@ -305,7 +318,7 @@ public class StatusChangeConfirm extends ActionHandlerEJB implements StatusChang
if(lsRemarks != null && lsRemarks.length() > 1500)
{
lsRemarks = utilMethod.mid(lsRemarks, 1, 1500);
sql = "update emp_statuschg "
+ "set remarks = ? "
+ "where "
......@@ -325,7 +338,7 @@ public class StatusChangeConfirm extends ActionHandlerEJB implements StatusChang
}
}
}
/* if(errString == null || errString.trim().length() == 0)
/* if(errString == null || errString.trim().length() == 0)
{
errString = itmDBAccessEJB.getErrorString("", "VTMCONF2", userId, "", conn);
return errString;
......@@ -407,26 +420,26 @@ public class StatusChangeConfirm extends ActionHandlerEJB implements StatusChang
ldToday = utilMethod.dateTime(utilMethod.today() , utilMethod.stringToTime("00:00"));
termId = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "termId"));
userId = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"));
sql = "select "
+ "extend ,"
+ "status_type ,"
+ "date__due_chg ,"
+ "months_extend ,"
+ "notice_prd ,"
+ "date__effchg ,"
+ "grade_n , "
+ "cadre_n , "
+ "design_code_n , "
+ "designation_n , "
+ "emp_code__aprv , "
+ "conf_date , "
+ "eligible_ot ,"
+ "case when confirm is null then 'N' else confirm end as confirm "
+ "from emp_statuschg "
+ "where "
+ "emp_code = ? "
+ "and tran_date= ?";
+ "extend ,"
+ "status_type ,"
+ "date__due_chg ,"
+ "months_extend ,"
+ "notice_prd ,"
+ "date__effchg ,"
+ "grade_n , "
+ "cadre_n , "
+ "design_code_n , "
+ "designation_n , "
+ "emp_code__aprv , "
+ "conf_date , "
+ "eligible_ot ,"
+ "case when confirm is null then 'N' else confirm end as confirm "
+ "from emp_statuschg "
+ "where "
+ "emp_code = ? "
+ "and tran_date= ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
pstmt.setTimestamp(2, tranDate);
......@@ -476,9 +489,9 @@ public class StatusChangeConfirm extends ActionHandlerEJB implements StatusChang
if("P".equalsIgnoreCase(mstatus))
{
sql = "select probation_prd as li_probprd "
+ "from "
+ "employee "
+ "where emp_code = ?";
+ "from "
+ "employee "
+ "where emp_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
......@@ -497,25 +510,25 @@ public class StatusChangeConfirm extends ActionHandlerEJB implements StatusChang
pstmt.close();
pstmt = null;
}
ldConf = utilmethod.AddMonths(meffdate, liProbprd);
System.out.println("ldConf :: ["+ldConf+"]");
sql = "UPDATE employee "
+ "set probation = 'Y', "
+ "probation_date = ? ,"
+ "notice_prd = ? ,"
+ "date_conf = ? ,"
+ "grade = ? , "
+ "cadre = ? ,"
+ "design_code = ? ,"
+ "designation = ? ,"
+ "chg_date = ? ,"
+ "chg_user = ? ,"
+ "chg_term = ? ,"
+ "eligible_ot = ? "
+ "where emp_code = ?";
+ "set probation = 'Y', "
+ "probation_date = ? ,"
+ "notice_prd = ? ,"
+ "date_conf = ? ,"
+ "grade = ? , "
+ "cadre = ? ,"
+ "design_code = ? ,"
+ "designation = ? ,"
+ "chg_date = ? ,"
+ "chg_user = ? ,"
+ "chg_term = ? ,"
+ "eligible_ot = ? "
+ "where emp_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,meffdate);
pstmt.setDouble(2,lcNoticePrd);
......@@ -536,24 +549,24 @@ public class StatusChangeConfirm extends ActionHandlerEJB implements StatusChang
pstmt.close();
pstmt = null;
}
System.out.println("liProbprd222222"+liProbprd);
if (liProbprd == 0)
{
sql = "update employee "
+ "set "
+ "confirmed = 'Y', "
+ "grade = ? , "
+ "cadre = ? , "
+ "design_code = ? ,"
+ "designation = ? , "
+ "notice_prd = ? , "
+ "chg_date= ? , "
+ "chg_user = ? ,"
+ "chg_term = ? ,"
+ "eligible_ot = ? "
+ "where "
+ "emp_code = ?";
+ "set "
+ "confirmed = 'Y', "
+ "grade = ? , "
+ "cadre = ? , "
+ "design_code = ? ,"
+ "designation = ? , "
+ "notice_prd = ? , "
+ "chg_date= ? , "
+ "chg_user = ? ,"
+ "chg_term = ? ,"
+ "eligible_ot = ? "
+ "where "
+ "emp_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,lsGrade);
pstmt.setString(2,lsCadre);
......@@ -567,16 +580,16 @@ public class StatusChangeConfirm extends ActionHandlerEJB implements StatusChang
pstmt.setString(10,empCode);
cnt = pstmt.executeUpdate();
if(cnt > 0)
{
System.out.println("Data Updated for employee");
}
{
System.out.println("Data Updated for employee");
}
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
else
{
......@@ -585,20 +598,20 @@ public class StatusChangeConfirm extends ActionHandlerEJB implements StatusChang
if("C".equalsIgnoreCase(mstatus))
{
sql = "UPDATE employee "
+ "set "
+ "confirmed = 'Y',"
+ "date_conf = ? ,"
+ "notice_prd = ? ,"
+ "grade = ? ,"
+ "cadre = ? ,"
+ "design_code = ? ,"
+ "designation = ? ,"
+ "chg_date= ? ,"
+ "chg_user = ? ,"
+ "chg_term = ? ,"
+ "eligible_ot = ? "
+ "where "
+ "emp_code = ?";
+ "set "
+ "confirmed = 'Y',"
+ "date_conf = ? ,"
+ "notice_prd = ? ,"
+ "grade = ? ,"
+ "cadre = ? ,"
+ "design_code = ? ,"
+ "designation = ? ,"
+ "chg_date= ? ,"
+ "chg_user = ? ,"
+ "chg_term = ? ,"
+ "eligible_ot = ? "
+ "where "
+ "emp_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,meffdate);
pstmt.setDouble(2,lcNoticePrd);
......@@ -627,11 +640,11 @@ public class StatusChangeConfirm extends ActionHandlerEJB implements StatusChang
if("Y".equalsIgnoreCase(mexten))
{
sql = "update "
+ "emp_statuschg "
+ "set date__effchg = ? "
+ "where "
+ "emp_code = ? "
+ "and tran_date = ?";
+ "emp_statuschg "
+ "set date__effchg = ? "
+ "where "
+ "emp_code = ? "
+ "and tran_date = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,mduedtchg);
pstmt.setString(2,empCode);
......@@ -639,9 +652,9 @@ public class StatusChangeConfirm extends ActionHandlerEJB implements StatusChang
int cnt3 = pstmt.executeUpdate();
System.out.println("cnt333333333"+cnt3);
if(cnt3 > 0)
{
System.out.println("Data Updated for emp_statuschg");
}
{
System.out.println("Data Updated for emp_statuschg");
}
}
if(pstmt != null)
{
......@@ -655,14 +668,14 @@ public class StatusChangeConfirm extends ActionHandlerEJB implements StatusChang
{
mduedt = utilmethod.AddMonths(mduedtchg, mmonth);
System.out.println("mduedt is ["+mduedt+"]");
sql = "select "
+ "training_prd, "
+ "date_conf "
+ "from "
+ "employee "
+ "where "
+ "emp_code = ?";
+ "training_prd, "
+ "date_conf "
+ "from "
+ "employee "
+ "where "
+ "emp_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
......@@ -685,23 +698,23 @@ public class StatusChangeConfirm extends ActionHandlerEJB implements StatusChang
mextprd = mmonth + mVal;
ldConf = utilmethod.AddMonths(ldConf, mmonth);
System.out.println("mextprd ["+mextprd+"] \t ldConf ["+ldConf+"]");
sql = "Update "
+ "employee "
+ "set "
+ "probation_date = ? ,"
+ "training_prd = ? , "
+ "grade = ? ,"
+ "cadre = ?,"
+ "design_code = ? ,"
+ "designation = ? ,"
+ "notice_prd = ? ,"
+ "chg_date= ? ,"
+ "chg_user = ? ,"
+ "chg_term = ? ,"
+ "eligible_ot = ? "
+ "Where "
+ "emp_code = ?";
+ "employee "
+ "set "
+ "probation_date = ? ,"
+ "training_prd = ? , "
+ "grade = ? ,"
+ "cadre = ?,"
+ "design_code = ? ,"
+ "designation = ? ,"
+ "notice_prd = ? ,"
+ "chg_date= ? ,"
+ "chg_user = ? ,"
+ "chg_term = ? ,"
+ "eligible_ot = ? "
+ "Where "
+ "emp_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,mduedt);
pstmt.setInt(2,mextprd);
......@@ -718,9 +731,9 @@ public class StatusChangeConfirm extends ActionHandlerEJB implements StatusChang
int cnt4 = pstmt.executeUpdate();
System.out.println("cnt4"+cnt4);
if(cnt4 > 0)
{
System.out.println("Data Updated for emp_statuschg");
}
{
System.out.println("Data Updated for emp_statuschg");
}
if(pstmt != null)
{
pstmt.close();
......@@ -737,18 +750,18 @@ public class StatusChangeConfirm extends ActionHandlerEJB implements StatusChang
System.out.println("mduedt-----"+mduedt);
sql = "select "
+ "probation_prd "
+ "from "
+ "employee "
+ "where "
+ "emp_code = ?";
+ "probation_prd "
+ "from "
+ "employee "
+ "where "
+ "emp_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
if(rs.next())
{
mVal = rs.getInt("probation_prd");
}
System.out.println("mVal:::::"+mVal);
if(rs != null)
......@@ -762,26 +775,26 @@ public class StatusChangeConfirm extends ActionHandlerEJB implements StatusChang
pstmt = null;
}
}
mextprd = mmonth + mVal;
System.out.println("mextprd ::: ["+mextprd+"]");
sql = "Update "
+ "employee "
+ "set "
+ "date_conf = ? , "
+ "probation_prd = ? ,"
+ "grade = ? ,"
+ "cadre = ? ,"
+ "design_code = ? ,"
+ "designation = ? , "
+ "notice_prd = ? ,"
+ "chg_date= ? ,"
+ "chg_user = ? , "
+ "chg_term = ? ,"
+ "eligible_ot = ? "
+ "where "
+ "emp_code = ?";
+ "employee "
+ "set "
+ "date_conf = ? , "
+ "probation_prd = ? ,"
+ "grade = ? ,"
+ "cadre = ? ,"
+ "design_code = ? ,"
+ "designation = ? , "
+ "notice_prd = ? ,"
+ "chg_date= ? ,"
+ "chg_user = ? , "
+ "chg_term = ? ,"
+ "eligible_ot = ? "
+ "where "
+ "emp_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,mduedt);
pstmt.setInt(2,mextprd);
......@@ -798,9 +811,9 @@ public class StatusChangeConfirm extends ActionHandlerEJB implements StatusChang
int cnt5 = pstmt.executeUpdate();
System.out.println("cnt5"+cnt5);
if(cnt5 > 0)
{
System.out.println("Data Updated for employee");
}
{
System.out.println("Data Updated for employee");
}
if(pstmt != null)
{
pstmt.close();
......@@ -808,17 +821,17 @@ public class StatusChangeConfirm extends ActionHandlerEJB implements StatusChang
}
}
}
sql = "update "
+ "emp_statuschg "
+ "set "
+ "confirm = 'Y' , "
+ "conf_date = ? , "
+ "emp_code__aprv = ? "
+ "where "
+ "emp_code = ? "
+ "and "
+ "tran_date = ?";
+ "emp_statuschg "
+ "set "
+ "confirm = 'Y' , "
+ "conf_date = ? , "
+ "emp_code__aprv = ? "
+ "where "
+ "emp_code = ? "
+ "and "
+ "tran_date = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,ldConfDate);
pstmt.setString(2,lsEmpAprv);
......@@ -827,9 +840,9 @@ public class StatusChangeConfirm extends ActionHandlerEJB implements StatusChang
int cnt6 = pstmt.executeUpdate();
System.out.println("cnt6"+cnt6);
if(cnt6 > 0)
{
System.out.println("Data Updated for emp_statuschg");
}
{
System.out.println("Data Updated for emp_statuschg");
}
if(pstmt != null)
{
pstmt.close();
......@@ -866,7 +879,7 @@ public class StatusChangeConfirm extends ActionHandlerEJB implements StatusChang
}
return lsErrcode;
}
private String checkNull(String input)
{
if (input == null)
......
......@@ -25,7 +25,7 @@ public class StatusChangeIC extends ValidatorEJB //implements StatusChangeLocal,
E12GenericUtility genericUtility = new E12GenericUtility();
AdmCommon adm = new AdmCommon();
FinCommon finCommon = new FinCommon();
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException, ITMException
{
Document dom = null;
......@@ -115,7 +115,7 @@ public class StatusChangeIC extends ValidatorEJB //implements StatusChangeLocal,
ArrayList<String> errList = new ArrayList<String>();
ArrayList<String> errFields = new ArrayList<String>();
Timestamp dateEffchg = null , tranDate = null , ldTrandateO = null , ldStatusDateX = null , ldProbDate = null ,
ldConfDate = null , reliveDate = null;
ldConfDate = null , reliveDate = null;
try
{
conn = getConnection();
......@@ -130,48 +130,169 @@ public class StatusChangeIC extends ValidatorEJB //implements StatusChangeLocal,
switch (currentFormNo)
{
case 1:
case 1:
{
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
for (int ctr = 0; ctr < childNodeListLength; ctr++)
{
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
for (int ctr = 0; ctr < childNodeListLength; ctr++)
childNode = childNodeList.item(ctr);
if (childNode.getNodeType() != Node.ELEMENT_NODE)
{
childNode = childNodeList.item(ctr);
if (childNode.getNodeType() != Node.ELEMENT_NODE)
continue;
}
childNodeName = childNode.getNodeName();
System.out.println("childNodeName.editFlag." + childNodeName + "@V@ Edit flag :-" + editFlag);
if("date__effchg".equalsIgnoreCase(childNodeName))
{
empCode = checkNull(genericUtility.getColumnValue("emp_code",dom));
dateEffchgStr = checkNull(genericUtility.getColumnValue("date__effchg",dom));
System.out.println("dateEffchgStr::::::::::::::::"+dateEffchgStr);
System.out.println("empCode::::::::::::::::"+empCode);
if(dateEffchgStr != null && dateEffchgStr.trim().length() > 0)
{
dateEffchg = Timestamp.valueOf(genericUtility.getValidDateString(dateEffchgStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
}
if(dateEffchgStr == null || dateEffchgStr.trim().length() == 0 )
{
errList.add("VTEMPSTS04"); //Effective date is blank, please specify effective date
errFields.add(childNodeName.toLowerCase());
}
else
{
sql = " select pay_site as ls_site from employee where emp_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
if(rs.next())
{
lsSite = checkNull(rs.getString("ls_site"));
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
if(dateEffchgStr != null && dateEffchgStr.trim().length() > 0)
{
errCode = checkNull(finCommon.nfCheckPeriod("ADM", dateEffchg, lsSite, conn));
}
else if(errCode != null && errCode.trim().length() > 0)
{
continue;
if("VTPRD2".equalsIgnoreCase(errCode))
{
errList.add("VTPRDTEMP1");//This is a temporary error for status change
errFields.add(childNodeName.toLowerCase());
}
else if("VTPRDADM".equalsIgnoreCase(errCode))
{
errList.add("VTPRDTEMP2");//Period status not defined for Admin
errFields.add(childNodeName.toLowerCase());
}
}
childNodeName = childNode.getNodeName();
System.out.println("childNodeName.editFlag." + childNodeName + "@V@ Edit flag :-" + editFlag);
}
else if("emp_code".equalsIgnoreCase(childNodeName))
{
System.out.println("empCode:::::::::"+empCode);
if("date__effchg".equalsIgnoreCase(childNodeName))
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
lsEmpcodeO = checkNull(genericUtility.getColumnValue("emp_code_orig", dom));
dateEffchgStr = checkNull(genericUtility.getColumnValue("date__effchg", dom));
tranDateStr = checkNull(genericUtility.getColumnValue("tran_date", dom));
ldTrandateOStr = checkNull(genericUtility.getColumnValue("tran_date_orig", dom));
if(dateEffchgStr != null && dateEffchgStr.trim().length() > 0)
{
empCode = checkNull(genericUtility.getColumnValue("emp_code",dom));
dateEffchgStr = checkNull(genericUtility.getColumnValue("date__effchg",dom));
System.out.println("dateEffchgStr::::::::::::::::"+dateEffchgStr);
System.out.println("empCode::::::::::::::::"+empCode);
dateEffchg = Timestamp.valueOf(genericUtility.getValidDateString(dateEffchgStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
}
if(tranDateStr != null && tranDateStr.trim().length() > 0)
{
tranDate = Timestamp.valueOf(genericUtility.getValidDateString(tranDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
}
if(ldTrandateOStr != null && ldTrandateOStr.trim().length() > 0)
{
ldTrandateO = Timestamp.valueOf(genericUtility.getValidDateString(ldTrandateOStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
}
System.out.println("dateEffchgStr:::::::::"+dateEffchgStr);
System.out.println("tranDateStr:::::::::"+tranDateStr);
System.out.println("ldTrandateOStr:::::::::"+ldTrandateOStr);
if(dateEffchgStr != null && dateEffchgStr.trim().length() > 0)
if(empCode == null || empCode.trim().length() == 0)
{
errList.add("VTEMPSTS05");//Employee code is blank, please specify employee code
errFields.add(childNodeName.toLowerCase());
}
else
{
liCnt = 0;
sql = "select confirmed, "
+ "probation, "
+ "probation_date, "
+ "date_conf, "
+ "1 as li_cnt "
+ "from "
+ "employee "
+ "where "
+ "emp_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
if(rs.next())
{
dateEffchg = Timestamp.valueOf(genericUtility.getValidDateString(dateEffchgStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
lsConfStatus = checkNull(rs.getString("confirmed"));
lsProbStatus = checkNull(rs.getString("probation"));
ldProbDate = rs.getTimestamp("probation_date");
ldConfDate = rs.getTimestamp("date_conf");
liCnt = rs.getInt("li_cnt");
}
if(dateEffchgStr == null || dateEffchgStr.trim().length() == 0 )
if (rs != null)
{
errList.add("VTEMPSTS04"); //Effective date is blank, please specify effective date
errFields.add(childNodeName.toLowerCase());
rs.close();
rs = null;
}
else
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
if(liCnt == 0)
{
errList.add("VTEMPSTS03");//Employee code entered does not existing in master, please enter valid employee code
errFields.add(childNodeName.toLowerCase());
}
else
{
liCnt = 0;
if("A".equalsIgnoreCase(editFlag))
{
sql = " select pay_site as ls_site from employee where emp_code = ? ";
sql = "select count(*) as li_cnt "
+ "from "
+ "emp_statuschg "
+ "where "
+ "emp_code = ? "
+ "and "
+ "case when confirm is null then 'N' else confirm end <> 'X' "
+ "and "
+ "tran_date = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
pstmt.setTimestamp(2, tranDate);
rs = pstmt.executeQuery();
if(rs.next())
{
lsSite = checkNull(rs.getString("ls_site"));
liCnt = rs.getInt("li_cnt");
}
if (rs != null)
{
......@@ -183,79 +304,34 @@ public class StatusChangeIC extends ValidatorEJB //implements StatusChangeLocal,
pstmt.close();
pstmt = null;
}
}
if(dateEffchgStr != null && dateEffchgStr.trim().length() > 0)
{
errCode = checkNull(finCommon.nfCheckPeriod("ADM", dateEffchg, lsSite, conn));
}
if(errCode != null && errCode.trim().length() > 0)
{
if("VTPRD2".equalsIgnoreCase(errCode))
{
errList.add("VTPRDTEMP1");//This is a temporary error for status change
errFields.add(childNodeName.toLowerCase());
}
else if("VTPRDADM".equalsIgnoreCase(errCode))
if(liCnt > 0)
{
errList.add("VTPRDTEMP2");//Period status not defined for Admin
errList.add("VTEMPSTS08");
errFields.add(childNodeName.toLowerCase());
}
}
}
else if("emp_code".equalsIgnoreCase(childNodeName))
{
System.out.println("empCode:::::::::"+empCode);
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
lsEmpcodeO = checkNull(genericUtility.getColumnValue("emp_code_orig", dom));
dateEffchgStr = checkNull(genericUtility.getColumnValue("date__effchg", dom));
tranDateStr = checkNull(genericUtility.getColumnValue("tran_date", dom));
ldTrandateOStr = checkNull(genericUtility.getColumnValue("tran_date_orig", dom));
if(dateEffchgStr != null && dateEffchgStr.trim().length() > 0)
{
dateEffchg = Timestamp.valueOf(genericUtility.getValidDateString(dateEffchgStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
}
if(tranDateStr != null && tranDateStr.trim().length() > 0)
{
tranDate = Timestamp.valueOf(genericUtility.getValidDateString(tranDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
}
if(ldTrandateOStr != null && ldTrandateOStr.trim().length() > 0)
{
ldTrandateO = Timestamp.valueOf(genericUtility.getValidDateString(ldTrandateOStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
}
System.out.println("dateEffchgStr:::::::::"+dateEffchgStr);
System.out.println("tranDateStr:::::::::"+tranDateStr);
System.out.println("ldTrandateOStr:::::::::"+ldTrandateOStr);
if(empCode == null || empCode.trim().length() == 0)
{
errList.add("VTEMPSTS05");//Employee code is blank, please specify employee code
errFields.add(childNodeName.toLowerCase());
}
else
else
{
liCnt = 0;
sql = "select confirmed, "
+ "probation, "
+ "probation_date, "
+ "date_conf, "
+ "1 as li_cnt "
+ "from "
+ "employee "
+ "where "
+ "emp_code = ? ";
sql = "select count(*) as li_cnt "
+ "from "
+ "emp_statuschg "
+ "where "
+ "emp_code = ? "
+ "and case when confirm is null then 'N' else confirm end <> 'X' "
+ "and tran_date = ? "
+ "and (emp_code <> ? or tran_date <> ?)";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
pstmt.setTimestamp(2, tranDate);
pstmt.setString(3, lsEmpcodeO);
pstmt.setTimestamp(4, ldTrandateO);
rs = pstmt.executeQuery();
if(rs.next())
{
lsConfStatus = checkNull(rs.getString("confirmed"));
lsProbStatus = checkNull(rs.getString("probation"));
ldProbDate = rs.getTimestamp("probation_date");
ldConfDate = rs.getTimestamp("date_conf");
liCnt = rs.getInt("li_cnt");
}
System.out.println("liCnt:::::::::"+liCnt);
if (rs != null)
{
rs.close();
......@@ -266,180 +342,104 @@ public class StatusChangeIC extends ValidatorEJB //implements StatusChangeLocal,
pstmt.close();
pstmt = null;
}
}
if(liCnt == 0)
{
errList.add("VTEMPSTS03");//Employee code entered does not existing in master, please enter valid employee code
errFields.add(childNodeName.toLowerCase());
}
else
{
liCnt = 0;
if("A".equalsIgnoreCase(editFlag))
if(liCnt > 0)
{
sql = "select count(*) as li_cnt "
+ "from "
+ "emp_statuschg "
+ "where "
+ "emp_code = ? "
+ "and "
+ "case when confirm is null then 'N' else confirm end <> 'X' "
+ "and "
+ "tran_date = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
pstmt.setTimestamp(2, tranDate);
rs = pstmt.executeQuery();
if(rs.next())
{
liCnt = rs.getInt("li_cnt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(liCnt > 0)
{
errList.add("VTEMPSTS08");
errFields.add(childNodeName.toLowerCase());
}
errList.add("VTEMPSTS08");
errFields.add(childNodeName.toLowerCase());
}
else
{
liCnt = 0;
sql = "select count(*) as li_cnt "
+ "from "
+ "emp_statuschg "
+ "where "
+ "emp_code = ? "
+ "and case when confirm is null then 'N' else confirm end <> 'X' "
+ "and tran_date = ? "
+ "and (emp_code <> ? or tran_date <> ?)";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
pstmt.setTimestamp(2, tranDate);
pstmt.setString(3, lsEmpcodeO);
pstmt.setTimestamp(4, ldTrandateO);
rs = pstmt.executeQuery();
if(rs.next())
{
liCnt = rs.getInt("li_cnt");
}
System.out.println("liCnt:::::::::"+liCnt);
if (rs != null)
if("A".equalsIgnoreCase(editFlag))
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(liCnt > 0)
{
errList.add("VTEMPSTS08");
errFields.add(childNodeName.toLowerCase());
}
else
{
if("A".equalsIgnoreCase(editFlag))
{
liCnt = 0;
sql = "select count(*) as li_cnt "
liCnt = 0;
sql = "select count(*) as li_cnt "
+ "from "
+ "emp_statuschg "
+ "where "
+ "emp_code = ? "
+ "and case when confirm is null then 'N' else confirm end = 'N' ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
if(rs.next())
{
liCnt = rs.getInt("li_cnt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
if(rs.next())
{
liCnt = rs.getInt("li_cnt");
}
else
if (rs != null)
{
liCnt = 0;
sql = "select count(*) as li_cnt "
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
else
{
liCnt = 0;
sql = "select count(*) as li_cnt "
+ "from "
+ "emp_statuschg "
+ "where "
+ "emp_code = ? "
+ "and case when confirm is null then 'N' else confirm end = 'N' "
+ "and (emp_code <> ? or tran_date <> ?)";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
pstmt.setString(2, lsEmpcodeO);
pstmt.setTimestamp(3, ldTrandateO);
rs = pstmt.executeQuery();
if(rs.next())
{
liCnt = rs.getInt("li_cnt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(liCnt > 0)
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
pstmt.setString(2, lsEmpcodeO);
pstmt.setTimestamp(3, ldTrandateO);
rs = pstmt.executeQuery();
if(rs.next())
{
liCnt = rs.getInt("li_cnt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(liCnt > 0)
{
errList.add("VTEMPSTS09");
errFields.add(childNodeName.toLowerCase());
}
else
{
lsStatusType = checkNull(genericUtility.getColumnValue("status_type", dom));
if("N".equalsIgnoreCase(lsProbStatus))
{
errList.add("VTEMPSTS09");
errFields.add(childNodeName.toLowerCase());
lsStatusTypeX = "P";
ldStatusDateX = ldProbDate;
}
else
{
lsStatusType = checkNull(genericUtility.getColumnValue("status_type", dom));
if("N".equalsIgnoreCase(lsProbStatus))
if("Y".equalsIgnoreCase(lsProbStatus) && "N".equalsIgnoreCase(lsConfStatus))
{
lsStatusTypeX = "P";
ldStatusDateX = ldProbDate;
}
else
{
if("Y".equalsIgnoreCase(lsProbStatus) && "N".equalsIgnoreCase(lsConfStatus))
{
lsStatusTypeX = "C";
ldStatusDateX = ldConfDate;
}
lsStatusTypeX = "C";
ldStatusDateX = ldConfDate;
}
}
if(!lsStatusTypeX.equalsIgnoreCase(lsStatusType))
{
errList.add("VTEMPSTS10");
errFields.add(childNodeName.toLowerCase());
}
else
}
if(!lsStatusTypeX.equalsIgnoreCase(lsStatusType))
{
errList.add("VTEMPSTS10");
errFields.add(childNodeName.toLowerCase());
}
else
{
if("A".equalsIgnoreCase(editFlag))
{
if("A".equalsIgnoreCase(editFlag))
{
liCnt = 0;
sql = "select count(*) as li_cnt "
liCnt = 0;
sql = "select count(*) as li_cnt "
+ "from "
+ "emp_statuschg "
+ "where "
......@@ -447,278 +447,197 @@ public class StatusChangeIC extends ValidatorEJB //implements StatusChangeLocal,
+ "and "
+ "tran_date >= ? "
+ "and case when confirm is null then 'N' else confirm end <> 'X'";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
pstmt.setTimestamp(2, tranDate);
rs = pstmt.executeQuery();
if(rs.next())
{
liCnt = rs.getInt("li_cnt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
pstmt.setTimestamp(2, tranDate);
rs = pstmt.executeQuery();
if(rs.next())
{
liCnt = rs.getInt("li_cnt");
}
if (rs != null)
{
rs.close();
rs = null;
}
else
if (pstmt != null)
{
liCnt = 0;
sql = "select count(*) as li_cnt "
pstmt.close();
pstmt = null;
}
}
else
{
liCnt = 0;
sql = "select count(*) as li_cnt "
+ "from "
+ "emp_statuschg "
+ "where emp_code = ? "
+ "and tran_date >= ? "
+ "and case when confirm is null then 'N' else confirm end <> 'X' "
+ "and (emp_code <> ? or tran_date <> ?)";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
pstmt.setTimestamp(2, tranDate);
pstmt.setString(3, lsEmpcodeO);
pstmt.setTimestamp(4, ldTrandateO);
rs = pstmt.executeQuery();
if(rs.next())
{
liCnt = rs.getInt("li_cnt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
pstmt.setTimestamp(2, tranDate);
pstmt.setString(3, lsEmpcodeO);
pstmt.setTimestamp(4, ldTrandateO);
rs = pstmt.executeQuery();
if(rs.next())
{
liCnt = rs.getInt("li_cnt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if(liCnt == 0)
if (pstmt != null)
{
sql = "select "
pstmt.close();
pstmt = null;
}
}
if(liCnt == 0)
{
sql = "select "
+ "emp_site as ls_site "
+ "from "
+ "employee "
+ "where "
+ "emp_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
if(rs.next())
{
lsSite = rs.getString("ls_site");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(lsSite != null && lsSite.trim().length() > 0)
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
if(rs.next())
{
lsSite = rs.getString("ls_site");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(lsSite != null && lsSite.trim().length() > 0)
{
errCode = adm.gbfEmp(empCode, dateEffchg, lsSite, loginSite, conn);
System.out.println("error Code is ====" + errCode);
if(errCode != null && errCode.trim().length() > 0)
{
errCode = adm.gbfEmp(empCode, dateEffchg, lsSite, loginSite, conn);
System.out.println("error Code is ====" + errCode);
if(errCode != null && errCode.trim().length() > 0)
{
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
sql = "select "
}
sql = "select "
+ "confirmed "
+ "from "
+ "employee "
+ "where "
+ "emp_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
if(rs.next())
{
confirmed = rs.getString("confirmed");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if("Y".equalsIgnoreCase(confirmed))
{
errList.add("VMEMP3");
errFields.add(childNodeName.toLowerCase());
}
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
if(rs.next())
{
confirmed = rs.getString("confirmed");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
else
if("Y".equalsIgnoreCase(confirmed))
{
errList.add("VDEMP1");
errList.add("VMEMP3");
errFields.add(childNodeName.toLowerCase());
}
}
else
{
errList.add("VDEMP1");
errFields.add(childNodeName.toLowerCase());
}
}
}
}
}
}
else if("extend".equalsIgnoreCase(childNodeName))
{
extend = checkNull(genericUtility.getColumnValue("extend", dom));
dateEffchgStr = checkNull(genericUtility.getColumnValue("date__effchg", dom));
dateDueChgStr = checkNull(genericUtility.getColumnValue("date__due_chg", dom));
if(dateEffchgStr != null && dateEffchgStr.trim().length() > 0)
{
dateEffchg = Timestamp.valueOf(genericUtility.getValidDateString(dateEffchgStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
}
else if("extend".equalsIgnoreCase(childNodeName))
{
extend = checkNull(genericUtility.getColumnValue("extend", dom));
dateEffchgStr = checkNull(genericUtility.getColumnValue("date__effchg", dom));
dateDueChgStr = checkNull(genericUtility.getColumnValue("date__due_chg", dom));
}
if(dateDueChgStr != null && dateDueChgStr.trim().length() > 0)
{
dateDue = Timestamp.valueOf(genericUtility.getValidDateString(dateDueChgStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
if(dateEffchgStr != null && dateEffchgStr.trim().length() > 0)
{
dateEffchg = Timestamp.valueOf(genericUtility.getValidDateString(dateEffchgStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
}
if("N".equalsIgnoreCase(extend))
{
if((dateEffchg != null && dateDue != null) && dateEffchg.before(dateDue))
{
errList.add("VMDATE20");//effective date can not be prior to due date
errFields.add(childNodeName.toLowerCase());
}
else if("Y".equalsIgnoreCase(extend))
{
lcMonthsStr = checkNull(genericUtility.getColumnValue("months_extend", dom));
try
{
lcMonths = Integer.parseInt(lcMonthsStr);
}
catch(Exception e)
{
lcMonths = 0;
}
if(lcMonths <= 0)
{
errList.add("VTEXT");//Extend Months cannot be zero or negative
errFields.add(childNodeName.toLowerCase());
}
}
}
}
else if("emp_code__aprv".equalsIgnoreCase(childNodeName))
if(dateDueChgStr != null && dateDueChgStr.trim().length() > 0)
{
empCodeAprv = checkNull(genericUtility.getColumnValue("emp_code__aprv", dom));
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
if(empCodeAprv != null && empCodeAprv.trim().length() > 0)
{
sql = "select count(*) as cnt , "
+ "RELIEVE_DATE "
+ "from "
+ "employee "
+ "where "
+ "emp_code = ? group by RELIEVE_DATE";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt("cnt");
reliveDate = rs.getTimestamp("RELIEVE_DATE");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
if((cnt == 0))
{
errList.add("VMEMP1");
errFields.add(childNodeName.toLowerCase());
}
if(reliveDate != null)
{
errList.add("VMEMPV");
errFields.add(childNodeName.toLowerCase());
}
if(empCodeAprv.equalsIgnoreCase(empCode))
{
errList.add("VMEMP4");
errFields.add(childNodeName.toLowerCase());
}
dateDue = Timestamp.valueOf(genericUtility.getValidDateString(dateDueChgStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
}
else if("design_code".equalsIgnoreCase(childNodeName))
if("N".equalsIgnoreCase(extend))
{
designCode = checkNull(genericUtility.getColumnValue("design_code", dom));
if(designCode == null || designCode.trim().length() == 0)
if((dateEffchg != null && dateDue != null) && dateEffchg.before(dateDue))
{
errList.add("VMDESIGN2");
errList.add("VMDATE20");//effective date can not be prior to due date
errFields.add(childNodeName.toLowerCase());
}
else
else if("Y".equalsIgnoreCase(extend))
{
cnt = 0;
sql = "select count(*) as cnt "
+ "from "
+ "designation "
+ "where "
+ "design_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, designCode);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt("cnt");
}
if (rs != null)
lcMonthsStr = checkNull(genericUtility.getColumnValue("months_extend", dom));
try
{
rs.close();
rs = null;
lcMonths = Integer.parseInt(lcMonthsStr);
}
if (pstmt != null)
catch(Exception e)
{
pstmt.close();
pstmt = null;
lcMonths = 0;
}
if(cnt == 0)
if(lcMonths <= 0)
{
errList.add("VMDESIGN");
errList.add("VTEXT");//Extend Months cannot be zero or negative
errFields.add(childNodeName.toLowerCase());
}
}
sql = "select "
+ "status "
+ "from "
+ "designation "
+ "where "
+ "design_code = ?";
}
}
else if("emp_code__aprv".equalsIgnoreCase(childNodeName))
{
empCodeAprv = checkNull(genericUtility.getColumnValue("emp_code__aprv", dom));
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
if(empCodeAprv != null && empCodeAprv.trim().length() > 0)
{
sql = "select count(*) as cnt , "
+ "RELIEVE_DATE "
+ "from "
+ "employee "
+ "where "
+ "emp_code = ? group by RELIEVE_DATE";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, designCode);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
if(rs.next())
{
status = rs.getString("status");
cnt = rs.getInt("cnt");
reliveDate = rs.getTimestamp("RELIEVE_DATE");
}
if (rs != null)
{
......@@ -730,24 +649,43 @@ public class StatusChangeIC extends ValidatorEJB //implements StatusChangeLocal,
pstmt.close();
pstmt = null;
}
if(!"A".equalsIgnoreCase(status))
{
errList.add("VTDGINAC");
errFields.add(childNodeName.toLowerCase());
}
}
else if("cadre_code".equalsIgnoreCase(childNodeName))
if((cnt == 0))
{
errList.add("VMEMP1");
errFields.add(childNodeName.toLowerCase());
}
if(reliveDate != null)
{
errList.add("VMEMPV");
errFields.add(childNodeName.toLowerCase());
}
if(empCodeAprv.equalsIgnoreCase(empCode))
{
errList.add("VMEMP4");
errFields.add(childNodeName.toLowerCase());
}
}
else if("design_code".equalsIgnoreCase(childNodeName))
{
designCode = checkNull(genericUtility.getColumnValue("design_code", dom));
if(designCode == null || designCode.trim().length() == 0)
{
errList.add("VMDESIGN2");
errFields.add(childNodeName.toLowerCase());
}
else
{
cnt = 0;
cadreCode = checkNull(genericUtility.getColumnValue("cadre_code", dom));
sql = "select "
+ "count(*) as cnt "
+ "from "
+ "cadre "
+ "where "
+ "cadre_code = ?";
sql = "select count(*) as cnt "
+ "from "
+ "designation "
+ "where "
+ "design_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, cadreCode);
pstmt.setString(1, designCode);
rs = pstmt.executeQuery();
if(rs.next())
{
......@@ -765,22 +703,132 @@ public class StatusChangeIC extends ValidatorEJB //implements StatusChangeLocal,
}
if(cnt == 0)
{
errList.add("VMCAD1");//err = "Invalid cadre code, not defined in master"
errList.add("VMDESIGN");
errFields.add(childNodeName.toLowerCase());
}
}
else if("grade_code".equalsIgnoreCase(childNodeName))
sql = "select "
+ "status "
+ "from "
+ "designation "
+ "where "
+ "design_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, designCode);
rs = pstmt.executeQuery();
if(rs.next())
{
status = rs.getString("status");
}
if (rs != null)
{
cnt = 0;
gradeCode = checkNull(genericUtility.getColumnValue("grade_code", dom));
sql = "select "
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(!"A".equalsIgnoreCase(status))
{
errList.add("VTDGINAC");
errFields.add(childNodeName.toLowerCase());
}
}
else if("cadre_code".equalsIgnoreCase(childNodeName))
{
cnt = 0;
cadreCode = checkNull(genericUtility.getColumnValue("cadre_code", dom));
sql = "select "
+ "count(*) as cnt "
+ "from "
+ "cadre "
+ "where "
+ "cadre_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, cadreCode);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt("cnt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt == 0)
{
errList.add("VMCAD1");//err = "Invalid cadre code, not defined in master"
errFields.add(childNodeName.toLowerCase());
}
}
else if("grade_code".equalsIgnoreCase(childNodeName))
{
cnt = 0;
gradeCode = checkNull(genericUtility.getColumnValue("grade_code", dom));
sql = "select "
+ "count(*) as cnt "
+ "from "
+ "grade "
+ "where "
+ "grade_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, gradeCode);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt("cnt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt == 0)
{
errList.add("VMGRA1");//err = "Invalid grade code, not defined in master"
errFields.add(childNodeName.toLowerCase());
}
}
else if("reason_code".equalsIgnoreCase(childNodeName))
{
cnt = 0;
reasonCode = checkNull(genericUtility.getColumnValue("reason_code", dom));
if(reasonCode == null || reasonCode.trim().length() == 0)
{
errList.add("VTEMPSTS06");
errFields.add(childNodeName.toLowerCase());
}
else
{
cnt = 0;
statusType = checkNull(genericUtility.getColumnValue("status_type", dom));
extend = checkNull(genericUtility.getColumnValue("extend", dom));
sql = "select count(1) as cnt "
+ "from "
+ "gencodes "
+ "where "
+ "fld_name = 'REASON_CODE' "
+ "and "
+ "mod_name in ('W_EMP_STATUS') "
+ "and case when active is null then 'Y' else active end = 'Y' "
+ "and fld_value = ? and udf_str1 = ? and udf_str2 = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, gradeCode);
pstmt.setString(1, reasonCode);
pstmt.setString(2, statusType);
pstmt.setString(3, extend);
rs = pstmt.executeQuery();
if(rs.next())
{
......@@ -798,99 +846,53 @@ public class StatusChangeIC extends ValidatorEJB //implements StatusChangeLocal,
}
if(cnt == 0)
{
errList.add("VMGRA1");//err = "Invalid grade code, not defined in master"
errList.add("VTEMPSTS07");
errFields.add(childNodeName.toLowerCase());
}
}
else if("reason_code".equalsIgnoreCase(childNodeName))
}
else if("notice_prd".equalsIgnoreCase(childNodeName))
{
lcNoticePrd = genericUtility.getColumnValue("notice_prd", dom);
try
{
cnt = 0;
reasonCode = checkNull(genericUtility.getColumnValue("reason_code", dom));
if(reasonCode == null || reasonCode.trim().length() == 0)
{
errList.add("VTEMPSTS06");
errFields.add(childNodeName.toLowerCase());
}
else
{
cnt = 0;
statusType = checkNull(genericUtility.getColumnValue("status_type", dom));
extend = checkNull(genericUtility.getColumnValue("extend", dom));
sql = "select count(1) as cnt "
+ "from "
+ "gencodes "
+ "where "
+ "fld_name = 'REASON_CODE' "
+ "and "
+ "mod_name in ('W_EMP_STATUS') "
+ "and case when active is null then 'Y' else active end = 'Y' "
+ "and fld_value = ? and udf_str1 = ? and udf_str2 = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, statusType);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt("cnt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt == 0)
{
errList.add("VTEMPSTS07");
errFields.add(childNodeName.toLowerCase());
}
}
noticePrd = Integer.parseInt(lcNoticePrd);
}
else if("notice_prd".equalsIgnoreCase(childNodeName))
catch(Exception e)
{
lcNoticePrd = genericUtility.getColumnValue("notice_prd", dom);
try
{
noticePrd = Integer.parseInt(lcNoticePrd);
}
catch(Exception e)
{
errList.add("VTEMPSTS13");// Please enter proper value
errFields.add(childNodeName.toLowerCase());
}
if(noticePrd < 0)
{
errList.add("VTEMPSTS11");
errFields.add(childNodeName.toLowerCase());
}
errList.add("VTEMPSTS13");// Please enter proper value
errFields.add(childNodeName.toLowerCase());
}
else if("months_extend".equalsIgnoreCase(childNodeName))
if(noticePrd < 0)
{
monthsExtend1 = genericUtility.getColumnValue("months_extend", dom);
System.out.println("months_extend :: ["+monthsExtend1+"]");
try
{
monthsExtend = Integer.parseInt(monthsExtend1);
}
catch(Exception e)
{
errList.add("VTEMPSTS13");// Please enter proper value
errFields.add(childNodeName.toLowerCase());
}
}
if(monthsExtend < 0)
{
errList.add("VTEMPSTS12");
errFields.add(childNodeName.toLowerCase());
}
errList.add("VTEMPSTS11");
errFields.add(childNodeName.toLowerCase());
}
}
else if("months_extend".equalsIgnoreCase(childNodeName))
{
monthsExtend1 = genericUtility.getColumnValue("months_extend", dom);
System.out.println("months_extend :: ["+monthsExtend1+"]");
try
{
monthsExtend = Integer.parseInt(monthsExtend1);
}
catch(Exception e)
{
errList.add("VTEMPSTS13");// Please enter proper value
errFields.add(childNodeName.toLowerCase());
}
}
if(monthsExtend < 0)
{
errList.add("VTEMPSTS12");
errFields.add(childNodeName.toLowerCase());
}
}
}
}
System.out.println("errStringXml.toString()---1= "+errStringXml.toString());
if (errList != null && errList.size() > 0)
{
......@@ -1012,7 +1014,7 @@ public class StatusChangeIC extends ValidatorEJB //implements StatusChangeLocal,
String confirmed = "";
String probation = "";
String noticePrd = "";
String grade = "";
String cadre = "";
String designCode = "";
......@@ -1025,7 +1027,9 @@ public class StatusChangeIC extends ValidatorEJB //implements StatusChangeLocal,
String lsDesignCode = "";
String lsDesignation = "";
String lsEligibleOt = "";
String tranDate = "";
//String tranDate = "";
String tranDateStr = "";
Timestamp tranDate = null;
String extend = "";
String gradeCode = "";
String cadreCode = "";
......@@ -1040,7 +1044,7 @@ public class StatusChangeIC extends ValidatorEJB //implements StatusChangeLocal,
StringBuffer valueXmlString = null;
SimpleDateFormat sdf = null;
//Added by Shital on 13/12/2019 [End]
try
{
conn = getConnection();
......@@ -1062,42 +1066,44 @@ public class StatusChangeIC extends ValidatorEJB //implements StatusChangeLocal,
if("itm_default".equalsIgnoreCase(currentColumn))
{
System.out.println("Inside item default ===========");
monthsExtend = checkNull(genericUtility.getColumnValue("months_extend", dom));
System.out.println("tranDateStr####"+tranDateStr);
System.out.println("months_extend :: ["+monthsExtend+"]");
valueXmlString.append("<extend>").append("<![CDATA[N]]>").append("</extend>");
valueXmlString.append("<tran_date><![CDATA[").append(sdf.format(new java.util.Date())).append("]]></tran_date>\r\n");
//valueXmlString.append("<tran_date>").append(tranDateStr).append("</tran_date>");
valueXmlString.append("<months_extend protect='1'>").append("<![CDATA[" + monthsExtend + "]]>").append("</months_extend>\r\n");
valueXmlString.append("<confirm>").append("<![CDATA[N]]>").append("</confirm>");
valueXmlString.append("<notice_prd>").append("<![CDATA[0]]>").append("</notice_prd>");
}
else if("emp_code".equalsIgnoreCase(currentColumn))
{
empCode = genericUtility.getColumnValue("emp_code", dom);
System.out.println("::::::::::inside emp_code ITEMCHANGED::::::::"+empCode);
sql = "select "
+ "emp_lname ,"
+ "emp_fname ,"
+ "confirmed ,"
+ "probation ,"
+ "probation_date ,"
+ "date_conf ,"
+ "notice_prd , "
+ "date_join ,"
+ "grade ,"
+ "cadre ,"
+ "design_code ,"
+ "designation , "
+ "case when eligible_ot is null then 'N' else eligible_ot end , "
+ "emp_fname_long , "
+ "emp_lname_long "
+ "from "
+ "employee "
+ "where "
+ "emp_code = ?";
+ "emp_lname ,"
+ "emp_fname ,"
+ "confirmed ,"
+ "probation ,"
+ "probation_date ,"
+ "date_conf ,"
+ "notice_prd , "
+ "date_join ,"
+ "grade ,"
+ "cadre ,"
+ "design_code ,"
+ "designation , "
+ "case when eligible_ot is null then 'N' else eligible_ot end , "
+ "emp_fname_long , "
+ "emp_lname_long "
+ "from "
+ "employee "
+ "where "
+ "emp_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
......@@ -1155,7 +1161,7 @@ public class StatusChangeIC extends ValidatorEJB //implements StatusChangeLocal,
empLname = lsEmpLnameLong;
}
System.out.println("probationDate:["+probationDate+"] \t dateConf["+dateConf+"] \t ldJoinDate["+ldJoinDate+"]");
//Added by Shital on 13/12/2019 [Start]
if(ldJoinDate != null )
{
......@@ -1166,7 +1172,7 @@ public class StatusChangeIC extends ValidatorEJB //implements StatusChangeLocal,
{
ldJoinDateStr = "";
}
if(probationDate != null )
{
probationDateStr = sdf.format(probationDate);
......@@ -1176,7 +1182,7 @@ public class StatusChangeIC extends ValidatorEJB //implements StatusChangeLocal,
{
probationDateStr = "";
}
if(dateConf != null )
{
dateConfStr = sdf.format(dateConf);
......@@ -1186,7 +1192,8 @@ public class StatusChangeIC extends ValidatorEJB //implements StatusChangeLocal,
{
dateConfStr = "";
}
//Added by Shital on 13/12/2019 [End]
/*if(probationDateStr != null && probationDateStr.trim().length() > 0)
{
probationDateStr = genericUtility.getValidDateString(probationDateStr,"yyyy-MM-dd", genericUtility.getApplDateFormat());
......@@ -1206,7 +1213,7 @@ public class StatusChangeIC extends ValidatorEJB //implements StatusChangeLocal,
{
dateConfStr = "";
}*/
/*if(ldJoinDateStr != null && ldJoinDateStr.trim().length() > 0)
{
ldJoinDate = (Timestamp) sdf.parse(ldJoinDateStr);
......@@ -1251,11 +1258,12 @@ public class StatusChangeIC extends ValidatorEJB //implements StatusChangeLocal,
{
if("Y".equalsIgnoreCase(probation) && "N".equalsIgnoreCase(confirmed))
{
System.out.println("dateConfStr111111111"+dateConfStr);
valueXmlString.append("<status_type>").append("<![CDATA[C]]>").append("</status_type>");
valueXmlString.append("<date__due_chg>").append("<![CDATA[" + dateConfStr + "]]>").append("</date__due_chg>");
valueXmlString.append("<date__effchg>").append("<![CDATA[" + dateConfStr + "]]>").append("</date__effchg>");
}
System.out.println("dateConfStr111111111"+dateConfStr);
}
if("A".equalsIgnoreCase(editFlag))
{
......@@ -1264,14 +1272,19 @@ public class StatusChangeIC extends ValidatorEJB //implements StatusChangeLocal,
}
else if("tran_date".equalsIgnoreCase(currentColumn))
{
System.out.println("::::: Inside Tran_Date :::::");
if("A".equalsIgnoreCase(editFlag))
{
tranDate = checkNull(genericUtility.getColumnValue("tran_date", dom));
valueXmlString.append("<tran_date_orig>").append("<![CDATA[" + tranDate + "]]>").append("</tran_date_orig>");
//tranDate = checkNull(genericUtility.getColumnValue("tran_date", dom));
tranDateStr = checkNull(genericUtility.getColumnValue("tran_date", dom));
valueXmlString.append("<tran_date_orig><![CDATA[").append(tranDateStr).append("]]></tran_date_orig>\r\n");
//valueXmlString.append("<tran_date_orig>").append("<![CDATA[" + tranDate + "]]>").append("</tran_date_orig>");
}
System.out.println("tranDateStr=========="+tranDateStr);
}
else if("extend".equalsIgnoreCase(currentColumn))
{
System.out.println("=====extend====");
extend = checkNull(genericUtility.getColumnValue("extend", dom));
monthsExtend = checkNull(genericUtility.getColumnValue("months_extend", dom));
if("N".equalsIgnoreCase(extend))
......@@ -1288,11 +1301,11 @@ public class StatusChangeIC extends ValidatorEJB //implements StatusChangeLocal,
{
gradeCode = checkNull(genericUtility.getColumnValue("grade_code", dom));
sql = "select "
+ "cadre_code "
+ "from "
+ "grade "
+ "where "
+ "grade_code = ?";
+ "cadre_code "
+ "from "
+ "grade "
+ "where "
+ "grade_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, gradeCode);
rs = pstmt.executeQuery();
......@@ -1316,11 +1329,11 @@ public class StatusChangeIC extends ValidatorEJB //implements StatusChangeLocal,
{
designCode = checkNull(genericUtility.getColumnValue("design_code", dom));
sql = "select "
+ "designation "
+ "from "
+ "designation "
+ "where "
+ "design_code = ?";
+ "designation "
+ "from "
+ "designation "
+ "where "
+ "design_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, designCode);
rs = pstmt.executeQuery();
......@@ -1349,11 +1362,11 @@ public class StatusChangeIC extends ValidatorEJB //implements StatusChangeLocal,
reasonCode = "";
}
sql = "select "
+ "descr from gencodes "
+ "where fld_name = 'REASON_CODE' "
+ "and mod_name in ('W_EMP_STATUS') "
+ "and case when active is null then 'Y' else active end = 'Y' "
+ "and fld_value = ?";
+ "descr from gencodes "
+ "where fld_name = 'REASON_CODE' "
+ "and mod_name in ('W_EMP_STATUS') "
+ "and case when active is null then 'Y' else active end = 'Y' "
+ "and fld_value = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, designCode);
rs = pstmt.executeQuery();
......@@ -1373,8 +1386,8 @@ public class StatusChangeIC extends ValidatorEJB //implements StatusChangeLocal,
}
valueXmlString.append("<reason_code_descr>").append("<![CDATA[" + reasonCodeDescr + "]]>").append("</reason_code_descr>");
}
}
valueXmlString.append("</Detail1>");
break;
......
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