Commit 8cba988d authored by dpingle's avatar dpingle

* changes done in leave balance on [31/08/19]

w_leavebal.sql
leaveBalIC.java


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@206625 ce508802-f39f-4f6c-b175-0d175dae99d5
parent f1e5145c
...@@ -52,7 +52,7 @@ Insert into SYSTEM_EVENT_SERVICES (SERVICE_CODE,SERVICE_DESCR,SERVICE_URI,SERVIC ...@@ -52,7 +52,7 @@ Insert into SYSTEM_EVENT_SERVICES (SERVICE_CODE,SERVICE_DESCR,SERVICE_URI,SERVIC
---------------------------------------------------- SYSTEM_SERVICE_ARGS ---------------------------------------------------- SYSTEM_SERVICE_ARGS
Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('poic_default_ejb',1,'COMPONENT_TYPE','I',null,'S',null,null,null,null,'JB'); Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('poic_default_ejb',1,'COMPONENT_TYPE','I',null,'S',null,null,null,null,'JB');
Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('poic_default_ejb',2,'COMPONENT_NAME','I',null,'S',null,null,null,null,); Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('poic_default_ejb',2,'COMPONENT_NAME','I',null,'S',null,null,null,null,null);
Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('poic_default_ejb',3,'XML_DATA','I',null,'S',null,null,null,null,null); Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('poic_default_ejb',3,'XML_DATA','I',null,'S',null,null,null,null,null);
Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('poic_default_ejb',4,'XML_DATA_1','I',null,'S',null,null,null,null,null); Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('poic_default_ejb',4,'XML_DATA_1','I',null,'S',null,null,null,null,null);
Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('poic_default_ejb',5,'XML_DATA_ALL','I',null,'S',null,null,null,null,null); Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('poic_default_ejb',5,'XML_DATA_ALL','I',null,'S',null,null,null,null,null);
...@@ -109,5 +109,35 @@ Insert into MESSAGES (MSG_NO,MSG_STR,MSG_DESCR,MSG_TYPE,MSG_OPT,MSG_TIME,ALARM,E ...@@ -109,5 +109,35 @@ Insert into MESSAGES (MSG_NO,MSG_STR,MSG_DESCR,MSG_TYPE,MSG_OPT,MSG_TIME,ALARM,E
----------------------------------------------------- Dipesh [31/08/2019] Start
delete OBJ_ACTIONS WHERE OBJ_NAME ='leavebal' and line_no=3;
delete OBJ_ACTIONS WHERE OBJ_NAME ='leavebal' and line_no=21;
delete OBJ_ACTIONS WHERE OBJ_NAME ='leavebal' and line_no=22;
delete OBJ_ACTIONS WHERE OBJ_NAME ='leavebal' and line_no=40;
Insert into OBJ_ACTIONS (OBJ_NAME,LINE_NO,IMAGE,DESCRIPTION,SERVICE_CODE,INTERACTIVE,RIGHTS_CHAR,TITLE,FORM_NO,SERVICE_HANDLER,PLACEMENT,ACTION_TYPE,TRAN_TYPE,CHG_DATE,CHG_TERM,CHG_USER,IS_CONFIRMATION_REQ,SEP_DUTY_OPT,RE_AUTH_OPT,SHOW_IN_PANEL,PAGE_CONTEXT,TYPE,ACTION_ARG,SWIPE_POSITION,MULTI_ROW_OPT,ACTION_ID,DEF_NODATA,IN_PROC_INTRUPT,ESTIMATED_TIME,ACTION_GROUP,DISPLAY_OPT,DISPLAY_MODE,SHOW_CONFIRM,REC_SPECIFIC) values ('leavebal',39,'ibase/resource/objaction/exprtExl.svg','Export To Excel','a','a','B','Export2XLS','1',null,null,'S',null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,'2',null,null);
Insert into OBJ_ACTIONS (OBJ_NAME,LINE_NO,IMAGE,DESCRIPTION,SERVICE_CODE,INTERACTIVE,RIGHTS_CHAR,TITLE,FORM_NO,SERVICE_HANDLER,PLACEMENT,ACTION_TYPE,TRAN_TYPE,CHG_DATE,CHG_TERM,CHG_USER,IS_CONFIRMATION_REQ,SEP_DUTY_OPT,RE_AUTH_OPT,SHOW_IN_PANEL,PAGE_CONTEXT,TYPE,ACTION_ARG,SWIPE_POSITION,MULTI_ROW_OPT,ACTION_ID,DEF_NODATA,IN_PROC_INTRUPT,ESTIMATED_TIME,ACTION_GROUP,DISPLAY_OPT,DISPLAY_MODE,SHOW_CONFIRM,REC_SPECIFIC) values ('leavebal',40,'ibase/resource/objaction/Audit-trail.svg','View Audit Trail','audit_trail','1','X','Audit Trail','1','1','1','U',null,null,null,null,null,null,null,'1',null,null,null,null,null,null,null,null,null,null,null,'2',null,null);
Insert into TRANS_COPY_SETUP (OBJ_NAME,FORM_NO,FIELD_NAME,DEF_VALUE,COPY_FLAG) values ('leavebal','1','emp_fname',null,'N');
Insert into TRANS_COPY_SETUP (OBJ_NAME,FORM_NO,FIELD_NAME,DEF_VALUE,COPY_FLAG) values ('leavebal','1','emp_lname',null,'N');
Insert into TRANS_COPY_SETUP (OBJ_NAME,FORM_NO,FIELD_NAME,DEF_VALUE,COPY_FLAG) values ('leavebal','1','leaves_descr',null,'N');
update TRANSETUP set ref_ser='E-LOAN' where TRAN_WINDOW='w_leavebal';
Insert into TRANS_COPY_SETUP (OBJ_NAME,FORM_NO,FIELD_NAME,DEF_VALUE,COPY_FLAG) values ('emp_work_info','1','emp_fname_long',null,'N');
Insert into TRANS_COPY_SETUP (OBJ_NAME,FORM_NO,FIELD_NAME,DEF_VALUE,COPY_FLAG) values ('emp_work_info','1','emp_mname_long',null,'N');
Insert into TRANS_COPY_SETUP (OBJ_NAME,FORM_NO,FIELD_NAME,DEF_VALUE,COPY_FLAG) values ('emp_work_info','1','emp_lname_long',null,'N');
update messages set MSG_DESCR='Eff Date cannot be less the Upto date.' where msg_no='VTLVEDATE1';
Insert into MESSAGES (MSG_NO,MSG_STR,MSG_DESCR,MSG_TYPE,MSG_OPT,MSG_TIME,ALARM,ERR_SOURCE,CHG_DATE,CHG_USER,CHG_TERM,OVERRIDE_INPUT,MAIL_OPTION)
values ('VTLVEDATE4','Invalid Date !','Upto Date cannot be less the Exp date..','E','Y',null,null,null,to_date('22-10-00','DD-MM-RR'),'SUN ','HDP ',null,null);
Insert into MESSAGES (MSG_NO,MSG_STR,MSG_DESCR,MSG_TYPE,MSG_OPT,MSG_TIME,ALARM,ERR_SOURCE,CHG_DATE,CHG_USER,CHG_TERM,OVERRIDE_INPUT,MAIL_OPTION)
values ('INVLVDATA3','Invalid Date !','Data Already existed in Employee, Eff Date and Leave code.','E','Y',null,null,null,to_date('22-10-00','DD-MM-RR'),'SUN ','HDP ',null,null);
----------------------------------------------------- Dipesh [31/08/2019] End
...@@ -97,7 +97,8 @@ public class leaveBalIC extends ValidatorEJB implements leaveBalRemote,leaveBalL ...@@ -97,7 +97,8 @@ public class leaveBalIC extends ValidatorEJB implements leaveBalRemote,leaveBalL
int noOfChilds = 0; int noOfChilds = 0;
int counter; int counter;
int cnt = 0; int cnt = 0;
Date expDate = null;
Date uptoDate = null;
E12GenericUtility genericUtility = null; E12GenericUtility genericUtility = null;
errStringXml = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root><Errors>"); errStringXml = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root><Errors>");
...@@ -155,10 +156,9 @@ public class leaveBalIC extends ValidatorEJB implements leaveBalRemote,leaveBalL ...@@ -155,10 +156,9 @@ public class leaveBalIC extends ValidatorEJB implements leaveBalRemote,leaveBalL
if ("emp_code".equalsIgnoreCase(childNodeName)) if ("emp_code".equalsIgnoreCase(childNodeName))
{ {
uptoDateStr = checkNull(genericUtility.getColumnValue("upto_date", dom)); uptoDateStr = checkNull(genericUtility.getColumnValue("upto_date", dom));
Date uptoDate = null;
uptoDate = uptoDateStr!= null && uptoDateStr.length() > 0 ? sdf.parse(uptoDateStr) : uptoDate; uptoDate = uptoDateStr!= null && uptoDateStr.length() > 0 ? sdf.parse(uptoDateStr) : uptoDate;
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom)); empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
sql = "select work_site as ls_site from employee where emp_code = ?"; sql = "select work_site as ls_site from employee where emp_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode); pstmt.setString(1, empCode);
...@@ -183,12 +183,6 @@ public class leaveBalIC extends ValidatorEJB implements leaveBalRemote,leaveBalL ...@@ -183,12 +183,6 @@ public class leaveBalIC extends ValidatorEJB implements leaveBalRemote,leaveBalL
{ {
errList.add(lsErrorCode); errList.add(lsErrorCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
msgType = errorType( conn , "lsErrorCode" );
if ( msgType.equalsIgnoreCase("E"))
{
break;
}
} }
} }
else if ("lve_code".equalsIgnoreCase(childNodeName)) else if ("lve_code".equalsIgnoreCase(childNodeName))
...@@ -198,7 +192,7 @@ public class leaveBalIC extends ValidatorEJB implements leaveBalRemote,leaveBalL ...@@ -198,7 +192,7 @@ public class leaveBalIC extends ValidatorEJB implements leaveBalRemote,leaveBalL
cadre = checkNull(genericUtility.getColumnValue("cadre", dom)); cadre = checkNull(genericUtility.getColumnValue("cadre", dom));
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom)); empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
workSite = checkNull(genericUtility.getColumnValue("work_site", dom)); workSite = checkNull(genericUtility.getColumnValue("work_site", dom));
sql = "select lve_tblno as ls_lve_table from grade_site_lvetbl where site_code = ? and grade_code =? "; sql = "select lve_tblno as ls_lve_table from grade_site_lvetbl where site_code = ? and grade_code =? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, workSite); pstmt.setString(1, workSite);
...@@ -269,35 +263,53 @@ public class leaveBalIC extends ValidatorEJB implements leaveBalRemote,leaveBalL ...@@ -269,35 +263,53 @@ public class leaveBalIC extends ValidatorEJB implements leaveBalRemote,leaveBalL
errList.add("VMLVECD1"); errList.add("VMLVECD1");
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
msgType = errorType( conn , "VMLVECD1" );
if ( msgType.equalsIgnoreCase("E"))
{
break;
}
} }
} }
else if ("upto_date".equalsIgnoreCase(childNodeName)) else if ("upto_date".equalsIgnoreCase(childNodeName))
{ {
uptoDateStr = checkNull(genericUtility.getColumnValue("upto_date", dom)); uptoDateStr = checkNull(genericUtility.getColumnValue("upto_date", dom));
effDateStr = checkNull(genericUtility.getColumnValue("eff_date", dom)); effDateStr = checkNull(genericUtility.getColumnValue("eff_date", dom));
System.out.println("upto_date :: ["+uptoDateStr+"] \t eff_date :: ["+effDateStr+"]");
if(uptoDateStr != null && effDateStr != null) if(uptoDateStr != null && effDateStr != null)
{ {
if(uptoDateStr.trim().length() > 0 && effDateStr.trim().length() > 0) if(uptoDateStr.trim().length() > 0 && effDateStr.trim().length() > 0)
{ {
Date uptoDate = sdf.parse( uptoDateStr ); uptoDate = sdf.parse( uptoDateStr );
Date effDate = sdf.parse( effDateStr ); Date effDate = sdf.parse( effDateStr );
if(uptoDate.before(effDate)) if(uptoDate.before(effDate))
{ {
errList.add("VTLVEDATE1"); errList.add("VTLVEDATE1");
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
msgType = errorType( conn , "VTLVEDATE1" ); }
if ( msgType.equalsIgnoreCase("E")) cnt = 0 ;
{ sql="select count(*) as cnt from leavebal where exp_date=? and upto_date= ? and lve_code= ? and emp_code= ?";
break; pstmt = conn.prepareStatement(sql);
} pstmt.setString(1, expDateStr);
pstmt.setString(2, uptoDateStr);
pstmt.setString(3, lveCode);
pstmt.setString(4, empCode);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("cnt");
}
System.out.println("cnt:::: " + cnt+editFlag);
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (cnt > 0 && !"E".equalsIgnoreCase(editFlag))
{
errList.add("INVLVEDATA");
errFields.add(childNodeName.toLowerCase());
} }
} }
} }
...@@ -305,24 +317,21 @@ public class leaveBalIC extends ValidatorEJB implements leaveBalRemote,leaveBalL ...@@ -305,24 +317,21 @@ public class leaveBalIC extends ValidatorEJB implements leaveBalRemote,leaveBalL
{ {
expDateStr = checkNull(genericUtility.getColumnValue("exp_date", dom)); expDateStr = checkNull(genericUtility.getColumnValue("exp_date", dom));
uptoDateStr = checkNull(genericUtility.getColumnValue("upto_date", dom)); uptoDateStr = checkNull(genericUtility.getColumnValue("upto_date", dom));
System.out.println("upto_date :: ["+uptoDateStr+"] \t exp_date :: ["+expDateStr+"]");
if(expDateStr != null && uptoDateStr != null) if(expDateStr != null && uptoDateStr != null)
{ {
if(expDateStr.trim().length() > 0 && uptoDateStr.trim().length() > 0) if(expDateStr.trim().length() > 0 && uptoDateStr.trim().length() > 0)
{ {
Date expDate = sdf.parse( expDateStr ); expDate = sdf.parse( expDateStr );
Date uptoDate = sdf.parse( uptoDateStr ); uptoDate = sdf.parse( uptoDateStr );
if(expDate.before(uptoDate)) if(expDate.before(uptoDate))
{ {
errList.add("VTLVEDATE1"); errList.add("VTLVEDATE4");
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
msgType = errorType( conn , "VTLVEDATE1" );
if ( msgType.equalsIgnoreCase("E"))
{
break;
}
} }
} }
} }
...@@ -334,11 +343,6 @@ public class leaveBalIC extends ValidatorEJB implements leaveBalRemote,leaveBalL ...@@ -334,11 +343,6 @@ public class leaveBalIC extends ValidatorEJB implements leaveBalRemote,leaveBalL
errList.add("VTBALDAYS"); errList.add("VTBALDAYS");
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
msgType = errorType( conn , "VTBALDAYS" );
if ( msgType.equalsIgnoreCase("E"))
{
break;
}
} }
} }
break; break;
...@@ -359,7 +363,7 @@ public class leaveBalIC extends ValidatorEJB implements leaveBalRemote,leaveBalL ...@@ -359,7 +363,7 @@ public class leaveBalIC extends ValidatorEJB implements leaveBalRemote,leaveBalL
System.out.println("errCode .........." + errCode); System.out.println("errCode .........." + errCode);
errString = itmDbAcess.getErrorString(errFldName, errCode, userId, "", conn); errString = itmDbAcess.getErrorString(errFldName, errCode, userId, "", conn);
System.out.println("errString is : ::::>>>> " + errString); System.out.println("errString is : ::::>>>> " + errString);
msgType = errorType(conn, errCode); msgType = errorType(conn, errCode);
if (errString.length() > 0) if (errString.length() > 0)
{ {
String bifurErrString = errString.substring(errString.indexOf("<Errors>") + 8,errString.indexOf("<trace>")); String bifurErrString = errString.substring(errString.indexOf("<Errors>") + 8,errString.indexOf("<trace>"));
...@@ -415,8 +419,8 @@ public class leaveBalIC extends ValidatorEJB implements leaveBalRemote,leaveBalL ...@@ -415,8 +419,8 @@ public class leaveBalIC extends ValidatorEJB implements leaveBalRemote,leaveBalL
errString = errStringXml.toString(); errString = errStringXml.toString();
return errString; return errString;
} }
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext,
String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException
{ {
...@@ -451,7 +455,7 @@ public class leaveBalIC extends ValidatorEJB implements leaveBalRemote,leaveBalL ...@@ -451,7 +455,7 @@ public class leaveBalIC extends ValidatorEJB implements leaveBalRemote,leaveBalL
System.out.println("returning from leaveBalIC itemChanged"); System.out.println("returning from leaveBalIC itemChanged");
return valueXmlString; return valueXmlString;
} }
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn,
String editFlag, String xtraParams) throws RemoteException, ITMException String editFlag, String xtraParams) throws RemoteException, ITMException
{ {
...@@ -502,7 +506,7 @@ public class leaveBalIC extends ValidatorEJB implements leaveBalRemote,leaveBalL ...@@ -502,7 +506,7 @@ public class leaveBalIC extends ValidatorEJB implements leaveBalRemote,leaveBalL
int consDays = 0; int consDays = 0;
int convDays = 0; int convDays = 0;
int availDays = 0; int availDays = 0;
try try
{ {
genericUtility = new E12GenericUtility(); genericUtility = new E12GenericUtility();
...@@ -520,565 +524,565 @@ public class leaveBalIC extends ValidatorEJB implements leaveBalRemote,leaveBalL ...@@ -520,565 +524,565 @@ public class leaveBalIC extends ValidatorEJB implements leaveBalRemote,leaveBalL
switch (currentFormNo) switch (currentFormNo)
{ {
case 1: case 1:
{ {
System.out.println("=========================================Case1============================"); System.out.println("=========================================Case1============================");
valueXmlString.append("<Detail1>\r\n"); valueXmlString.append("<Detail1>\r\n");
if ("itm_defaultedit".equalsIgnoreCase(currentColumn)) if ("itm_defaultedit".equalsIgnoreCase(currentColumn))
{ {
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom)); empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
lveCode = checkNull(genericUtility.getColumnValue("lve_code", dom)); lveCode = checkNull(genericUtility.getColumnValue("lve_code", dom));
effDateStr = checkNull(genericUtility.getColumnValue("eff_date", dom)); effDateStr = checkNull(genericUtility.getColumnValue("eff_date", dom));
if(effDateStr != null && effDateStr.trim().length() > 0) if(effDateStr != null && effDateStr.trim().length() > 0)
{ {
effDate = Timestamp.valueOf(genericUtility.getValidDateString(effDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0"); effDate = Timestamp.valueOf(genericUtility.getValidDateString(effDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
} }
uptoDateStr = checkNull(genericUtility.getColumnValue("upto_date", dom)); uptoDateStr = checkNull(genericUtility.getColumnValue("upto_date", dom));
if(uptoDateStr != null && uptoDateStr.trim().length() > 0) if(uptoDateStr != null && uptoDateStr.trim().length() > 0)
{ {
uptoDate = Timestamp.valueOf(genericUtility.getValidDateString(uptoDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0"); uptoDate = Timestamp.valueOf(genericUtility.getValidDateString(uptoDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
} }
sql = "select nvl( ddf_get_leave_days( ?,?,?,?,'CLVA' ) , 0 ) as lc_cons_days from dual"; sql = "select nvl( ddf_get_leave_days( ?,?,?,?,'CLVA' ) , 0 ) as lc_cons_days from dual";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode); pstmt.setString(1, empCode);
pstmt.setTimestamp(2,effDate); pstmt.setTimestamp(2,effDate);
pstmt.setTimestamp(3, uptoDate); pstmt.setTimestamp(3, uptoDate);
pstmt.setString(4, lveCode); pstmt.setString(4, lveCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
lcConsDays = rs.getInt("lc_cons_days"); lcConsDays = rs.getInt("lc_cons_days");
} }
if (rs != null) if (rs != null)
{ {
rs.close(); rs.close();
rs = null; rs = null;
} }
if (pstmt != null) if (pstmt != null)
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
sql = "select nvl( ddf_get_leave_days( ?,?,?,?,'E' ) , 0 ) as lc_ench_days from dual"; sql = "select nvl( ddf_get_leave_days( ?,?,?,?,'E' ) , 0 ) as lc_ench_days from dual";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode); pstmt.setString(1, empCode);
pstmt.setTimestamp(2, effDate); pstmt.setTimestamp(2, effDate);
pstmt.setTimestamp(3, uptoDate); pstmt.setTimestamp(3, uptoDate);
pstmt.setString(4, lveCode); pstmt.setString(4, lveCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
lcEnchDays = rs.getInt("lc_ench_days"); lcEnchDays = rs.getInt("lc_ench_days");
} }
if (rs != null) if (rs != null)
{ {
rs.close(); rs.close();
rs = null; rs = null;
} }
if (pstmt != null) if (pstmt != null)
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
valueXmlString.append("<consume_days ><![CDATA[").append(lcConsDays).append("]]></consume_days>\r\n"); valueXmlString.append("<consume_days ><![CDATA[").append(lcConsDays).append("]]></consume_days>\r\n");
admCommon.setNodeValue(dom, "consume_days", lcConsDays+""); admCommon.setNodeValue(dom, "consume_days", lcConsDays+"");
valueXmlString.append("<encash_days ><![CDATA[").append(lcEnchDays).append("]]></encash_days>\r\n"); valueXmlString.append("<encash_days ><![CDATA[").append(lcEnchDays).append("]]></encash_days>\r\n");
admCommon.setNodeValue(dom, "encash_days", lcEnchDays+""); admCommon.setNodeValue(dom, "encash_days", lcEnchDays+"");
if("E".equalsIgnoreCase(editFlag) && "P".equalsIgnoreCase(checkNull(genericUtility.getColumnValue(editFlag, dom)))) if("E".equalsIgnoreCase(editFlag) && "P".equalsIgnoreCase(checkNull(genericUtility.getColumnValue(editFlag, dom))))
{ {
valueXmlString.append("<edit_flag ><![CDATA[").append("E").append("]]></edit_flag>\r\n"); valueXmlString.append("<edit_flag ><![CDATA[").append("E").append("]]></edit_flag>\r\n");
admCommon.setNodeValue(dom, "edit_flag", "E"); admCommon.setNodeValue(dom, "edit_flag", "E");
} }
expDateStr = checkNull(genericUtility.getColumnValue("exp_date", dom)); expDateStr = checkNull(genericUtility.getColumnValue("exp_date", dom));
if(expDateStr != null && expDateStr.trim().length() > 0) if(expDateStr != null && expDateStr.trim().length() > 0)
expDate = Timestamp.valueOf(genericUtility.getValidDateString(expDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0"); expDate = Timestamp.valueOf(genericUtility.getValidDateString(expDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
if("E".equalsIgnoreCase(editFlag) && "A".equalsIgnoreCase(checkNull(genericUtility.getColumnValue(editFlag, dom)))) if("E".equalsIgnoreCase(editFlag) && "A".equalsIgnoreCase(checkNull(genericUtility.getColumnValue(editFlag, dom))))
{ {
valueXmlString.append("<eff_date protect=\"0\"><![CDATA[").append(effDateStr).append("]]></eff_date>\r\n"); valueXmlString.append("<eff_date protect=\"0\"><![CDATA[").append(effDateStr).append("]]></eff_date>\r\n");
valueXmlString.append("<upto_date protect=\"0\"><![CDATA[").append(uptoDateStr).append("]]></upto_date>\r\n"); valueXmlString.append("<upto_date protect=\"0\"><![CDATA[").append(uptoDateStr).append("]]></upto_date>\r\n");
valueXmlString.append("<exp_date protect=\"0\"><![CDATA[").append(expDateStr).append("]]></exp_date>\r\n"); valueXmlString.append("<exp_date protect=\"0\"><![CDATA[").append(expDateStr).append("]]></exp_date>\r\n");
} }
else else
{ {
valueXmlString.append("<eff_date protect=\"1\"><![CDATA[").append(effDateStr).append("]]></eff_date>\r\n"); valueXmlString.append("<eff_date protect=\"1\"><![CDATA[").append(effDateStr).append("]]></eff_date>\r\n");
valueXmlString.append("<upto_date protect=\"1\"><![CDATA[").append(uptoDateStr).append("]]></upto_date>\r\n"); valueXmlString.append("<upto_date protect=\"1\"><![CDATA[").append(uptoDateStr).append("]]></upto_date>\r\n");
valueXmlString.append("<exp_date protect=\"1\"><![CDATA[").append(expDateStr).append("]]></exp_date>\r\n"); valueXmlString.append("<exp_date protect=\"1\"><![CDATA[").append(expDateStr).append("]]></exp_date>\r\n");
} }
} }
else if ("itm_default".equalsIgnoreCase(currentColumn)) else if ("itm_default".equalsIgnoreCase(currentColumn))
{ {
if(utilmethods.pos(xtraParams, "frdate") > 0) if(utilmethods.pos(xtraParams, "frdate") > 0)
{ {
ldEffDateStr = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "frdate"); ldEffDateStr = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "frdate");
} }
else else
{ {
ldEffDateStr = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "eff_date"); ldEffDateStr = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "eff_date");
} }
System.out.println("ldEffDateStr:::["+ldEffDateStr+"]"); System.out.println("ldEffDateStr:::["+ldEffDateStr+"]");
if(ldEffDateStr != null && ldEffDateStr.trim().length() > 0) if(ldEffDateStr != null && ldEffDateStr.trim().length() > 0)
{ {
ldEffDate = Timestamp.valueOf(genericUtility.getValidDateString(ldEffDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0"); ldEffDate = Timestamp.valueOf(genericUtility.getValidDateString(ldEffDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
} }
if(utilmethods.pos(xtraParams, "todate") > 0) if(utilmethods.pos(xtraParams, "todate") > 0)
{ {
ldUptoDateStr = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "todate"); ldUptoDateStr = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "todate");
System.out.println("ldUptoDateStr:::["+ldUptoDateStr+"]"); System.out.println("ldUptoDateStr:::["+ldUptoDateStr+"]");
ldExpDateStr = ldUptoDateStr; ldExpDateStr = ldUptoDateStr;
} }
else else
{ {
ldUptoDateStr = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "upto_date"); ldUptoDateStr = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "upto_date");
System.out.println("ldUptoDateStr:::["+ldUptoDateStr+"]"); System.out.println("ldUptoDateStr:::["+ldUptoDateStr+"]");
ldExpDateStr = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "exp_date"); ldExpDateStr = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "exp_date");
System.out.println("ldExpDateStr:::["+ldExpDateStr+"]"); System.out.println("ldExpDateStr:::["+ldExpDateStr+"]");
} }
if(ldUptoDateStr != null && ldUptoDateStr.trim().length() > 0) if(ldUptoDateStr != null && ldUptoDateStr.trim().length() > 0)
{ {
ldUptoDate = Timestamp.valueOf(genericUtility.getValidDateString(ldUptoDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0"); ldUptoDate = Timestamp.valueOf(genericUtility.getValidDateString(ldUptoDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
} }
valueXmlString.append("<exp_date ><![CDATA[").append(ldExpDateStr).append("]]></exp_date>\r\n"); valueXmlString.append("<exp_date ><![CDATA[").append(ldExpDateStr).append("]]></exp_date>\r\n");
admCommon.setNodeValue(dom, "exp_date", ldExpDateStr); admCommon.setNodeValue(dom, "exp_date", ldExpDateStr);
valueXmlString.append("<edit_flag ><![CDATA[").append("A").append("]]></edit_flag>\r\n"); valueXmlString.append("<edit_flag ><![CDATA[").append("A").append("]]></edit_flag>\r\n");
valueXmlString.append("<conv_days ><![CDATA[").append(0).append("]]></conv_days>\r\n"); valueXmlString.append("<conv_days ><![CDATA[").append(0).append("]]></conv_days>\r\n");
valueXmlString.append("<encash_days ><![CDATA[").append(0).append("]]></encash_days>\r\n"); valueXmlString.append("<encash_days ><![CDATA[").append(0).append("]]></encash_days>\r\n");
valueXmlString.append("<consume_days ><![CDATA[").append(0).append("]]></consume_days>\r\n"); valueXmlString.append("<consume_days ><![CDATA[").append(0).append("]]></consume_days>\r\n");
valueXmlString.append("<eff_date protect=\"0\"><![CDATA[").append(ldEffDateStr).append("]]></eff_date>\r\n"); valueXmlString.append("<eff_date protect=\"0\"><![CDATA[").append(ldEffDateStr).append("]]></eff_date>\r\n");
valueXmlString.append("<upto_date protect=\"0\"><![CDATA[").append(ldUptoDateStr).append("]]></upto_date>\r\n"); valueXmlString.append("<upto_date protect=\"0\"><![CDATA[").append(ldUptoDateStr).append("]]></upto_date>\r\n");
valueXmlString.append("<exp_date protect=\"0\"><![CDATA[").append(ldExpDateStr).append("]]></exp_date>\r\n"); valueXmlString.append("<exp_date protect=\"0\"><![CDATA[").append(ldExpDateStr).append("]]></exp_date>\r\n");
sql = "select code as ls_acctprd from acctprd where ? between fr_date and to_date"; sql = "select code as ls_acctprd from acctprd where ? between fr_date and to_date";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, ldEffDate); pstmt.setTimestamp(1, ldEffDate);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
lsAcctPrd = rs.getString("ls_acctprd"); lsAcctPrd = rs.getString("ls_acctprd");
} }
if (rs != null) if (rs != null)
{ {
rs.close(); rs.close();
rs = null; rs = null;
} }
if (pstmt != null) if (pstmt != null)
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
if(utilmethods.year(ldEffDate) == utilmethods.year(ldUptoDate)) if(utilmethods.year(ldEffDate) == utilmethods.year(ldUptoDate))
{ {
intAcctPrd = (utilmethods.year(ldUptoDate)); intAcctPrd = (utilmethods.year(ldUptoDate));
System.out.println("intAcctPrd value is == "+intAcctPrd); System.out.println("intAcctPrd value is == "+intAcctPrd);
lsAcctPrd = String.valueOf(intAcctPrd); lsAcctPrd = String.valueOf(intAcctPrd);
System.out.println("lsAcctPrd value == "+lsAcctPrd); System.out.println("lsAcctPrd value == "+lsAcctPrd);
} }
valueXmlString.append("<acct_prd ><![CDATA[").append(lsAcctPrd).append("]]></acct_prd>\r\n"); valueXmlString.append("<acct_prd ><![CDATA[").append(lsAcctPrd).append("]]></acct_prd>\r\n");
admCommon.setNodeValue(dom, "acct_prd", lsAcctPrd); admCommon.setNodeValue(dom, "acct_prd", lsAcctPrd);
} }
else if ("emp_code".equalsIgnoreCase(currentColumn)) else if ("emp_code".equalsIgnoreCase(currentColumn))
{ {
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom)); empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
sql = "select emp_lname, emp_fname , grade, cadre, work_site as ls_site from employee where emp_code = ?"; sql = "select emp_lname, emp_fname , grade, cadre, work_site as ls_site from employee where emp_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode); pstmt.setString(1, empCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
empLname = rs.getString("emp_lname"); empLname = rs.getString("emp_lname");
empFname = rs.getString("emp_fname"); empFname = rs.getString("emp_fname");
grade = rs.getString("grade"); grade = rs.getString("grade");
cadre = rs.getString("cadre"); cadre = rs.getString("cadre");
workSite = rs.getString("ls_site"); workSite = rs.getString("ls_site");
} }
if (rs != null) if (rs != null)
{ {
rs.close(); rs.close();
rs = null; rs = null;
} }
if (pstmt != null) if (pstmt != null)
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
valueXmlString.append("<emp_lname ><![CDATA[").append(empLname).append("]]></emp_lname>\r\n"); valueXmlString.append("<emp_lname ><![CDATA[").append(empLname).append("]]></emp_lname>\r\n");
admCommon.setNodeValue(dom, "emp_lname", empLname); admCommon.setNodeValue(dom, "emp_lname", empLname);
valueXmlString.append("<emp_fname ><![CDATA[").append(empFname).append("]]></emp_fname>\r\n"); valueXmlString.append("<emp_fname ><![CDATA[").append(empFname).append("]]></emp_fname>\r\n");
admCommon.setNodeValue(dom, "emp_fname", empFname); admCommon.setNodeValue(dom, "emp_fname", empFname);
valueXmlString.append("<grade ><![CDATA[").append(grade).append("]]></grade>\r\n"); valueXmlString.append("<grade ><![CDATA[").append(grade).append("]]></grade>\r\n");
admCommon.setNodeValue(dom, "grade", grade); admCommon.setNodeValue(dom, "grade", grade);
valueXmlString.append("<cadre ><![CDATA[").append(cadre).append("]]></cadre>\r\n"); valueXmlString.append("<cadre ><![CDATA[").append(cadre).append("]]></cadre>\r\n");
admCommon.setNodeValue(dom, "cadre", cadre); admCommon.setNodeValue(dom, "cadre", cadre);
valueXmlString.append("<work_site ><![CDATA[").append(workSite).append("]]></work_site>\r\n"); valueXmlString.append("<work_site ><![CDATA[").append(workSite).append("]]></work_site>\r\n");
admCommon.setNodeValue(dom, "work_site", workSite); admCommon.setNodeValue(dom, "work_site", workSite);
lveCode = checkNull(genericUtility.getColumnValue("lve_code", dom)); lveCode = checkNull(genericUtility.getColumnValue("lve_code", dom));
sql = "select lve_tblno as ls_lve_tblno from grade_site_lvetbl where site_code = ? and grade_code = ?"; sql = "select lve_tblno as ls_lve_tblno from grade_site_lvetbl where site_code = ? and grade_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, workSite); pstmt.setString(1, workSite);
pstmt.setString(2, grade); pstmt.setString(2, grade);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
lveTblNo = rs.getString("ls_lve_tblno"); lveTblNo = rs.getString("ls_lve_tblno");
} }
if (rs != null) if (rs != null)
{ {
rs.close(); rs.close();
rs = null; rs = null;
} }
if (pstmt != null) if (pstmt != null)
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
if(lveTblNo == null || lveTblNo.trim().length() == 0 ) if(lveTblNo == null || lveTblNo.trim().length() == 0 )
{ {
sql = "select lve_tblno as ls_lve_tblno from cadre_site_lvetbl where site_code = ? and cadre_code = ?"; sql = "select lve_tblno as ls_lve_tblno from cadre_site_lvetbl where site_code = ? and cadre_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, workSite); pstmt.setString(1, workSite);
pstmt.setString(2, cadre); pstmt.setString(2, cadre);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
lveTblNo = rs.getString("ls_lve_tblno"); lveTblNo = rs.getString("ls_lve_tblno");
} }
if (rs != null) if (rs != null)
{ {
rs.close(); rs.close();
rs = null; rs = null;
} }
if (pstmt != null) if (pstmt != null)
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
if(lveTblNo != null && lveTblNo.trim().length() >0) if(lveTblNo != null && lveTblNo.trim().length() >0)
{ {
sql = "select encashable as ls_encashable from lvetable where lve_tblno = ? and lve_code = ?"; sql = "select encashable as ls_encashable from lvetable where lve_tblno = ? and lve_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lveTblNo); pstmt.setString(1, lveTblNo);
pstmt.setString(2, lveCode); pstmt.setString(2, lveCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
encashable = rs.getString("ls_encashable"); encashable = rs.getString("ls_encashable");
} }
if (rs != null) if (rs != null)
{ {
rs.close(); rs.close();
rs = null; rs = null;
} }
if (pstmt != null) if (pstmt != null)
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
if(encashable == null || encashable.trim().length() == 0) if(encashable == null || encashable.trim().length() == 0)
{ {
encashable = "N"; encashable = "N";
} }
valueXmlString.append("<encashable ><![CDATA[").append(encashable).append("]]></encashable>\r\n"); valueXmlString.append("<encashable ><![CDATA[").append(encashable).append("]]></encashable>\r\n");
} }
} }
} }
else if ("eff_date".equalsIgnoreCase(currentColumn) || "upto_date".equalsIgnoreCase(currentColumn)) else if ("eff_date".equalsIgnoreCase(currentColumn) || "upto_date".equalsIgnoreCase(currentColumn))
{ {
effDateStr = checkNull(genericUtility.getColumnValue("eff_date", dom)); effDateStr = checkNull(genericUtility.getColumnValue("eff_date", dom));
if(effDateStr != null && effDateStr.trim().length() > 0) if(effDateStr != null && effDateStr.trim().length() > 0)
{ {
effDate = Timestamp.valueOf(genericUtility.getValidDateString(effDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0"); effDate = Timestamp.valueOf(genericUtility.getValidDateString(effDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
} }
uptoDateStr = checkNull(genericUtility.getColumnValue("upto_date", dom)); uptoDateStr = checkNull(genericUtility.getColumnValue("upto_date", dom));
if(uptoDateStr != null && uptoDateStr.trim().length() > 0) if(uptoDateStr != null && uptoDateStr.trim().length() > 0)
{ {
uptoDate = Timestamp.valueOf(genericUtility.getValidDateString(uptoDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0"); uptoDate = Timestamp.valueOf(genericUtility.getValidDateString(uptoDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
} }
sql = "select code as ls_acctprd from acctprd where ? between fr_date and to_date"; sql = "select code as ls_acctprd from acctprd where ? between fr_date and to_date";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, effDate); pstmt.setTimestamp(1, effDate);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
lsAcctPrd = rs.getString("ls_acctprd"); lsAcctPrd = rs.getString("ls_acctprd");
} }
if (rs != null) if (rs != null)
{ {
rs.close(); rs.close();
rs = null; rs = null;
} }
if (pstmt != null) if (pstmt != null)
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
if(utilmethods.year(effDate) == utilmethods.year(uptoDate)) if(utilmethods.year(effDate) == utilmethods.year(uptoDate))
{ {
intAcctPrd = (utilmethods.year(uptoDate)); intAcctPrd = (utilmethods.year(uptoDate));
System.out.println("intAcctPrd value is == "+intAcctPrd); System.out.println("intAcctPrd value is == "+intAcctPrd);
lsAcctPrd = String.valueOf(intAcctPrd); lsAcctPrd = String.valueOf(intAcctPrd);
System.out.println("lsAcctPrd value == "+lsAcctPrd); System.out.println("lsAcctPrd value == "+lsAcctPrd);
} }
valueXmlString.append("<acct_prd ><![CDATA[").append(lsAcctPrd).append("]]></acct_prd>\r\n"); valueXmlString.append("<acct_prd ><![CDATA[").append(lsAcctPrd).append("]]></acct_prd>\r\n");
admCommon.setNodeValue(dom, "acct_prd", lsAcctPrd); admCommon.setNodeValue(dom, "acct_prd", lsAcctPrd);
} }
else if ("lve_code".equalsIgnoreCase(currentColumn)) else if ("lve_code".equalsIgnoreCase(currentColumn))
{ {
lveCode = checkNull(genericUtility.getColumnValue("lve_code", dom)); lveCode = checkNull(genericUtility.getColumnValue("lve_code", dom));
sql = "select descr, max_days as mnodays from leaves where lve_code = ?"; sql = "select descr, max_days as mnodays from leaves where lve_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lveCode); pstmt.setString(1, lveCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
mdescr = rs.getString("descr"); mdescr = rs.getString("descr");
mnodays = rs.getString("mnodays"); mnodays = rs.getString("mnodays");
} }
if (rs != null) if (rs != null)
{ {
rs.close(); rs.close();
rs = null; rs = null;
} }
if (pstmt != null) if (pstmt != null)
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
valueXmlString.append("<leaves_descr ><![CDATA[").append(mdescr).append("]]></leaves_descr>\r\n"); valueXmlString.append("<leaves_descr ><![CDATA[").append(mdescr).append("]]></leaves_descr>\r\n");
admCommon.setNodeValue(dom, "leaves_descr", mdescr); admCommon.setNodeValue(dom, "leaves_descr", mdescr);
valueXmlString.append("<bal_days ><![CDATA[").append(mnodays).append("]]></bal_days>\r\n"); valueXmlString.append("<bal_days ><![CDATA[").append(mnodays).append("]]></bal_days>\r\n");
admCommon.setNodeValue(dom, "bal_days", mnodays); admCommon.setNodeValue(dom, "bal_days", mnodays);
valueXmlString.append("<avail_days ><![CDATA[").append(mnodays).append("]]></avail_days>\r\n"); valueXmlString.append("<avail_days ><![CDATA[").append(mnodays).append("]]></avail_days>\r\n");
admCommon.setNodeValue(dom, "avail_days", mnodays); admCommon.setNodeValue(dom, "avail_days", mnodays);
valueXmlString.append("<balance_days ><![CDATA[").append(mnodays).append("]]></balance_days>\r\n"); valueXmlString.append("<balance_days ><![CDATA[").append(mnodays).append("]]></balance_days>\r\n");
admCommon.setNodeValue(dom, "balance_days", mnodays); admCommon.setNodeValue(dom, "balance_days", mnodays);
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom)); empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
sql = "select grade, cadre, work_site as ls_site from employee where emp_code = ?"; sql = "select grade, cadre, work_site as ls_site from employee where emp_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode); pstmt.setString(1, empCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
grade = rs.getString("grade"); grade = rs.getString("grade");
cadre = rs.getString("cadre"); cadre = rs.getString("cadre");
workSite = rs.getString("ls_site"); workSite = rs.getString("ls_site");
} }
if (rs != null) if (rs != null)
{ {
rs.close(); rs.close();
rs = null; rs = null;
} }
if (pstmt != null) if (pstmt != null)
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
sql = "select lve_tblno as ls_lve_tblno from grade_site_lvetbl where site_code =? and grade_code =? "; sql = "select lve_tblno as ls_lve_tblno from grade_site_lvetbl where site_code =? and grade_code =? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, workSite); pstmt.setString(1, workSite);
pstmt.setString(2, grade); pstmt.setString(2, grade);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
lveTblNo = rs.getString("ls_lve_tblno"); lveTblNo = rs.getString("ls_lve_tblno");
} }
if (rs != null) if (rs != null)
{ {
rs.close(); rs.close();
rs = null; rs = null;
} }
if (pstmt != null) if (pstmt != null)
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
if(lveTblNo.trim().length() == 0 || lveTblNo == null) if(lveTblNo.trim().length() == 0 || lveTblNo == null)
{ {
sql = "select lve_tblno as ls_lve_tblno from cadre_site_lvetbl where site_code = ? and cadre_code = ?"; sql = "select lve_tblno as ls_lve_tblno from cadre_site_lvetbl where site_code = ? and cadre_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, workSite); pstmt.setString(1, workSite);
pstmt.setString(2, cadre); pstmt.setString(2, cadre);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
lveTblNo = rs.getString("ls_lve_tblno"); lveTblNo = rs.getString("ls_lve_tblno");
} }
if (rs != null) if (rs != null)
{ {
rs.close(); rs.close();
rs = null; rs = null;
} }
if (pstmt != null) if (pstmt != null)
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
} }
if(lveTblNo != null && lveTblNo.trim().length() >0) if(lveTblNo != null && lveTblNo.trim().length() >0)
{ {
sql = "select encashable, max_days as mnodays from lvetable where lve_tblno = ? and lve_code = ?"; sql = "select encashable, max_days as mnodays from lvetable where lve_tblno = ? and lve_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lveTblNo); pstmt.setString(1, lveTblNo);
pstmt.setString(2, lveCode); pstmt.setString(2, lveCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
encashable = rs.getString("encashable"); encashable = rs.getString("encashable");
mnodays = rs.getString("mnodays"); mnodays = rs.getString("mnodays");
} }
if (rs != null) if (rs != null)
{ {
rs.close(); rs.close();
rs = null; rs = null;
} }
if (pstmt != null) if (pstmt != null)
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
} }
if(encashable == null || encashable.trim().length() == 0) if(encashable == null || encashable.trim().length() == 0)
{ {
encashable = "N"; encashable = "N";
} }
valueXmlString.append("<encashable ><![CDATA[").append(encashable).append("]]></encashable>\r\n"); valueXmlString.append("<encashable ><![CDATA[").append(encashable).append("]]></encashable>\r\n");
admCommon.setNodeValue(dom, "encashable", encashable); admCommon.setNodeValue(dom, "encashable", encashable);
if(mnodays != null && mnodays.trim().length() > 0) if(mnodays != null && mnodays.trim().length() > 0)
{ {
valueXmlString.append("<bal_days ><![CDATA[").append(mnodays).append("]]></bal_days>\r\n"); valueXmlString.append("<bal_days ><![CDATA[").append(mnodays).append("]]></bal_days>\r\n");
admCommon.setNodeValue(dom, "bal_days", mnodays); admCommon.setNodeValue(dom, "bal_days", mnodays);
valueXmlString.append("<avail_days ><![CDATA[").append(mnodays).append("]]></avail_days>\r\n"); valueXmlString.append("<avail_days ><![CDATA[").append(mnodays).append("]]></avail_days>\r\n");
admCommon.setNodeValue(dom, "avail_days", mnodays); admCommon.setNodeValue(dom, "avail_days", mnodays);
valueXmlString.append("<balance_days ><![CDATA[").append(mnodays).append("]]></balance_days>\r\n"); valueXmlString.append("<balance_days ><![CDATA[").append(mnodays).append("]]></balance_days>\r\n");
admCommon.setNodeValue(dom, "balance_days", mnodays); admCommon.setNodeValue(dom, "balance_days", mnodays);
}
}
else if ("avail_days".equalsIgnoreCase(currentColumn))
{
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
lveCode = checkNull(genericUtility.getColumnValue("lve_code", dom));
effDateStr = checkNull(genericUtility.getColumnValue("eff_date", dom));
if(effDateStr != null && effDateStr.trim().length() > 0)
{
effDate = Timestamp.valueOf(genericUtility.getValidDateString(effDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
}
uptoDateStr = checkNull(genericUtility.getColumnValue("upto_date", dom));
if(uptoDateStr != null && uptoDateStr.trim().length() > 0)
{
uptoDate = Timestamp.valueOf(genericUtility.getValidDateString(uptoDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
}
sql = "select nvl(avail_days,0) as lc_avail_days_old , nvl(bal_days,0) as lc_bal_days from leavebal where emp_code = ? and lve_code = ? and eff_date = ? and upto_date = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
pstmt.setString(2, lveCode);
pstmt.setTimestamp(3,effDate);
pstmt.setTimestamp(4, uptoDate);
rs = pstmt.executeQuery();
if (rs.next())
{
lcAvailDaysOld = rs.getInt("lc_avail_days_old");
lcBalDays = rs.getInt("lc_bal_days");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
availDaysStr = checkInt(genericUtility.getColumnValue("avail_days", dom));
availDays = Integer.parseInt(availDaysStr);
consDaysStr = checkInt(genericUtility.getColumnValue("cons_days", dom));
consDays = Integer.parseInt(consDaysStr);
convDaysStr = checkInt(genericUtility.getColumnValue("conv_days", dom));
convDays = Integer.parseInt(convDaysStr);
if(enchDays == 0)
{
enchDays = 0;
} }
} enchDaysStr = checkInt(genericUtility.getColumnValue("ench_days", dom));
enchDays = Integer.parseInt(enchDaysStr);
else if ("avail_days".equalsIgnoreCase(currentColumn))
{ lcBalDays = availDays + convDays - consDays - enchDays;
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom)); valueXmlString.append("<bal_days ><![CDATA[").append(lcBalDays).append("]]></bal_days>\r\n");
lveCode = checkNull(genericUtility.getColumnValue("lve_code", dom)); admCommon.setNodeValue(dom, "bal_days", lcBalDays+"");
effDateStr = checkNull(genericUtility.getColumnValue("eff_date", dom)); double lcprevBal = 0.0;
if(effDateStr != null && effDateStr.trim().length() > 0) lcprevBalStr = checkInt(genericUtility.getColumnValue("prev_bal", dom));
{ lcprevBal = Double.parseDouble(lcprevBalStr);
effDate = Timestamp.valueOf(genericUtility.getValidDateString(effDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
} valueXmlString.append("<balance_days ><![CDATA[").append(lcBalDays + lcprevBal).append("]]></balance_days>\r\n");
admCommon.setNodeValue(dom, "balance_days", lcBalDays + lcprevBal+"");
uptoDateStr = checkNull(genericUtility.getColumnValue("upto_date", dom)); }
if(uptoDateStr != null && uptoDateStr.trim().length() > 0) }
{ valueXmlString.append("</Detail1>");
uptoDate = Timestamp.valueOf(genericUtility.getValidDateString(uptoDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0"); break;
}
sql = "select nvl(avail_days,0) as lc_avail_days_old , nvl(bal_days,0) as lc_bal_days from leavebal where emp_code = ? and lve_code = ? and eff_date = ? and upto_date = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
pstmt.setString(2, lveCode);
pstmt.setTimestamp(3,effDate);
pstmt.setTimestamp(4, uptoDate);
rs = pstmt.executeQuery();
if (rs.next())
{
lcAvailDaysOld = rs.getInt("lc_avail_days_old");
lcBalDays = rs.getInt("lc_bal_days");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
availDaysStr = checkInt(genericUtility.getColumnValue("avail_days", dom));
availDays = Integer.parseInt(availDaysStr);
consDaysStr = checkInt(genericUtility.getColumnValue("cons_days", dom));
consDays = Integer.parseInt(consDaysStr);
convDaysStr = checkInt(genericUtility.getColumnValue("conv_days", dom));
convDays = Integer.parseInt(convDaysStr);
if(enchDays == 0)
{
enchDays = 0;
}
enchDaysStr = checkInt(genericUtility.getColumnValue("ench_days", dom));
enchDays = Integer.parseInt(enchDaysStr);
lcBalDays = availDays + convDays - consDays - enchDays;
valueXmlString.append("<bal_days ><![CDATA[").append(lcBalDays).append("]]></bal_days>\r\n");
admCommon.setNodeValue(dom, "bal_days", lcBalDays+"");
double lcprevBal = 0.0;
lcprevBalStr = checkInt(genericUtility.getColumnValue("prev_bal", dom));
lcprevBal = Double.parseDouble(lcprevBalStr);
valueXmlString.append("<balance_days ><![CDATA[").append(lcBalDays + lcprevBal).append("]]></balance_days>\r\n");
admCommon.setNodeValue(dom, "balance_days", lcBalDays + lcprevBal+"");
}
}
valueXmlString.append("</Detail1>");
break;
} }
valueXmlString.append("</Root>"); valueXmlString.append("</Root>");
} }
...@@ -1199,4 +1203,3 @@ public class leaveBalIC extends ValidatorEJB implements leaveBalRemote,leaveBalL ...@@ -1199,4 +1203,3 @@ public class leaveBalIC extends ValidatorEJB implements leaveBalRemote,leaveBalL
} }
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