Commit ea7b03ec authored by sgadve's avatar sgadve

For the resolving issue of Perk Lapse process

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@215629 ce508802-f39f-4f6c-b175-0d175dae99d5
parent a4876fd5
......@@ -313,9 +313,13 @@ public class PerkLapsePrc extends ProcessEJB
String empCodeStr = "", adCodeStr = "", startDateStr = "", endDateStr = "", paySite = "";
String finent = "",deptCode = "", payMode = "", currCode = "", bankCode = "";
double loanAdjust = 0, paidAmt = 0, claimAmtDble = 0, balAmtDbl = 0;
Timestamp startDateTs = null, endDateTs = null,claimDateTs = null,startDateStrTs = null,endDateStrTs = null,chgDateTs = null;
SimpleDateFormat sdfApplFormat = new SimpleDateFormat(genericUtility.getApplDateFormat());
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
chgDate = sdfApplFormat.format(new Date());
chgDateTs = Timestamp.valueOf(genericUtility.getValidDateString(chgDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())
+ " 00:00:00.0");
UserInfoBean userInfoBean = getUserInfo();
chgTerm = userInfoBean.getRemoteHost();
......@@ -362,6 +366,12 @@ public class PerkLapsePrc extends ProcessEJB
endDate = E12GenericUtility.checkNull(childNode.getFirstChild().getNodeValue());
}
}
startDateTs = Timestamp.valueOf(genericUtility.getValidDateString(startDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())
+ " 00:00:00.0");
endDateTs = Timestamp.valueOf(genericUtility.getValidDateString(endDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())
+ " 00:00:00.0");
claimDateTs = Timestamp.valueOf(genericUtility.getValidDateString(claimDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())
+ " 00:00:00.0");
claimAmtDble = Double.parseDouble(claimAmt);
paidAmt = claimAmtDble - loanAdjust;
......@@ -409,15 +419,15 @@ public class PerkLapsePrc extends ProcessEJB
pStmt = con.prepareStatement(sql);
pStmt.setString(1, empCode);
pStmt.setString(2, adCode);
pStmt.setString(3, startDate);
pStmt.setString(4, endDate);
pStmt.setTimestamp(3, startDateTs);
pStmt.setTimestamp(4, endDateTs);
rs = pStmt.executeQuery();
while (rs.next())
{
empCodeStr = rs.getString("emp_code");
adCodeStr = rs.getString("ad_code");
startDateStr = rs.getString("start_date");
endDateStr = rs.getString("end_date");
startDateStrTs = rs.getTimestamp("start_date");
endDateStrTs = rs.getTimestamp("end_date");
balAmtDbl = rs.getDouble("amt_bal");
if (balAmtDbl < 0)
{
......@@ -460,7 +470,7 @@ public class PerkLapsePrc extends ProcessEJB
payMode = rs.getString("pay_mode");
currCode = rs.getString("curr_code");
bankCode = rs.getString("bank_code");
errorString = claimProcess(adCodeStr, empCodeStr, startDate, endDate, claimAmtDble, xtraParams, con);
errorString = claimProcess(adCodeStr, empCodeStr, startDateTs, endDateTs, claimAmtDble, xtraParams, con);
if(errorString.length()>0)
{
return errorString;
......@@ -486,13 +496,13 @@ public class PerkLapsePrc extends ProcessEJB
"VALUES(?,?,?,?,?,?,?,?,?,?,?,?)";
pStmt = con.prepareStatement(sql);
pStmt.setString(1, tranId);
pStmt.setString(2, claimDate);
pStmt.setTimestamp(2,claimDateTs);
pStmt.setString(3, empCode);
pStmt.setDouble(4, claimAmtDble);
pStmt.setDouble(5, loanAdjust);
pStmt.setString(6, payRollVoucher);
pStmt.setString(7, payRoll);
pStmt.setString(8, chgDate);
pStmt.setTimestamp(8, chgDateTs);
pStmt.setString(9, userId);
pStmt.setString(10, chgTerm);
pStmt.setString(11, adCode);
......@@ -516,14 +526,14 @@ public class PerkLapsePrc extends ProcessEJB
+ ",CLAIM_AMT,CHG_DATE, CHG_USER, CHG_TERM ) VALUES (?,?,?,?,?,?,?,?,?,?,?)";
pStmt = con.prepareStatement(sql);
pStmt.setString(1, tranId);
pStmt.setString(2, claimDate);
pStmt.setTimestamp(2, claimDateTs);
pStmt.setString(3, payRollVoucher);
pStmt.setString(4, empCode);
pStmt.setString(5, adCode);
pStmt.setString(6, startDate);
pStmt.setTimestamp(6, startDateTs);
pStmt.setDouble(7, balAmtDbl);
pStmt.setDouble(8, claimAmtDble);
pStmt.setString(9, chgDate);
pStmt.setTimestamp(9, chgDateTs);
pStmt.setString(10, userId);
pStmt.setString(11, chgTerm);
int empAdClaim = pStmt.executeUpdate();
......@@ -584,7 +594,7 @@ public class PerkLapsePrc extends ProcessEJB
}
public String claimProcess(String adCode,String empCode,String startDate,String endDate,double claimAmt,String xtraParams,Connection con)
public String claimProcess(String adCode,String empCode,Timestamp startDate,Timestamp endDate,double claimAmt,String xtraParams,Connection con)
{
String errorString ="",sql="",userId="";
double balAmtDbl=0,amtAdjDbl=0;
......@@ -592,13 +602,14 @@ public class PerkLapsePrc extends ProcessEJB
ResultSet rs = null;
try
{
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
sql="SELECT AMT_BAL,AMT_ADJ FROM ALLOWDEDN_BAL WHERE EMP_CODE=? AND AD_CODE=? AND START_DATE=? AND END_DATE=?";
pStmt = con.prepareStatement(sql);
pStmt.setString(1, empCode);
pStmt.setString(2, adCode);
pStmt.setString(3, startDate);
pStmt.setString(4, endDate);
pStmt.setTimestamp(3, startDate);
pStmt.setTimestamp(4, endDate);
rs=pStmt.executeQuery();
while(rs.next())
{
......@@ -621,8 +632,8 @@ public class PerkLapsePrc extends ProcessEJB
pStmt.setDouble(2, amtAdjDbl+claimAmt);
pStmt.setString(3, empCode);
pStmt.setString(4, adCode);
pStmt.setString(5, startDate);
pStmt.setString(6, endDate);
pStmt.setTimestamp(5, startDate);
pStmt.setTimestamp(6, endDate);
int noRowsUpdate = pStmt.executeUpdate();
if(noRowsUpdate!=1)
......
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