Commit 9442a88c authored by arawankar's avatar arawankar

HRVoucherReversal.java

-bug fixing for create payroll voucher
-Changes made to errstring 


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@190950 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 0fc537f5
......@@ -30,7 +30,7 @@ public class HRVoucherReversal
public String actionHandler(String tranID, String xtraParams, String forcedFlag,Connection conn) throws RemoteException,ITMException
{
ITMDBAccessEJB itmDBAccessEjb = null;
ITMDBAccessEJB itmDBAccessEjb = new ITMDBAccessEJB();
AdmCommon admCommon = null;
FinCommon finCommon = null;
String sql = "";
......@@ -77,7 +77,8 @@ public class HRVoucherReversal
String payMode = "";
String chgTerm = "";
String chgUser = "";
Timestamp chgDate = null;
//Timestamp chgDate = null;
Timestamp revTranDate = null; // Modified by Piyush on 15/09/2018
int lineNo = 0;
String acctCode = "";
......@@ -85,13 +86,20 @@ public class HRVoucherReversal
double amountDet = 0.0;
String adCode = "";
String retString = "";
//Modified by Anjali R. on [19/08/2018][Start]
PayrollVoucherConf payrollVoucherConf = null;
E12GenericUtility genericUtility = null;
//Modified by Anjali R. on [19/08/2018][End]
try
{
itmDBAccessEjb = new ITMDBAccessEJB();
admCommon = new AdmCommon();
finCommon = new FinCommon();
E12GenericUtility genericUtility = new E12GenericUtility();
PayrollVoucherConf payrollVoucherConf = new PayrollVoucherConf();
genericUtility = new E12GenericUtility();
payrollVoucherConf = new PayrollVoucherConf();
Calendar currentDate = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
String sysDateStr = sdf.format(currentDate.getTime());
......@@ -121,16 +129,20 @@ public class HRVoucherReversal
pstmt.close();
pstmt = null;
}
// Modified by Piyush on 15/09/2018[Trandate should be current date and should be in application date format. Should be after confirmation checking].Start
/*
if(tranDate != null)
{
tranDateStr = genericUtility.getValidDateString(tranDate, genericUtility.getDBDateTimeFormat());
System.out.println("tranDateStr---["+tranDateStr+"]");
}
*/
// Modified by Piyush on 15/09/2018[Trandate should be current date and should be in application date format. Should be after confirmation checking].End
if("X".equalsIgnoreCase(confirm))
{
//errorString = itmDBAccessEjb.getErrorString("confirmed", "VTADMLVE01", "","",conn);
errorString = "VTADMLVE01";
errorString = itmDBAccessEjb.getErrorString("", "VTADMLVE01", "","",conn);
//errorString = "VTADMLVE01";
return errorString;
}
else
......@@ -181,16 +193,22 @@ public class HRVoucherReversal
autoPost = getAutoPostValue (empCode, "AUTO_POST", conn);
if("NULLFOUND".equalsIgnoreCase(autoPost))
{
//errorString = itmDBAccessEjb.getErrorString("", "VSENVAR1", "", "", conn);
errorString = "VSENVAR1";
errorString = itmDBAccessEjb.getErrorString("", "VSENVAR1", "", "", conn);
//errorString = "VSENVAR1";
return errorString;
}
System.out.println("autoPost value:::::[" + autoPost + "]");
// Modified by Piyush on 15/09/2018[Trandate should be current date and should be in application date format. Should be after confirmation checking].Start
tranDateStr = sysDateStr;
System.out.println("tranDateStr---["+tranDateStr+"]");
// Modified by Piyush on 15/09/2018[Trandate should be current date and should be in application date format. Should be after confirmation checking].End
reversalVoucherTranId = generateTranId("w_payr_voucher", siteCodeAcct, tranDateStr,conn) ;
System.out.println("reversalVoucherTranId--["+reversalVoucherTranId+"]");
sql = "select TRAN_TYPE, EFF_DATE, REF_DATE, " +
// Modified by Piyush on 15/09/2018[Added ref_no]
String refId = "";
sql = "select TRAN_TYPE, EFF_DATE, REF_DATE, REF_NO, " +
"BANK_CODE, AUTO_PAY, PAY_MODE, SITE_CODE, FIN_ENTITY, REMARKS, " +
"ANAL_CODE, CONFIRMED, PAID, ACCT_CODE__PAY, CCTR_CODE__PAY, TOT_AMT, ENTRY_BATCH_NO, VOUCH_TYPE, " +
"CURR_CODE, EXCH_RATE, TOT_AMT__BC, HOLD from PAYR_VOUCHER where TRAN_ID=?";
......@@ -220,6 +238,16 @@ public class HRVoucherReversal
exchRate = rs.getDouble("EXCH_RATE");
totAmtBC = rs.getDouble("TOT_AMT__BC");
hold = checkNull(rs.getString("HOLD"));
// Modified by Piyush on 15/09/2018[Added ref_no]
refId = checkNull(rs.getString("REF_NO"));
if (refId.trim().length() == 0)
{
refId = "RV-" + tranID;
}
else
{
refId = "RV-" + refId;
}
}
if(rs != null)
{
......@@ -233,21 +261,31 @@ public class HRVoucherReversal
}
System.out.println("@V@ Inserting Payer_voucher");
chgDate=Timestamp.valueOf(genericUtility.getValidDateString(sysDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat())
revTranDate=Timestamp.valueOf(genericUtility.getValidDateString(sysDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat())
+ " 00:00:00.0");
//chgDate=Timestamp.valueOf(genericUtility.getValidDateString(sysDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat())
// + " 00:00:00.0");
//Check period is open or not
errorString = finCommon.nfCheckPeriod("ADM", chgDate, siteCode, conn);
// Modified by Piyush on 15/09/2018 [As per Sun Component].Start
//ValidatorEJB validatorEJB = new ValidatorEJB();
errorString = finCommon.nfCheckPeriod("ADM", revTranDate, siteCode, conn);
// Modified by Piyush on 15/09/2018 [As per Sun Component].End
System.out.println("errorString for period checking--["+errorString+"]");
if(errorString != null && errorString.trim().length() >0)
{
//Modified by Anjali R. on[19/09/2018]
errorString = itmDBAccessEjb.getErrorString("", errorString, "", "", conn);//seems nfCheckPeriod returns only error code
return errorString;
}
// Modified by Piyush on 15/09/2018
/*
String refId="";
refId="RV-"+reversalVoucherTranId;
*/
sql = " INSERT INTO PAYR_VOUCHER (TRAN_ID, TRAN_DATE, TRAN_TYPE, EFF_DATE, EMP_CODE, REF_NO, REF_DATE, " +
"BANK_CODE, AUTO_PAY, PAY_MODE, CHG_DATE, CHG_USER, CHG_TERM, SITE_CODE, FIN_ENTITY, REMARKS, " +
......@@ -257,13 +295,21 @@ public class HRVoucherReversal
"?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, reversalVoucherTranId);
pstmt.setTimestamp(2, chgDate);
// Modified by Piyush on 15/09/2018
// pstmt.setTimestamp(2, chgDate);
pstmt.setTimestamp(2, revTranDate);
//pstmt.setString(3, tranType);
pstmt.setString(3, "A");
pstmt.setTimestamp(4, effDate);
// Modified by Piyush on 15/09/2018
// pstmt.setString(3, "A");
pstmt.setString(3, tranType);
// Modified by Piyush on 15/09/2018
// pstmt.setTimestamp(4, effDate);
pstmt.setTimestamp(4, revTranDate);
pstmt.setString(5, empCode);
pstmt.setString(6, refId);
pstmt.setTimestamp(7, chgDate);
// Modified by Piyush on 15/09/2018
// pstmt.setTimestamp(7, chgDate);
pstmt.setTimestamp(7, new java.sql.Timestamp(System.currentTimeMillis()));
pstmt.setString(8, bankCode);
pstmt.setString(9, autoPay);
pstmt.setString(10, payMode);
......@@ -341,7 +387,7 @@ public class HRVoucherReversal
retString = checkNull(payrollVoucherConf.confirm(reversalVoucherTranId, forcedFlag, xtraParams, conn));
System.out.println("retString---["+retString+"]");
}
if(retString.length() > 0 && retString.indexOf("VTMCONF2") != -1 )
if(retString == null || retString.trim().length() == 0 )
{
errorString = "";
System.out.println("@V@ Payrol voucher confirmed..");
......@@ -349,6 +395,9 @@ public class HRVoucherReversal
else
{
errorString = retString;
//Modified by Anjali R. on [19/08/2018][In case of error ,connection will rollback][Start]
conn.rollback();
//Modified by Anjali R. on [19/08/2018][In case of error ,connection will rollback][End]
}
}
......@@ -357,6 +406,22 @@ public class HRVoucherReversal
{
System.out.println("Exception in actionHandler method--["+ e.getMessage()+"]");
e.printStackTrace();
//Modified by Anjali R. on [18/09/2018][Start]
try
{
conn.rollback();
}
catch(Exception e1)
{
System.out.println("Exception in actionHandler method--["+ e1.getMessage()+"]");
e1.printStackTrace();
throw new ITMException(e1);
}
retString = itmDBAccessEjb.getErrorString("", "VTLVECAN01", "", "", conn);
return retString;
//Modified by Anjali R. on [18/09/2018][End]
// Modified by Piyush on 15/09/2018
//throw new ITMException(e);
}
finally
{
......@@ -372,6 +437,10 @@ public class HRVoucherReversal
pstmt.close();
pstmt = null;
}
if(payrollVoucherConf != null)
{
payrollVoucherConf = null;
}
}
catch(Exception e )
{
......@@ -399,7 +468,8 @@ public class HRVoucherReversal
PreparedStatement pstmt=null;
ResultSet rs=null;
try {
try
{
sql="select ddf_hr_site_env_value(?,SYSDATE,?)as var_value from dual";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, empCode);
......@@ -421,9 +491,19 @@ public class HRVoucherReversal
pstmt = null;
}
}
catch (SQLException e)
catch (Exception e)
{
e.printStackTrace();
//Modified by Anjali R. on[19/09/2018][Start]
try
{
conn.rollback();
}
catch(Exception e1)
{
throw new ITMException(e1);
}
//Modified by Anjali R. on[19/09/2018][End]
throw new ITMException(e);
}
finally
......@@ -475,11 +555,16 @@ public class HRVoucherReversal
keyCol = rs.getString("TRAN_ID_COL");
tranSer = rs.getString("REF_SER");
}
if(rs != null)
{
rs.close();
rs=null;
}
if(pstmt != null)
{
pstmt.close();
pstmt=null;
}
System.out.println("keyString :"+keyString);
......@@ -507,6 +592,18 @@ public class HRVoucherReversal
catch (Exception e)
{
System.out.println("Exception :HRVoucherReversal :generateTranId :Exception ::" + e.getMessage() + ":");
//Modified by Anjali R. on[19/09/2018][Start]
try
{
conn.rollback();
}
catch (Exception e1)
{
e1.printStackTrace();
System.out.println("Exception from generateTranId class--["+e1.getMessage()+"]");
throw new ITMException(e1);
}
//Modified by Anjali R. on[19/09/2018][End]
e.printStackTrace();
throw new ITMException(e);
}
......
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