Commit 6f490a97 authored by vvengurlekar's avatar vvengurlekar

EmpLeaveConf.java- changes done as per suggested by PP Sir for negative leave transfer


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@195241 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 0a65b96c
...@@ -3512,7 +3512,7 @@ public class EmpLeaveConf extends ActionHandlerEJB implements EmpLeaveConfLocal, ...@@ -3512,7 +3512,7 @@ public class EmpLeaveConf extends ActionHandlerEJB implements EmpLeaveConfLocal,
//Modified by Anjali R. on[20/09/2018][Start] //Modified by Anjali R. on[20/09/2018][Start]
java.sql.Timestamp todaysDate = null; java.sql.Timestamp todaysDate = null;
//Modified by Anjali R. on[20/09/2018][End] //Modified by Anjali R. on[20/09/2018][End]
String detTranId = "";
String sql = "", sql1 = "", sql2 = "", sql3 = "" , sql4 = "", sql5 = "", sql6 = "", sql7 = ""; String sql = "", sql1 = "", sql2 = "", sql3 = "" , sql4 = "", sql5 = "", sql6 = "", sql7 = "";
PreparedStatement pstmt = null, pstmt1 = null, pstmt2 = null, pstmt3 = null, pstmt4 = null, pstmt5 = null, pstmt6 = null, pstmt7 = null; PreparedStatement pstmt = null, pstmt1 = null, pstmt2 = null, pstmt3 = null, pstmt4 = null, pstmt5 = null, pstmt6 = null, pstmt7 = null;
ResultSet resultSet = null, resultSet1 = null, resultSet2 = null, resultSet3 = null, resultSet4 = null, resultSet5 = null, resultSet6 = null, resultSet7 = null ; ResultSet resultSet = null, resultSet1 = null, resultSet2 = null, resultSet3 = null, resultSet4 = null, resultSet5 = null, resultSet6 = null, resultSet7 = null ;
...@@ -3739,36 +3739,21 @@ public class EmpLeaveConf extends ActionHandlerEJB implements EmpLeaveConfLocal, ...@@ -3739,36 +3739,21 @@ public class EmpLeaveConf extends ActionHandlerEJB implements EmpLeaveConfLocal,
} }
nextBal = mDays; nextBal = mDays;
noRows = 0; noRows = 0;
sql = "SELECT EMP_CODE, LVE_CODE,EFF_DATE, UPTO_DATE,EXP_DATE, BAL_DAYS FROM LEAVEBAL WHERE EMP_CODE = ? AND LVE_CODE = ? AND EXP_DATE >= ? ORDER BY EXP_DATE"; //Added by Varsha V on 03-01-19 for taking from date and to date from emp_lveprkbal_trfdet
pstmt = connectionObject.prepareStatement(sql); System.out.println("mEmp: ["+mEmp+"] mLveCode: ["+mLveCode+"] mDate1: ["+mDate1+"]");
pstmt.setString(1, mEmp); if( mDays < 0 && museFlag.equals("A"))
pstmt.setString(2, mLveCode);
pstmt.setTimestamp(3, mDate1);
resultSet = pstmt.executeQuery();
while(resultSet.next())
{
noRows++;
fVal1 = resultSet.getString("EMP_CODE");
fVal2 = resultSet.getString("LVE_CODE");
fVal3 = resultSet.getTimestamp("EFF_DATE");
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 //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+"]"); System.out.println("tranId::: ["+tranId+"] mLveCode::: ["+mLveCode+"] fVal3::: ["+fVal3+"] fVal4::: ["+fVal4+"]");
String detTranId = ""; sql2 = "select from_date, to_date, tran_id from emp_lveprkbal_trfdet where tran_id__ref = ?";
sql2 = "select tran_id from emp_lveprkbal_trfdet where tran_id__ref = ?";
pstmt2 = connectionObject.prepareStatement(sql2); pstmt2 = connectionObject.prepareStatement(sql2);
pstmt2.setString(1, tranId); pstmt2.setString(1, tranId);
resultSet2 = pstmt2.executeQuery(); resultSet2 = pstmt2.executeQuery();
while(resultSet2.next()) while(resultSet2.next())
{ {
detTranId = checkNull(resultSet2.getString("tran_id")); detTranId = checkNull(resultSet2.getString("tran_id"));
detFrDate = resultSet2.getTimestamp("from_date");
detToDate = resultSet2.getTimestamp("to_date");
} }
if(resultSet2 != null) if(resultSet2 != null)
{ {
...@@ -3781,35 +3766,40 @@ public class EmpLeaveConf extends ActionHandlerEJB implements EmpLeaveConfLocal, ...@@ -3781,35 +3766,40 @@ public class EmpLeaveConf extends ActionHandlerEJB implements EmpLeaveConfLocal,
pstmt2 = null; pstmt2 = null;
} }
System.out.println("detTranId::: ["+detTranId+"]"); System.out.println("detTranId::: ["+detTranId+"]");
if(detTranId.trim().length() > 0) 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
sql2 = "select from_date, to_date from emp_lveprkbal_trfdet where " sql = "SELECT EMP_CODE, LVE_CODE,EFF_DATE, UPTO_DATE,EXP_DATE, BAL_DAYS "
+ "tran_id = ? and balance_code = ? " + "FROM LEAVEBAL WHERE EMP_CODE = ? AND LVE_CODE = ? AND EFF_DATE = ? and UPTO_DATE = ? ORDER BY EXP_DATE";
+ "and from_date = ? and to_date = ?"; pstmt = connectionObject.prepareStatement(sql);
pstmt2 = connectionObject.prepareStatement(sql2); pstmt.setString(1, mEmp);
pstmt2.setString(1, detTranId); pstmt.setString(2, mLveCode);
pstmt2.setString(2, mLveCode); pstmt.setTimestamp(3, detFrDate);
pstmt2.setTimestamp(3, fVal3); pstmt.setTimestamp(4, detToDate);
pstmt2.setTimestamp(4, fVal4);
resultSet2 = pstmt2.executeQuery();
while(resultSet2.next())
{
detFrDate = resultSet2.getTimestamp("from_date");
detToDate = resultSet2.getTimestamp("to_date");
} }
if(resultSet2 != null) else
{ {
resultSet2.close(); sql = "SELECT EMP_CODE, LVE_CODE,EFF_DATE, UPTO_DATE,EXP_DATE, BAL_DAYS FROM LEAVEBAL WHERE EMP_CODE = ? AND LVE_CODE = ? AND EXP_DATE >= ? ORDER BY EXP_DATE";
resultSet2 = null; pstmt = connectionObject.prepareStatement(sql);
pstmt.setString(1, mEmp);
pstmt.setString(2, mLveCode);
pstmt.setTimestamp(3, mDate1);
} }
if(pstmt2 != null) //Ended by Varsha V on 03-01-19 for taking from date and to date from emp_lveprkbal_trfdet
resultSet = pstmt.executeQuery();
while(resultSet.next())
{
noRows++;
fVal1 = resultSet.getString("EMP_CODE");
fVal2 = resultSet.getString("LVE_CODE");
fVal3 = resultSet.getTimestamp("EFF_DATE");
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)
{ {
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))))) if( ((fVal6 < 0) || (fVal6 == 0 && (fVal3.before(mDate1) || fVal3.equals(mDate1)))))
{ {
//Commented and Added by Varsha V on 06-12-18 for not to allow if following condition fails //Commented and Added by Varsha V on 06-12-18 for not to allow if following condition fails
...@@ -3841,25 +3831,9 @@ public class EmpLeaveConf extends ActionHandlerEJB implements EmpLeaveConfLocal, ...@@ -3841,25 +3831,9 @@ public class EmpLeaveConf extends ActionHandlerEJB implements EmpLeaveConfLocal,
} }
} }
else 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; continue;
} }
}
//Ended by Varsha V on 06-12-18 for not to allow if following condition fails //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 //Ended by Varsha V on 28-12-18 for comparing leavebal eff and upto date to emp_lveprkbal_trfdet from and to date
} }
......
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