Commit f0ea08be authored by vvengurlekar's avatar vvengurlekar

EmployeeEJB.java - Changes committed for nationality


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@203840 ce508802-f39f-4f6c-b175-0d175dae99d5
parent f856c582
......@@ -7,6 +7,13 @@
package ibase.webitm.ejb.adm;
//import ibase.system.config.*;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.*;
//import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
//import jxl.write.DateTime;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
......@@ -29,13 +36,13 @@ import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import ibase.system.config.ConnDriver;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB;
//import bsh.util.Util;
//import ibase.system.config.ConnDriver;
//import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.ejb.sys.UtilMethods;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
//import ibase.webitm.utility.GenericUtility;
//import ibase.webitm.utility.ITMException;
//import com.sun.org.apache.xalan.internal.xsltc.compiler.Pattern;
......@@ -134,7 +141,7 @@ public class EmployeeEJB extends ValidatorEJB implements EmployeeEJBLocal,Employ
ArrayList<String> errFields = new ArrayList<String>();
try
{
ConnDriver connDriver = new ConnDriver();
//ConnDriver connDriver = new ConnDriver();
//Modified by Anjali R. on [30/05/2019][Start]
//conn = connDriver.getConnectDB("DriverITM");
conn = getConnection();
......@@ -145,8 +152,11 @@ public class EmployeeEJB extends ValidatorEJB implements EmployeeEJBLocal,Employ
// Modified by Yashwant on 26/06/2019.Start
ITMDBAccessEJB itmdbAccessEJB=new ITMDBAccessEJB();
// Modified by Yashwant on 26/06/2019.End
GenericUtility genericUtility = GenericUtility.getInstance();
//Modified by Yashwant on 26/06/2019.Start
E12GenericUtility genericUtility = new E12GenericUtility();
//GenericUtility genericUtility = GenericUtility.getInstance();
//Modified by Yashwant on 26/06/2019.End
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
SimpleDateFormat dbsdf = new SimpleDateFormat(genericUtility.getDBDateFormat());
if(editFlag == null || editFlag.trim().length() == 0)
......@@ -2788,7 +2798,7 @@ public class EmployeeEJB extends ValidatorEJB implements EmployeeEJBLocal,Employ
errCode = (String)errList.get(i);
errFldName = (String)errFields.get(i);
System.out.println("errCode .........."+errCode);
errString = itmdbAccessEJB.getErrorString(errFldName, errCode, userId, "", conn);
//errString = getErrorString( errFldName, errCode, userId );
System.out.println("errString is : ::::>>>> " + errString);
msgType = errorType( conn , errCode );
......@@ -2857,7 +2867,10 @@ public class EmployeeEJB extends ValidatorEJB implements EmployeeEJBLocal,Employ
Document dom1 = null;
Document dom2 = null;
String errString = null;
GenericUtility genericUtility = GenericUtility.getInstance();
//Modified by Yashwant on 26/06/2019.Start
E12GenericUtility genericUtility = new E12GenericUtility();
//GenericUtility genericUtility = GenericUtility.getInstance();
//Modified by Yashwant on 26/06/2019.End
try
{
System.out.println("EmployeeEJB:itemChanged value of xmlString ["+xmlString+"]");
......@@ -2897,7 +2910,10 @@ public class EmployeeEJB extends ValidatorEJB implements EmployeeEJBLocal,Employ
int currentFormNo = 0;
StringBuffer valueXmlString =null;
GenericUtility genericUtility = GenericUtility.getInstance();
//Modified by Yashwant on 26/06/2019.Start
E12GenericUtility genericUtility = new E12GenericUtility();
//GenericUtility genericUtility = GenericUtility.getInstance();
//Modified by Yashwant on 26/06/2019.End
String code="";
String addDate="";
......@@ -2913,17 +2929,31 @@ public class EmployeeEJB extends ValidatorEJB implements EmployeeEJBLocal,Employ
String columnValue = "";
String childNodeName = null,childNodeValue = null;
int ctr=0,childNodeListLength =0,cnt =0;
int countProb=0;
int countConf=0;
String reportToAdmin = "",empLname = "",empFname = "",noticePrd="";
String contactCode = "",contactName = "",desgnCode="",curAdd2="",conCity="",perTel="",curAdd3="";
String deptName ="",deptCode ="",cadreCode ="",cadreName ="",gradeCode ="",gradeName ="",lname="",fname="";
String empSite ="",empSiteName ="",workSiteName ="",workSite ="",designation="",sex="",reportTo="";
String paySite ="",paySiteName ="",stanCodeHq ="",perState="",probationFlag="",curTel1="",confirmedFlag="";
String stanCodeHqName ="",curAdd1="",perAdd1="",empCode="",joinedAs="",curCity="",curState="",curPin="";
String stanCodeHqName ="",curAdd1="",perAdd1="",empCode="",joinedAs="",curCity="",curState="",lsState="",curPin="";
String probation="",confirmed="",trainPrd="",probPrd="",joinDate="",probDate="",payMode="",empClass="";
String empCodeHOD="",occuCode="",posCode="",drivLicNo="",phyHandicap="",funcGroup="",parentDept="";
String gratNominee="",seqNo="",pfNominee="",penNominee="",gratPerc="",pfPerc="",qlfCode="",penPerc="",bankCode="";
String gs_runmode = "I",mName="";
String sql = "",editFlg="",loginSite="";
String mcode="";
String mval1="";
int mval2=0;
String addr1 = "" , addr2 = "" , addr3 = "" , city = "" , pin = "",stateCode="" ;
String tel1 = "" , tel2 = "" , tel3 = "" , curAdr1 = "" , peAdr1 = "";
String shname = "" , contactPers = "";
String shName="";
String contPers="";
String shiftRot="";
//Modified by Azhar K. on 19/April/2019[To Trim Column name and value of employee name to process validation][Start]
String value = "", newColumn = "";
//Modified by Azhar K. on 19/April/2019[To Trim Column name and value of employee name to process validation][End]
......@@ -2932,7 +2962,7 @@ public class EmployeeEJB extends ValidatorEJB implements EmployeeEJBLocal,Employ
PreparedStatement pstmt = null, pstmt1=null;
Connection connection = null;
ConnDriver connDriver = null;
//ConnDriver connDriver = null;
//Modified by Rohini T on 27/March/2019[Req ID:A18KSUN005][start]
String retirementDateVarVal = "";
......@@ -2975,7 +3005,7 @@ public class EmployeeEJB extends ValidatorEJB implements EmployeeEJBLocal,Employ
{
currentFormNo = Integer.parseInt(objContext);
}
connDriver = new ConnDriver();
//connDriver = new ConnDriver();
//Modified by Anjali R. on [30/05/2019][Start]
//connection = connDriver.getConnectDB("Driver");
......@@ -3004,7 +3034,46 @@ public class EmployeeEJB extends ValidatorEJB implements EmployeeEJBLocal,Employ
valueXmlString.append("<confirmed protect=\"1\">").append("<![CDATA[N]]>").append("</confirmed>");
//Modified by Ahmed on 23/AUG/2016[A16ESUN005][To set confirmed column as N and non-editable in add mode][end]
//Added by Sana to set name_prefix , basic , gross , salary with_held on itm_default][Start]
valueXmlString.append("<nationality>").append("<![CDATA[IND]]>").append("</nationality>");
//Modified by Yashwant on 03/07/2019[start]
String mdescr=admCommon.getEnv("999999", "NATIONAL", connection);
if(mdescr!=null && mdescr.trim().length()>0)
{
valueXmlString.append("<nationality>").append(mdescr).append("</nationality>");
//valueXmlString.append("<nationality>").append("<![CDATA[IND]]>").append("</nationality>");
}
valueXmlString.append("<m_status>").append("<![CDATA[U]]>").append("</m_status>");
String EmpRetAge=admCommon.getEnv("999999", "EMP_RETIREMENT_AGE", connection);
if(EmpRetAge == null || EmpRetAge.trim().length() == 0 ||EmpRetAge.equalsIgnoreCase("NULLFOUND"))
{
EmpRetAge = "0";
}
int maval1=Integer.parseInt(EmpRetAge);
if(maval1 <=0 )
{
maval1=0;
}
if(maval1 <=100)
{
maval1=maval1*12;
}
valueXmlString.append("<retirement_age>").append(maval1).append("</retirement_age>");
String protect= gbfGetRetdateProtectFlag(dom);
valueXmlString.append("<retirement_date protect=\""+protect+"\"><![CDATA[").append("]]></retirement_date>\r\n");
//gbf_itemchg_modifier_ds(dw_edit,"retirement_date","protect", gbf_get_retdate_protect_flag())
//Modified by Yashwant on 03/07/2019[End]
valueXmlString.append("<pay_mode>").append("<![CDATA[C]]>").append("</pay_mode>");
valueXmlString.append("<name_prefix>").append("<![CDATA[" ).append("Mr").append( "]]>").append("</name_prefix>");
valueXmlString.append("<basic>").append("<![CDATA[0.00]]>").append("</basic>");
......@@ -3257,9 +3326,318 @@ public class EmployeeEJB extends ValidatorEJB implements EmployeeEJBLocal,Employ
valueXmlString.append("<cur_state protect=\"1\">").append("<![CDATA[" + presentState + "]]>").append("</cur_state>");
}
//Modified by Ahmed on 30/AUG/2016[A16ESUN005][To set contact_state and present state field as non-editable in edit mode][ENd]
}
// Modified by Yashwant on 05/07/2019[start]
String nationality=genericUtility.getColumnValue("nationality", dom2);
if(nationality ==null)
{
String mdescr=admCommon.getEnv("999999", "NATIONAL", connection);
if(mdescr!=null && mdescr.trim().length()>0)
{
valueXmlString.append("<nationality>").append(mdescr).append("</nationality>");
}
}
contactCode=genericUtility.getColumnValue("contactCode", dom2);
if(contactCode !=null && contactCode.trim().length()>0)
{
sql="select addr1, addr2, addr3, city, state_code, pin, tele1, tele2, tele3, sh_name, cont_pers from contact where contact_code =?";
pstmt = connection.prepareStatement(sql);
pstmt.setString(1, contactCode);
rs = pstmt.executeQuery();
if(rs.next())
{
addr1=checkNull(rs.getString("addr1"));
addr2=checkNull(rs.getString("addr2"));
addr2=checkNull(rs.getString("addr3"));
city=checkNull(rs.getString("city"));
stateCode=checkNull(rs.getString("state_code"));
pin=checkNull(rs.getString("pin"));
tel1=checkNull(rs.getString("tele1"));
tel2=checkNull(rs.getString("tele2"));
tel3=checkNull(rs.getString("tele3"));
shname=checkNull(rs.getString("sh_name"));
contactPers=checkNull(rs.getString("cont_pers"));
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
lsState=genericUtility.getColumnValue("cur_state", dom2);
if(lsState !=null && lsState.trim().length()>0)
{
valueXmlString.append("<cur_state protect=\"1\">").append("<![CDATA[" ).append(lsState).append( "]]>").append("</cur_state>");
}
else
{
valueXmlString.append("<cur_state protect=\"0\">").append("<![CDATA[" ).append(lsState).append( "]]>").append("</cur_state>");
}
mcode=genericUtility.getColumnValue("emp_site", dom2);
if(mcode ==null || mcode.trim().length() == 0 )
{
valueXmlString.append("<emp_site>").append(empSite).append("</emp_site>");
//dw_edit.setitem(1 , "emp_site" , login_site)
}
mcode=genericUtility.getColumnValue("emp_site", dom2);
if(mcode !=null && mcode.trim().length()>0)
{
valueXmlString.append("<emp_site protect=\"1\">").append("<![CDATA[" ).append(mcode).append( "]]>").append("</emp_site>");
}
else
{
valueXmlString.append("<emp_site protect=\"0\">").append("<![CDATA[" ).append(mcode).append( "]]>").append("</emp_site>");
}
mcode=genericUtility.getColumnValue("pay_site", dom2);
if(mcode ==null || mcode.trim().length() == 0 )
{
valueXmlString.append("<pay_site>").append(loginSite).append("</pay_site>");
//dw_edit.setitem(1 , "pay_site" , login_site)
}
mcode=genericUtility.getColumnValue("work_site", dom2);
if(mcode ==null || mcode.trim().length() == 0 )
{
valueXmlString.append("<work_site>").append(loginSite).append("</work_site>");
//dw_edit.setitem(1 , "work_site" , login_site)
}
mval1=genericUtility.getColumnValue("notice_prd", dom2);
if(mval1==null)
{
gradeCode=genericUtility.getColumnValue("grade", dom2);
if(gradeCode!=null && gradeCode.trim().length()>0)
{
//select grade.notice_prd into :li_mval2 from grade where grade.grade_code = :mcode ;
sql="select grade.notice_prd as mval2 from grade where grade.grade_code =? ;";
pstmt = connection.prepareStatement(sql);
pstmt.setString(1, gradeCode);
rs = pstmt.executeQuery();
if(rs.next())
{
mval2 = rs.getInt("mval2");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
valueXmlString.append("<notice_prd>").append(mval2).append("</notice_prd>");
}
}
String trainingPrd=genericUtility.getColumnValue("training_prd", dom2);
int periodTraining = Integer.parseInt(checkInt(trainingPrd));
if(trainingPrd==null)
{
valueXmlString.append("<training_prd>").append(0).append("</training_prd>");
//dw_edit.setitem(1, "training_prd", 0)
}
String probationPrd=genericUtility.getColumnValue("probation_prd", dom2);
int periodProb = Integer.parseInt(checkInt(probationPrd));
if(probationPrd==null)
{
valueXmlString.append("<probation_prd>").append(0).append("</probation_prd>");
//dw_edit.setitem(1, "probation_prd", 0)
}
shiftRot=genericUtility.getColumnValue("shift_rot", dom2);
if(shiftRot ==null || shiftRot.trim().length() == 0 )
{
valueXmlString.append("<shift_rot>").append("N").append("</shift_rot>");
//dw_edit.setitem(1, "shift_rot", 'N')
}
String date=checkNull(genericUtility.getColumnValue("date_join", dom2));
//Timestamp ts=Timestamp.valueOf(genericUtility.getValidDateTimeString(date,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())+"00:00:00.0");
empCode=genericUtility.getColumnValue("emp_code", dom2);
if(date == null)
{
valueXmlString.append("<date_join protect=\"0\">").append("<![CDATA[" ).append(date).append( "]]>").append("</date_join>");
}
else
{
int mval3=0;
//select COUNT(*) into :li_mval3 from payroll where prd_code between '00' and 'zz' and emp_code = :ls_emp_code ;
sql="select count(*) as mval3 from payroll where prd_code between '00' and 'zz' and emp_code = ?";
pstmt = connection.prepareStatement(sql);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
if(rs.next())
{
mval3 = rs.getInt("mval3");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(mval3 == 0)
{
valueXmlString.append("<date_join protect=\"0\">").append("<![CDATA[" ).append(date).append( "]]>").append("</date_join>");
}
else
{
valueXmlString.append("<date_join protect=\"1\">").append("<![CDATA[" ).append(date).append( "]]>").append("</date_join>");
}
}
probation=genericUtility.getColumnValue("probation", dom2);
confirmed=genericUtility.getColumnValue("confirmed", dom2);
//trainingPrd=genericUtility.getColumnValue("training_prd", dom2);
trainingPrd=genericUtility.getColumnValue("training_prd", dom2);
int liMval1 = Integer.parseInt(checkInt(trainingPrd));
probationPrd=genericUtility.getColumnValue("probation_prd", dom2);
int liMval2 = Integer.parseInt(checkInt(probationPrd));
sql="select count(*) as countProb from emp_statuschg where emp_code =? and status_type = 'P' and case when confirm is null then 'N' else confirm end <> 'X'";
pstmt = connection.prepareStatement(sql);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
if(rs.next())
{
countProb=rs.getInt("countProb");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(countProb>0)
{
valueXmlString.append("<training_prd protect=\"1\">").append("<![CDATA[" ).append(trainingPrd).append( "]]>").append("</training_prd>");
valueXmlString.append("<date_join protect=\"0\">").append("<![CDATA[" ).append(date).append( "]]>").append("</date_join>");
}
else
{
if((confirmed !=null && confirmed.equalsIgnoreCase("Y"))||(probation!=null && probation.equalsIgnoreCase("Y") && liMval1>0))
{
valueXmlString.append("<training_prd protect=\"1\">").append("<![CDATA[" ).append(trainingPrd).append( "]]>").append("</training_prd>");
}
else
{
valueXmlString.append("<training_prd protect=\"0\">").append("<![CDATA[" ).append(date).append( "]]>").append("</training_prd>");
}
}
sql="select count(*) as count_conf from emp_statuschg where emp_code=? and status_type = 'C' and case when confirm is null then 'N' else confirm end <> 'X'";
pstmt = connection.prepareStatement(sql);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
if(rs.next())
{
countConf =rs.getInt("count_conf");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(countConf>0)
{
valueXmlString.append("<training_prd protect=\"1\">").append("<![CDATA[" ).append(trainingPrd).append( "]]>").append("</training_prd>");
valueXmlString.append("<probation_prd protect=\"1\">").append("<![CDATA[" ).append(probationPrd).append( "]]>").append("</probation_prd>");
valueXmlString.append("<date_join protect=\"1\">").append("<![CDATA[" ).append(date).append( "]]>").append("</date_join>");
}
else
{
if(confirmed.equalsIgnoreCase("Y") && liMval2>0)
{
valueXmlString.append("<probation_prd protect=\"1\">").append("<![CDATA[" ).append(probationPrd).append( "]]>").append("</probation_prd>");
}
else
{
valueXmlString.append("<probation_prd protect=\"0\">").append("<![CDATA[" ).append(probationPrd).append( "]]>").append("</probation_prd>");
}
}
String payType=genericUtility.getColumnValue("pay_type", dom2);
if(payType!=null)
{
valueXmlString.append("<pay_type>").append("<![CDATA[S]]>").append("</pay_type>");
}
payMode =genericUtility.getColumnValue("pay_mode", dom2);
if(payMode!=null)
{
valueXmlString.append("<pay_mode>").append("<![CDATA[C]]>").append("</pay_mode>");
}
String withHeld=genericUtility.getColumnValue("with_held", dom2);
if(withHeld!=null)
{
valueXmlString.append("<with_held>").append("<![CDATA[N]]>").append("</with_held>");
}
liMval1=0;
liMval2=0;
String state=genericUtility.getColumnValue("per_state", dom2);
if(state !=null && state.trim().length()>0)
{
valueXmlString.append("<per_state protect=\"1\">").append("<![CDATA[" ).append(state).append( "]]>").append("</per_state>");
}
else
{
valueXmlString.append("<per_state protect=\"0\">").append("<![CDATA[" ).append(state).append( "]]>").append("</per_state>");
}
String mStatus="";
mStatus=genericUtility.getColumnValue("m_status", dom2);
if(mStatus==null || mStatus.trim().length() ==0)
{
valueXmlString.append("<m_status>").append("U").append("</m_status>");
}
/*valueXmlString.append("<retirement_age>").append(maval1).append("</retirement_age>");
String protect= gbfGetRetdateProtectFlag(dom);
valueXmlString.append("<retirement_date protect=\""+protect+"\"><![CDATA[").append(maval1).append("]]></retirement_date>\r\n");*/
String retirmentDate=genericUtility.getColumnValue("retirement_date", dom);
String protect=gbfGetRetdateProtectFlag(dom);
valueXmlString.append("<retirement_date protect=\""+protect+"\"><![CDATA[").append(retirmentDate).append("]]></retirement_date>\r\n");
// Modified by Yashwant on 05/July/2019[End]
}
else if(currentColumn.trim().equalsIgnoreCase("contact_code"))
{
System.out.println("ItemChange of:::::"+currentColumn);
......@@ -5520,6 +5898,19 @@ public class EmployeeEJB extends ValidatorEJB implements EmployeeEJBLocal,Employ
}
return input;
}
private String checkInt(String input)
{
if (input == null)
{
input = "0";
}
else
{
input =input.trim();
}
return input;
}
private String getFieldValue(String column,String tableName, String columnName, String columnValue,Connection conn)
......@@ -5921,5 +6312,171 @@ public class EmployeeEJB extends ValidatorEJB implements EmployeeEJBLocal,Employ
return (retDate);
}
//Modified by Rohini T on 27/March/2019[Req ID:A18KSUN005][end]
//Modified by Yashwant on 03/07/2019[start]
private String gbfGetRetdateProtectFlag(Document dom) throws ITMException
//gbf_get_retdate_protect_flag()
{
String lsEmpSite="";
String lsCadreCode="";
String lsGradeCode="";
String lsVarValue="";
String lsProtVal="0";
String lsStatus="";
java.sql.Timestamp currentDate = null,today = null;
String ldtRelieveDate="";
int liProtVal=0;
Connection conn=null;
E12GenericUtility genericUtility = new E12GenericUtility();
AdmCommon admCommon = new AdmCommon();
try
{
conn=getConnection();
ldtRelieveDate=genericUtility.getColumnValue("relieve_date", dom);
//ldt_relieve_date = dw_edit.getitemdatetime(1,"relieve_date")
lsStatus=genericUtility.getColumnValue("status", dom);
if(ldtRelieveDate !=null || (lsStatus != null && lsStatus.equalsIgnoreCase("S")))
{
lsProtVal="1";
}
else
{
today = new java.sql.Timestamp(System.currentTimeMillis()) ;
SimpleDateFormat sdf1 = new SimpleDateFormat(genericUtility.getDBDateFormat());
currentDate = java.sql.Timestamp.valueOf(sdf1.format(today) + " 00:00:00.000");
lsEmpSite=genericUtility.getColumnValue("emp_site", dom);
lsCadreCode=genericUtility.getColumnValue("cadre_code", dom);
lsGradeCode=genericUtility.getColumnValue("grade_code", dom);
}
lsVarValue=admCommon.getAdmEnv(lsEmpSite, lsCadreCode, lsGradeCode, "PROTECT_RETIRE_DATE",today, conn);
if("NULLFOUND".equalsIgnoreCase(lsVarValue))
{
lsVarValue=admCommon.getEnv("999999", "PROTECT_RETIRE_DATE", conn);
}
if(lsVarValue==null || !lsVarValue.toUpperCase().equalsIgnoreCase("Y"))
//if isnull(ls_var_value) or upper(ls_var_value) <> "Y" then
{
lsProtVal="0";
}
else
{
lsProtVal="1";
}
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
System.out.println("lsProtVal:["+lsProtVal+"]");
return lsProtVal;
}
//Modified by Yashwant on 03/07/2019[End]
//Modified by Yashwant on 04/07/2019[Start]
private String gbSetRetirementDate(Document dom) throws ITMException
{
int retAge=0;
String retAgeStr="";
String empCode="";
String retVal="";
String retirementVarvalue="";
String siteCode="";
String gradeCode="";
String cadreCode="";
String sql="";
ResultSet rs = null;
PreparedStatement pstmt = null;
//DateTime ldt_birth_date, ldt_retirement_date
java.sql.Timestamp birthDate = null,retirementDate = null,today=null;
Connection conn=null;
AdmCommon admCommon = new AdmCommon();
UtilMethods utilmethod=new UtilMethods();
try
{
empCode=genericUtility.getColumnValue("emp_code", dom);
siteCode=genericUtility.getColumnValue("emp_site", dom);
gradeCode=genericUtility.getColumnValue("grade_code", dom);
cadreCode=genericUtility.getColumnValue("cadre_code", dom);
retAgeStr=genericUtility.getColumnValue("retirement_age", dom);
retAge=Integer.parseInt(retAgeStr);
String BirthDate=genericUtility.getColumnValue("birth_date", dom);
Timestamp ts=Timestamp.valueOf(genericUtility.getValidDateTimeString(BirthDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())+"00:00:00.0");
if(retAge<=0 || birthDate==null)
{
return retVal;
}
today = new java.sql.Timestamp(System.currentTimeMillis()) ;
retirementVarvalue=admCommon.getAdmEnv(siteCode, cadreCode, gradeCode, "RETIREMENT_CALC_DBF",today, conn);
if(retirementVarvalue.equalsIgnoreCase("ERR~t<NULLFOUND>"))
{
retirementVarvalue=admCommon.getEnv("999999", "RETIREMENT_CALC_DBF", conn);
if(retirementVarvalue.equalsIgnoreCase("NULLFOUND") || retirementVarvalue == null || retirementVarvalue.trim().length() == 0)
{
retirementVarvalue="";
}
else if(utilmethod.left(retirementVarvalue, 4).equalsIgnoreCase("ERR"))
{
retirementVarvalue="";
}
}
if(retirementVarvalue != null && retirementVarvalue.trim().length() > 0)
{
sql="SELECT "+retirementVarvalue.trim()+"(?,?,?)as retDate FROM DUAL";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,empCode);
pstmt.setInt(2,retAge);
pstmt.setTimestamp(3,birthDate);
rs=pstmt.executeQuery();
if(rs.next())
{
retirementDate=rs.getTimestamp("retDate");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
if(retirementDate == null)
{
retirementDate=utilmethod.AddMonths(birthDate, retAge);
}
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
return retVal;
}
//Modified by Yashwant on 04/07/2019[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