Commit 35df4a54 authored by ngadkari's avatar ngadkari

Loan Tracking system

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@185441 ce508802-f39f-4f6c-b175-0d175dae99d5
parent c5673c18
......@@ -64,7 +64,7 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
int currentFormNo = 0;
int ctr = 0;
String sql = "",partyName="",loanParty="",bankCode="",bankName="",acctDescr="",acctCodePay="",cctrCodePay="",cctrCodeDescr="",refNo="",netAmtBc="",mAmt="";
String refSer="",acctCode="",amountPaid="", cctrCode="",marginAmount="",currCode="",exchRate="",tranDate="",loanAmt="",siteCode="",cctrCodeAp="",acctCodeAp="";
String refSer="",acctCode="", cctrCode="",currCode="",tranDate="",loanAmt="",siteCode="",cctrCodeAp="",acctCodeAp="";
StringBuffer valueXmlString = new StringBuffer();
Connection conn = null;
PreparedStatement pstmt = null, pstmt1 = null;
......@@ -74,8 +74,8 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
Node parentNode = null;
Node childNode = null;
String childNodeName = null;
Double loanAmtBC = 0.0,mAmtBC=0.0;
Double mexrate = 0.0;
Double loanAmtBC = 0.0,mAmtBC=0.0,exchRate=0.0;
Double mexrate = 0.0,totAmt=0.0,adjAmt=0.0,amountPaid=0.0,marginAmount=0.0;
List amtList = new ArrayList();
String code="",tempCode="",descr = "";
......@@ -131,7 +131,8 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
System.out.println("----------- inside itm_default ---------------");
tranDate = simpleDateFormat.format(currentDate.getTime());
valueXmlString.append("<tran_date>").append("<![CDATA[" + tranDate + "]]>").append("</tran_date>");
valueXmlString.append("<disburs_date>").append("<![CDATA[" + tranDate + "]]>").append("</disburs_date>");
valueXmlString.append("<santion_date>").append("<![CDATA[" + tranDate + "]]>").append("</santion_date>");
}
else if(currentColumn.trim().equalsIgnoreCase("loan_party"))
{
......@@ -273,7 +274,10 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
mexrate = finCommon.getDailyExchRateSellBuy(currCode, "", siteCode, tranDate, "B", conn);
valueXmlString.append("<exch_rate>").append("<![CDATA[" + mexrate + "]]>").append("</exch_rate>");
loanAmt = genericUtility.getColumnValue("loan_amount", dom);
if(loanAmt !=null && loanAmt.trim().length() > 0)
{
loanAmtBC = (Double.parseDouble(loanAmt)) * mexrate;
}
valueXmlString.append("<loan_amt__bc>").append("<![CDATA[" + loanAmtBC + "]]>").append("</loan_amt__bc>");
}
......@@ -312,30 +316,27 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
}
while(ctr < childNodeListLength && !childNodeName.equals(currentColumn));
System.out.println("IN DETAILS column name is %%%%%%%%%%%%%[" + currentColumn + "] ==> '" + columnValue + "'");
if("itm_default".equalsIgnoreCase(currentColumn.trim()))
{
valueXmlString.append("<ref_ser>").append("<![CDATA["+"M-VOUC"+"]]>").append("</ref_ser>");
}
else if(currentColumn.trim().equalsIgnoreCase("ref_no"))
if(currentColumn.trim().equalsIgnoreCase("ref_no"))
{
refNo=checkNull(this.genericUtility.getColumnValue("ref_no", dom));
refSer = checkNull(genericUtility.getColumnValue("ref_ser",dom));
if(refNo != null && refNo.trim().length() > 0 )
{
sql = "select acct_code,cctr_code,tot_amt from voucher where tran_id = ? and confirmed = ? ";
sql = "select acct_code,cctr_code,tot_amt,adj_amt from misc_payables where ref_no = ? and tran_ser = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, refNo);
pstmt.setString(2,"Y");
pstmt.setString(2,refSer);
rs = pstmt.executeQuery();
if(rs.next())
{
amountPaid=checkNull(rs.getString("tot_amt"));
totAmt=rs.getDouble("tot_amt");
acctCode=checkNull(rs.getString("acct_code"));
cctrCode=checkNull(rs.getString("cctr_code"));
adjAmt=rs.getDouble("adj_amt");
}
rs.close();
......@@ -343,7 +344,7 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
pstmt.close();
pstmt = null;
amountPaid = totAmt-adjAmt;
valueXmlString.append("<amount_paid protect = \"1\">").append("<![CDATA["+amountPaid+"]]>").append("</amount_paid>");
valueXmlString.append("<acct_code>").append("<![CDATA["+acctCode+"]]>").append("</acct_code>");
......@@ -369,7 +370,7 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
}
if(currentColumn.trim().equalsIgnoreCase("acct_code"))
{
acctCode = checkNull(genericUtility.getColumnValue("acct_code",dom)).trim();
acctCode = checkNull(genericUtility.getColumnValue("acct_code",dom));
sql = "select descr from accounts where acct_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,acctCode);
......@@ -397,7 +398,7 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
}
if(currentColumn.trim().equalsIgnoreCase("cctr_code"))
{
cctrCode = checkNull(genericUtility.getColumnValue("cctr_code",dom)).trim();
cctrCode = checkNull(genericUtility.getColumnValue("cctr_code",dom));
sql = "select descr from costctr where cctr_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,cctrCode);
......@@ -453,40 +454,36 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
}
while(ctr < childNodeListLength && !childNodeName.equals(currentColumn));
System.out.println("IN DETAILS column name is %%%%%%%%%%%%%[" + currentColumn + "] ==> '" + columnValue + "'");
if("itm_default".equalsIgnoreCase(currentColumn.trim()))
{
valueXmlString.append("<ref_ser>").append("<![CDATA["+"M-ADV"+"]]>").append("</ref_ser>");
}
else if(currentColumn.trim().equalsIgnoreCase("ref_no"))
if(currentColumn.trim().equalsIgnoreCase("ref_no"))
{
refNo=checkNull(this.genericUtility.getColumnValue("ref_no", dom));
refSer = checkNull(genericUtility.getColumnValue("ref_ser",dom));
if(refNo != null && refNo.trim().length() > 0 )
{
sql = "select acct_code,cctr_code,curr_code,exch_rate,tot_amt,net_amt__bc from voucher where tran_id = ? and confirmed = ?";
sql = "select acct_code,cctr_code,curr_code,exch_rate,tot_amt,adj_amt from misc_payables where ref_no = ? and tran_ser = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, refNo);
pstmt.setString(2,"Y");
pstmt.setString(2,refSer);
rs = pstmt.executeQuery();
if(rs.next())
{
marginAmount=checkNull(rs.getString("tot_amt"));
totAmt=rs.getDouble("tot_amt");
adjAmt=rs.getDouble("adj_amt");
acctCode=checkNull(rs.getString("acct_code"));
cctrCode=checkNull(rs.getString("cctr_code"));
currCode=checkNull(rs.getString("curr_code"));
exchRate=checkNull(rs.getString("exch_rate"));
netAmtBc=checkNull(rs.getString("net_amt__bc"));
exchRate=rs.getDouble("exch_rate");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
valueXmlString.append("<ref_ser>").append("<![CDATA["+refSer+"]]>").append("</ref_ser>");
marginAmount = totAmt-adjAmt;
valueXmlString.append("<margin_amount protect = \"1\">").append("<![CDATA["+marginAmount+"]]>").append("</margin_amount>");
......@@ -496,7 +493,9 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
setNodeValue(dom,"cctr_code" , cctrCode);
valueXmlString.append("<curr_code protect = \"1\">").append("<![CDATA["+currCode+"]]>").append("</curr_code>");
valueXmlString.append("<exch_rate protect = \"1\">").append("<![CDATA["+exchRate+"]]>").append("</exch_rate>");
valueXmlString.append("<amount__bc protect = \"1\">").append("<![CDATA[" + netAmtBc + "]]>").append("</amount__bc>");
mAmtBC = marginAmount * exchRate;
valueXmlString.append("<amount__bc protect = \"1\">").append("<![CDATA[" + mAmtBC + "]]>").append("</amount__bc>");
String reStr = itemChanged(dom, dom1, dom2, objContext, "acct_code", editFlag, xtraParams);
int pos = reStr.indexOf("<Detail3>");
......@@ -524,7 +523,7 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
}
else if(currentColumn.trim().equalsIgnoreCase("acct_code"))
{
acctCode = checkNull(genericUtility.getColumnValue("acct_code",dom)).trim();
acctCode = checkNull(genericUtility.getColumnValue("acct_code",dom));
sql = "select descr from accounts where acct_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,acctCode);
......@@ -552,7 +551,7 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
}
else if(currentColumn.trim().equalsIgnoreCase("cctr_code"))
{
cctrCode = checkNull(genericUtility.getColumnValue("cctr_code",dom)).trim();
cctrCode = checkNull(genericUtility.getColumnValue("cctr_code",dom));
sql = "select descr from costctr where cctr_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,cctrCode);
......@@ -588,7 +587,10 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
mexrate = finCommon.getDailyExchRateSellBuy(currCode, "", siteCode, tranDate, "B", conn);
valueXmlString.append("<exch_rate protect = \"1\">").append("<![CDATA["+mexrate+"]]>").append("</exch_rate>");
mAmt = genericUtility.getColumnValue("margin_amount", dom);
if(mAmt !=null && mAmt.trim().length() > 0)
{
mAmtBC = (Double.parseDouble(mAmt)) * mexrate;
}
valueXmlString.append("<amount__bc protect = \"1\">").append("<![CDATA[" + mAmtBC + "]]>").append("</amount__bc>");
}
......@@ -740,7 +742,7 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
}// end of if block for site_code
else if("loan_party".equalsIgnoreCase(childNodeName))
{
loanParty = checkNull(genericUtility.getColumnValue("loan_party", dom)).trim();
loanParty = checkNull(genericUtility.getColumnValue("loan_party", dom));
if(loanParty == null || loanParty.trim().length() ==0)
{
errCode = "VTLPCDNL";
......@@ -778,7 +780,7 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
}// end of if block
else if("bank_code".equalsIgnoreCase(childNodeName))
{
bankCode = checkNull(genericUtility.getColumnValue("bank_code",dom)).trim();
bankCode = checkNull(genericUtility.getColumnValue("bank_code",dom));
if(bankCode == null || bankCode.trim().length() == 0)
{
errCode = "VTBANKBLK";
......@@ -816,7 +818,7 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
}// end of if block
else if("acct_code__pay".equalsIgnoreCase(childNodeName))
{
acctCodePay = checkNull(genericUtility.getColumnValue("acct_code__pay",dom)).trim();
acctCodePay = checkNull(genericUtility.getColumnValue("acct_code__pay",dom));
if(acctCodePay == null || acctCodePay.trim().length() == 0)
{
errCode = "VMACCTNULL";
......@@ -854,7 +856,7 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
}// end of if block for party_name
else if("cctr_code__pay".equalsIgnoreCase(childNodeName))
{
cctrCodePay = checkNull(genericUtility.getColumnValue("cctr_code__pay",dom)).trim();
cctrCodePay = checkNull(genericUtility.getColumnValue("cctr_code__pay",dom));
if(cctrCodePay == null || cctrCodePay.trim().length() == 0)
{
errCode = "VTNULCCTR";
......@@ -892,7 +894,7 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
}// end of if block for party_name
else if("curr_code".equalsIgnoreCase(childNodeName))
{
currCode = checkNull(genericUtility.getColumnValue("curr_code",dom)).trim();
currCode = checkNull(genericUtility.getColumnValue("curr_code",dom));
if(currCode == null || currCode.trim().length() == 0)
{
errCode = "VMCUR2";
......@@ -943,7 +945,7 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
childNodeName = childNode.getNodeName();
if("ref_no".equalsIgnoreCase(childNodeName))
{
refNo = checkNull(genericUtility.getColumnValue("ref_no", dom)).trim();
refNo = checkNull(genericUtility.getColumnValue("ref_no", dom));
if(refNo == null || refNo.trim().length() ==0)
{
errCode = "VTREFRNO";
......@@ -952,10 +954,9 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
}
else
{
sql = "select count(*) as cnt from voucher where tran_id =? and confirmed = ?";
sql = "select count(*) as cnt from misc_payables where ref_no = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,refNo);
pstmt.setString(2,"Y");
rs = pstmt.executeQuery();
if(rs.next())
{
......@@ -982,7 +983,7 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
}// end of if block
else if("ref_ser".equalsIgnoreCase(childNodeName))
{
refSer = checkNull(genericUtility.getColumnValue("ref_ser",dom)).trim();
refSer = checkNull(genericUtility.getColumnValue("ref_ser",dom));
if(refSer == null || refSer.trim().length() == 0)
{
errCode = "VTREFSER7";
......@@ -991,7 +992,7 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
}
else
{
sql = "select count(*) as cnt from refser where ref_ser =?";
sql = "select count(*) as cnt from misc_payables where tran_ser =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,refSer);
rs = pstmt.executeQuery();
......@@ -1020,7 +1021,7 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
}// end of if block
else if("acct_code".equalsIgnoreCase(childNodeName))
{
acctCode = checkNull(genericUtility.getColumnValue("acct_code",dom)).trim();
acctCode = checkNull(genericUtility.getColumnValue("acct_code",dom));
if(acctCode == null || acctCode.trim().length() == 0)
{
errCode = "VMACCTNULL";
......@@ -1058,7 +1059,7 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
}// end of if block
else if("cctr_code".equalsIgnoreCase(childNodeName))
{
cctrCode = checkNull(genericUtility.getColumnValue("cctr_code",dom)).trim();
cctrCode = checkNull(genericUtility.getColumnValue("cctr_code",dom));
if(cctrCode == null || cctrCode.trim().length() == 0)
{
errCode = "VTNULCCTR";
......@@ -1119,10 +1120,9 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
}
else
{
sql = "select count(*) as cnt from voucher where tran_id =? and confirmed = ? ";
sql = "select count(*) as cnt from misc_payables where ref_no = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,refNo);
pstmt.setString(2,"Y");
rs = pstmt.executeQuery();
if(rs.next())
{
......@@ -1149,7 +1149,7 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
}// end of if block
else if("ref_ser".equalsIgnoreCase(childNodeName))
{
refSer = checkNull(genericUtility.getColumnValue("ref_ser",dom)).trim();
refSer = checkNull(genericUtility.getColumnValue("ref_ser",dom));
if(refSer == null || refSer.trim().length() == 0)
{
errCode = "VTREFSER7";
......@@ -1158,7 +1158,7 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
}
else
{
sql = "select count(*) as cnt from refser where ref_ser =?";
sql = "select count(*) as cnt from misc_payables where tran_ser =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,refSer);
rs = pstmt.executeQuery();
......@@ -1187,7 +1187,7 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
}// end of if block
else if("acct_code".equalsIgnoreCase(childNodeName))
{
acctCode = checkNull(genericUtility.getColumnValue("acct_code",dom)).trim();
acctCode = checkNull(genericUtility.getColumnValue("acct_code",dom));
if(acctCode == null || acctCode.trim().length() == 0)
{
errCode = "VMACCTNULL";
......@@ -1225,7 +1225,7 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
}// end of if block
else if("cctr_code".equalsIgnoreCase(childNodeName))
{
cctrCode = checkNull(genericUtility.getColumnValue("cctr_code",dom)).trim();
cctrCode = checkNull(genericUtility.getColumnValue("cctr_code",dom));
if(cctrCode == null || cctrCode.trim().length() == 0)
{
errCode = "VTNULCCTR";
......@@ -1263,7 +1263,7 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
}// end of if block
else if("curr_code".equalsIgnoreCase(childNodeName))
{
currCode = checkNull(genericUtility.getColumnValue("curr_code",dom)).trim();
currCode = checkNull(genericUtility.getColumnValue("curr_code",dom));
if(currCode == null || currCode.trim().length() == 0)
{
errCode = "VMCUR2";
......
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