Commit 153bbee9 authored by ssalve's avatar ssalve

Sarita : Added Component from Sun on 01-November-2019

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@210950 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 337d8f21
package ibase.webitm.ejb.adm;
import ibase.system.config.ConnDriver;
import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ProcessEJB;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import ibase.webitm.utility.TransIDGenerator;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import javax.xml.rpc.ParameterMode;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import org.apache.poi.ss.formula.udf.UDFFinder;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@javax.ejb.Stateless
@SuppressWarnings({ "unused", "rawtypes", "unchecked" })
public class PerkClaimCancelProcess extends ProcessEJB implements PerkClaimCancelProcessLocal,PerkClaimCancelProcessRemote //implements SessionBean
{
public String process()throws RemoteException,ITMException
{
return "";
}
public String process(String xmlString, String xmlString2, String windowName, String xtraParams)
throws RemoteException,ITMException
{
Document detailDom = null;
Document headerDom = null;
E12GenericUtility genericUtility= new E12GenericUtility();
String retStr = "";
Connection conn = null;
try
{
ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
System.out.println("xmlString[process]::::::::::;;;"+xmlString);
System.out.println("xmlString2[process]::::::::::;;;"+xmlString2);
System.out.println("dummy[process]::::::::::;;;"+windowName);//TESTING PURPOSE
System.out.println("xtraParams[process]:::::::::;;;"+xtraParams);
System.out.println("parsing xml condition");
if(xmlString != null && xmlString.trim().length()!=0)
{
headerDom = genericUtility.parseString(xmlString);
System.out.println("headerDom" + headerDom);
System.out.println("xmlString >> "+xmlString);
}
System.out.println("parsing xml2 condition");
if(xmlString2 != null && xmlString2.trim().length()!=0)
{
detailDom = genericUtility.parseString(xmlString2);
System.out.println("detailDom" + detailDom);
System.out.println("xmlString2 >> "+xmlString2);
}
retStr = process(headerDom, detailDom, windowName, xtraParams, conn);
}
catch (Exception e)
{
System.out.println("Exception : :process(String xmlString, String xmlString2, String windowName, String xtraParams):" + e.getMessage() + ":");
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if(conn != null)
{
conn.close();
conn = null;
}
}
catch(Exception e1)
{
System.out.println("exception in process >> "+ e1);
throw new ITMException(e1);
}
}
return retStr;
}
/**
* @method : process
* @param : String,String,String,String
* @throws : RemoteException, ITMException
* @return : String
*
*/
public String process(String xmlString, String xmlString2, String windowName, String xtraParams, Connection conn)
throws RemoteException,ITMException
{
Document detailDom = null;
Document headerDom = null;
E12GenericUtility genericUtility= new E12GenericUtility();
String retStr = "";
try
{
System.out.println("xmlString[process]::::::::::;;;"+xmlString);
System.out.println("xmlString2[process]::::::::::;;;"+xmlString2);
System.out.println("dummy[process]::::::::::;;;"+windowName);//TESTING PURPOSE
System.out.println("xtraParams[process]:::::::::;;;"+xtraParams);
System.out.println("parsing xml condition");
if(xmlString != null && xmlString.trim().length()!=0)
{
headerDom = genericUtility.parseString(xmlString);
System.out.println("headerDom" + headerDom);
System.out.println("xmlString >> "+xmlString);
}
System.out.println("parsing xml2 condition");
if(xmlString2 != null && xmlString2.trim().length()!=0)
{
detailDom = genericUtility.parseString(xmlString2);
System.out.println("detailDom" + detailDom);
System.out.println("xmlString2 >> "+xmlString2);
}
retStr = process(headerDom, detailDom, windowName, xtraParams, conn);
}
catch (Exception e)
{
System.out.println("Exception : :process(String xmlString, String xmlString2, String windowName, String xtraParams):" + e.getMessage() + ":");
e.printStackTrace();
throw new ITMException(e);
}
return retStr;
}
/**
* @method : process
* @param : String,String,String,String
* @throws : RemoteException, ITMException
* @return : String
*
*/
public String process(Document headerDom, Document detailDom, String windowName, String xtraParams, Connection conn) throws RemoteException,ITMException
{
ResultSet rs = null,rs2 = null;
PreparedStatement pstmt = null,adclaimhdrPstmt = null,adAllowBalPstmt = null,
adClaimPstmthdr = null,payrVcrPstmt = null,allowdednbalPstmt = null,
adClaimPstmt = null, adClaimUpdate = null;
Document dom = null;
boolean isError = false, isLocalConn = false;
int count = 0,updateCnt = 0,empCnt = 0,insertCnt =0;
String payrollVoucher = "",payrollPrd = "",adCode = "",adCode1 = "",confirmed = "",pyrlAdclaim = "",
fromDate = "", toDate = "",keyString = "",keyStr = "",bankCode = "",payModeParm = "",bankEnv ="",
empCode = "",tranDate = "",refNo = "",balAmt = "",claimAmt = "",sql ="",errorString = "",
loanAdjamt = "",effDateStr = "",tranId ="",descr ="",paySite ="",msgString ="",tranIdNew = "",
claimPrd = "",effDate1 = "",endDate1 = "",columnValue = "",chgDate = "",empFName = "",
chgUsr = "",empMName = "",empLname = "",remarks = "",userXtraParms = "",month = "",
retString = "",errString = "",objName = "",sqlUpdateEmpAdClaimHDR = "",successStr = "",
sqlPayrVcr = "", sqlUpdateEmpAdClaim = "",tranIdPayVcr = "",empAdclaimSql ="";
String tranType = "PRK";
StringBuffer msgType = new StringBuffer();
Date currentDate = new Date();
Date effDate = null,startDate = null,endDate = null,claimDate = null;
ArrayList<String> errList = new ArrayList<String>();
ArrayList<String> errFields = new ArrayList<String>();
//added by vinay:start date 29/10/18
String sqlInsertEmpAdClaimHDR="",employeeCode="",payrollVoucherValue="",payrollPrdValue="",
adCodeValue="",confirmedValue = "",udfType = "";
Double claimAmountValue=0.0d,loanAdjamountValue=0.0d,balAmountValue =0.0d;
Double balAmount = 0.0d,claimAmount = 0.0d,loanAdjamount = 0.0d;
java.sql.Date tranDateNew=null;
//added by end date 29/10/18
HRVoucherReversal hrVcrRev= null;
Timestamp tranDateTimpstamp=null;
//Added By Amit Shrivastava on 02/01/19 start [ for change trandate to current date]
java.util.Date currDate = new java.util.Date();
java.sql.Date date=new java.sql.Date(currDate.getTime());
System.out.println("@AMitDate"+date);
Double amtBal= 0.0d;
//Added By Amit Shrivastava on 02/01/19 end [ for change trandate to current date]
//Added By Amit Shrivastava on 02/01/19 start [ for change trandate to current date]
PreparedStatement payr_Voucherpstmt = null;
ResultSet payr_Voucherrs = null;
PreparedStatement empadclaimPstmt = null;
PreparedStatement pstmtPayroll= null;
ResultSet rsPayroll = null;
PreparedStatement pstmtPeriod= null;
ResultSet rsPeriod = null;
PreparedStatement pstmallowdednt= null;
ResultSet rsallowdedn = null;
String frDateStr = "";
String toDateStr = "";
//Added By Amit Shrivastava on 02/01/19 end [ for change trandate to current date]
ITMDBAccessEJB itmDBAccess = new ITMDBAccessEJB();
int noRowInst = 0;
try
{
GenericUtility genericUtility = GenericUtility.getInstance();
AdmCommon admCommon = new AdmCommon();
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
System.out.println("detailDom:::::::"+detailDom);
System.out.println("headerDom:::::::"+headerDom);
System.out.println("xtraParams..["+xtraParams+"]");
if(xtraParams == null || xtraParams.length() == 0)
{
xtraParams = checkNull(genericUtility.getColumnValue("user_xtra_parms", headerDom, "1"));
System.out.println("userXtraParms["+xtraParams+"]");
}
System.out.println("xtraParams.new .["+xtraParams+"]");
String userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
String chgTerm = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "termId");
objName = getObjNameFromDom( headerDom, "objName");
System.out.println("objName["+objName+"]");
payrollVoucher = checkNull(genericUtility.getColumnValue("pay_vouch", headerDom, "1"));
payrollPrd = checkNull(genericUtility.getColumnValue("pay_period", headerDom, "1"));
adCode = checkNull(genericUtility.getColumnValue("ad_code", headerDom, "1"));
confirmed = checkNull(genericUtility.getColumnValue("confirmed", headerDom, "1"));
tranId = checkNull(genericUtility.getColumnValue("tran_id", headerDom, "1"));
tranDate = checkNull(genericUtility.getColumnValue("tran_date", headerDom, "1"));
empCode = checkNull(genericUtility.getColumnValue("emp_code", headerDom, "1"));
empFName = checkNull(genericUtility.getColumnValue("emp_fname", headerDom, "1"));
empLname = checkNull(genericUtility.getColumnValue("emp_lname", headerDom, "1"));
descr = checkNull(genericUtility.getColumnValue("descr", headerDom, "1"));
paySite = checkNull(genericUtility.getColumnValue("pay_site", headerDom, "1"));
String claimAmountStr = checkNull(genericUtility.getColumnValue("claim_amt", headerDom, "1"));
String loanAdjamountStr = checkNull(genericUtility.getColumnValue("loan_adjust", headerDom, "1"));
chgDate = checkNull(genericUtility.getColumnValue("chg_date", headerDom, "1"));
chgUsr = checkNull(genericUtility.getColumnValue("chg_user", headerDom, "1"));
if(claimAmountStr.trim().length() > 0 ){
claimAmount = Double.parseDouble(claimAmountStr);
}else{
claimAmount = 0.0d;
}
if(loanAdjamountStr.trim().length() > 0 ){
loanAdjamount = Double.parseDouble(loanAdjamountStr);
}else{
loanAdjamount = 0.0d;
}
System.out.println("payrollVoucher [" + payrollVoucher + "]");
System.out.println("payrollPrd [" + payrollPrd + "]");
System.out.println("adCode [" + adCode + "]");
System.out.println("confirmed [" + confirmed + "]");
System.out.println("tranId [" + tranId + "]");
System.out.println("empCode [" + empCode + "]");
System.out.println("empFName [" + empFName + "]");
System.out.println("empLname [" + empLname + "]");
System.out.println("descr [" + descr + "]");
System.out.println("paySite [" + paySite + "]");
System.out.println("claimAmt [" + claimAmount + "]");
System.out.println("loanAdjamount [" + loanAdjamount + "]");
String curDate = sdf.format(currentDate);
curDate = genericUtility.getValidDateTimeString(curDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat() );
System.out.println("curDate::::::"+curDate);
//ADDED BY AMIT SHRIVASTAVA ON[A15ISUN003] 30/11/18 TO CONVERT TRAN DATE INTO TIMSTAMP [START]
tranDateTimpstamp = Timestamp.valueOf(genericUtility.getValidDateTimeString(tranDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat() ));
System.out.println("@Amit @ tranDateTimpstamp:::"+tranDateTimpstamp);
//ADDED BY AMIT SHRIVASTAVA ON[A15ISUN003] 30/11/18 TO CONVERT TRAN DATE INTO TIMSTAMP [END].
claimDate = sdf.parse(tranDate);
System.out.println("claimDate >> "+claimDate);
if((confirmed.trim().length() >0 && confirmed.trim().equalsIgnoreCase("Y"))
&& (loanAdjamount != null && loanAdjamount >0.0d))
{
errorString = itmDBAccess.getErrorString("", "VPPERKAD1", "");
return errorString;
}
else
{
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
sql="select amt_bal from allowdedn_bal where ad_code = ? for update ";
}
else if ( "mssql".equalsIgnoreCase(CommonConstants.DB_NAME ))
{
sql="select amt_bal from allowdedn_bal(updlock) where ad_code = ? ";
}
else
{
sql="select amt_bal from allowdedn_bal where ad_code = ? for update nowait ";
}
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, adCode);
rs2 = pstmt.executeQuery();
if(rs2.next())
{
//Added By Amit Shrivastava on 20/02/19 for declair amtBal variable [start]
/*String amtBal = rs2.getString("amt_bal");*/
amtBal = rs2.getDouble("amt_bal");
//Added By Amit Shrivastava on 20/02/19 for declair amtBal variable [end]
System.out.println("@S@ amtBal ["+amtBal+"]");
}
close(pstmt, rs2);
/**If Payroll voucher type is payroll
* will inserted records into tables
* */
if(payrollVoucher.equalsIgnoreCase("P"))
{
pyrlAdclaim = checkNull(admCommon.getEnv("999999",adCode+"_CLAIMAD", conn));
System.out.println("pyrlAdclaim ["+pyrlAdclaim+"]");
if(pyrlAdclaim == "NULLFOUND" || pyrlAdclaim == null || pyrlAdclaim.length() == 0)
{
errString = itmDBAccess.getErrorString("","VSENVAR1","","",conn);
isError = true;
return errString;
}
sql = "select fr_date , to_date from period where code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,payrollPrd);
rs = pstmt.executeQuery();
if(rs.next())
{
fromDate = checkNull(rs.getString("fr_date"));
toDate = checkNull(rs.getString("to_date"));
}
else
{
errString = itmDBAccess.getErrorString("","VTPED1","","",conn);
}
close(pstmt, rs);
System.out.println("fromDate::::::"+fromDate);
System.out.println("toDate::::::"+toDate);
//added by amir shrivastava on 14/11/18 strat. for check fromDate and toDate null.
if(fromDate !=null && toDate !=null)
{
if(errString != null && errString.trim().length() > 0)
{
isError = true;
return errString ;
}
if(payrollPrd != null && payrollPrd.length() > 0)
{
month = payrollPrd.substring( payrollPrd.length() - 2 ,payrollPrd.length()) ;
}
sql = "select count(*) as cnt from employee_mthad where emp_code = ? and ad_code = ? and eff_date = ? and exp_date = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,empCode);
pstmt.setString(2,pyrlAdclaim);
pstmt.setTimestamp(3,java.sql.Timestamp.valueOf(fromDate));
pstmt.setTimestamp(4,java.sql.Timestamp.valueOf(toDate));
rs = pstmt.executeQuery();
if(rs.next())
{
count=rs.getInt("cnt");
}
}
else
{
System.out.println("fromDate and toDate found null ");
}
close(pstmt,rs);
System.out.println("count"+count);
if(count > 0)
{
/* START >> Commented by vinay c 03102019
sql = "update employee_mthad set amount = amount + ? " +
" where emp_code = ? and eff_date = ? and exp_date = ? ";
END*/
/* START >> Added by vinay c 03102019 To Update change date,change user and change term */
sql = "update employee_mthad set amount = amount + ? ,chg_date=?,chg_user=?,chg_term=? " +
" where emp_code = ? and eff_date = ? and exp_date = ? ";
System.out.println("@vinay:sql>>"+sql);
/* END >> Added by vinay c 03102019 */
pstmt = conn.prepareStatement(sql);
/* START >> Commented by vinay c 03102019
pstmt.setDouble(1,claimAmount*(-1));
pstmt.setString(2,empCode);
pstmt.setTimestamp(3,java.sql.Timestamp.valueOf(fromDate));
pstmt.setTimestamp(4,java.sql.Timestamp.valueOf(toDate));
END */
/* START >> Added by vinay c 03102019 To Update change date,change user and change term */
pstmt.setDouble(1,claimAmount*(-1));
pstmt.setTimestamp(2,java.sql.Timestamp.valueOf(curDate));
pstmt.setString(3,userId);
pstmt.setString(4,chgTerm);
pstmt.setString(5,empCode);
pstmt.setTimestamp(6,java.sql.Timestamp.valueOf(fromDate));
pstmt.setTimestamp(7,java.sql.Timestamp.valueOf(toDate));
/* END >> Added by vinay c 03102019 */
updateCnt = pstmt.executeUpdate();
if(updateCnt >0)
{
msgType.append("employee");
System.out.println("employee_mthad Updated with empCode >> "+ empCode);
}
}
else
{
sql = "insert into employee_mthad (emp_code, month_code, ad_code, eff_date, exp_date, type, amount, chg_date, chg_user, chg_term, ref_type, ref_no, prop_yn) " +
"Values(? , ? , ? , ? , ? ,'F',?, ? , ? , ? ,'C', ? ,'N')";
pstmt= conn.prepareStatement(sql);
pstmt.setString(1,empCode);
pstmt.setString(2,month);
pstmt.setString(3,pyrlAdclaim);
pstmt.setTimestamp(4,java.sql.Timestamp.valueOf(fromDate));
pstmt.setTimestamp(5,java.sql.Timestamp.valueOf(toDate));
pstmt.setDouble(6,claimAmount *(-1));
pstmt.setTimestamp(7,java.sql.Timestamp.valueOf(curDate));
pstmt.setString(8,userId);
pstmt.setString(9,chgTerm);
pstmt.setString(10,tranId);
updateCnt = pstmt.executeUpdate();
if(updateCnt >0)
{
msgType.append("employee");
System.out.println("employee_mthad Inserted with tran Id >> "+ tranId);
}
}
/**added and modified by vinay chaurasiya for insert new record instead
* of updating the adclaimhdr table for perk claim cancel process date 29/10/18. start**/
//tranIdNew=checkNull(generateTranId(claimDate,paySite,conn));
tranIdNew=checkNull(generateTranId(tranDate,paySite,conn));
System.out.println("tranIdNew >> "+ tranIdNew);
sql = "select count(*) as cnt from EMP_ADCLAIMHDR where tran_id = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranId);
//pstmt.setString(1,tranIdNew);
rs = pstmt.executeQuery();
if(rs.next())
{
empCnt = rs.getInt("cnt");
}
System.out.println("Count --["+empCnt+"]");
close(pstmt,rs);
if(empCnt > 0)
{
//Added by amit shrivastava on 12/NOV/2018 for alter adclaimhdr table
/*sqlUpdateEmpAdClaimHDR = "UPDATE EMP_ADCLAIMHDR SET CONFIRMED =?,CANCEL_BY =?,CANCEL_DATE = ?"
*/
sqlUpdateEmpAdClaimHDR = "UPDATE EMP_ADCLAIMHDR SET REF_STATUS =?,REF_ID__REV = ?"
+ " WHERE TRAN_ID = ?";
adclaimhdrPstmt = conn.prepareStatement(sqlUpdateEmpAdClaimHDR);
//adclaimhdrPstmt.setString(1,"X");
adclaimhdrPstmt.setString(1,"Y");
adclaimhdrPstmt.setString(2,tranIdNew);
//adclaimhdrPstmt.setTimestamp(3, new java.sql.Timestamp(System.currentTimeMillis()));
adclaimhdrPstmt.setString(3,tranId);
updateCnt = adclaimhdrPstmt.executeUpdate();
if(updateCnt >0)
{
msgType.append("adclaimhdr");
System.out.println("EMP_ADCLAIMHDR Updated with tran Id >> "+ tranId);
}
close(adclaimhdrPstmt,rs);
}
empAdclaimSql = "select count(*) as cnt,eff_date from EMP_ADCLAIM where tran_id = ? group by eff_date";
adClaimPstmt = conn.prepareStatement(empAdclaimSql);
adClaimPstmt.setString(1,tranId);
rs = adClaimPstmt.executeQuery();
if(rs.next())
{
insertCnt = rs.getInt("cnt");
effDate = rs.getDate("eff_date");
}
System.out.println("Count --["+insertCnt+"]");
close(adClaimPstmt,rs);
/*
if(insertCnt > 0)
{
sqlUpdateEmpAdClaim = "UPDATE EMP_ADCLAIM SET CLAIM_AMT = ?"
+ " WHERE TRAN_ID = ?";
adClaimUpdate = conn.prepareStatement(sqlUpdateEmpAdClaim);
adClaimUpdate.setDouble(1,claimAmount *(-1));
adClaimUpdate.setString(2,tranId);
updateCnt = adClaimUpdate.executeUpdate();
if(updateCnt >0)
{
msgType.append("adclaim");
System.out.println("EMP_ADCLAIMHDR EMP_ADCLAIM with tran Id >> "+ tranId);
}
}
*/
/*tranIdNew=checkNull(generateTranId(claimDate,paySite,conn));
System.out.println("tranIdNew >> "+ tranIdNew);*/
sql="SELECT tran_date,emp_code,claim_amt,loan_adjamt,payroll_voucher,prd_code__payroll,"
+ " ad_code,confirmed,udf_type FROM EMP_ADCLAIMHDR where tran_id=? ";//changes
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranId);
rs = pstmt.executeQuery();
if(rs.next())
{
tranDateNew=rs.getDate("tran_date");
employeeCode=rs.getString("emp_code");
claimAmountValue=rs.getDouble("claim_amt");
loanAdjamountValue=rs.getDouble("loan_adjamt");
payrollVoucherValue=rs.getString("payroll_voucher");
payrollPrdValue=rs.getString("prd_code__payroll");
adCodeValue=rs.getString("ad_code");
confirmedValue=rs.getString("confirmed");
udfType = rs.getString("udf_type");
}
System.out.println("Count --["+tranId+"]");
close(pstmt,rs);
//Added by Amit Shrivastava on 02/04/19 start for add one parameter[]
/*sqlInsertEmpAdClaimHDR="insert into EMP_ADCLAIMHDR "
+ " (tran_id,tran_date,emp_code,claim_amt,loan_adjamt,payroll_voucher,prd_code__payroll,chg_date,chg_user,chg_term,ad_code,confirmed,udf_type) "
+ " Values(?,?,?,?,?,?,?,?,?,?,?,?)";*/
sqlInsertEmpAdClaimHDR="insert into EMP_ADCLAIMHDR "
+ " (tran_id,tran_date,emp_code,claim_amt,loan_adjamt,payroll_voucher,prd_code__payroll,chg_date,chg_user,chg_term,ad_code,confirmed,udf_type) "
+ " Values(?,?,?,?,?,?,?,?,?,?,?,?,?)";
//Added by Amit Shrivastava on 02/04/19 end for add one parameter[]
adclaimhdrPstmt=conn.prepareStatement(sqlInsertEmpAdClaimHDR);
adclaimhdrPstmt.setString(1,checkNull(tranIdNew));
//Added By Amit Shrivastava on 002/2019 [Start] for change trandate to current
/* adclaimhdrPstmt.setDate(2,tranDateNew);*/
adclaimhdrPstmt.setDate(2,date);
//Added By Amit Shrivastava on 002/2019 [End] for change trandate to current
adclaimhdrPstmt.setString(3,checkNull(employeeCode));
//Added By Amit Shrivastava on 002/2019 [Start] for insert negative amount value
/*adclaimhdrPstmt.setDouble(4,claimAmountValue);*/
adclaimhdrPstmt.setDouble(4,claimAmountValue*(-1));
System.out.println("@AmitPayrollclaimAmountValue"+claimAmountValue*(-1));
//Added By Amit Shrivastava on 002/2019 for insert negative amount value [End]
adclaimhdrPstmt.setDouble(5,loanAdjamountValue);
adclaimhdrPstmt.setString(6,checkNull(payrollVoucherValue));
adclaimhdrPstmt.setString(7,checkNull(payrollPrdValue));
adclaimhdrPstmt.setTimestamp(8, new java.sql.Timestamp(System.currentTimeMillis()));
adclaimhdrPstmt.setString(9,checkNull(userId));
adclaimhdrPstmt.setString(10,checkNull(chgTerm));
adclaimhdrPstmt.setString(11,checkNull(adCodeValue));
adclaimhdrPstmt.setString(12,checkNull(confirmed));
adclaimhdrPstmt.setString(13,checkNull(udfType));
int insert=adclaimhdrPstmt.executeUpdate();
if(insert >0)
{
msgType.append("adclaimhdr");
System.out.println("EMP_ADCLAIMHDR inserted with new tran Id >> "+ tranIdNew);
}
/**added and modified by vinay chaurasiya for insert new record instead
* of updating the adclaimhdr table for perk claim cancel process date 29/10/18. end*/
/**added and modified by vinay chaurasiya for insert new record instead
* of updating the adclaim table for perk claim cancel process date 29/10/18. start*/
/*
empAdclaimSql = "select count(*) as cnt,eff_date from EMP_ADCLAIM where tran_id = ? group by eff_date";
adClaimPstmt = conn.prepareStatement(empAdclaimSql);
adClaimPstmt.setString(1,tranId);
rs=adClaimPstmt.executeQuery();
if(rs.next())
{
insertCnt = rs.getInt("cnt");
effDate = rs.getDate("eff_date");
}
System.out.println("Count --["+insertCnt+"]");
close(adClaimPstmt,rs);
if(insertCnt > 0)
{
sqlUpdateEmpAdClaim = "UPDATE EMP_ADCLAIM SET CLAIM_AMT = ?"
+ " WHERE TRAN_ID = ?";
adClaimUpdate = conn.prepareStatement(sqlUpdateEmpAdClaim);
adClaimUpdate.setDouble(1,claimAmount *(-1));
adClaimUpdate.setString(2,tranId);
updateCnt = adClaimUpdate.executeUpdate();
if(updateCnt >0)
{
msgType.append("adclaim");
System.out.println("EMP_ADCLAIMHDR EMP_ADCLAIM with tran Id >> "+ tranId);
}
}
*/
employeeCode="";payrollVoucherValue="";payrollPrdValue="";
adCodeValue="";confirmedValue = "";udfType = "";
claimAmountValue=0.0d;loanAdjamountValue=0.0d;
tranDateNew = null;
empAdclaimSql= "SELECT EMP_CODE,AD_CODE,EFF_DATE,BAL_AMT,CLAIM_AMT,LOAN_ADJAMT,"
+ " PAYROLL_VOUCHER,PRD_CODE__PAYROLL, TRAN_DATE FROM EMP_ADCLAIM WHERE TRAN_ID = ? ";
adClaimPstmt = conn.prepareStatement(empAdclaimSql);
adClaimPstmt.setString(1,tranId);
rs = adClaimPstmt.executeQuery();
//Added By Amit Shrivastava on 26/02/19 for get all claim users details [Start]
/*if(rs.next())*/
//Added By Amit Shrivastava on 26/02/19 for get all claim users details [End]
while(rs.next())
{
employeeCode = checkNull(rs.getString("EMP_CODE"));
adCodeValue = checkNull(rs.getString("AD_CODE"));
effDate = rs.getDate("EFF_DATE");
balAmountValue = rs.getDouble("BAL_AMT");
claimAmountValue =rs.getDouble("CLAIM_AMT");
loanAdjamountValue =rs.getDouble("LOAN_ADJAMT");
payrollVoucherValue =checkNull(rs.getString("PAYROLL_VOUCHER"));
payrollPrdValue =checkNull(rs.getString("PRD_CODE__PAYROLL"));
tranDateNew =rs.getDate("TRAN_DATE");
System.out.println("@amit tranDateNew inside without eff>>"+tranDateNew);
sqlUpdateEmpAdClaim = "insert into EMP_ADCLAIM (TRAN_ID,EMP_CODE,AD_CODE,EFF_DATE,BAL_AMT,CLAIM_AMT,LOAN_ADJAMT,PAYROLL_VOUCHER,PRD_CODE__PAYROLL,CHG_DATE,CHG_USER,CHG_TERM,TRAN_DATE)"
+ " Values(?,?,?,?,?,?,?,?,?,?,?,?,?)";
// Added By Amit Shrivastava on 20/02/19 for replace BAL_AMT value with amt_bal[end]
adClaimUpdate = conn.prepareStatement(sqlUpdateEmpAdClaim);
adClaimUpdate.setString(1,checkNull(tranIdNew));
adClaimUpdate.setString(2,checkNull(employeeCode));
adClaimUpdate.setString(3,checkNull(adCodeValue));
adClaimUpdate.setDate(4,(java.sql.Date) effDate);
// Added By Amit Shrivastava on 20/02/19 for replace BAL_AMT value with amt_bal[start]
/*adClaimUpdate.setDouble(5,balAmountValue);*/
adClaimUpdate.setDouble(5,amtBal);
System.out.println("@Amit amtBal>>"+amtBal);
System.out.println("@Amit claimAmountValue Value>>"+claimAmountValue);
adClaimUpdate.setDouble(6,claimAmountValue*(-1));
System.out.println("claimAmountValue*"+claimAmountValue*(-1));
//Added By Amit Shrivastava on 190219 end for change claimAmountValue value into negative calim amount
adClaimUpdate.setDouble(7,loanAdjamountValue);
adClaimUpdate.setString(8,checkNull(payrollVoucherValue));
adClaimUpdate.setString(9,checkNull(payrollPrdValue));
adClaimUpdate.setTimestamp(10, new java.sql.Timestamp(System.currentTimeMillis()));
adClaimUpdate.setString(11,checkNull(userId));
adClaimUpdate.setString(12,checkNull(chgTerm));
adClaimUpdate.setDate(13,tranDateNew);
//Added By Amit Shrivastava on 02/04/19 [end ] for changes for pstmt
updateCnt = adClaimUpdate.executeUpdate();
if(adClaimUpdate != null)
{
adClaimUpdate.close();
adClaimUpdate = null;
}
if(updateCnt >0)
{
msgType.append("adclaim");
System.out.println("insert EMP_ADCLAIM with tran Id >> "+ tranIdNew);
}
/**added and modified by vinay chaurasiya for insert new record instead
* of updating the adclaim table for perk claim cancel process date 29/10/18. end*/
sql ="";
int allWCnt = 0;
sql = "select count(*) as cnt,start_date,end_date from ALLOWDEDN_BAL where emp_code = ?"
+ " and ad_code = ? and start_date = ? group by start_date, end_date";
adAllowBalPstmt = conn.prepareStatement(sql);
adAllowBalPstmt.setString(1,empCode);
adAllowBalPstmt.setString(2,adCode);
adAllowBalPstmt.setDate(3,(java.sql.Date) effDate);
ResultSet rsAllBal = null;
rsAllBal = adAllowBalPstmt.executeQuery();
if(rsAllBal.next())
{
allWCnt = rsAllBal.getInt("cnt");
startDate = rsAllBal.getDate("start_date");
endDate = rsAllBal.getDate("end_date");
}
System.out.println("Count --["+allWCnt+"]");
close(adAllowBalPstmt,rsAllBal);
if(allWCnt > 0)
{
sql = "UPDATE ALLOWDEDN_BAL SET AMT_BAL = AMT_BAL + ?, AMT_ADJ = AMT_ADJ - ? WHERE EMP_CODE = ? AND AD_CODE = ? AND START_DATE = ? AND END_DATE = ?";
adAllowBalPstmt = conn.prepareStatement(sql);
adAllowBalPstmt.setDouble(1 , claimAmountValue);
adAllowBalPstmt.setDouble(2 , claimAmountValue);
adAllowBalPstmt.setString(3 , empCode);
adAllowBalPstmt.setString(4 , adCode);
adAllowBalPstmt.setDate(5,(java.sql.Date) startDate);
adAllowBalPstmt.setDate(6, (java.sql.Date) endDate);
updateCnt = adAllowBalPstmt.executeUpdate();
if(adAllowBalPstmt != null)
{
adAllowBalPstmt.close();
adAllowBalPstmt = null;
}
if(updateCnt > 0 )
{
msgType.append("allowden");
System.out.println(" ALLOWDEDN_BAL is updated" +updateCnt);
}
}
}
close(adClaimPstmt,rs);
// Added By Amit Shrivastava on 20/02/19 for replace BAL_AMT value with amt_bal[start]
/*sqlUpdateEmpAdClaim = "insert into EMP_ADCLAIM (TRAN_ID,EMP_CODE,AD_CODE,EFF_DATE,BAL_AMT,CLAIM_AMT,LOAN_ADJAMT,PAYROLL_VOUCHER,PRD_CODE__PAYROLL,CHG_DATE,CHG_USER,CHG_TERM,TRAN_DATE)"
+ " Values(?,?,?,?,?,?,?,?,?,?,?,?,?)";*/
/*sqlUpdateEmpAdClaim = "insert into EMP_ADCLAIM (TRAN_ID,EMP_CODE,AD_CODE,EFF_DATE,BAL_AMT,CLAIM_AMT,LOAN_ADJAMT,PAYROLL_VOUCHER,PRD_CODE__PAYROLL,CHG_DATE,CHG_USER,CHG_TERM,TRAN_DATE)"
+ " Values(?,?,?,?,?,?,?,?,?,?,?,?,?)";
// Added By Amit Shrivastava on 20/02/19 for replace BAL_AMT value with amt_bal[end]
adClaimUpdate = conn.prepareStatement(sqlUpdateEmpAdClaim);
//Added By Amit Shrivastava on 02/04/19 [start ] for changes for pstmt
adclaimhdrPstmt.setString(1,checkNull(tranIdNew));
adclaimhdrPstmt.setString(2,checkNull(employeeCode));
adclaimhdrPstmt.setString(3,checkNull(adCodeValue));
adclaimhdrPstmt.setDate(4,(java.sql.Date) effDate);
adclaimhdrPstmt.setDouble(5,balAmountValue);
adclaimhdrPstmt.setDouble(6,claimAmountValue);
adclaimhdrPstmt.setDouble(7,loanAdjamountValue);
adclaimhdrPstmt.setString(8,checkNull(payrollVoucherValue));
adclaimhdrPstmt.setString(9,checkNull(payrollPrdValue));
adclaimhdrPstmt.setTimestamp(10, new java.sql.Timestamp(System.currentTimeMillis()));
adclaimhdrPstmt.setString(11,checkNull(userId));
adclaimhdrPstmt.setString(12,checkNull(chgTerm));
adclaimhdrPstmt.setDate(13,tranDateNew);
adClaimUpdate.setString(1,checkNull(tranIdNew));
adClaimUpdate.setString(2,checkNull(employeeCode));
adClaimUpdate.setString(3,checkNull(adCodeValue));
adClaimUpdate.setDate(4,(java.sql.Date) effDate);
// Added By Amit Shrivastava on 20/02/19 for replace BAL_AMT value with amt_bal[start]
adClaimUpdate.setDouble(5,balAmountValue);
adClaimUpdate.setDouble(5,amtBal);
System.out.println("@Amit amtBal>>"+amtBal);
//Added By Amit Shrivastava on 20/02/19 for replace BAL_AMT value with amt_bal[end]
//Added By Amit Shrivastava on 190219 start for change claimAmountValue value into negative calim amount
//adClaimUpdate.setDouble(6,claimAmountValue);
System.out.println("@Amit claimAmountValue Value>>"+claimAmountValue);
adClaimUpdate.setDouble(6,claimAmountValue*(-1));
System.out.println("claimAmountValue*"+claimAmountValue*(-1));
//Added By Amit Shrivastava on 190219 end for change claimAmountValue value into negative calim amount
adClaimUpdate.setDouble(7,loanAdjamountValue);
adClaimUpdate.setString(8,checkNull(payrollVoucherValue));
adClaimUpdate.setString(9,checkNull(payrollPrdValue));
adClaimUpdate.setTimestamp(10, new java.sql.Timestamp(System.currentTimeMillis()));
adClaimUpdate.setString(11,checkNull(userId));
adClaimUpdate.setString(12,checkNull(chgTerm));
adClaimUpdate.setDate(13,tranDateNew);
//Added By Amit Shrivastava on 02/04/19 [end ] for changes for pstmt
updateCnt = adClaimUpdate.executeUpdate();
if(updateCnt >0)
{
msgType.append("adclaim");
System.out.println("insert EMP_ADCLAIM with tran Id >> "+ tranIdNew);
}
*//**added and modified by vinay chaurasiya for insert new record instead
* of updating the adclaim table for perk claim cancel process date 29/10/18. end*//*
sql ="";
int allWCnt = 0;
sql = "select count(*) as cnt,start_date,end_date from ALLOWDEDN_BAL where emp_code = ?"
+ " and ad_code = ? and start_date = ? group by start_date, end_date";
adAllowBalPstmt = conn.prepareStatement(sql);
adAllowBalPstmt.setString(1,empCode);
adAllowBalPstmt.setString(2,adCode);
adAllowBalPstmt.setDate(3,(java.sql.Date) effDate);
rs = adAllowBalPstmt.executeQuery();
if(rs.next())
{
allWCnt = rs.getInt("cnt");
startDate = rs.getDate("start_date");
endDate = rs.getDate("end_date");
}
System.out.println("Count --["+allWCnt+"]");
close(adAllowBalPstmt,rs);
if(allWCnt > 0)
{
sql = "UPDATE ALLOWDEDN_BAL SET AMT_BAL = AMT_BAL + ?, AMT_ADJ = AMT_ADJ - ? WHERE EMP_CODE = ? AND AD_CODE = ? AND START_DATE = ? AND END_DATE = ?";
adAllowBalPstmt = conn.prepareStatement(sql);
adAllowBalPstmt.setDouble(1 , claimAmount);
adAllowBalPstmt.setDouble(2 , claimAmount);
adAllowBalPstmt.setString(3 , empCode);
adAllowBalPstmt.setString(4 , adCode);
adAllowBalPstmt.setDate(5,(java.sql.Date) startDate);
adAllowBalPstmt.setDate(6, (java.sql.Date) endDate);
updateCnt = adAllowBalPstmt.executeUpdate();
if(updateCnt > 0 )
{
msgType.append("allowden");
System.out.println(" ALLOWDEDN_BAL is updated" +updateCnt);
}
}*/
if(msgType != null ){
msgString = msgType.toString();
System.out.println("msgString >> "+ msgString);
}
//Added By Amit Shrivastava on 2/05/19 [start]
/*if(checkNull(msgString).trim().length() > 0
&& msgString.trim().equalsIgnoreCase("employeeadclaimhdradclaimallowden"))*/
if(checkNull(msgString).trim().length() > 0
&& msgString.trim().equalsIgnoreCase("employeeadclaimhdradclaimhdradclaimallowden"))
//Added by Amit Shrivastava on 02/05/19 End
{
System.out.println("@Amitinside Sucess");
isError = false;
errString = itmDBAccess.getErrorString("", "VTPRCSUCSS", "");
}
System.out.println("Payroll String >> "+ errString);
//Added By Amit Shrivastava on 26/02/19 for update reversal claim amount [Start]
/*sql = " select start_date,end_date from allowdedn_bal where emp_code = ? and ad_code = ? ";
pstmallowdednt = conn.prepareStatement(sql);
pstmallowdednt.setString( 1, empCode );
pstmallowdednt.setString( 2, adCode );
rsallowdedn = pstmallowdednt.executeQuery();
while( rsallowdedn.next() )
{
startDate = rsallowdedn.getTimestamp("start_date");
endDate = rsallowdedn.getTimestamp("end_date");
}
close(pstmallowdednt, rsallowdedn);
frDateStr = sdf.format(startDate);
toDateStr = sdf.format(endDate);
System.out.println("@Amit startDate >> "+ frDateStr +" "+ "@Amit endDate >> "+ frDateStr);*/
sql="select code from period where sysdate between fr_date and to_date";
pstmtPeriod = conn.prepareStatement(sql);
rsPeriod = pstmtPeriod.executeQuery();
if(rsPeriod.next())
{
claimPrd = checkNull(rsPeriod.getString("code"));
System.out.println("@Amit acctPrd>>"+claimPrd);
}
if(rsPeriod!=null)
{
rsPeriod.close();
rsPeriod = null;
}
if(pstmtPeriod != null)
{
pstmtPeriod.close();
pstmtPeriod = null;
}
sql = "select count(1) as cnt from payroll where emp_code = ? and prd_code = ?";
pstmtPayroll = conn.prepareStatement(sql);
pstmtPayroll.setString(1, empCode);
/* Commented by vinay c 01/11/2019
pstmtPayroll.setString(2, claimPrd);
End */
/* Added by vinay c 01/11/2019 To set payroll period instead of claim period */
pstmtPayroll.setString(2,payrollPrd);
/* */
rsPayroll = pstmtPayroll.executeQuery();
if(rsPayroll.next())
{
count = rsPayroll.getInt("cnt");
System.out.println("@Amit count>>"+count);
}
if(rsPayroll != null)
{
rsPayroll.close();
rsPayroll = null;
}
if(pstmtPayroll != null)
{
pstmtPayroll.close();
pstmtPayroll = null;
}
System.out.println("count--["+count+"]");
if(count > 0)
{
/* Commented by vinay c 01/11/2019
retString = admCommon.payarrToProcUpdation(claimPrd, claimPrd, empCode, empCode, "AR", "w_perkclaim_cancel_load", "", adCode,claimAmount*-1 , frDateStr, toDateStr, xtraParams, conn);
End */
/* Added by vinay c 01/11/2019 To set payroll period instead of claim period */
System.out.println("@vinay c::payrollPrd>>"+payrollPrd);
retString = admCommon.payarrToProcUpdation(payrollPrd,payrollPrd, empCode, empCode, "AR", "w_perkclaim_cancel_load", "", adCode,claimAmount*-1 , frDateStr, toDateStr, xtraParams, conn);
/* End */
System.out.println("retString--["+retString+"]");
if(retString != null && retString.trim().length() > 0)
{
conn.rollback();
retString = itmDBAccess.getErrorString("", retString, "", "",conn);
return retString;
}
}
//Added By Amit Shrivastava on 26/02/19 for update reversal claim amount [End]
}
else
{
/**If Payroll voucher type is Voucher
* will inserted records into tables
* */
if(tranId != null && tranId.trim().length() > 0)
{
sqlPayrVcr = "select tran_id from payr_voucher where tran_type = ? AND REF_NO = ?";
payrVcrPstmt = conn.prepareStatement(sqlPayrVcr);
payrVcrPstmt.setString(1,tranType);
payrVcrPstmt.setString(2,tranId);
rs2 = payrVcrPstmt.executeQuery();
if(rs2.next())
{
tranIdPayVcr = rs2.getString("tran_id");
System.out.println("tranIdPayVcr >> "+tranIdPayVcr);
}
close(payrVcrPstmt, rs2);
}
tranIdPayVcr = checkNull(tranIdPayVcr);
System.out.println("@amit tranIdPayVcr@"+tranIdPayVcr);
/**
* Check the old voucher voucher
* is in same financial year
* */
if(tranIdPayVcr != null && tranIdPayVcr.trim().length() > 0)
{
//Adde By Amit Shrivastava on 31/01/19 [Start]
/*sql = "select FN_CHECK_ACCOUNTING_YEAR(?,?,?,?) as err_code from dual";*/
sql = "select FN_CHECK_ACCOUNTING_YEAR(?,?,?,?,?) as err_code from dual";
//Adde By Amit Shrivastava on 31/01/19 [end]
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
//pstmt.setString(2, tranIdPayVcr);
pstmt.setString(2, tranId);
pstmt.setString(3, userId);
/* pstmt.setString(4, tranDate);*/
//ADDED BY AMIT SHRIVASTAVA[START]
pstmt.setTimestamp(4, tranDateTimpstamp);
//ADDED BY AMIT SHRIVASTAVA[END].
//Adde By Amit Shrivastava on 31/01/19 [Start]
pstmt.setString(5, "PERK_CLAIM_CAN");
//Adde By Amit Shrivastava on 31/01/19 [end]
rs = pstmt.executeQuery();
if (rs.next())
{
errorString = rs.getString("err_code");
}
}
close(pstmt, rs);
if(errorString!=null && errorString.trim().length()>0)
{
errString = itmDBAccess.getErrorString("", errorString, "");
return errString;
}
else
{
int cntHDR = 0,cnt = 0;
/**added and modified by vinay chaurasiya for insert new record instead
* of updating the adclaimhdr table for perk claim cancel process date 29/10/18. start**/
//tranIdNew=checkNull(generateTranId(claimDate,paySite,conn));
tranIdNew=checkNull(generateTranId(tranDate,paySite,conn));
System.out.println("tranIdNew >> "+ tranIdNew);
sql = "select count(*) as cnt from EMP_ADCLAIMHDR where tran_id = ?";
adClaimPstmthdr = conn.prepareStatement(sql);
adClaimPstmthdr.setString(1,tranId);
//adClaimPstmthdr.setString(1,tranIdNew);
rs = adClaimPstmthdr.executeQuery();
if(rs.next())
{
cntHDR = rs.getInt("cnt");
}
System.out.println("Count --["+cntHDR+"]");
System.out.println(this.getClass().getName()+"713["+userId+"]");
System.out.println("--new train id voucher--"+tranIdNew);
close(adClaimPstmthdr,rs);
if(cntHDR > 0)
{
/*sqlUpdateEmpAdClaimHDR = "UPDATE EMP_ADCLAIMHDR SET CONFIRMED =?,CANCEL_BY =?,CANCEL_DATE = ?"+ " WHERE TRAN_ID = ?";*/
//added by amit shrivatava on 12/NOV/2018 for alter adclaimhdr table
sqlUpdateEmpAdClaimHDR = "UPDATE EMP_ADCLAIMHDR SET REF_STATUS =? ,REF_ID__REV = ?"
+ " WHERE TRAN_ID = ?";
adclaimhdrPstmt = conn.prepareStatement(sqlUpdateEmpAdClaimHDR);
adclaimhdrPstmt.setString(1,"Y");
adclaimhdrPstmt.setString(2,tranIdNew);
//adclaimhdrPstmt.setTimestamp(3, new java.sql.Timestamp(System.currentTimeMillis()));
adclaimhdrPstmt.setString(3,tranId);
updateCnt = adclaimhdrPstmt.executeUpdate();
if(updateCnt >0)
System.out.println("EMP_ADCLAIMHDR Updated with tran Id >> "+ tranId);
System.out.println("EMP_ADCLAIMHDR Updated with tran Id >> "+ tranIdNew);
}
close(adclaimhdrPstmt,rs);
/*empAdclaimSql = "select count(*) as cnt from EMP_ADCLAIM where tran_id = ?";
adClaimPstmt = conn.prepareStatement(empAdclaimSql);
adClaimPstmt.setString(1,tranId);
rs = adClaimPstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt("cnt");
}
System.out.println("Count --["+cnt+"]");
close(adClaimPstmt,rs);
if(cnt > 0)
{
sqlUpdateEmpAdClaim = "UPDATE EMP_ADCLAIM SET CLAIM_AMT = ?"
+ " WHERE TRAN_ID = ?";
adClaimUpdate = conn.prepareStatement(sqlUpdateEmpAdClaim);
adClaimUpdate.setDouble(1,claimAmount *(-1));
adClaimUpdate.setString(2,tranId);
updateCnt = adClaimUpdate.executeUpdate();
if(updateCnt >0)
System.out.println("EMP_ADCLAIMHDR EMP_ADCLAIM with tran Id >> "+ tranId);
}*/
/*tranIdNew=checkNull(generateTranId(claimDate,paySite,conn));
System.out.println("tranIdNew >> "+ tranIdNew);*/
sql="SELECT tran_date,emp_code,claim_amt,loan_adjamt,payroll_voucher,prd_code__payroll,"
+ " ad_code,confirmed,udf_type FROM EMP_ADCLAIMHDR where tran_id=? ";
adClaimPstmthdr = conn.prepareStatement(sql);
adClaimPstmthdr.setString(1,tranId);
rs = adClaimPstmthdr.executeQuery();
if(rs.next())
{
tranDateNew=rs.getDate("tran_date");
employeeCode=rs.getString("emp_code");
claimAmountValue=rs.getDouble("claim_amt");
loanAdjamountValue=rs.getDouble("loan_adjamt");
payrollVoucherValue=rs.getString("payroll_voucher");
payrollPrdValue=rs.getString("prd_code__payroll");
adCodeValue=rs.getString("ad_code");
confirmedValue=rs.getString("confirmed");
udfType = rs.getString("udf_type");
}
System.out.println("Count --["+tranId+"]");
close(pstmt,rs);
sqlUpdateEmpAdClaimHDR="insert into EMP_ADCLAIMHDR "
+ " (tran_id,tran_date,emp_code,claim_amt,loan_adjamt,payroll_voucher,prd_code__payroll,chg_date,chg_user,chg_term,ad_code,confirmed,udf_type) "
+ " Values(?,?,?,?,?,?,?,?,?,?,?,?,?)";
adclaimhdrPstmt=conn.prepareStatement(sqlUpdateEmpAdClaimHDR);
adclaimhdrPstmt.setString(1,checkNull(tranIdNew));
//Added By Amit Shrivastava on 2/04/19 [start] for upate trandatenew to current date
/*adclaimhdrPstmt.setDate(2,tranDateNew);*/
adclaimhdrPstmt.setDate(2,date);
//Added By Amit Shrivastava on 2/04/19 [end] for upate trandatenew to current date
adclaimhdrPstmt.setString(3,checkNull(employeeCode));
//Added By Amit Shrivastava on 2/04/19 [start] for upate claimAmountValue to negative amount
/*adclaimhdrPstmt.setDouble(4,claimAmountValue);*/
adclaimhdrPstmt.setDouble(4,claimAmountValue*(-1));
System.out.println("@AmitclaimAmountValue"+claimAmountValue*(-1));
//Added By Amit Shrivastava on 2/04/19 [end] for upate claimAmountValue to negative amount
adclaimhdrPstmt.setDouble(5,loanAdjamountValue);
adclaimhdrPstmt.setString(6,checkNull(payrollVoucherValue));
adclaimhdrPstmt.setString(7,checkNull(payrollPrdValue));
adclaimhdrPstmt.setTimestamp(8, new java.sql.Timestamp(System.currentTimeMillis()));
adclaimhdrPstmt.setString(9,checkNull(userId));
adclaimhdrPstmt.setString(10,checkNull(chgTerm));
adclaimhdrPstmt.setString(11,checkNull(adCodeValue));
adclaimhdrPstmt.setString(12,checkNull(confirmed));
adclaimhdrPstmt.setString(13,checkNull(udfType));
int insert=adclaimhdrPstmt.executeUpdate();
if(insert >0)
{
msgType.append("adclaimhdr");
System.out.println("EMP_ADCLAIMHDR inserted with new tran Id >> "+ tranIdNew);
}
employeeCode="";payrollVoucherValue="";payrollPrdValue="";
adCodeValue="";confirmedValue = "";udfType = "";
claimAmountValue=0.0d;loanAdjamountValue=0.0d;
tranDateNew = null;
empAdclaimSql= "SELECT EMP_CODE,AD_CODE,EFF_DATE,BAL_AMT,CLAIM_AMT,LOAN_ADJAMT,"
+ " PAYROLL_VOUCHER,PRD_CODE__PAYROLL, TRAN_DATE FROM EMP_ADCLAIM WHERE TRAN_ID = ? ";
adClaimPstmt = conn.prepareStatement(empAdclaimSql);
adClaimPstmt.setString(1,tranId);
rs = adClaimPstmt.executeQuery();
//Added By amit Shrivastava on 26/02/19 for get all claim usres data [Start]
/*if(rs.next())*/
//Added By amit Shrivastava 26/02/19 for get all claim usres data [Start]
while(rs.next())
{
employeeCode = checkNull(rs.getString("EMP_CODE"));
adCodeValue = checkNull(rs.getString("AD_CODE"));
effDate = rs.getDate("EFF_DATE");
//Added By Amit shrivastava on 05/02/19 [start]
System.out.println("@AmitEFF_DATE"+effDate);
//Added By Amit shrivastava on 050219 [start
balAmountValue = rs.getDouble("BAL_AMT");
claimAmountValue =rs.getDouble("CLAIM_AMT");
loanAdjamountValue =rs.getDouble("LOAN_ADJAMT");
payrollVoucherValue =checkNull(rs.getString("PAYROLL_VOUCHER"));
payrollPrdValue =checkNull(rs.getString("PRD_CODE__PAYROLL"));
tranDateNew =rs.getDate("TRAN_DATE");
System.out.println(" @Amit tranDateNew value AmitEFF_DATE>>"+tranDateNew);
sqlUpdateEmpAdClaim = "insert into EMP_ADCLAIM (TRAN_ID,EMP_CODE,AD_CODE,EFF_DATE,BAL_AMT,CLAIM_AMT,LOAN_ADJAMT,PAYROLL_VOUCHER,PRD_CODE__PAYROLL,CHG_DATE,CHG_USER,CHG_TERM,TRAN_DATE)"
+ " Values(?,?,?,?,?,?,?,?,?,?,?,?,?)";
adClaimUpdate = conn.prepareStatement(sqlUpdateEmpAdClaim);
adClaimUpdate.setString(1,checkNull(tranIdNew));
adClaimUpdate.setString(2,checkNull(employeeCode));
adClaimUpdate.setString(3,checkNull(adCodeValue));
adClaimUpdate.setDate(4,(java.sql.Date) effDate);
adClaimUpdate.setDouble(5,balAmountValue);
//Added By Amit Shrivastava on 19/02/19 start for change claimAmountValue value into negative calim amount
/*adClaimUpdate.setDouble(6,claimAmountValue);*/
System.out.println("@Amit claimAmountValue>>"+claimAmountValue);
adClaimUpdate.setDouble(6,claimAmountValue*(-1));
System.out.println("claimAmountValue*"+claimAmountValue*(-1));
//Added By Amit Shrivastava on 19/02/19 start for change claimAmountValue value into negative calim amount
adClaimUpdate.setDouble(7,loanAdjamountValue);
adClaimUpdate.setString(8,checkNull(payrollVoucherValue));
adClaimUpdate.setString(9,checkNull(payrollPrdValue));
adClaimUpdate.setTimestamp(10, new java.sql.Timestamp(System.currentTimeMillis()));
adClaimUpdate.setString(11,checkNull(userId));
adClaimUpdate.setString(12,checkNull(chgTerm));
adClaimUpdate.setDate(13,tranDateNew);
updateCnt = adClaimUpdate.executeUpdate();
if(adClaimUpdate != null)
{
adClaimUpdate.close();
adClaimUpdate = null;
}
if(updateCnt >0)
{
msgType.append("adclaim");
System.out.println("insert EMP_ADCLAIM with tran Id >> "+ tranIdNew);
}
sql ="";
int allWCnt = 0;
sql = "select count(*) as cnt,start_date,end_date from ALLOWDEDN_BAL where emp_code = ?"
+ " and ad_code = ? and start_date = ? group by start_date, end_date";
adAllowBalPstmt = conn.prepareStatement(sql);
adAllowBalPstmt.setString(1,empCode);
adAllowBalPstmt.setString(2,adCode);
adAllowBalPstmt.setDate(3,(java.sql.Date) effDate);
ResultSet rsAllBal = null;
rsAllBal = adAllowBalPstmt.executeQuery();
while(rsAllBal.next())
{
allWCnt = rsAllBal.getInt("cnt");
startDate = rsAllBal.getDate("start_date");
endDate = rsAllBal.getDate("end_date");
sql="UPDATE ALLOWDEDN_BAL SET AMT_BAL = AMT_BAL + ?, AMT_ADJ = AMT_ADJ - ? , CHG_DATE= ?, CHG_USER= ? ,CHG_TERM= ? "
+ " WHERE EMP_CODE = ? AND AD_CODE = ? AND START_DATE = ? AND END_DATE = ?";
allowdednbalPstmt = conn.prepareStatement(sql);
allowdednbalPstmt.setDouble(1 , claimAmountValue);
allowdednbalPstmt.setDouble(2 , claimAmountValue);
allowdednbalPstmt.setTimestamp(3, new java.sql.Timestamp(System.currentTimeMillis()));
allowdednbalPstmt.setString(4,checkNull(userId));
allowdednbalPstmt.setString(5,checkNull(chgTerm));
allowdednbalPstmt.setString(6 , empCode);
allowdednbalPstmt.setString(7 , adCode);
allowdednbalPstmt.setDate( 8,new java.sql.Date(startDate.getTime()));
allowdednbalPstmt.setDate( 9, new java.sql.Date(endDate.getTime()));
//Added And Modify by Amit Shrivastava on 20/02/19 start for update chgg_term,chg_date,chg_user
int up = allowdednbalPstmt.executeUpdate();
if(allowdednbalPstmt != null)
{
allowdednbalPstmt.close();
allowdednbalPstmt = null;
}
if(up > 0){
System.out.println("ALLOWDEDN_BAL updated for >> "+empCode);
}
}
System.out.println("Count --["+allWCnt+"]");
close(adAllowBalPstmt,rsAllBal);
System.out.println("startDate >> "+ startDate +" "+ "endDate >> "+ endDate);
}
close(adClaimPstmt,rs);
/*sqlUpdateEmpAdClaim = "insert into EMP_ADCLAIM (TRAN_ID,EMP_CODE,AD_CODE,EFF_DATE,BAL_AMT,CLAIM_AMT,LOAN_ADJAMT,PAYROLL_VOUCHER,PRD_CODE__PAYROLL,CHG_DATE,CHG_USER,CHG_TERM,TRAN_DATE)"
+ " Values(?,?,?,?,?,?,?,?,?,?,?,?,?)";
adClaimUpdate = conn.prepareStatement(sqlUpdateEmpAdClaim);
adClaimUpdate.setString(1,checkNull(tranIdNew));
adClaimUpdate.setString(2,checkNull(employeeCode));
adClaimUpdate.setString(3,checkNull(adCodeValue));
adClaimUpdate.setDate(4,(java.sql.Date) effDate);
adClaimUpdate.setDouble(5,balAmountValue);
//Added By Amit Shrivastava on 19/02/19 start for change claimAmountValue value into negative calim amount
adClaimUpdate.setDouble(6,claimAmountValue);
System.out.println("@Amit claimAmountValue>>"+claimAmountValue);
adClaimUpdate.setDouble(6,claimAmountValue*(-1));
System.out.println("claimAmountValue*"+claimAmountValue*(-1));
//Added By Amit Shrivastava on 19/02/19 start for change claimAmountValue value into negative calim amount
adClaimUpdate.setDouble(7,loanAdjamountValue);
adClaimUpdate.setString(8,checkNull(payrollVoucherValue));
adClaimUpdate.setString(9,checkNull(payrollPrdValue));
adClaimUpdate.setTimestamp(10, new java.sql.Timestamp(System.currentTimeMillis()));
adClaimUpdate.setString(11,checkNull(userId));
adClaimUpdate.setString(12,checkNull(chgTerm));
adClaimUpdate.setDate(13,tranDateNew);
updateCnt = adClaimUpdate.executeUpdate();
if(updateCnt >0)
{
msgType.append("adclaim");
System.out.println("insert EMP_ADCLAIM with tran Id >> "+ tranIdNew);
}*/
/**added and modified by vinay chaurasiya for insert new record instead
* of updating the adclaim table for perk claim cancel process date 29/10/18. end*/
/**to update the allowden_bal table start*/
String autoPost = checkNull(getAutoPostValue(empCode,"AUTO_POST",conn));
/*// Amit Shrivastava on 02/01/19 Start for update allowdedn
sql = "SELECT start_date,end_date"
+ " FROM allowdedn_bal "
+ " WHERE ( allowdedn_bal.emp_code = ? ) "
+ " AND (ad_code = ?) AND (amt_bal <> 0 ) "
+ " AND (ref_type = 'K' ) AND "
+ " ( decode(?,'Y',allowdedn_bal.start_date,allowdedn_bal.end_date) < ? ) "
+ " AND (allowdedn_bal.exp_date is null OR allowdedn_bal.exp_date >= ? ) "
+ " ORDER BY allowdedn_bal.start_date ASC";
//Added By Amit Shrivastava on 200219 for get start_date and end_date value start
sql = "SELECT start_date,end_date"
+ " FROM allowdedn_bal "
+ " WHERE ( allowdedn_bal.emp_code = ? ) "
+ " AND (ad_code = ?) AND (amt_bal <> 0 ) "
+ " AND (ref_type = 'K' ) AND "
+ " ( decode(?,'Y',allowdedn_bal.start_date,allowdedn_bal.end_date) < ? ) "
+ " AND (allowdedn_bal.exp_date is null OR allowdedn_bal.exp_date >= ? ) "
+ " AND(allowdedn_bal.start_date=?) "
+ " ORDER BY allowdedn_bal.start_date ASC";
//Added By Amit Shrivastava on 02/01/19 end for update allowdedn
*/
/*sql = " select start_date,end_date from allowdedn_bal where emp_code = ? and ad_code = ? ";
//Added By Amit Shrivastava on 20/02/19 for get end and end_date value END
pstmt = conn.prepareStatement(sql);
pstmt.setString( 1, empCode );
pstmt.setString( 2, adCode );
//Commited By Amit Shrivastava on 20/02/19
pstmt.setString( 3, autoPost.trim() );
pstmt.setDate( 4,new java.sql.Date(claimDate.getTime()));
pstmt.setDate( 5, new java.sql.Date(claimDate.getTime()));
//Added By Amit Shrivastava on 02/01/19[Start]
pstmt.setDate( 6,(java.sql.Date)effDate);
//Commited By Amit Shrivastava on 20/02/19[End]
rs = pstmt.executeQuery();
while( rs.next() )
{
startDate = rs.getDate("start_date");
endDate = rs.getDate("end_date");
}
close(pstmt, rs);*/
/*sql ="";
int allWCnt = 0;
sql = "select count(*) as cnt,start_date,end_date from ALLOWDEDN_BAL where emp_code = ?"
+ " and ad_code = ? and start_date = ? group by start_date, end_date";
adAllowBalPstmt = conn.prepareStatement(sql);
adAllowBalPstmt.setString(1,empCode);
adAllowBalPstmt.setString(2,adCode);
adAllowBalPstmt.setDate(3,(java.sql.Date) effDate);
rs = adAllowBalPstmt.executeQuery();
while(rs.next())
{
allWCnt = rs.getInt("cnt");
startDate = rs.getDate("start_date");
endDate = rs.getDate("end_date");
sql="UPDATE ALLOWDEDN_BAL SET AMT_BAL = AMT_BAL + ?, AMT_ADJ = AMT_ADJ - ? , CHG_DATE= ?, CHG_USER= ? ,CHG_TERM= ? "
+ " WHERE EMP_CODE = ? AND AD_CODE = ? AND START_DATE = ? AND END_DATE = ?";
allowdednbalPstmt = conn.prepareStatement(sql);
allowdednbalPstmt.setDouble(1 , claimAmount);
allowdednbalPstmt.setDouble(2 , claimAmount);
allowdednbalPstmt.setTimestamp(3, new java.sql.Timestamp(System.currentTimeMillis()));
allowdednbalPstmt.setString(4,checkNull(userId));
allowdednbalPstmt.setString(5,checkNull(chgTerm));
allowdednbalPstmt.setString(6 , empCode);
allowdednbalPstmt.setString(7 , adCode);
allowdednbalPstmt.setDate( 8,new java.sql.Date(startDate.getTime()));
allowdednbalPstmt.setDate( 9, new java.sql.Date(endDate.getTime()));
//Added And Modify by Amit Shrivastava on 20/02/19 start for update chgg_term,chg_date,chg_user
int up = allowdednbalPstmt.executeUpdate();
if(allowdednbalPstmt != null)
{
allowdednbalPstmt.close();
allowdednbalPstmt = null;
}
if(up > 0){
System.out.println("ALLOWDEDN_BAL updated for >> "+empCode);
}
}
System.out.println("Count --["+allWCnt+"]");
close(adAllowBalPstmt,rs);
System.out.println("startDate >> "+ startDate +" "+ "endDate >> "+ endDate);*/
//added by amir shrivastava on 14/11/18 strat. for check fromDate and toDate null.
/*if(allWCnt>0)
{
//Added And Modify by Amit Shrivastava on 20/02/19 start for update chgg_term,chg_date,chg_user
sql = "UPDATE ALLOWDEDN_BAL SET AMT_BAL = AMT_BAL + ?, AMT_ADJ = AMT_ADJ - ? "
+ " WHERE EMP_CODE = ? AND AD_CODE = ? AND START_DATE = ? AND END_DATE = ?";
allowdednbalPstmt = conn.prepareStatement(sql);
allowdednbalPstmt.setDouble(1 , claimAmount);
allowdednbalPstmt.setDouble(2 , claimAmount);
allowdednbalPstmt.setString(3 , empCode);
allowdednbalPstmt.setString(4 , adCode);
allowdednbalPstmt.setDate( 5,new java.sql.Date(startDate.getTime()));
allowdednbalPstmt.setDate( 6, new java.sql.Date(endDate.getTime()));
sql="UPDATE ALLOWDEDN_BAL SET AMT_BAL = AMT_BAL + ?, AMT_ADJ = AMT_ADJ - ? , CHG_DATE= ?, CHG_USER= ? ,CHG_TERM= ? "
+ " WHERE EMP_CODE = ? AND AD_CODE = ? AND START_DATE = ? AND END_DATE = ?";
allowdednbalPstmt = conn.prepareStatement(sql);
allowdednbalPstmt.setDouble(1 , claimAmount);
allowdednbalPstmt.setDouble(2 , claimAmount);
allowdednbalPstmt.setTimestamp(3, new java.sql.Timestamp(System.currentTimeMillis()));
allowdednbalPstmt.setString(4,checkNull(userId));
allowdednbalPstmt.setString(5,checkNull(chgTerm));
allowdednbalPstmt.setString(6 , empCode);
allowdednbalPstmt.setString(7 , adCode);
allowdednbalPstmt.setDate( 8,new java.sql.Date(startDate.getTime()));
allowdednbalPstmt.setDate( 9, new java.sql.Date(endDate.getTime()));
//Added And Modify by Amit Shrivastava on 20/02/19 start for update chgg_term,chg_date,chg_user
int up = allowdednbalPstmt.executeUpdate();
if(up > 0){
System.out.println("ALLOWDEDN_BAL updated for >> "+empCode);
}
}else
{
System.out.println("startDateand endDate null found");
}*/
/**to update the allowden_bal table END*/
/**calling Hr voucher reversal component to create reverse voucher*/
hrVcrRev = new HRVoucherReversal();
System.out.println("CALL TO hrVcrRev.actionHandler ");
successStr = checkNull(hrVcrRev.actionHandler(tranIdPayVcr, xtraParams, "", conn));
System.out.println("successStr FROM >> hrVcrRev.actionHandler"+successStr);
String description = "", message = "",type = "",tranIdVouch="";
try
{
if(successStr.trim().length() >0)
{
Document error = genericUtility.parseString(successStr);
description = checkNull(genericUtility.getColumnValue( "description", error));
message = checkNull(genericUtility.getColumnValue( "message", error));
type = checkNull(genericUtility.getColumnValue( "type", error));
if(type.trim().length() >0)
isError = true;
}
else{
errString = itmDBAccess.getErrorString("", "VTPRCSUCSS", "");
}
//Added By Amit Shrivastava for get value of tran_id from PAYR_VOUCHER and update EMP_ADCLAIMHDR[Start]
/*sql=" select tran_id from PAYR_VOUCHER where ref_no=?";
payr_Voucherpstmt = conn.prepareStatement(sql);
payr_Voucherpstmt.setString( 1, tranId);
payr_Voucherrs = payr_Voucherpstmt.executeQuery();
while( payr_Voucherrs.next() )
{
tranIdVouch = payr_Voucherrs.getString("tran_id");
}
close(payr_Voucherpstmt, payr_Voucherrs);
sql="UPDATE EMP_ADCLAIMHDR SET REF_ID__PVOUCH=? WHERE TRAN_ID=?";
empadclaimPstmt = conn.prepareStatement(sql);
empadclaimPstmt.setString(1 , tranIdVouch);
empadclaimPstmt.setString(2 , tranIdNew);
int up = empadclaimPstmt.executeUpdate();
if(up > 0){
System.out.println("@AmitALLOWDEDN_BAL updated for >> "+tranIdVouch);
}
else {
System.out.println("@Amit ALLOWDEDN_BAL is not updated >>");
}
if(empadclaimPstmt != null)
{
empadclaimPstmt.close();
empadclaimPstmt = null;
}*/
//Added By Amit Shrivastava for get value of tran_id from PAYR_VOUCHER and update EMP_ADCLAIMHDR[End]
}
catch(Exception e)
{
isError = true;
e.printStackTrace();
}
}
System.out.println("return String >> "+ errString);
}
}
}
catch(Exception e)
{
isError = true;
System.out.println("Exception :PerkClaimCancelProcess : :==>\n"+e.getMessage());
e.printStackTrace();
}
finally
{
try
{
System.out.println("isError ["+isError+"]");
System.out.println("isLocalConn ["+isLocalConn+"]");
if( conn != null )
{
if( isError )
{
conn.rollback();
errString = itmDBAccess.getErrorString("", "VTPRKFAIL", "");
System.out.println(">> transaction Rollback <<");
}
else
{
conn.commit();
System.out.println(">> transaction commited <<");
}
}
if (rs != null)
{
rs.close();
rs = null;
}
if (rs2 != null)
{
rs2.close();
rs2 = null;
}
close(pstmt, rs);
close(adclaimhdrPstmt, null);
close(adClaimPstmthdr, null);
close(adAllowBalPstmt, null);
close(payrVcrPstmt, null);
close(adClaimPstmt, null);
close(adClaimUpdate, null);
}
catch(Exception e)
{
System.out.println("Exception :PerkClaimCancelProcess : :==>\n"+e.getMessage());
try
{
System.out.println("Before rollback");
conn.rollback();
}
catch(SQLException sqle)
{
System.out.println(sqle);
}
e.printStackTrace();
}
}
System.out.println("Return string :"+errString);
return errString;
}
/**
* @method : checkNull
* @param : String
* @throws :
* @return : String
*
**/
public String checkNull(String input)
{
if (input == null || "null".equalsIgnoreCase(input))
{
input= "";
}
return input.trim();
}
/**
* @method : getObjNameFromDom
* @param : Document,String
* @throws : RemoteException,ITMException
* @return : String
*
**/
private String getObjNameFromDom( Document dom, String attribute ) throws RemoteException,ITMException
{
String objName = "";
try
{
NodeList detailList = null;
Node currDetail = null,reqDetail = null;
int detailListLength = 0;
detailList = dom.getElementsByTagName("Detail1");
detailListLength = detailList.getLength();
for (int ctr = 0;ctr < detailListLength;ctr++)
{
currDetail = detailList.item(ctr);
objName = currDetail.getAttributes().getNamedItem(attribute).getNodeValue();
}
}
catch(Exception e)
{
e.printStackTrace();
}
return objName;
}
/**
* @method : close
* @param : PreparedStatement,ResultSet
* @throws :
* @return :
*
**/
private void close(PreparedStatement pstmt,ResultSet rs) //Method to close PreparedStatement & ResultSet
{
try
{
if( rs != null)
{
rs.close();
rs = null;
}
if( pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
private String errorType(Connection conn, String errorCode) throws ITMException
{
String msgType = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
String sql = " SELECT MSG_TYPE FROM MESSAGES WHERE MSG_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, errorCode);
rs = pstmt.executeQuery();
while (rs.next())
{
msgType = rs.getString("MSG_TYPE");
}
}
catch (Exception ex)
{
ex.printStackTrace();
throw new ITMException(ex);
}
finally
{
try
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
}
return msgType;
}
private String getAutoPostValue(String empCode, String varName, Connection conn) throws ITMException
{
String autoPost="",sql="";
PreparedStatement pstmt=null;
ResultSet rs=null;
try
{
sql="select ddf_hr_site_env_value(?,SYSDATE,?)as var_value from dual";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, empCode);
pstmt.setString(2, varName);
rs=pstmt.executeQuery();
if(rs.next())
{
autoPost = rs.getString("var_value");
}
System.out.println("autoPost----["+autoPost+"]");
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
return autoPost;
}
//private String generateTranId(Date claimDate,String paySite,Connection conn)
private String generateTranId(String claimDate,String paySite,Connection conn)
{
String sql = "",keyStr ="",errString ="",tranId ="",refSer = "";
ResultSet rs = null;
PreparedStatement pstmt = null;
ITMDBAccessEJB itmDBAccess = new ITMDBAccessEJB();
System.out.println("claimDate >> " + claimDate);
System.out.println("paySite >> " + paySite);
try
{
sql = "select key_string as keystr,ref_ser as refSer "
+ " from transetup where upper(tran_window) = 'T_EMP_ADCLAIM'";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if(rs.next())
{
keyStr = checkNull(rs.getString("keystr"));
refSer = checkNull(rs.getString("refSer"));
}
else
{
errString = itmDBAccess.getErrorString("","VTSEQ1","","",conn);
}
System.out.println("keyStr"+keyStr);
close(pstmt, rs);
String xmlValues = "";
xmlValues ="<?xml version=\"1.0\" encoding=\"utf-8\"?><Root>";
xmlValues = xmlValues + "<Header></Header>";
xmlValues = xmlValues + "<Detail1>";
xmlValues = xmlValues + "<tran_id></tran_id>";
xmlValues = xmlValues + "<tran_date>" + claimDate + "</tran_date>";
xmlValues = xmlValues + "<site_code>" + paySite + "</site_code>";
xmlValues = xmlValues + "</Detail1></Root>";
System.out.println("xmlValues :["+xmlValues+"]");
TransIDGenerator tg = new TransIDGenerator(xmlValues, "SYSTEM", CommonConstants.DB_NAME);
//tranId = tg.generateTranSeqID(refSer.trim(), "tran_id", keyStr.trim(), conn);
tranId = tg.generateTranSeqID("ECLAIM", "tran_id", keyStr.trim(), conn);
System.out.println("tranId >> "+tranId);
}
catch(Exception e)
{
e.printStackTrace();
}
return tranId;
}
}
package ibase.webitm.ejb.adm;
import ibase.webitm.ejb.*;
import java.rmi.RemoteException;
import javax.ejb.EJBObject;
import java.util.ArrayList;
import java.sql.Connection;
import org.w3c.dom.*;
import ibase.webitm.utility.ITMException;
@javax.ejb.Local
public interface PerkClaimCancelProcessLocal extends ibase.webitm.ejb.ProcessLocal//, EJBObject
{
public String process() throws RemoteException,ITMException;
public String process(String xmlString, String xmlString2, String windowName, String xtraParams) throws RemoteException,ITMException;
public String process(Document dom, Document dom2, String windowName, String xtraParams) throws RemoteException,ITMException;
}
\ No newline at end of file
package ibase.webitm.ejb.adm;
import ibase.webitm.ejb.*;
import java.rmi.RemoteException;
import javax.ejb.EJBObject;
import java.util.ArrayList;
import java.sql.Connection;
import org.w3c.dom.*;
import ibase.webitm.utility.ITMException;
@javax.ejb.Remote
public interface PerkClaimCancelProcessRemote extends ibase.webitm.ejb.ProcessRemote//, EJBObject
{
public String process() throws RemoteException,ITMException;
public String process(String xmlString, String xmlString2, String windowName, String xtraParams) throws RemoteException,ITMException;
public String process(Document dom, Document dom2, String windowName, String xtraParams) throws RemoteException,ITMException;
}
\ No newline at end of file
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