Commit b267e3b7 authored by arawankar's avatar arawankar

Changes made in below components:

EmpLeaveConf.java
--Changes made to not validate minimum balance while confirming
EmpLvePrkBalTrfConf.java
--Changes amde to validate amount balance in perk
EmpLvePrkBalTrfDefault.java
--Changes made to show only data which will have leave balance greater than 0 in leave , and amount balance greater than 0 in perk case
EmpLvePrkBalTrfIC.java
--Changes made to set employee fr site 
--Added validation for same fin entity belongs to emp code fr and emp code to respectively

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@189343 ce508802-f39f-4f6c-b175-0d175dae99d5
parent b03bc483
......@@ -112,7 +112,11 @@ public class EmpLvePrkBalTrfIC extends ValidatorEJB implements EmpLvePrkBalTrfIC
String childNodeName = null;
String columnValue="", errString = "";
//Modified by Anjali R. on [14-08-2018][Added to get empSiteFr][Start]
String empSiteFr = "";
String empSiteFrDescr = "";
//Modified by Anjali R. on [14-08-2018][Added to get empSiteFr][End]
E12GenericUtility genericUtility = new E12GenericUtility();
String loginEmpCode = checkNull( genericUtility.getValueFromXTRA_PARAMS( xtraParams, "loginEmpCode" ) );
String loginSiteCode = checkNull( genericUtility.getValueFromXTRA_PARAMS( xtraParams, "loginSiteCode") );
......@@ -218,8 +222,10 @@ public class EmpLvePrkBalTrfIC extends ValidatorEJB implements EmpLvePrkBalTrfIC
valueXmlString.append( "<tran_type><![CDATA[").append( "LVE" ).append("]]></tran_type>\r\n" );
valueXmlString.append( "<tran_mode protect=\"1\"><![CDATA[").append( "I" ).append("]]></tran_mode>\r\n" );
valueXmlString.append("<emp_code__fr><![CDATA[").append( empCodeFrom ).append("]]></emp_code__fr>\r\n");
valueXmlString.append( "<site_code__fr protect=\"1\"><![CDATA[").append( loginSiteCode ).append("]]></site_code__fr>\r\n" );
valueXmlString.append( "<site_descr__fr protect=\"1\"><![CDATA[").append( siteDescrFrm ).append("]]></site_descr__fr>\r\n" );
//Modified by Anjali R. on [14-08-2018][Site code fr and to should be set from employee table for respective employee][Start]
//valueXmlString.append( "<site_code__fr protect=\"1\"><![CDATA[").append( loginSiteCode ).append("]]></site_code__fr>\r\n" );
//valueXmlString.append( "<site_descr__fr protect=\"1\"><![CDATA[").append( siteDescrFrm ).append("]]></site_descr__fr>\r\n" );
//Modified by Anjali R. on [14-08-2018][Site code fr and to should be set from employee table for respective employee][End]
valueXmlString.append( "<status protect=\"1\"><![CDATA[").append( "U" ).append("]]></status>\r\n" );
valueXmlString.append( "<status_date protect=\"1\"><![CDATA[").append( curDate ).append("]]></status_date>\r\n" );
valueXmlString.append( "<add_user protect=\"1\"><![CDATA[").append( chgUser ).append( "]]></add_user>\r\n" );
......@@ -245,16 +251,21 @@ public class EmpLvePrkBalTrfIC extends ValidatorEJB implements EmpLvePrkBalTrfIC
{
if(empCodeFrom != null && empCodeFrom.length() > 0 )
{
sql = "SELECT RELIEVE_DATE FROM EMPLOYEE WHERE EMP_CODE = ? ";
//Modified by Anjali R. on [16/08/2018][To take employees work site][Start]
//sql = "SELECT RELIEVE_DATE FROM EMPLOYEE WHERE EMP_CODE = ? ";
sql = "SELECT RELIEVE_DATE ,EMP_SITE FROM EMPLOYEE WHERE EMP_CODE = ? ";
//Modified by Anjali R. on [16/08/2018][To take employees work site][End]
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,empCodeFrom);
rs = pstmt.executeQuery();
if(rs.next())
{
relieveDate = rs.getDate("RELIEVE_DATE");
//Modified by Anjali R. on [16/08/2018][To take employees work site][Start]
empSiteFr = checkNull(rs.getString("EMP_SITE"));
//Modified by Anjali R. on [16/08/2018][To take employees work site][End]
}
System.out.println("relieveDate [:" + relieveDate+ ":]" );
System.out.println("relieveDate [:" + relieveDate+ ":]empSiteFr--["+empSiteFr+ "]");
if( rs != null )
{
rs.close();
......@@ -265,7 +276,32 @@ public class EmpLvePrkBalTrfIC extends ValidatorEJB implements EmpLvePrkBalTrfIC
pstmt.close();
pstmt = null;
}
//Modified by Anjali R. on [16/08/2018][To set employees work site][Start]
if( checkNull( empSiteFr ).length() > 0 && !"null".equalsIgnoreCase( empSiteFr ) )
{
sql = "SELECT DESCR FROM SITE WHERE SITE_CODE = ? ";
pstmt = conn.prepareStatement( sql );
pstmt.setString( 1, empSiteFr );
rs = pstmt.executeQuery();
if(rs.next())
{
empSiteFrDescr = checkNull( rs.getString( "DESCR" ) );
}
System.out.println("description::: [:" + empSiteFrDescr+ ":]" );
if( rs != null )
{
rs.close();
rs = null;
}
if( pstmt != null )
{
pstmt.close();
pstmt = null;
}
}
//Modified by Anjali R. on [16/08/2018][To set employees work site][End]
if( relieveDate != null )
{
relieveDate1 = sdf.format( relieveDate );
......@@ -294,10 +330,19 @@ public class EmpLvePrkBalTrfIC extends ValidatorEJB implements EmpLvePrkBalTrfIC
pstmt = null;
}
valueXmlString.append("<emp_name__fr protect=\"1\"><![CDATA[").append( empNameFrom ).append("]]></emp_name__fr>\r\n");
//Modified by Anjali R. on[14-08-2018][Added description and site code for respective employee.][Start]
valueXmlString.append("<site_code__fr protect=\"1\"><![CDATA[").append( empSiteFr ).append("]]></site_code__fr>\r\n");
valueXmlString.append("<site_descr__fr protect=\"1\"><![CDATA[").append( empSiteFrDescr ).append("]]></site_descr__fr>\r\n");
//Modified by Anjali R. on[14-08-2018][Added description and site code for respective employee.][End]
}
else
{
valueXmlString.append("<emp_name__fr protect=\"1\"><![CDATA[").append( "" ).append("]]></emp_name__fr>\r\n");
//Modified by Anjali R. on[14-08-2018][Added description and site code for respective employee.][Start]
valueXmlString.append("<site_code__fr protect=\"1\"><![CDATA[").append( "" ).append("]]></site_code__fr>\r\n");
valueXmlString.append("<site_descr__fr protect=\"1\"><![CDATA[").append( "" ).append("]]></site_descr__fr>\r\n");
//Modified by Anjali R. on[14-08-2018][Added description and site code for respective employee.][End]
}
}
else if ( "emp_code__to".equalsIgnoreCase( currentColumn ) )
......@@ -727,7 +772,36 @@ public class EmpLvePrkBalTrfIC extends ValidatorEJB implements EmpLvePrkBalTrfIC
}
}
}
//Modified by Anjali R. on [16/08/2018][To validate unconfirmed records for same employee][Start]
cnt =0;
String tranType = checkNull(genericUtility.getColumnValue("tran_type", dom,objContext ));
System.out.println("tranType--["+tranType+"]");
sql = " SELECT count(*) as cnt FROM EMP_LVEPRKBAL_TRFHDR WHERE EMP_CODE__FR = ? AND TRAN_TYPE = ? AND STATUS <> 'A' ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCodeFrom);
pstmt.setString(2, tranType);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt > 0)
{
retString = itmDBAccess.getErrorString("", "VTUNCONF01", userId, "", conn);
return retString;
}
}
//Modified by Anjali R. on [16/08/2018][To validate unconfirmed records for same employee][End]
}
else if("emp_code__to".equalsIgnoreCase( childNodeName ) )
{
......@@ -846,10 +920,14 @@ public class EmpLvePrkBalTrfIC extends ValidatorEJB implements EmpLvePrkBalTrfIC
{
String finEntity1 = "";
String finEntity2 = "";
count = 0;//Added by Anjali R. on [16/08/2018]
List<String> finEntityList = new ArrayList<String>();
//sql = "SELECT FIN_ENTITY FROM SITE WHERE SITE_CODE = ? ";
sql = "SELECT FIN_ENTITY FROM SITE WHERE SITE_CODE in (?,?) ";
//Modified by Anjali R. on [16/08/2018][To get count of fin entity][Start]
//sql = "SELECT FIN_ENTITY FROM SITE WHERE SITE_CODE in (?,?) ";
sql = "SELECT COUNT (FIN_ENTITY ) AS CNT FROM SITE WHERE SITE_CODE in( ?,?)";
//Modified by Anjali R. on [16/08/2018][To get count of fin entity][End]
pstmt = conn.prepareStatement( sql );
pstmt.setString( 1, siteCodeFrom );
pstmt.setString( 2, siteCodeTo );
......@@ -857,11 +935,25 @@ public class EmpLvePrkBalTrfIC extends ValidatorEJB implements EmpLvePrkBalTrfIC
while( rs.next())
{
//finEntity1 = rs.getString( "FIN_ENTITY" );
finEntityList.add(rs.getString( "FIN_ENTITY" ));
//Modified by Anjali R. on [16/08/2018][To get count of fin entity][Start]
//finEntityList.add(rs.getString( "FIN_ENTITY" ));
count = rs.getInt("CNT");
}
if ( rs != null )
{
rs.close();
rs = null;
}
if ( pstmt != null )
{
pstmt.close();
pstmt = null;
}
//Modified by Anjali R. on [16/08/2018][To get count of fin entity][End]
System.out.println("finEntityList:::: ["+finEntityList+"] -----> size of finEntityList: ["+finEntityList.size()+"]");
//added by Varsha V on 25-06-18 for assigning values for finentity from and to
if(finEntityList.size() >= 2)
/*if(finEntityList.size() >= 2)
{
finEntity1 = finEntityList.get(0);
finEntity2 = finEntityList.get(1);
......@@ -901,12 +993,15 @@ public class EmpLvePrkBalTrfIC extends ValidatorEJB implements EmpLvePrkBalTrfIC
pstmt.close();
pstmt = null;
}*/
if( finEntity1.equalsIgnoreCase( finEntity2 ) )
//Modified by Anjali R. on [14-08-2018][Finace Entity of both empCodeFrom and empCodeto can not same][Start]
//if( finEntity1.equalsIgnoreCase( finEntity2 ) )
if(count == 1)
{
System.out.println("finEntity1.equalsIgnoreCase(finEntity2) ::::");
retString = itmDBAccess.getErrorString( "", "VTELPTRF11", userId, "", conn );
return retString;
}
//Modified by Anjali R. on [14-08-2018][Finace Entity of both empCodeFrom and empCodeto can not same][End]
}
}
}
......
......@@ -1028,7 +1028,9 @@ public class EmpLeaveConf extends ActionHandlerEJB implements EmpLeaveConfLocal,
pstmt.close();
pstmt = null;
}
if (noRows == 0 || balDays <= 0)
//Changes by Anjali R. on[16/08/2018][Balance check not perform on confirmation][Start]
//This will not check on confirmation
/*if (noRows == 0 || balDays <= 0)
{
errCode = "VTEMPLVE1";
fldName = "emp_code";
......@@ -1049,8 +1051,9 @@ public class EmpLeaveConf extends ActionHandlerEJB implements EmpLeaveConfLocal,
isError = true;
break;
}
}
}*/
//This will not check on confirmation
//Changes by Anjali R. on[16/08/2018][Balance check not perform on confirmation][End]
}
}
break;
......@@ -1083,7 +1086,9 @@ public class EmpLeaveConf extends ActionHandlerEJB implements EmpLeaveConfLocal,
pstmt.close();
pstmt = null;
}
if (noRows == 0 || balDays <= 0)
//Changes by Anjali R. on[16/08/2018][Balance check not perform on confirmation][Start]
//This will not check on confirmation
/*if (noRows == 0 || balDays <= 0)
{
errCode = "VTEMPLVE1";
fldName = "emp_code";
......@@ -1104,8 +1109,10 @@ public class EmpLeaveConf extends ActionHandlerEJB implements EmpLeaveConfLocal,
isError = true;
break;
}
}
break;
}*/
//This will not check on confirmation
//break;
//Changes by Anjali R. on[16/08/2018][Balance check not perform on confirmation][End]
}
else if ("C".equals(museFlag))
{
......
......@@ -98,7 +98,7 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa
String successString = "";
ResultSet rs = null;
ResultSet rs1 = null;
PreparedStatement pStmt = null, pStmt1 = null, pStmt2 = null, pStmt3 = null, pStmt4 = null, pStmt5 = null, pStmt6 = null;
PreparedStatement pStmt = null, pStmt1 = null, pStmt2 = null, pStmt3 = null, pStmt4 = null, pStmt5 = null, pStmt6 = null,pStmt7 = null;
CallableStatement callStmt = null;
String sql = "";
Timestamp tranDate = null;
......@@ -132,6 +132,10 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa
E12GenericUtility genericUtility = new E12GenericUtility();
boolean successFlag = true;
StringBuffer xmlStringForID = null;
//Added by anjali
double orgAmtBal = 0.0;
try {
System.out.println("Inside confirm method of EmpLvePrkBalTrfConf");
//Added & Commented by sarita to create object instead creating lookup for ITMDBAccessEJB on 20 JULY 18 [START]
......@@ -334,7 +338,7 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa
logEmpCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode");
System.out.println("Umakanta::loginCode[" + logEmpCode + "]");
if ("LVE".equalsIgnoreCase(tranType)) {
sql = "INSERT INTO EMPLEAVE ( EMP_CODE, LVE_DATE_FR, LVE_DATE_TO, LVE_CODE, USE_FLAG, ENCH_AMT, NO_DAYS, STATUS_DATE, PRD_CODE, CHG_DATE, CHG_USER, CHG_TERM, APPL_DATE, TRAN_ID, LEAVE_STARTS, LEAVE_ENDS ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) ";
......@@ -498,8 +502,12 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa
retString = itmDBAccess.getErrorString("", outParam.trim(), userId, "", conn);
successFlag = false;
}
successFlag = true;
//Changed by varsha v. [16/08/2018][To rollback ,if out parameter is not null in procedure ][Start]
else
{
successFlag = true;
}
//Changed by varsha v. [16/08/2018][To rollback ,if out parameter is not null in procedure ][End]
} catch (SQLException se) {
se.printStackTrace();
retString = this.admCommon.getErrorMessage(se, "");
......@@ -555,6 +563,11 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa
String procSql = "{call " + admEnvReturn + "(?,?,?,?,?)}";
callStmt = conn.prepareCall(procSql);
//Added by Anjali R. on[16/08/2018][To give error if amount balance is changes after inserting record in EMP_LVEPRKBAL_TRFHDR][Start]
sql = "select amt_bal from allowdedn_bal where emp_code =? and ad_code =? and start_date = ? and end_date = ?";
pStmt7 = conn.prepareStatement(sql);
//Added by Anjali R. on[16/08/2018][To give error if amount balance is changes after inserting record in EMP_LVEPRKBAL_TRFHDR][End]
sql = " SELECT ACCT_PRD, BALANCE_CODE , ENCASHABLE, LVE_UNIT, FROM_DATE, TO_DATE, EXP_DATE, BALANCE FROM EMP_LVEPRKBAL_TRFDET WHERE TRAN_ID = ? GROUP BY ACCT_PRD, BALANCE_CODE, ENCASHABLE, LVE_UNIT, FROM_DATE, to_date, exp_date, BALANCE ";
pStmt = conn.prepareStatement(sql);
......@@ -578,6 +591,24 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa
String tranIdGen = tg.generateTranSeqID(refSer, "", keyString, conn);
System.out.println("Umakanta::uniqueKey[" + tranIdGen + "]");
//Added by Anjali R. on[16/08/2018][To give error if amount balance is changes after inserting record in EMP_LVEPRKBAL_TRFHDR][Start]
pStmt7.setString(1,empCodeFr);
pStmt7.setString(2, balCode);
pStmt7.setTimestamp(3, frDate);
pStmt7.setTimestamp(4, toDate);
rs1 = pStmt7.executeQuery();
while(rs1.next())
{
orgAmtBal = rs1.getDouble("amt_bal");
}
System.out.println("orgAmtBal--["+orgAmtBal+"]perkBalance["+perkBalance+"]");
if(orgAmtBal != perkBalance)
{
retString = itmDBAccess.getErrorString("", "VTELPTRF25", userId, "", conn);
successFlag = false;
return retString;
}
//Added by Anjali R. on[16/08/2018][To give error if amount balance is changes after inserting record in EMP_LVEPRKBAL_TRFHDR][End]
pStmt1.setString(1, tranIdGen);
pStmt1.setTimestamp(2, curDateTm);
pStmt1.setString(3, empCodeFr);
......@@ -612,7 +643,7 @@ public class EmpLvePrkBalTrfConf extends ActionHandlerEJB implements EmpLvePrkBa
pStmt2.setTimestamp(9, new Timestamp(System.currentTimeMillis()));
pStmt2.setString(10, chgUser);
pStmt2.setString(11, chgTerm);
insrtStatus = pStmt2.executeUpdate();
System.out.println("insert executed = [" + insrtStatus + "]");
pStmt2.clearParameters();
......
......@@ -205,9 +205,14 @@ public class EmpLvePrkBalTrfDefault extends ActionHandlerEJB implements EmpLvePr
}
else if ( "LVE".equalsIgnoreCase( tranType ) )
{
//Modified by Anjali R. on [14/08/2018][To do not show records which is having o balance days][Start]
/*sql = " SELECT LEAVEBAL.LVE_CODE, LEAVEBAL.EFF_DATE, LEAVEBAL.UPTO_DATE, LEAVEBAL.EXP_DATE, LEAVEBAL.ACCT_PRD, LEAVEBAL.LVE_UNIT, LEAVEBAL.ENCASHABLE, "
+" LEAVEBAL.BAL_DAYS,FN_GET_LVEPRK_DESCR( 'LVE' , LVE_CODE) AS BALANCE_CODE_DESCR FROM LEAVEBAL LEAVEBAL INNER JOIN EMPLOYEE EMPLOYEE ON LEAVEBAL.EMP_CODE = EMPLOYEE.EMP_CODE WHERE EMPLOYEE.EMP_CODE= ? "
+" AND LEAVEBAL.EXP_DATE > EMPLOYEE.RELIEVE_DATE ";*/
sql = " SELECT LEAVEBAL.LVE_CODE, LEAVEBAL.EFF_DATE, LEAVEBAL.UPTO_DATE, LEAVEBAL.EXP_DATE, LEAVEBAL.ACCT_PRD, LEAVEBAL.LVE_UNIT, LEAVEBAL.ENCASHABLE, "
+" LEAVEBAL.BAL_DAYS,FN_GET_LVEPRK_DESCR( 'LVE' , LVE_CODE) AS BALANCE_CODE_DESCR FROM LEAVEBAL LEAVEBAL INNER JOIN EMPLOYEE EMPLOYEE ON LEAVEBAL.EMP_CODE = EMPLOYEE.EMP_CODE WHERE EMPLOYEE.EMP_CODE= ? "
+" AND LEAVEBAL.EXP_DATE > EMPLOYEE.RELIEVE_DATE ";
+" AND LEAVEBAL.EXP_DATE > EMPLOYEE.RELIEVE_DATE AND LEAVEBAL.BAL_DAYS <> 0";
//Modified by Anjali R. on [14/08/2018][To do not show records which is having o balance days][End]
pstmt = conn.prepareStatement( sql );
pstmt.setString( 1, empCodeFrom );
rs = pstmt.executeQuery();
......
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