Commit cf18288f authored by akhokar's avatar akhokar

Changes done in existing component as per new framework and add new components of loan schedule

LoanOpeningCnc.java
AdmCommon.java
LoanOpeningConf.java
LoanscheduleCnc.java
LoanscheduleStDedn.java
LoanOpeningIC.java
LoanChk.java
LoanChkLocal.java
LoanChkRemote.java
LoanScheduleConf.java
LoanScheduleConfLocal.java
LoanScheduleConfRemote.java
LoanScheduleIC.java
LoanScheduleICLocal.java
LoanScheduleICRemote.java
loanschedule.sql


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@203198 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 8ef732cd
......@@ -3379,4 +3379,124 @@ public class AdmCommon
return ret;
}
//Added by Azhar K. on[08-07-2019][Start]
public Timestamp gfLastDate(Timestamp mdate) throws ITMException
{
Timestamp retDate = null;
java.util.Date nDate = null;
SimpleDateFormat sdf = null;
UtilMethods utilMethod = new UtilMethods();
try
{
System.out.println("*************Inside gfLastDate Method*******************");
sdf = new SimpleDateFormat("dd/MM/yyyy");
String formatDate = sdf.format(mdate);
System.out.println("formatDate:::[" + formatDate +"]");
if(mdate == null || ("01/01/1900".equalsIgnoreCase(formatDate)))
{
return mdate;
}
nDate = utilMethod.date(utilMethod.year(mdate), utilMethod.month(mdate), 01);
//nDate = utilMethod.year(utilMethod.date(mdate)), utilMethod.month(mdate)), 01);
nDate = utilMethod.RelativeDate(nDate, 31);
System.out.println("nDate ::[" + nDate + "]" );
do
{
if(utilMethod.month(nDate) == utilMethod.month(mdate))
{
break;
}
nDate = utilMethod.RelativeDate(nDate, -1);
System.out.println("nDate ::[" + nDate + "]" );
}
while(true);
retDate = new Timestamp(nDate.getTime());
System.out.println("retDate::[" + retDate + "]");
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
return retDate;
}
public double gfGetRndAmt(double unrAmt, String rndOff, double rndTo) throws ITMException
{
double rndAmt = 0;
double lcMultiply = 1;
UtilMethods utilMethod = new UtilMethods();
try
{
System.out.println("Inside gfGetRndAmt Method:::::::");
char c = rndOff.charAt(0);
if(unrAmt < 0)
{
lcMultiply = -1;
unrAmt = utilMethod.abs(unrAmt);
}
else if(unrAmt == 0)
{
return unrAmt;
}
else if("N".equalsIgnoreCase(rndOff))
{
return unrAmt;
}
else if(rndTo == 0)
{
return unrAmt;
}
switch(c)
{
case 'X':
{
if(utilMethod.mod(unrAmt, rndTo) > 0)
{
rndAmt = unrAmt - utilMethod.mod(unrAmt, rndTo) + rndTo;
}
else
{
rndAmt = unrAmt;
}
}
break;
case 'P':
{
rndAmt = unrAmt - utilMethod.mod(unrAmt, rndTo);
}
break;
case 'R':
{
if(utilMethod.mod(unrAmt, rndTo) < rndTo/2)
{
rndAmt = unrAmt - utilMethod.mod(unrAmt, rndTo);
}
else
{
rndAmt = unrAmt - utilMethod.mod(unrAmt, rndTo) + rndTo;
}
}
break;
default:
{
rndAmt = unrAmt;
}
break;
}
rndAmt = rndAmt * lcMultiply;
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
return rndAmt;
}
//Added by Azhar K. on[08-07-2019][End]
}
......@@ -15,6 +15,7 @@ import org.w3c.dom.NodeList;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.ejb.adm.adv.LoanChk;
import ibase.webitm.ejb.fin.FinCommon;
import ibase.webitm.ejb.sys.UtilMethods;
import ibase.webitm.utility.ITMException;
......@@ -23,8 +24,10 @@ public class LoanOpeningIC extends ValidatorEJB implements LoanOpeningICLocal,Lo
{
E12GenericUtility genericUtility = new E12GenericUtility();
AdmCommon admCommon= new AdmCommon();
LoanChk loanChk = new LoanChk();
UtilMethods utilMethod = new UtilMethods();
FinCommon finCommon = new FinCommon();
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException
{
Document dom = null;
......@@ -552,7 +555,7 @@ public class LoanOpeningIC extends ValidatorEJB implements LoanOpeningICLocal,Lo
}
if(!("NULLFOUND".equalsIgnoreCase(lsRndOff)))
{
mAmt1 = gfGetRndAmt(mAmt1, lsRndOff, lcRndTo);
mAmt1 = admCommon.gfGetRndAmt(mAmt1, lsRndOff, lcRndTo);
}
if(loanAmt == null)
{
......@@ -571,7 +574,7 @@ public class LoanOpeningIC extends ValidatorEJB implements LoanOpeningICLocal,Lo
if(utilMethod.mod(mAmt2, mAmt1) != 0)
{
lcTerm = lcTerm + 1;
lcTerm = gfGetRndAmt(lcTerm, "P", 1);
lcTerm = admCommon.gfGetRndAmt(lcTerm, "P", 1);
}
}
valueXmlString.append("<term>").append("<![CDATA["+lcTerm+"]]>").append("</term>");
......@@ -588,7 +591,7 @@ public class LoanOpeningIC extends ValidatorEJB implements LoanOpeningICLocal,Lo
if(utilMethod.mod(mAmt2, mAmt1) != 0)
{
lcTerm = lcTerm + 1;
lcTerm = gfGetRndAmt(lcTerm, "P", 1);
lcTerm = admCommon.gfGetRndAmt(lcTerm, "P", 1);
}
valueXmlString.append("<term>").append("<![CDATA["+lcTerm+"]]>").append("</term>");
}
......@@ -883,7 +886,7 @@ public class LoanOpeningIC extends ValidatorEJB implements LoanOpeningICLocal,Lo
lcLoanAmt = Double.parseDouble(lcLoanAmtStr);
issueDateStr = checkNull(genericUtility.getColumnValue("issue_date", dom));
mdate1 = Timestamp.valueOf(genericUtility.getValidDateString(issueDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
errString = gbfLoanchkGeneral(mVal1, lsEmp, mVal2, lcLoanAmt, mdate1,conn);
errString = checkNull(loanChk.gbfLoanchkGeneral(mVal1, lsEmp, mVal2, lcLoanAmt, mdate1,conn));
if(errString != null && errString.trim().length() > 0)
{
......@@ -1017,7 +1020,7 @@ public class LoanOpeningIC extends ValidatorEJB implements LoanOpeningICLocal,Lo
close(pstmt, rs);
errString = checkNull(finCommon.nfCheckPeriod("ADM",mdate1,lsSite,conn));
if(errCode != null && errCode.trim().length() > 0)
if(errString != null && errString.trim().length() > 0)
{
errCode = errString;
errList.add(errCode);
......@@ -1741,174 +1744,6 @@ public class LoanOpeningIC extends ValidatorEJB implements LoanOpeningICLocal,Lo
return errString;
}//END OF VALIDATION
public String gbfLoanchkGeneral(String asSchemeNo, String asEmpCode, String asGrade, double acLoanAmt, Timestamp adLoanDate,Connection conn) throws ITMException
{
String lsErrcode = "", lsEligchk = "";
int liNvoNo = 0,cnt = 0;
double lcMinAmt = 0.00, lcMaxAmt = 0.00, lcAccrual = 0.00;
String sql = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
System.out.println("*************Inside gbfLoanchkGeneral Method********************");
do
{ // check for loan_scheme_grade and eligibility if required and amount limit
sql = "select count(*) as count from loan_scheme_grade where scheme_no = ? and grade_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, asSchemeNo);
pstmt.setString(2, asGrade);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt("count");
}
close(pstmt, rs);
if(cnt == 0)
{
lsErrcode = "VMSCHGRA1";
break;
}
// check if eligibility check is reqd. for this loan scheme
sql = "select elig_check from loan_scheme where scheme_no = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, asSchemeNo);
rs = pstmt.executeQuery();
if(rs.next())
{
lsEligchk = checkNull(rs.getString("elig_check"));
}
close(pstmt, rs);
sql = "select min_amt, max_amt, nvo_no from loan_scheme_grade where scheme_no = ? and grade_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, asSchemeNo);
pstmt.setString(2, asGrade);
rs = pstmt.executeQuery();
if(rs.next())
{
lcMinAmt = rs.getDouble("min_amt");
lcMaxAmt = rs.getDouble("max_amt");
liNvoNo = rs.getInt("nvo_no");
}
close(pstmt, rs);
if(lcMinAmt > 0)
{
if(acLoanAmt < lcMinAmt)
{
lsErrcode = "VTLOAN1"; // loan amount not in range
break;
}
}
if(lcMaxAmt > 0)
{
if(acLoanAmt > lcMaxAmt)
{
lsErrcode = "VTLOAN1"; // loan amount not in range
break;
}
}
// if elig. check is required then call function as per nvo no.
if("Y".equalsIgnoreCase(lsEligchk))
{
switch(liNvoNo)
{
case 1:
//lc_accrual = gbf_loan_rules_1(as_emp_code, as_scheme_no, ac_loanamt, ad_loandate)
lsErrcode = gbfLoanRules1(asEmpCode, asSchemeNo, acLoanAmt, adLoanDate,conn);
}
}
break;
}
while(true);
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
return lsErrcode;
}
public String gbfLoanRules1(String asEmpCode, String asSchemeNo, double acLoanamt, Timestamp adLoanDate,Connection conn) throws ITMException
{
Timestamp ldJoinDate = null, ldDate = null;
String lsErrCode = "", lsCadre = "", lsSite = "";
double lcAccAmount = 0.00, lcAccrual = 0.00, lcTotElig = 0.00, lcBasic = 0.00;
String sql = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
System.out.println("*************Inside gbfLoanRules1 Method********************");
do
{
sql = "select cadre, basic, date_join, pay_site from employee where emp_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, asEmpCode);
rs = pstmt.executeQuery();
if(rs.next())
{
lsCadre = checkNull(rs.getString("cadre"));
lcBasic = rs.getDouble("basic");
ldJoinDate = rs.getTimestamp("date_join");
lsSite = checkNull(rs.getString("pay_site"));
}
close(pstmt, rs);
lsCadre = lsCadre.trim();
if(ldJoinDate != null && adLoanDate != null)
{
if(utilMethod.DaysAfter(ldJoinDate, adLoanDate) < 365)
{
lsErrCode = "VTLOAN2"; // one year not completed from joining date
break;
}
}
sql = "select max(date__balance) as dateBalance from loans where emp_code = ? and scheme_no = ? and balance_amt = 0";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, asEmpCode);
pstmt.setString(2, asSchemeNo);
rs = pstmt.executeQuery();
if(rs.next())
{
ldDate = rs.getTimestamp("dateBalance");
}
close(pstmt, rs);
if((ldDate != null && adLoanDate != null) && utilMethod.DaysAfter(ldDate, adLoanDate) < 365)
{
lsErrCode = "VTLOAN10"; // one year not completed since repayment of last loan against this scheme
break;
}
break;
}
while(true);
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
return lsErrCode;
}
public void close(PreparedStatement pstmt,ResultSet rs)
{
try
......@@ -1930,80 +1765,6 @@ public class LoanOpeningIC extends ValidatorEJB implements LoanOpeningICLocal,Lo
}
}
public double gfGetRndAmt(double unrAmt, String rndOff, double rndTo) throws ITMException
{
double rndAmt = 0;
double lcMultiply = 1;
try
{
System.out.println("Inside gfGetRndAmt Method:::::::");
char c = rndOff.charAt(0);
if(unrAmt < 0)
{
lcMultiply = -1;
unrAmt = utilMethod.abs(unrAmt);
}
else if(unrAmt == 0)
{
return unrAmt;
}
else if("N".equalsIgnoreCase(rndOff))
{
return unrAmt;
}
else if(rndTo == 0)
{
return unrAmt;
}
switch(c)
{
case 'X':
{
if(utilMethod.mod(unrAmt, rndTo) > 0)
{
rndAmt = unrAmt - utilMethod.mod(unrAmt, rndTo) + rndTo;
}
else
{
rndAmt = unrAmt;
}
}
break;
case 'P':
{
rndAmt = unrAmt - utilMethod.mod(unrAmt, rndTo);
}
break;
case 'R':
{
if(utilMethod.mod(unrAmt, rndTo) < rndTo/2)
{
rndAmt = unrAmt - utilMethod.mod(unrAmt, rndTo);
}
else
{
rndAmt = unrAmt - utilMethod.mod(unrAmt, rndTo) + rndTo;
}
}
break;
default:
{
rndAmt = unrAmt;
}
break;
}
rndAmt = rndAmt * lcMultiply;
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
return rndAmt;
}
private String errorType(Connection conn, String errorCode) throws ITMException
{
String msgType = "E";
......
This diff is collapsed.
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
import javax.ejb.Local;
import org.w3c.dom.Document;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
@Local
public interface LoanScheduleICLocal extends ValidatorLocal {
@Override
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException, ITMException;
@Override
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException, ITMException;
@Override
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException;
@Override
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException;
}
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
import javax.ejb.Remote;
import org.w3c.dom.Document;
import ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException;
@Remote
public interface LoanScheduleICRemote extends ValidatorRemote {
@Override
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException, ITMException;
@Override
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException, ITMException;
@Override
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException;
@Override
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException;
}
\ No newline at end of file
This diff is collapsed.
package ibase.webitm.ejb.adm.adv;
import java.sql.Connection;
import java.sql.Timestamp;
import java.util.HashMap;
import javax.ejb.Local;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
@Local
public interface LoanChkLocal extends ValidatorLocal
{
public String gbfLoanchkGeneral(String asSchemeNo, String asEmpCode, String asGrade, double acLoanAmt, Timestamp adLoanDate,Connection conn) throws ITMException;
public String gbfLoanRules1(String asEmpCode, String asSchemeNo, double acLoanamt, Timestamp adLoanDate,Connection conn) throws ITMException;
public String gbfLoanApprove(String asTranid, int aiCommit, String asOpen,String xtraParams,Connection conn) throws ITMException;
public String gbfInstCreate(String asLoanNo,Connection conn) throws ITMException;
public String gbfPayrVouch(HashMap astrVouchDataMap,String xtraParams,Connection conn) throws ITMException;
public double gbfCalcLoanAccrual(String asEmpCode,Timestamp adLoanDate,String asScheme, String asGrade,Connection conn) throws ITMException;
public double gbfGetAdjustablePerkamt(String asEmpCode,Timestamp adLoanDate,String asScheme,String asGrade,Connection conn) throws ITMException;
}
package ibase.webitm.ejb.adm.adv;
import java.sql.Connection;
import java.sql.Timestamp;
import java.util.HashMap;
import javax.ejb.Remote;
import ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException;
@Remote
public interface LoanChkRemote extends ValidatorRemote
{
public String gbfLoanchkGeneral(String asSchemeNo, String asEmpCode, String asGrade, double acLoanAmt, Timestamp adLoanDate,Connection conn) throws ITMException;
public String gbfLoanRules1(String asEmpCode, String asSchemeNo, double acLoanamt, Timestamp adLoanDate,Connection conn) throws ITMException;
public String gbfLoanApprove(String asTranid, int aiCommit, String asOpen,String xtraParams,Connection conn) throws ITMException;
public String gbfInstCreate(String asLoanNo,Connection conn) throws ITMException;
public String gbfPayrVouch(HashMap astrVouchDataMap,String xtraParams,Connection conn) throws ITMException;
public double gbfCalcLoanAccrual(String asEmpCode,Timestamp adLoanDate,String asScheme, String asGrade,Connection conn) throws ITMException;
public double gbfGetAdjustablePerkamt(String asEmpCode,Timestamp adLoanDate,String asScheme,String asGrade,Connection conn) throws ITMException;
}
/*
Developed by : Hatim Laxmidhar
Started On : 07/01/2006
Purpose : Cancel Button
Window : w_loan_opening
*/
package ibase.webitm.ejb.adm.adv;
import java.rmi.RemoteException;
import java.sql.*;
import javax.ejb.*;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.utility.ITMException;
@Stateless // added for ejb3
public class LoanOpeningCnc extends ActionHandlerEJB implements LoanOpeningCncLocal,LoanOpeningCncRemote //SessionBean
{
/*public void ejbCreate() throws RemoteException, CreateException
{
}
public void ejbRemove()
{
}
public void ejbActivate()
{
}
public void ejbPassivate()
{
}*/
public String actionHandler() throws RemoteException,ITMException
{
return "";
}
public String actionHandler(String loanNo, String xtraParams, String forcedFlag) throws RemoteException,ITMException
{
String retString = null;
// Modified by Azhar K. on [28-June-2019][Changes done as per new framework][Start]
//GenericUtility genericUtility = GenericUtility.getInstance();
E12GenericUtility genericUtility = new E12GenericUtility();
// Modified by Azhar K. on [28-June-2019][Changes done as per new framework][End]
try
{
retString = actionCancel(loanNo, xtraParams, forcedFlag);
}
catch(Exception e)
{
System.out.println("Exception :LoanOpeningCncEJB :actionHandler :" + e.getMessage() + ":");
e.printStackTrace();
throw new ITMException(e);
}
System.out.println("returning String from LoanOpeningCncEJB :actionHandler :"+retString);
return retString;
}
private String actionCancel(String loanNo, String xtraParams, String forcedFlag) throws RemoteException,ITMException
{
String status = "", sql = "";
String errCode = "", errString = "";
String loginCode = "";
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
// Modified by Azhar K. on [28-June-2019][Changes done as per new framework][Start]
//ConnDriver connDriver = new ConnDriver();
// Modified by Azhar K. on [28-June-2019][Changes done as per new framework][End]
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
// Modified by Azhar K. on [28-June-2019][Changes done as per new framework][Start]
//GenericUtility genericUtility = GenericUtility.getInstance();
E12GenericUtility genericUtility = new E12GenericUtility();
// Modified by Azhar K. on [28-June-2019][Changes done as per new framework][End]
int cnt = 0;
try
{
conn = getConnection();
// Modified by Azhar K. on [28-June-2019][Changes done as per new framework][Start]
//conn = connDriver.getConnectDB("DriverITM");
// Modified by Azhar K. on [28-June-2019][Changes done as per new framework][End]
stmt = conn.createStatement();
System.out.println("########### Inside LoanOpeningCncEJB[actionCancel] ###########");
System.out.println("Loan No : "+ loanNo);
sql = "SELECT STATUS FROM LOANS WHERE LOAN_NO = '" + loanNo + "'";
System.out.println("sql :\n" + sql +"\n");
rs = stmt.executeQuery(sql);
if (rs.next())
{
status = rs.getString(1);
}
System.out.println("Status :"+status);
if (status.equalsIgnoreCase("U"))
{
loginCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
if (loginCode == null || loginCode.trim().length() == 0)
{
errCode = "EMPAPRV";
}
else
{
stmt = conn.createStatement();
cnt = stmt.executeUpdate("UPDATE LOANS SET STATUS = 'X' WHERE LOAN_NO = '" + loanNo + "'");
if (cnt > 0)
{
errCode = "VTCANC1";
// Modified by Piyush on 23/12/2014 [To commit/rollback data].Start
conn.commit();
}
else
{
errCode = "VTCANC3";
conn.rollback();
}
// Modified by Piyush on 23/12/2014 [To commit/rollback data].End
}
}
// Modified by Piyush on 23/12/2014[To give proper message in case of already cancelled].Start
else if (status.equalsIgnoreCase("X"))
{
errCode = "VTCANC2";
}
// Modified by Piyush on 23/12/2014[To give proper message in case of already cancelled].End
else
{
errCode = "VTRCONF1";
}
}
catch (SQLException sqx)
{
System.out.println("The sqlException occure in LoanOpeningCncEJB :"+sqx);
throw new ITMException(sqx);
}
catch (Exception e)
{
System.out.println("The Exception occure in LoanOpeningCncEJB :"+e);
throw new ITMException(e);
}
finally
{
errString = itmDBAccessEJB.getErrorString("",errCode,"","",conn);
try
{
if (conn!=null)
{
conn.close();
conn = null;
}
}
catch (Exception e)
{
System.out.println("Exception in finally: " + e);
}
}
return errString;
}
}
\ No newline at end of file
package ibase.webitm.ejb.adm.adv;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.adm.AdmCommon;
import ibase.webitm.ejb.fin.FinCommon;
import ibase.webitm.ejb.sys.UtilMethods;
import ibase.webitm.utility.ITMException;
public class LoanScheduleConf extends ActionHandlerEJB implements LoanScheduleConfLocal, LoanScheduleConfRemote
{
E12GenericUtility genericUtility = new E12GenericUtility();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
AdmCommon admCommon = new AdmCommon();
FinCommon finCommon = new FinCommon();
UtilMethods utilMethod = new UtilMethods();
PayrollVoucherConf PayrollVoucherConf = new PayrollVoucherConf();
LoanChk loanChk = new LoanChk();
String userId = "",loginEmpCode = "",runMode = "",termId = "";
public String confirm(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException
{
String retString = null;
Connection conn = null;
try
{
conn = getConnection();
System.out.println("Conn==>[" + conn + "]");
retString = gbfPostLogic(tranId, tranId,xtraParams,forcedFlag,conn);
System.out.println("returning String from LoanScheduleConf :confirm():==>[" + retString + "]");
if(retString == null || retString.trim().length() == 0)
{
conn.commit();
}
else
{
conn.rollback();
}
}
catch(Exception e)
{
System.out.println("Exception :LoanScheduleConf :confirm() :" + e.getMessage() + ":");
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if(conn != null)
{
conn.close();
conn = null;
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
return retString;
}
public String gbfPostLogic(String asTranidFr,String asTranidTo,String xtraParams,String forcedFlag,Connection conn) throws ITMException
{
String lsTranid = "",lsErrcode = "",lsStatus = "",lsLoanentryWindow = "";
String lsnull = null;
int liCount = 0,liLoanTerm = 0,cnt = 0;
double lcInstAmt = 0.00;
String todayDate = "";
Timestamp ldToday = null;
String sql = "";
SimpleDateFormat sdf = new SimpleDateFormat();
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
System.out.println("***********Inside LoanScheduleConf Post Logic Method**************");
userId = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"));
loginEmpCode = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode"));
termId = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "termId"));
sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
todayDate = sdf.format(new java.util.Date());
System.out.println("todayDate::: "+ todayDate);
ldToday = Timestamp.valueOf(genericUtility.getValidDateString(todayDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
System.out.println("ldToday::: "+ ldToday);
if(asTranidFr.equalsIgnoreCase(asTranidTo))
{
lsTranid = asTranidFr;
sql = "select mon_inst, act_term, status, loanentry_window from loans where loan_no = ? " ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lsTranid);
rs = pstmt.executeQuery();
if(rs.next())
{
lcInstAmt = rs.getDouble("mon_inst");
liLoanTerm = rs.getInt("act_term");
lsStatus = checkNull(rs.getString("status"));
lsLoanentryWindow = checkNull(rs.getString("loanentry_window"));
}
else
{
lsErrcode = itmDBAccessEJB.getErrorString("", "VTMCONF20", userId, "", conn);
return lsErrcode;
}
close(pstmt, rs);
if(lsLoanentryWindow == null)
{
lsLoanentryWindow = "S";
}
if(!("S".equalsIgnoreCase(lsLoanentryWindow)))
{
lsErrcode = itmDBAccessEJB.getErrorString("", "VTLNENTRY", userId, "", conn);
return lsErrcode;
}
else if("U".equalsIgnoreCase(lsStatus))
{
sql = "select count(*) as count from loans_schedule where loan_no = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lsTranid);
rs = pstmt.executeQuery();
if(rs.next())
{
liCount = rs.getInt("count");
}
close(pstmt, rs);
if(liCount == 0)
{
sql = "insert into loans_schedule (loan_no, line_no, no_inst, amount, no_inst_ded ,chg_user,chg_date,chg_term)"+
"VALUES ( ?, 1, ?, ?, 0 ,? , ?, ?)";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lsTranid);
pstmt.setString(2, lsnull);
pstmt.setDouble(3, lcInstAmt);
pstmt.setString(4, userId);
pstmt.setTimestamp(5, ldToday);
pstmt.setString(6, termId);
cnt = pstmt.executeUpdate();
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt > 0)
{
System.out.println("*****Successfully inserted row into loans_schedule****** ");
}
}
lsErrcode = checkNull(loanChk.gbfLoanApprove(lsTranid, 2, "N",xtraParams,conn));
System.out.println("lsErrcode coming from gbfLoanApprove Method :::==>[" + lsErrcode + "]" );
}
else if("X".equalsIgnoreCase(lsStatus))
{
lsErrcode = itmDBAccessEJB.getErrorString("", "VTEMPLN01", userId, "", conn);
return lsErrcode;
}
else
{
lsErrcode = itmDBAccessEJB.getErrorString("", "VTMAPRV1", userId, "", conn);
return lsErrcode;
}
}
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch(Exception e1)
{
e1.printStackTrace();
}
}
return lsErrcode;
}
private void close(PreparedStatement pstmt, ResultSet rs) throws SQLException
{
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
private String checkNull(String input)
{
if (input == null)
{
input = "";
}
else
{
input = input.trim();
}
return input;
}
}
package ibase.webitm.ejb.adm.adv;
import java.rmi.RemoteException;
import java.sql.Connection;
import javax.ejb.Local;
import ibase.webitm.utility.ITMException;
@Local
public interface LoanScheduleConfLocal
{
public String confirm(String tranId, String xtraParams, String forcedFlag)throws RemoteException,ITMException;
public String gbfPostLogic(String asTranidFr,String asTranidTo, String xtraParams,String forcedFlag,Connection conn) throws ITMException;
}
package ibase.webitm.ejb.adm.adv;
import java.rmi.RemoteException;
import java.sql.Connection;
import javax.ejb.Remote;
import ibase.webitm.utility.ITMException;
@Remote
public interface LoanScheduleConfRemote
{
public String confirm(String tranId, String xtraParams, String forcedFlag)throws RemoteException,ITMException;
public String gbfPostLogic(String asTranidFr,String asTranidTo, String xtraParams,String forcedFlag,Connection conn) throws ITMException;
}
......@@ -8,15 +8,19 @@
package ibase.webitm.ejb.adm.adv;
import java.rmi.RemoteException;
import java.sql.*;
import javax.ejb.*;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import ibase.system.config.*;
import ibase.webitm.utility.GenericUtility;
import javax.ejb.Stateless; // added for ejb3
import ibase.system.config.ConnDriver;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.utility.ITMException;
@Stateless // added for ejb3
public class LoanscheduleCnc extends ActionHandlerEJB implements LoanscheduleCncLocal,LoanscheduleCncRemote // SessionBean
......@@ -46,7 +50,10 @@ public class LoanscheduleCnc extends ActionHandlerEJB implements LoanscheduleCnc
{
String retString = null;
GenericUtility genericUtility = GenericUtility.getInstance();
//Modified by Azhar K. on[08-July-2019][Changes made as per new framework][Start]
//GenericUtility genericUtility = GenericUtility.getInstance();
E12GenericUtility genericUtility = new E12GenericUtility();
//Modified by Azhar K. on[08-July-2019][Changes made as per new framework][End]
try
{
retString = actionCancel(loanNo, xtraParams, forcedFlag);
......@@ -71,11 +78,16 @@ public class LoanscheduleCnc extends ActionHandlerEJB implements LoanscheduleCnc
ResultSet rs = null;
ConnDriver connDriver = new ConnDriver();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
GenericUtility genericUtility = GenericUtility.getInstance();
//Modified by Azhar K. on[08-July-2019][Changes made as per new framework][Start]
//GenericUtility genericUtility = GenericUtility.getInstance();
E12GenericUtility genericUtility = new E12GenericUtility();
//Modified by Azhar K. on[08-July-2019][Changes made as per new framework][End]
int cnt = 0;
try
{
conn = connDriver.getConnectDB("DriverITM");
{ //Modified by Azhar K. on[08-July-2019][Changes made as per new framework][Start]
//conn = connDriver.getConnectDB("DriverITM");
conn = getConnection();
//Modified by Azhar K. on[08-July-2019][Changes made as per new framework][End]
stmt = conn.createStatement();
System.out.println("########### Inside LoanscheduleCncEJB[actionCancel] ###########");
......
......@@ -8,6 +8,8 @@ import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import ibase.system.config.*;
import ibase.utility.E12GenericUtility;
import javax.ejb.Stateless; // added for ejb3
// 05/05/10 manoharan
import java.text.SimpleDateFormat;
......@@ -63,7 +65,10 @@ public class LoanscheduleStDedn extends ActionHandlerEJB implements Loanschedule
String sql = "", loginEmpCode = "", start = "", status = "", errString = "";
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
ConnDriver connDriver = new ConnDriver();
GenericUtility genericUtility = GenericUtility.getInstance();
//Modified by Azhar K. on [09-07-2019][changes As per new framework][Start]
//GenericUtility genericUtility = GenericUtility.getInstance();
E12GenericUtility genericUtility = new E12GenericUtility();
//Modified by Azhar K. on [09-07-2019][changes As per new framework][End]
String winName = "w_start_dedn_load", errCode = "";
try
{
......@@ -162,7 +167,10 @@ public class LoanscheduleStDedn extends ActionHandlerEJB implements Loanschedule
ResultSet rs = null;
PreparedStatement pstmt = null;
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
GenericUtility genericUtility = GenericUtility.getInstance();
//Modified by Azhar K. on [09-07-2019][changes As per new framework][Start]
//GenericUtility genericUtility = GenericUtility.getInstance();
E12GenericUtility genericUtility = new E12GenericUtility();
//Modified by Azhar K. on [09-07-2019][changes As per new framework][End]
String dateInterest = "", errCode = "";
String sql = "", empCode = "", period = "", retDate1 = "";
java.util.Date toDate = null, retDate = null, frDate = null, startReco = null, issueDate2 = null;
......@@ -422,7 +430,10 @@ public class LoanscheduleStDedn extends ActionHandlerEJB implements Loanschedule
PreparedStatement pstmt = null;
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
ConnDriver connDriver = new ConnDriver();
GenericUtility genericUtility = GenericUtility.getInstance();
//Modified by Azhar K. on [09-07-2019][changes As per new framework][Start]
//GenericUtility genericUtility = GenericUtility.getInstance();
E12GenericUtility genericUtility = new E12GenericUtility();
//Modified by Azhar K. on [09-07-2019][changes As per new framework][End]
String empCode = "", schemeNo = "", adCodeDed = "", errCode = "", sql = "";
double loanAmt = 0, monInst = 0;
int term = 0, count = 0, insertCnt = 0;
......
This diff is collapsed.
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