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