Commit 25c83da1 authored by vvengurlekar's avatar vvengurlekar

EmpLeaveConf.java - changes to compare leavebal eff and upto date to...

EmpLeaveConf.java - changes to compare leavebal eff and upto date to emp_lveprkbal_trfdet from and to date 


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@194984 ce508802-f39f-4f6c-b175-0d175dae99d5
parent c6b5c8a3
......@@ -3525,6 +3525,8 @@ public class EmpLeaveConf extends ActionHandlerEJB implements EmpLeaveConfLocal,
//AEDFunctionsAdv functionsAdv = new AEDFunctionsAdv();
AttdProcess attdProc;
//$$$$$$$$$$$$$$$$$$$$$ END $$$$$$$$$$$$$$$$$$$$$$$$$$
Timestamp detFrDate = null, detToDate = null;
try
{
System.out.println("================Inside Leaves approve==============");
......@@ -3752,14 +3754,115 @@ public class EmpLeaveConf extends ActionHandlerEJB implements EmpLeaveConfLocal,
fVal4 = resultSet.getTimestamp("UPTO_DATE");
fVal5 = resultSet.getTimestamp("EXP_DATE");
fVal6 = resultSet.getDouble("BAL_DAYS");
System.out.println("museFlag: ["+museFlag+"] mDays: ["+mDays+"] fVal3: ["+fVal3+"]"
+ " mDate1: ["+mDate1+"] fVal4: ["+fVal4+"] mDate2: ["+mDate2+"] fVal6: ["+fVal6+"]");
if(noRows > 0)
{
//Added by Varsha V on 28-12-18 for taking from date and to date from emp_lveprkbal_trfdet
System.out.println("tranId::: ["+tranId+"] mLveCode::: ["+mLveCode+"] fVal3::: ["+fVal3+"] fVal4::: ["+fVal4+"]");
String detTranId = "";
sql2 = "select tran_id from emp_lveprkbal_trfdet where tran_id__ref = ?";
pstmt2 = connectionObject.prepareStatement(sql2);
pstmt2.setString(1, tranId);
resultSet2 = pstmt2.executeQuery();
while(resultSet2.next())
{
detTranId = checkNull(resultSet2.getString("tran_id"));
}
if(resultSet2 != null)
{
resultSet2.close();
resultSet2 = null;
}
if(pstmt2 != null)
{
pstmt2.close();
pstmt2 = null;
}
System.out.println("detTranId::: ["+detTranId+"]");
if(detTranId.trim().length() > 0)
{
sql2 = "select from_date, to_date from emp_lveprkbal_trfdet where "
+ "tran_id = ? and balance_code = ? "
+ "and from_date = ? and to_date = ?";
pstmt2 = connectionObject.prepareStatement(sql2);
pstmt2.setString(1, detTranId);
pstmt2.setString(2, mLveCode);
pstmt2.setTimestamp(3, fVal3);
pstmt2.setTimestamp(4, fVal4);
resultSet2 = pstmt2.executeQuery();
while(resultSet2.next())
{
detFrDate = resultSet2.getTimestamp("from_date");
detToDate = resultSet2.getTimestamp("to_date");
}
if(resultSet2 != null)
{
resultSet2.close();
resultSet2 = null;
}
if(pstmt2 != null)
{
pstmt2.close();
pstmt2 = null;
}
}
System.out.println("detFrDate:: ["+detFrDate+"] detToDate:: ["+detToDate+"]");
//Ended by Varsha V on 28-12-18 for taking from date and to date from emp_lveprkbal_trfdet
if( ((fVal6 < 0) || (fVal6 == 0 && (fVal3.before(mDate1) || fVal3.equals(mDate1)))))
{
continue;
//Commented and Added by Varsha V on 06-12-18 for not to allow if following condition fails
//continue;
// if(museFlag.equalsIgnoreCase("A") && mDays < 0 && fVal6 == mDays && fVal3.equals(mDate1) && fVal4.equals(mDate2))
//if(museFlag.equalsIgnoreCase("A") && mDays < 0 && fVal3.equals(mDate1) && fVal4.equals(mDate2))
//Added by Varsha V on 28-12-18 for comparing leavebal eff and upto date to emp_lveprkbal_trfdet from and to date
if(detTranId.trim().length() > 0)
{
System.out.println("Inside ((fVal6 < 0) || (fVal6 == 0 && (fVal3.before(mDate1) || fVal3.equals(mDate1))))");
if(museFlag.equalsIgnoreCase("A") && mDays < 0 && fVal3.equals(detFrDate) && fVal4.equals(detToDate))
{
System.out.println("detFrDate and detToDate is matched");
if (fVal6 != mDays)
{
System.out.println("Not equal");
errCode = "DS000NR";
this.errList.add(errCode);
this.fldList.add("");
isError = true;
break;
}
}
else
{
System.out.println("detFrDate and detToDate is not matched");
continue;
}
}
else
{
System.out.println("if(museFlag.equalsIgnoreCase(\"A\") && mDays < 0 && fVal3.equals(mDate1) && fVal4.equals(mDate2))");
if(museFlag.equalsIgnoreCase("A") && mDays < 0 && fVal3.equals(mDate1) && fVal4.equals(mDate2))
{
if (fVal6 != mDays)
{
System.out.println("Not equal");
errCode = "DS000NR";
this.errList.add(errCode);
this.fldList.add("");
isError = true;
break;
}
}
else
{
continue;
}
}
//Ended by Varsha V on 06-12-18 for not to allow if following condition fails
//Ended by Varsha V on 28-12-18 for comparing leavebal eff and upto date to emp_lveprkbal_trfdet from and to date
}
if(fVal6 < nextBal)
{
updBal = fVal6;
......@@ -3775,6 +3878,9 @@ public class EmpLeaveConf extends ActionHandlerEJB implements EmpLeaveConfLocal,
mConDays = 0;
mEnchDays = updBal;
}
System.out.println("updBal : ["+updBal+"] mConDays : ["+mConDays+"] mEnchDays : ["+mEnchDays+"]"
+ "fVal1: ["+fVal1+"] fVal2: ["+fVal2+"] fVal3: ["+fVal3+"] fVal4: ["+fVal4+"]");
sql2 = "UPDATE LEAVEBAL SET BAL_DAYS= BAL_DAYS - ?,CONS_DAYS = CONS_DAYS + ?,ENCH_DAYS = ENCH_DAYS + ? WHERE EMP_CODE = ? AND LVE_CODE = ? AND EFF_DATE = ? AND UPTO_DATE = ?";
pstmt2 = connectionObject.prepareStatement(sql2);
......@@ -3904,7 +4010,7 @@ public class EmpLeaveConf extends ActionHandlerEJB implements EmpLeaveConfLocal,
}
}
nextBal = nextBal - updBal;
if(nextBal == 0)
if(nextBal == 0d)
{
break;
}
......@@ -3921,13 +4027,23 @@ public class EmpLeaveConf extends ActionHandlerEJB implements EmpLeaveConfLocal,
pstmt.close();
pstmt = null;
}
System.out.println("nextBal: ["+nextBal+"]");
if((errCode != null) && errCode.trim().length() > 0)
{
isError = true;
break;
}
else if(nextBal > 0)
// Modified by Varsha V on 20/12/2018 [To check any negative balance and give error].Start
else if (nextBal < 0d)
{
errCode = "DS000NR";
this.errList.add(errCode);
this.fldList.add("");
isError = true;
break;
}
// Modified by Varsha V on 20/12/2018 [To check any negative balance for adjustment and give error].Start
else if(nextBal > 0d)
{
//allowUpdateNegLeave = (boolean) this.lveRuleList.get("allow_update_negative_leave");
allowUpdateNegLeave = (Boolean)this.lveRuleList.get("allow_update_negative_leave");
......@@ -3984,6 +4100,7 @@ public class EmpLeaveConf extends ActionHandlerEJB implements EmpLeaveConfLocal,
pstmt = null;
}
noRows = 0;
System.out.println("1. mEmp: ["+mEmp+"] mLveCode: ["+mLveCode+"] fVal3: ["+fVal3+"] fVal4: ["+fVal4+"]");
sql = "UPDATE LEAVEBAL SET BAL_DAYS = BAL_DAYS - ?,CONS_DAYS = CONS_DAYS + ? "+
" WHERE EMP_CODE = ? AND LVE_CODE = ? AND EFF_DATE = ? AND UPTO_DATE = ?";
pstmt = connectionObject.prepareStatement(sql);
......@@ -4032,6 +4149,8 @@ public class EmpLeaveConf extends ActionHandlerEJB implements EmpLeaveConfLocal,
if(mCnt == 0)
{
noRows = 0;
System.out.println("tranId: ["+tranId+"]"+"mEmp: ["+mEmp+"] mLveCode: ["+mLveCode+"] fVal3: ["
+fVal3+"] fVal4: ["+fVal4+"] mDate1: ["+mDate1+"] mDate2: ["+mDate2+"]");
sql = "INSERT INTO EMPLVE_TRACE (TRAN_ID , EMP_CODE, LVE_DATE_FR, LVE_DATE_TO, LVE_CODE,"
+" EFF_DATE, UPTO_DATE, LVES_ALLOC)VALUES (?,?,?,?,?,?,?,?) ";
pstmt = connectionObject.prepareStatement(sql);
......@@ -4061,6 +4180,7 @@ public class EmpLeaveConf extends ActionHandlerEJB implements EmpLeaveConfLocal,
else
{
noRows = 0;
System.out.println("nextBal: ["+nextBal+"] tranId: ["+tranId+"] fVal3: ["+fVal3+"] fVal4: ["+fVal4+"]");
sql = "UPDATE EMPLVE_TRACE SET LVES_ALLOC = (CASE WHEN LVES_ALLOC IS NULL THEN 0 ELSE LVES_ALLOC END) + ?"
+"WHERE TRAN_ID = ? AND EFF_DATE = ? AND UPTO_DATE = ?";
pstmt = connectionObject.prepareStatement(sql);
......@@ -4177,6 +4297,8 @@ public class EmpLeaveConf extends ActionHandlerEJB implements EmpLeaveConfLocal,
noDays = mDays;
}
noRows = 0;
System.out.println("tranId: ["+tranId+"]"+"mEmp: ["+mEmp+"] mLveCode: ["+mLveCode+"] noDays: ["
+noDays+"] period: ["+period+"] mDate1: ["+mDate1+"] mDate2: ["+mDate2+"] museFlag: ["+museFlag+"]");
sql7 = "INSERT INTO EMPLEAVE_SUMMARY (TRAN_ID , EMP_CODE, LVE_DATE_FR, LVE_DATE_TO, LVE_CODE, NO_DAYS,PRD_CODE,USE_FLAG ) VALUES(?,?,?,?,?,?,?,?)";
pstmt7 = connectionObject.prepareStatement(sql7);
pstmt7.setString(1, tranId);
......@@ -4322,6 +4444,7 @@ public class EmpLeaveConf extends ActionHandlerEJB implements EmpLeaveConfLocal,
}
}
noRows = 0;
System.out.println("2. mEmp: ["+mEmp+"] newLve: ["+newLve+"] effDt1: ["+effDt1+"] effDt2: ["+effDt2+"]");
sql = "UPDATE LEAVEBAL SET BAL_DAYS = BAL_DAYS + ? ,CONV_DAYS = NVL(CONV_DAYS, 0 ) + ? WHERE EMP_CODE = ? AND LVE_CODE = ? AND EFF_DATE >= ? AND EFF_DATE < ?";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setDouble( 1, mDays);
......@@ -4374,6 +4497,7 @@ public class EmpLeaveConf extends ActionHandlerEJB implements EmpLeaveConfLocal,
else
{
noRows = 0;
System.out.println("tranId: ["+tranId+"]");
sql = "UPDATE EMPLEAVE SET STATUS = 'A' WHERE TRAN_ID = ?";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString(1, tranId);
......
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