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,
//Modified by Anjali R. on[20/09/2018][Start]
java.sql.Timestamp todaysDate = null;
//Modified by Anjali R. on[20/09/2018][End]
String detTranId = "";
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;
ResultSet resultSet = null, resultSet1 = null, resultSet2 = null, resultSet3 = null, resultSet4 = null, resultSet5 = null, resultSet6 = null, resultSet7 = null ;
......@@ -3739,11 +3739,52 @@ public class EmpLeaveConf extends ActionHandlerEJB implements EmpLeaveConfLocal,
}
nextBal = mDays;
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";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString(1, mEmp);
pstmt.setString(2, mLveCode);
pstmt.setTimestamp(3, mDate1);
//Added by Varsha V on 03-01-19 for taking from date and to date from emp_lveprkbal_trfdet
System.out.println("mEmp: ["+mEmp+"] mLveCode: ["+mLveCode+"] mDate1: ["+mDate1+"]");
if( mDays < 0 && museFlag.equals("A"))
{
//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+"]");
sql2 = "select from_date, to_date, 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"));
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("detTranId::: ["+detTranId+"]");
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
sql = "SELECT EMP_CODE, LVE_CODE,EFF_DATE, UPTO_DATE,EXP_DATE, BAL_DAYS "
+ "FROM LEAVEBAL WHERE EMP_CODE = ? AND LVE_CODE = ? AND EFF_DATE = ? and UPTO_DATE = ? ORDER BY EXP_DATE";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString(1, mEmp);
pstmt.setString(2, mLveCode);
pstmt.setTimestamp(3, detFrDate);
pstmt.setTimestamp(4, detToDate);
}
else
{
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";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString(1, mEmp);
pstmt.setString(2, mLveCode);
pstmt.setTimestamp(3, mDate1);
}
//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())
{
......@@ -3759,58 +3800,7 @@ public class EmpLeaveConf extends ActionHandlerEJB implements EmpLeaveConfLocal,
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)))))
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
//continue;
......@@ -3842,23 +3832,7 @@ public class EmpLeaveConf extends ActionHandlerEJB implements EmpLeaveConfLocal,
}
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 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