<%@ page contentType="text/html; charset=GBK"%> <%@ include file="/IncludeBegin.jsp"%> <%@ include file="/Accounting/include_accounting.jspf"%> 咨询还款计划 <% //定义变量 BusinessObject transaction = null; //获得页面参数 String loanSerialNo = (String) CurPage.getParameter("LoanSerialNo"); String transactionSerialNo = (String) CurPage.getParameter("TransSerialNo"); String transactionCode = (String) CurPage.getParameter("TransactionCode"); String sTransDate = (String) CurPage.getParameter("TransDate"); String rightType = (String)CurPage.getParameter("RightType"); if(StringX.isEmpty(sTransDate)) sTransDate = DateHelper.getBusinessDate(); BusinessObjectManager bomanager = BusinessObjectManager.createBusinessObjectManager(); if ("9090".equals(transactionCode)) { String date_9090 = DateHelper.getRelativeDate(sTransDate, DateHelper.TERM_UNIT_DAY, -1); BusinessObject loan = bomanager.keyLoadBusinessObject(BUSINESSOBJECT_CONSTANTS.loan, loanSerialNo); loan.setAttributeValue("LoanPeriod", 0); transaction = com.amarsoft.app.base.trans.TransactionHelper.createTransaction("9090", null, loan, CurUser.getUserID(),CurUser.getOrgID(),date_9090,bomanager); if("0".equals(loan.getString("LoanStatus")) || "1".equals(loan.getString("LoanStatus"))) { com.amarsoft.app.base.trans.TransactionHelper.loadTransaction(transaction, bomanager); List rptList = loan.getBusinessObjectsBySql(BUSINESSOBJECT_CONSTANTS.loan_rpt_segment, "Status='1' "); for (BusinessObject rptSegment : rptList) { rptSegment.setAttributeValue("PSRestructureFlag", "1"); } com.amarsoft.app.base.trans.TransactionHelper.executeTransaction(transaction, bomanager); } } else { transaction = com.amarsoft.app.base.trans.TransactionHelper.loadTransaction(transactionSerialNo, bomanager); BusinessObject loan = transaction.getBusinessObject(transaction.getString("RelativeObjectType")); loan.setAttributeValue("LoanPeriod", 0); sTransDate = transaction.getString("TransDate"); //对于生效日期不是在当天的进行换日交易的处理 /* if (sTransDate.compareTo(loan.getString("BusinessDate")) > 0) { transaction = TransactionHelper.createTransaction("9090", null, loan, CurUser.getUserID(),CurUser.getOrgID(),DateHelper.getRelativeDate(sTransDate, DateHelper.TERM_UNIT_DAY, -1),bomanager); TransactionHelper.loadTransaction(transaction, bomanager); TransactionHelper.executeTransaction(transaction, bomanager); }*/ com.amarsoft.app.base.trans.TransactionHelper.executeTransaction(transaction, bomanager); } BusinessObject loan = transaction.getBusinessObject(transaction.getString("RelativeObjectType")); List list = loan.getBusinessObjectsBySql(BUSINESSOBJECT_CONSTANTS.payment_schedule, "PayDate<=:PayDate", "PayDate",loan.getString("BusinessDate")); List psList = loan.getBusinessObjectsBySql(BUSINESSOBJECT_CONSTANTS.payment_schedule, "PayDate>:PayDate and Direction = 'R'", "PayDate",loan.getString("BusinessDate")); rightType = "RPT15".equals(loan.getString("RPTTERMID")) ? rightType:"ReadOnly"; //删除原始的还款计划 BusinessObject loanChange = transaction.getBusinessObject(transaction.getString("DocumentType")); if(loanChange!=null&&!rightType.equals("ReadOnly")){ BusinessObjectManager bom1 = BusinessObjectManager.createBusinessObjectManager(); //删除历史 bom1.updateBusinessObjects(loanChange.getBusinessObjects(BUSINESSOBJECT_CONSTANTS.payment_schedule)); bom1.updateDB(); for(BusinessObject a:psList){ BusinessObject b = BusinessObject.createBusinessObject(a.getBizClassName()); b.setValue(a); b.setAttributeValue("ObjectType",loanChange.getBizClassName()); b.setAttributeValue("ObjectNo",loanChange.getKeyString()); bom1.updateBusinessObject(b); list.add(b); } bom1.updateDB(); } else if(loanChange!=null&&"ReadOnly".equals(rightType)&&"RPT15".equals(loanChange.getString("RPTTERMID"))) { ASValuePool as = new ASValuePool(); as.setAttribute("ObjectType",loanChange.getBizClassName()); as.setAttribute("ObjectNo",loanChange.getKeyString()); list = bomanager.loadBusinessObjects(BUSINESSOBJECT_CONSTANTS.payment_schedule,"ObjectType=:ObjectType and ObjectNo=:ObjectNo order by PayDate,PeriodNo",as); }else list.addAll(psList); double allPrincipalAmt = 0.0,allActualPrincipalAmt=0.0d; double allInteAmt = 0.0,allActualInteAmt=0.0d; double allFineAmt = 0.0,allActualFineAmt=0.0d; double allCompAmt = 0.0,allActualCompAmt=0.0d; double allFeeAmt = 0.0,allActualFeeAmt=0.0d; double allAmt = 0.0,allActualAmt=0.0d; String putoutDate = loan.getString("PutOutDate"); String maturityDate = loan.getString("MaturityDate"); int firstSeqID = 1; if(!list.isEmpty()) firstSeqID = list.get(0).getInt("PeriodNo"); int maxSeqID = list.size() + firstSeqID - 1; String rptTermID = loan.getString("RPTTERMID"); String defaultDueDay = ""; if(loanChange != null && "RPT15".equals(loanChange.getString("RPTTERMID"))){ List rptList = bomanager.loadBusinessObjects(BUSINESSOBJECT_CONSTANTS.loan_rpt_segment, " ObjectNo=:ObjectNo and ObjectType=:ObjectType ", "ObjectNo",loanChange.getKeyString(),"ObjectType",loanChange.getBizClassName()); if(rptList != null && rptList.size() > 0) { for(BusinessObject rpt:rptList) { if(rpt.getString("Status").equals("0")) defaultDueDay = rpt.getString("DefaultDueDay"); if(defaultDueDay.length() == 1) defaultDueDay = "0" + defaultDueDay; } } if(defaultDueDay.equals("")){ defaultDueDay = loan.getString("PutOutDate").substring(8,10); } } %>
<% if(list != null){ for(BusinessObject bo:list){ BusinessObject pbo = BusinessObjectHelper.getBusinessObjectBySql(list, "SerialNo=:SerialNo", "SerialNo", bo.getString("ParentSerialNo")); if(pbo != null) continue; double otherFeeAmt = 0.0d; double actualFeeAmt = 0.0d; List cls = BusinessObjectHelper.getBusinessObjectsBySql(list, "ParentSerialNo=:SerialNo", "SerialNo", bo.getString("SerialNo")); for(BusinessObject cl:cls) { otherFeeAmt += cl.getDouble("PayPrincipalAmt")+cl.getDouble("PayInterestAmt"); actualFeeAmt += cl.getDouble("ActualPayPrincipalAmt")+cl.getDouble("ActualPayInterestAmt"); } String payPrincipalColor = "black"; String payInteColor = "black"; String fixInstallmentColor = "black"; String payDateColor = "black"; String flag = ""; //1 为本金调整 2 为还款额调整 if( bo.getDouble("FixPrincipalAmt") > 0.0d) { payPrincipalColor = "red"; flag = "1"; } else if(bo.getDouble("FixInstallmentAmt") > 0.0d) { fixInstallmentColor = "red"; flag = "2"; } else if(!defaultDueDay.equals("") && !bo.getString("PayDate").substring(8, 10).equals(defaultDueDay) && !bo.getString("PayDate").equals(maturityDate)) { payDateColor = "red"; } allPrincipalAmt += bo.getDouble("PayPrincipalAmt"); allActualPrincipalAmt += bo.getDouble("ActualPayPrincipalAmt"); allInteAmt += bo.getDouble("PayInterestAmt"); allActualInteAmt += bo.getDouble("ActualPayInterestAmt"); allFeeAmt+=otherFeeAmt; allActualFeeAmt+=actualFeeAmt; allFineAmt += bo.getDouble("PAYPRINCIPALPENALTYAMT"); allActualFineAmt += bo.getDouble("ACTUALPAYPRINCIPALPENALTYAMT"); allCompAmt += bo.getDouble("PAYINTERESTPENALTYAMT"); allActualCompAmt += bo.getDouble("ACTUALPAYINTERESTPENALTYAMT"); allAmt += bo.getDouble("PayPrincipalAmt")+bo.getDouble("PayInterestAmt")+bo.getDouble("PAYPRINCIPALPENALTYAMT")+bo.getDouble("PAYINTERESTPENALTYAMT")+otherFeeAmt; allActualAmt += bo.getDouble("ActualPayPrincipalAmt")+bo.getDouble("ActualPayInterestAmt")+bo.getDouble("ACTUALPAYPRINCIPALPENALTYAMT")+bo.getDouble("ACTUALPAYINTERESTPENALTYAMT")+actualFeeAmt; %> " type=hidden value="<%=flag%>"/> <% } } %>
期次 日期 应还/已还本金 应还/已还利息 应还/已还费用 应还/已还罚息 应还/已还复利 应还/已还总金额 剩余本金 结清日期
<%=bo.getInt("PeriodNo")%>" type=hidden value="<%=bo.getString("SerialNo")%>"/> " style='text-align: right;WIDTH: 70px;COLOR: <%=payDateColor%>' class=fftdinput type=text onblur=parent.trimField(this) readOnly value="<%=DataConvert.toString(bo.getString("PayDate"))%>" <%=rightType %> onclick=selectDate("<%=bo.getInt("PeriodNo")%>","PayDate","<%=bo.getInt("PeriodNo")%>") > " style='text-align: right;WIDTH: 80px;COLOR: <%=payPrincipalColor%>' class=fftdinput type=text onblur=parent.trimField(this) value="<%=DataConvert.toMoney(bo.getDouble("PayPrincipalAmt"))%>" <%=rightType %> onchange=ChangeValue("<%=bo.getInt("PeriodNo")%>","PayPrincipalAmt","<%=bo.getInt("PeriodNo")%>")> <%=DataConvert.toMoney(bo.getDouble("ActualPayPrincipalAmt"))%> " style='text-align: right;WIDTH: 80px;COLOR: <%=payInteColor%>; ' class=fftdinput type=text onblur=parent.trimField(this) readOnly value="<%=DataConvert.toMoney(bo.getDouble("PayInterestAmt"))%>" onchange=ChangeValue("<%=bo.getInt("PeriodNo")%>","PayInterestAmt","<%=bo.getInt("PeriodNo")%>")> <%=DataConvert.toMoney(bo.getDouble("ActualPayInterestAmt"))%> " style='text-align: right;WIDTH: 80px;COLOR: <%=payInteColor%>; ' class=fftdinput type=text onblur=parent.trimField(this) readOnly value="<%=DataConvert.toMoney(otherFeeAmt)%>" onchange=ChangeValue("<%=bo.getInt("PeriodNo")%>","PayFeeAmt","<%=bo.getInt("PeriodNo")%>")> <%=DataConvert.toMoney(actualFeeAmt)%> " style='text-align: right;WIDTH: 80px;COLOR: <%=payInteColor%>; ' class=fftdinput type=text onblur=parent.trimField(this) readOnly value="<%=DataConvert.toMoney(bo.getDouble("PAYPRINCIPALPENALTYAMT"))%>" onchange=ChangeValue("<%=bo.getInt("PeriodNo")%>","PAYPRINCIPALPENALTYAMT","<%=bo.getInt("PeriodNo")%>")> <%=DataConvert.toMoney(bo.getDouble("ACTUALPAYPRINCIPALPENALTYAMT"))%> " style='text-align: right;WIDTH: 80px;COLOR: <%=payInteColor%>; ' class=fftdinput type=text onblur=parent.trimField(this) readOnly value="<%=DataConvert.toMoney(bo.getDouble("PAYINTERESTPENALTYAMT"))%>" onchange=ChangeValue("<%=bo.getInt("PeriodNo")%>","PAYINTERESTPENALTYAMT","<%=bo.getInt("PeriodNo")%>")> <%=DataConvert.toMoney(bo.getDouble("ACTUALPAYINTERESTPENALTYAMT"))%> " style='text-align: right;WIDTH: 80px;COLOR: <%=fixInstallmentColor%>' class=fftdinput type=text onblur=parent.trimField(this) value="<%=DataConvert.toMoney(bo.getDouble("PayPrincipalAmt")+bo.getDouble("PayInterestAmt")+bo.getDouble("PAYPRINCIPALPENALTYAMT")+bo.getDouble("PAYINTERESTPENALTYAMT")+otherFeeAmt)%>" <%=rightType %> onchange=ChangeValue("<%=bo.getInt("PeriodNo")%>","FixInstallmentAmt","<%=bo.getInt("PeriodNo")%>")> <%=DataConvert.toMoney(bo.getDouble("ActualPayPrincipalAmt")+bo.getDouble("ActualPayInterestAmt")+bo.getDouble("ACTUALPAYPRINCIPALPENALTYAMT")+bo.getDouble("ACTUALPAYINTERESTPENALTYAMT")+actualFeeAmt)%> " style='text-align: right;WIDTH: 80px; COLOR: black;' class=fftdinput type=text onblur=parent.trimField(this) readOnly value="<%=DataConvert.toMoney(bo.getDouble("PrincipalBalance"))%>" onchange=ChangeValue("<%=bo.getInt("PeriodNo")%>","PrincipalBalance","<%=bo.getInt("PeriodNo")%>")> <%=DataConvert.toString(bo.getString("FinishDate"))%>
合计 <%=DataConvert.toMoney(allPrincipalAmt)%> <%=DataConvert.toMoney(allActualPrincipalAmt)%> <%=DataConvert.toMoney(allInteAmt)%> <%=DataConvert.toMoney(allActualInteAmt)%> <%=DataConvert.toMoney(allFeeAmt)%> <%=DataConvert.toMoney(allActualFeeAmt)%> <%=DataConvert.toMoney(allFineAmt)%> <%=DataConvert.toMoney(allActualFineAmt)%> <%=DataConvert.toMoney(allCompAmt)%> <%=DataConvert.toMoney(allActualCompAmt)%> <%=DataConvert.toMoney(allAmt)%> <%=DataConvert.toMoney(allActualAmt)%>
<%@ include file="/IncludeEnd.jsp"%>