Commit f410a73c authored by ngadkari's avatar ngadkari

Loan Tracking system

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@187672 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 1d2f7e00
...@@ -69,7 +69,7 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote ...@@ -69,7 +69,7 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
int ctr = 0; int ctr = 0;
String sql = "",partyName="",loanParty="",bankCode="",bankName="",acctDescr="",acctCodePay="",cctrCodePay="",cctrCodeDescr="",refNo="",netAmtBc="",mAmt=""; String sql = "",partyName="",loanParty="",bankCode="",bankName="",acctDescr="",acctCodePay="",cctrCodePay="",cctrCodeDescr="",refNo="",netAmtBc="",mAmt="";
String refSer="",acctCode="", cctrCode="",currCode="",tranDate="",loanAmt="",siteCode="",cctrCodeAp="",acctCodeAp="",loanType="",billNo="",sundryCode="",billdateStr=""; String refSer="",acctCode="", cctrCode="",currCode="",tranDate="",loanAmt="",siteCode="",cctrCodeAp="",acctCodeAp="",loanType="",billNo="",sundryCode="",billdateStr="";
String acctCodeCf="",cctrCodeCf="",sundryName="",acctDescrCF="",acctCodeCF="",cctrCodeDescrCF="",cctrCodeCF=""; String acctCodeCf="",cctrCodeCf="",sundryName="",acctDescrCF="",acctCodeCF="",cctrCodeDescrCF="",cctrCodeCF="",exchRateStr="";
StringBuffer valueXmlString = new StringBuffer(); StringBuffer valueXmlString = new StringBuffer();
Connection conn = null; Connection conn = null;
PreparedStatement pstmt = null, pstmt1 = null; PreparedStatement pstmt = null, pstmt1 = null;
...@@ -79,7 +79,7 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote ...@@ -79,7 +79,7 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
Node parentNode = null; Node parentNode = null;
Node childNode = null; Node childNode = null;
String childNodeName = null; String childNodeName = null;
Double loanAmtBC = 0.0,mAmtBC=0.0,exchRate=0.0,amount=0.0,diffAmtExchEX=0.0; Double loanAmtBC = 0.0,mAmtBC=0.0,exchRate=0.0,amount=0.0,diffAmtExchEX=0.0,totalDiff=0.0;
Double mexrate = 0.0,totAmt=0.0,adjAmt=0.0,amountPaid=0.0,marginAmount=0.0,exchRatePay=0.0,diffAmtExch=0.0; Double mexrate = 0.0,totAmt=0.0,adjAmt=0.0,amountPaid=0.0,marginAmount=0.0,exchRatePay=0.0,diffAmtExch=0.0;
List amtList = new ArrayList(); List amtList = new ArrayList();
Timestamp billdate=null; Timestamp billdate=null;
...@@ -471,7 +471,7 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote ...@@ -471,7 +471,7 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
} }
while(ctr < childNodeListLength && !childNodeName.equals(currentColumn)); while(ctr < childNodeListLength && !childNodeName.equals(currentColumn));
System.out.println("IN DETAILS column name is %%%%%%%%%%%%%[" + currentColumn + "] ==> '" + columnValue + "'"); System.out.println("IN DETAILS column name is %%%%%%%%%%%%%[" + currentColumn + "] ==> '" + columnValue + "'");
if (currentColumn.trim().equalsIgnoreCase("itm_defaultedit")) /* if (currentColumn.trim().equalsIgnoreCase("itm_defaultedit"))
{ {
Node currDetailF=null; Node currDetailF=null;
Node currDetailF2=null; Node currDetailF2=null;
...@@ -490,7 +490,8 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote ...@@ -490,7 +490,8 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
valueXmlString.append("<diff_amt__exch protect = \"1\">").append("<![CDATA[" + getReqDecimal(diffAmtExch, 3) + "]]>").append("</diff_amt__exch>"); valueXmlString.append("<diff_amt__exch protect = \"1\">").append("<![CDATA[" + getReqDecimal(diffAmtExch, 3) + "]]>").append("</diff_amt__exch>");
} }
} }
else if(currentColumn.trim().equalsIgnoreCase("ref_no")) else*/
if(currentColumn.trim().equalsIgnoreCase("ref_no"))
{ {
...@@ -606,15 +607,21 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote ...@@ -606,15 +607,21 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
valueXmlString.append("<curr_code>").append("<![CDATA["+currCode+"]]>").append("</curr_code>"); valueXmlString.append("<curr_code>").append("<![CDATA["+currCode+"]]>").append("</curr_code>");
setNodeValue(dom,"curr_code" , currCode); setNodeValue(dom,"curr_code" , currCode);
String reStrcur = itemChanged(dom, dom1, dom2, objContext, "curr_code", editFlag, xtraParams); /*String reStrcur = itemChanged(dom, dom1, dom2, objContext, "curr_code", editFlag, xtraParams);
int poscur = reStrcur.indexOf("<Detail2>"); int poscur = reStrcur.indexOf("<Detail2>");
reStrcur = reStrcur.substring(poscur + 9); reStrcur = reStrcur.substring(poscur + 9);
poscur = reStrcur.indexOf("</Detail2>"); poscur = reStrcur.indexOf("</Detail2>");
reStrcur = reStrcur.substring(0, poscur); reStrcur = reStrcur.substring(0, poscur);
valueXmlString.append(reStrcur); valueXmlString.append(reStrcur);*/
valueXmlString.append("<exch_rate>").append("<![CDATA["+exchRate+"]]>").append("</exch_rate>"); valueXmlString.append("<exch_rate>").append("<![CDATA["+exchRate+"]]>").append("</exch_rate>");
setNodeValue(dom,"exch_rate" , exchRate.toString()); setNodeValue(dom,"exch_rate" , exchRate.toString());
String reStrcur = itemChanged(dom, dom1, dom2, objContext, "exch_rate", editFlag, xtraParams);
int poscur = reStrcur.indexOf("<Detail2>");
reStrcur = reStrcur.substring(poscur + 9);
poscur = reStrcur.indexOf("</Detail2>");
reStrcur = reStrcur.substring(0, poscur);
valueXmlString.append(reStrcur);
} }
...@@ -683,91 +690,23 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote ...@@ -683,91 +690,23 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
} }
} }
else if(currentColumn.trim().equalsIgnoreCase("acct_code__cf"))
{
acctCodeCf = checkNull(genericUtility.getColumnValue("acct_code__cf",dom));
sql = "select descr from accounts where acct_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,acctCodeCf);
rs = pstmt.executeQuery();
if(rs.next())
{
acctDescrCF = rs.getString("descr");
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
if(acctDescrCF != null && acctDescrCF.trim().length() > 0 )
{
valueXmlString.append("<acc_cf_descr>").append("<![CDATA[" + checkNull(acctDescrCF) + "]]>").append("</acc_cf_descr>");
}
else
{
valueXmlString.append("<acc_cf_descr>").append("<![CDATA[]]>").append("</acc_cf_descr>");
}
}
else if(currentColumn.trim().equalsIgnoreCase("cctr_code__cf"))
{
cctrCodeCf = checkNull(genericUtility.getColumnValue("cctr_code__cf",dom));
sql = "select descr from costctr where cctr_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,cctrCodeCf);
rs = pstmt.executeQuery();
if(rs.next())
{
cctrCodeDescrCF = rs.getString("descr");
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
if(cctrCodeDescrCF != null && cctrCodeDescrCF.trim().length() > 0 )
{
valueXmlString.append("<cctr_cf_descr>").append("<![CDATA[" + checkNull(cctrCodeDescrCF) + "]]>").append("</cctr_cf_descr>");
}
else
{
valueXmlString.append("<cctr_cf_descr>").append("<![CDATA[]]>").append("</cctr_cf_descr>");
}
}
else if(currentColumn.trim().equalsIgnoreCase("curr_code")) else if(currentColumn.trim().equalsIgnoreCase("curr_code"))
{ {
currCode =genericUtility.getColumnValue("curr_code", dom);
setNodeValue(dom,"curr_code" ,currCode);
Node currDetailF=null; Node currDetailF=null;
NodeList detailList1 = dom2.getElementsByTagName("Detail1"); NodeList detailList1 = dom2.getElementsByTagName("Detail1");
currDetailF = detailList1.item(0); currDetailF = detailList1.item(0);
tranDate = genericUtility.getColumnValueFromNode("tran_date",currDetailF); tranDate = genericUtility.getColumnValueFromNode("tran_date",currDetailF);
siteCode = genericUtility.getColumnValueFromNode("site_code",currDetailF); siteCode = genericUtility.getColumnValueFromNode("site_code",currDetailF);
currCode =genericUtility.getColumnValue("curr_code", dom);
mexrate = checkDoubleNull(genericUtility.getColumnValue("exch_rate",dom));
if (mexrate ==0 )
{
mexrate = finCommon.getDailyExchRateSellBuy(currCode, "", siteCode, tranDate, "B", conn); mexrate = finCommon.getDailyExchRateSellBuy(currCode, "", siteCode, tranDate, "B", conn);
valueXmlString.append("<exch_rate>").append("<![CDATA["+mexrate+"]]>").append("</exch_rate>"); valueXmlString.append("<exch_rate>").append("<![CDATA["+mexrate+"]]>").append("</exch_rate>");
setNodeValue(dom,"exch_rate" , mexrate.toString()); setNodeValue(dom,"exch_rate" , mexrate.toString());
}
else
{
setNodeValue(dom,"exch_rate" , mexrate.toString());
}
String reStr = itemChanged(dom, dom1, dom2, objContext, "exch_rate", editFlag, xtraParams); String reStr = itemChanged(dom, dom1, dom2, objContext, "exch_rate", editFlag, xtraParams);
int pos = reStr.indexOf("<Detail2>"); int pos = reStr.indexOf("<Detail2>");
reStr = reStr.substring(pos + 9); reStr = reStr.substring(pos + 9);
...@@ -782,18 +721,22 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote ...@@ -782,18 +721,22 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
Node currDetailF=null; Node currDetailF=null;
NodeList detailList1 = dom2.getElementsByTagName("Detail1"); NodeList detailList1 = dom2.getElementsByTagName("Detail1");
currDetailF = detailList1.item(0); currDetailF = detailList1.item(0);
loanAmtBC = checkDoubleNull(genericUtility.getColumnValueFromNode("loan_amt__bc",currDetailF)); /* loanAmtBC = checkDoubleNull(genericUtility.getColumnValueFromNode("loan_amt__bc",currDetailF));*/
tranDate = genericUtility.getColumnValueFromNode("tran_date",currDetailF);
siteCode = genericUtility.getColumnValueFromNode("site_code",currDetailF);
mexrate = checkDoubleNull(genericUtility.getColumnValue("exch_rate",dom)); mexrate = checkDoubleNull(genericUtility.getColumnValue("exch_rate",dom));
currCode =genericUtility.getColumnValue("curr_code", dom);
amount = checkDoubleNull(genericUtility.getColumnValue("amount_paid", dom)); amount = checkDoubleNull(genericUtility.getColumnValue("amount_paid", dom));
mAmtBC = amount * mexrate; mAmtBC = amount * mexrate;
valueXmlString.append("<amount__bc protect = \"1\">").append("<![CDATA[" + getReqDecimal(mAmtBC,3 ) + "]]>").append("</amount__bc>"); valueXmlString.append("<amount__bc protect = \"1\">").append("<![CDATA[" + getReqDecimal(mAmtBC,3 ) + "]]>").append("</amount__bc>");
exchRate = finCommon.getDailyExchRateSellBuy(currCode, "", siteCode, tranDate, "B", conn);
loanAmtBC = amount * exchRate;
diffAmtExch = loanAmtBC - mAmtBC ; diffAmtExch = loanAmtBC - mAmtBC ;
valueXmlString.append("<diff_amt__exch protect = \"1\">").append("<![CDATA[" + getReqDecimal(diffAmtExch, 3) + "]]>").append("</diff_amt__exch>"); valueXmlString.append("<diff_amt__exch protect = \"1\">").append("<![CDATA[" + getReqDecimal(diffAmtExch, 3) + "]]>").append("</diff_amt__exch>");
} }
...@@ -829,7 +772,7 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote ...@@ -829,7 +772,7 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
} }
while(ctr < childNodeListLength && !childNodeName.equals(currentColumn)); while(ctr < childNodeListLength && !childNodeName.equals(currentColumn));
System.out.println("IN DETAILS column name is %%%%%%%%%%%%%[" + currentColumn + "] ==> '" + columnValue + "'"); System.out.println("IN DETAILS column name is %%%%%%%%%%%%%[" + currentColumn + "] ==> '" + columnValue + "'");
if (currentColumn.trim().equalsIgnoreCase("itm_defaultedit")) /*if (currentColumn.trim().equalsIgnoreCase("itm_defaultedit"))
{ {
Node currDetailF=null; Node currDetailF=null;
Node currDetailF2=null; Node currDetailF2=null;
...@@ -848,7 +791,7 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote ...@@ -848,7 +791,7 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
valueXmlString.append("<diff_amt__exch protect = \"1\">").append("<![CDATA[" + getReqDecimal(diffAmtExch, 3) + "]]>").append("</diff_amt__exch>"); valueXmlString.append("<diff_amt__exch protect = \"1\">").append("<![CDATA[" + getReqDecimal(diffAmtExch, 3) + "]]>").append("</diff_amt__exch>");
} }
} }
else else*/
if(currentColumn.trim().equalsIgnoreCase("ref_no")) if(currentColumn.trim().equalsIgnoreCase("ref_no"))
{ {
...@@ -895,12 +838,12 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote ...@@ -895,12 +838,12 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
setNodeValue(dom,"cctr_code" , cctrCode); setNodeValue(dom,"cctr_code" , cctrCode);
valueXmlString.append("<curr_code>").append("<![CDATA["+currCode+"]]>").append("</curr_code>"); valueXmlString.append("<curr_code>").append("<![CDATA["+currCode+"]]>").append("</curr_code>");
setNodeValue(dom,"curr_code" , currCode); setNodeValue(dom,"curr_code" , currCode);
String reStrcur = itemChanged(dom, dom1, dom2, objContext, "curr_code", editFlag, xtraParams); /*String reStrcur = itemChanged(dom, dom1, dom2, objContext, "curr_code", editFlag, xtraParams);
int poscur = reStrcur.indexOf("<Detail3>"); int poscur = reStrcur.indexOf("<Detail3>");
reStrcur = reStrcur.substring(poscur + 9); reStrcur = reStrcur.substring(poscur + 9);
poscur = reStrcur.indexOf("</Detail3>"); poscur = reStrcur.indexOf("</Detail3>");
reStrcur = reStrcur.substring(0, poscur); reStrcur = reStrcur.substring(0, poscur);
valueXmlString.append(reStrcur); valueXmlString.append(reStrcur);*/
/*valueXmlString.append("<exch_rate protect = \"1\">").append("<![CDATA["+exchRate+"]]>").append("</exch_rate>"); /*valueXmlString.append("<exch_rate protect = \"1\">").append("<![CDATA["+exchRate+"]]>").append("</exch_rate>");
mAmtBC = marginAmount * exchRate; mAmtBC = marginAmount * exchRate;
...@@ -943,6 +886,12 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote ...@@ -943,6 +886,12 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
valueXmlString.append("<exch_rate>").append("<![CDATA["+exchRate+"]]>").append("</exch_rate>"); valueXmlString.append("<exch_rate>").append("<![CDATA["+exchRate+"]]>").append("</exch_rate>");
setNodeValue(dom,"exch_rate" , exchRate.toString()); setNodeValue(dom,"exch_rate" , exchRate.toString());
String reStrcur = itemChanged(dom, dom1, dom2, objContext, "exch_rate", editFlag, xtraParams);
int poscur = reStrcur.indexOf("<Detail3>");
reStrcur = reStrcur.substring(poscur + 9);
poscur = reStrcur.indexOf("</Detail3>");
reStrcur = reStrcur.substring(0, poscur);
valueXmlString.append(reStrcur);
} }
} }
else if(currentColumn.trim().equalsIgnoreCase("acct_code")) else if(currentColumn.trim().equalsIgnoreCase("acct_code"))
...@@ -1018,18 +967,12 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote ...@@ -1018,18 +967,12 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
tranDate = genericUtility.getColumnValueFromNode("tran_date",currDetailF); tranDate = genericUtility.getColumnValueFromNode("tran_date",currDetailF);
siteCode = genericUtility.getColumnValueFromNode("site_code",currDetailF); siteCode = genericUtility.getColumnValueFromNode("site_code",currDetailF);
currCode =genericUtility.getColumnValue("curr_code", dom); currCode =genericUtility.getColumnValue("curr_code", dom);
mexrate = checkDoubleNull(genericUtility.getColumnValue("exch_rate",dom));
if (mexrate ==0 )
{
mexrate = finCommon.getDailyExchRateSellBuy(currCode, "", siteCode, tranDate, "B", conn); mexrate = finCommon.getDailyExchRateSellBuy(currCode, "", siteCode, tranDate, "B", conn);
valueXmlString.append("<exch_rate>").append("<![CDATA["+mexrate+"]]>").append("</exch_rate>"); valueXmlString.append("<exch_rate>").append("<![CDATA["+mexrate+"]]>").append("</exch_rate>");
setNodeValue(dom,"exch_rate" , mexrate.toString()); setNodeValue(dom,"exch_rate" , mexrate.toString());
}
else
{
setNodeValue(dom,"exch_rate" , mexrate.toString());
}
String reStr = itemChanged(dom, dom1, dom2, objContext, "exch_rate", editFlag, xtraParams); String reStr = itemChanged(dom, dom1, dom2, objContext, "exch_rate", editFlag, xtraParams);
int pos = reStr.indexOf("<Detail3>"); int pos = reStr.indexOf("<Detail3>");
reStr = reStr.substring(pos + 9); reStr = reStr.substring(pos + 9);
...@@ -1042,21 +985,27 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote ...@@ -1042,21 +985,27 @@ public class LoanIC extends ValidatorEJB implements LoanICLocal, LoanICRemote
} }
else if(currentColumn.trim().equalsIgnoreCase("exch_rate")) else if(currentColumn.trim().equalsIgnoreCase("exch_rate"))
{ {
Node currDetailF=null; Node currDetailF=null;
NodeList detailList1 = dom2.getElementsByTagName("Detail1"); NodeList detailList1 = dom2.getElementsByTagName("Detail1");
currDetailF = detailList1.item(0); currDetailF = detailList1.item(0);
loanAmtBC = checkDoubleNull(genericUtility.getColumnValueFromNode("loan_amt__bc",currDetailF)); /* loanAmtBC = checkDoubleNull(genericUtility.getColumnValueFromNode("loan_amt__bc",currDetailF));*/
mexrate = checkDoubleNull(genericUtility.getColumnValue("exch_rate",dom)); tranDate = genericUtility.getColumnValueFromNode("tran_date",currDetailF);
amount = checkDoubleNull(genericUtility.getColumnValue("margin_amount", dom)); siteCode = genericUtility.getColumnValueFromNode("site_code",currDetailF);
mAmtBC = amount * mexrate;
mexrate = checkDoubleNull(genericUtility.getColumnValue("exch_rate",dom));
valueXmlString.append("<amount__bc protect = \"1\">").append("<![CDATA[" + getReqDecimal(mAmtBC,3 )+ "]]>").append("</amount__bc>"); currCode =genericUtility.getColumnValue("curr_code", dom);
amount = checkDoubleNull(genericUtility.getColumnValue("amount_paid", dom));
mAmtBC = amount * mexrate;
valueXmlString.append("<amount__bc protect = \"1\">").append("<![CDATA[" + getReqDecimal(mAmtBC,3 ) + "]]>").append("</amount__bc>");
exchRate = finCommon.getDailyExchRateSellBuy(currCode, "", siteCode, tranDate, "B", conn);
loanAmtBC = amount * exchRate;
diffAmtExch = loanAmtBC - mAmtBC ;
valueXmlString.append("<diff_amt__exch protect = \"1\">").append("<![CDATA[" + getReqDecimal(diffAmtExch, 3) + "]]>").append("</diff_amt__exch>");
diffAmtExch = loanAmtBC - mAmtBC ; }
valueXmlString.append("<diff_amt__exch protect = \"1\">").append("<![CDATA[" + getReqDecimal(diffAmtExch, 3) + "]]>").append("</diff_amt__exch>");
}
valueXmlString.append("</Detail3>"); valueXmlString.append("</Detail3>");
break; break;
......
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