Commit f421c0bb authored by arawankar's avatar arawankar

PayrollProjEnc.java

*Added new file related to payroll projection

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@204092 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 294f4b0d
package ibase.webitm.ejb.adm.adv;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.StringTokenizer;
import com.sybase.jaguar.management.jdk12utils.ArrayList;
import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.ejb.adm.AdmCommon;
import ibase.webitm.ejb.sys.UtilMethods;
import ibase.webitm.utility.ITMException;
public class PayrollProjEnc extends ActionHandlerEJB
{
public String confirm(String tranId, String xtraParams, String forcedFlag,Connection conn) throws ITMException
{
System.out.println("===========================================Inside confirm of PayrollProjEnc==============================");
String lsEmpCode = "" ;
String lsPrdCode = "" ;
String lsTempStr = "";
String lsErrcode = "" ;
String lsLveCode = "";
String lsForceReprocess = "N";
String errCode = "";
int liCnt = 0;
double lcDays = 0.0;
double lcAmount = 0.0;
ArrayList arrList = new ArrayList();
int arrSize = 0;
AdmCommon admCommon = null;
UtilMethods utilMethods = null;
String sql = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
admCommon = new AdmCommon();
utilMethods = new UtilMethods();
lsTempStr = tranId;
if(lsTempStr != null && lsTempStr.trim().length() > 0)
{
StringTokenizer stringToken = new StringTokenizer(lsTempStr, ":");
while(stringToken.hasMoreTokens())
{
arrList.add(stringToken.nextToken());
}
arrSize = arrList.size();
if(arrSize > 0 && arrSize == 4)
{
lsPrdCode = (String) arrList.get(0);
lsEmpCode = (String) arrList.get(1);
lsLveCode = (String) arrList.get(2);
lcDays = (double) arrList.get(3);
}
do
{
if(lcDays <= 0 || ( lsPrdCode == null || lsPrdCode.trim().length() == 0) || (lsEmpCode == null || lsEmpCode.trim().length() == 0))
{
errCode = "VTENCCAL01";
break;
}
lsForceReprocess = admCommon.getEnv("999999", "FORCE_PAYPROJ_ONENCH", conn);
if(lsForceReprocess == null || lsForceReprocess.trim().length() == 0 || utilMethods.pos("012", lsForceReprocess.toUpperCase().trim())== 0)
{
lsForceReprocess = "0";
}
else
{
lsForceReprocess = lsForceReprocess.toUpperCase().trim();
}
if(!lsForceReprocess.equalsIgnoreCase("2"))
{
sql = "select count(1) from payroll_projdet where prd_code = ? and emp_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lsPrdCode);
pstmt.setString(2, lsEmpCode);
rs = pstmt.executeQuery();
if(rs.next())
{
liCnt = rs.getInt(1);
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(liCnt == 0 && "0".equalsIgnoreCase(lsForceReprocess))
{
errCode = "VTLVEENC04";
break;
}
}
else
{
liCnt = 0;
lsForceReprocess = "2";
}
if(liCnt == 0)
{
System.out.println("Need to migrate this code later");
//Need to call nvo_bo_payroll_splitgen_acc === > gbf_process_logic
/*dw_filter = create nvo_datastore // Modified by Piyush on 12/03/2019 [To resolve null object reference error]
dw_filter.dataobject = is_dataobj_name[1]
dw_filter.settransobject(sqlca)
dw_filter.insertrow(0)
dw_filter.setitem(1, "prd_code__fr" , ls_prd_code)
dw_filter.setitem(1, "prd_code__to", ls_prd_code)
dw_filter.setitem(1, "emp_code__fr" , ls_emp_code)
dw_filter.setitem(1, "emp_code__to" , ls_emp_code)
dw_filter.setitem(1, "site_code__fr" , "0")
dw_filter.setitem(1, "site_code__to" , "ZZ")
dw_filter.setitem(1, "proc_group__from" , "0")
dw_filter.setitem(1, "proc_group__to" , "ZZ")
dw_filter.setitem(1, "prd_code__arr", ls_prd_code)
dw_filter.setitem(1, "consider_attd", "N")
// Modified by Piyush on 10/06/2019 [dataowrite should be "Y" to reprocess the projection]
// dw_filter.setitem(1, "dataowrite" , "N")
dw_filter.setitem(1, "dataowrite" , "Y")
dw_filter.setitem(1, "payroll_date", today())
dw_filter.setitem(1, "type" , "PP")
istr_log_writer.obj_name = "pay_proj_enc"
istr_log_writer.process_id = "LeaveEncProj"
ls_errcode = gbf_process_logic()
select count(1) into :li_cnt from payroll_projdet where prd_code = :ls_prd_code and emp_code = :ls_emp_code;
if get_sqlcode() <> 0 then
ls_errcode = "DS000" + trim(string(sqlca.sqldbcode)) + "~t" +sqlca.sqlerrtext
gbf_insert_err(ls_errcode , "")
exit
end if
if li_cnt = 0 then
if not isnull(ls_errcode ) and len(trim(ls_errcode)) > 0 then
is_errxml = ls_errcode
else
ls_errcode = "PAYPROJ01~tPayroll Projection Failed"
gbf_insert_err(ls_errcode , "")
end if
exit
else
is_errxml = ""
ls_errcode = ""
end if*/
}
LeaveEncashmentConfirmation leaveEncshmentConfirm = new LeaveEncashmentConfirmation();
errCode = leaveEncshmentConfirm.gbfCalcEnchamt(lsEmpCode, lsPrdCode, lsPrdCode, lcDays,conn);
System.out.println("errCode====["+errCode+"]");
break;
}
while(true);
}
}
catch(Exception e)
{
throw new ITMException(e);
}
return errCode;
}
}
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