<%@page import="com.amarsoft.app.accounting.cashflow.CashFlowHelper"%> <%@page import="com.amarsoft.app.accounting.config.impl.CashFlowConfig"%> <%@page import="com.amarsoft.app.base.util.DateHelper"%> <%@page import="com.amarsoft.app.base.util.BUSINESSOBJECT_CONSTANTS"%> <%@page import="com.amarsoft.app.base.businessobject.BusinessObjectManager"%> <%@page import="com.amarsoft.app.base.trans.TransactionHelper"%> <%@page import="com.amarsoft.app.base.businessobject.BusinessObject"%> <%@page import="com.amarsoft.are.util.json.*" %> <%@ page contentType="text/html; charset=GBK"%> <%@ include file="/Frame/resources/include/include_begin_info.jspf"%> <%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List01;Describe=定义页面属性;]~*/%> <% String PG_TITLE = "还款计划列表"; // 浏览器窗口标题 PG_TITLE String rpt = CurPage.getParameterNoCheck("rpt"); String rat = CurPage.getParameterNoCheck("rat"); String loan = CurPage.getParameterNoCheck("loan"); String ps = CurPage.getParameterNoCheck("ps"); BusinessObject simulationObject = BusinessObject.createBusinessObject("jbo.acct.ACCT_PUTOUT"); simulationObject.setAttributes(BusinessObject.createBusinessObject(JSONDecoder.decode(loan))); simulationObject.setAttributeValue("SerialNo", "simulation_loan"); simulationObject.setAttributeValue("LoanSerialNo", "simulation_loan"); simulationObject.setAttributeValue("LoanPeriod", 0); JSONObject rpts = JSONDecoder.decode(rpt); BusinessObject RPTObject=null; for(int i = 0;i < rpts.size(); i ++) { RPTObject = BusinessObject.createBusinessObject("jbo.acct.ACCT_RPT_SEGMENT"); RPTObject.setAttributes(BusinessObject.createBusinessObject((JSONObject)rpts.get(i).getValue())); RPTObject.setAttributeValue("STATUS", "1"); RPTObject.setAttributeValue("AMOUNTCODE", CashFlowConfig.getPaymentScheduleAttribute("1", "AmountCode")); RPTObject.generateKey(); simulationObject.appendBusinessObject(RPTObject.getBizClassName(), RPTObject); } if(!"RPT-14".equals(RPTObject.getString("TERMID"))){ JSONObject rats = JSONDecoder.decode(rat); for(int i = 0;i < rats.size(); i ++) { BusinessObject rateObject = BusinessObject.createBusinessObject("jbo.acct.ACCT_RATE_SEGMENT"); rateObject.setAttributes(BusinessObject.createBusinessObject((JSONObject)rats.get(i).getValue())); rateObject.setAttributeValue("STATUS", "1"); rateObject.generateKey(); simulationObject.appendBusinessObject(rateObject.getBizClassName(), rateObject); } } if(!StringX.isEmpty(ps)) { JSONObject pss = JSONDecoder.decode(ps); for(int i = 0;i < pss.size(); i ++) { BusinessObject paymentSchedule = BusinessObject.createBusinessObject("jbo.acct.ACCT_PAYMENT_SCHEDULE"); paymentSchedule.setAttributes(BusinessObject.createBusinessObject((JSONObject)pss.get(i).getValue())); paymentSchedule.setAttributeValue("STATUS", "1"); paymentSchedule.generateKey(); simulationObject.appendBusinessObject("FixPaymentSchedule", paymentSchedule); } } BusinessObjectManager bomanager = BusinessObjectManager.createBusinessObjectManager(); BusinessObject transaction = TransactionHelper.createTransaction("1001", simulationObject, null, CurUser.getUserID(), CurUser.getOrgID(), DateHelper.getBusinessDate(),bomanager); TransactionHelper.executeTransaction(transaction, bomanager); BusinessObject relativeObject = transaction.getBusinessObject(transaction.getString("RelativeObjectType")); List rates = relativeObject.getBusinessObjects("jbo.acct.ACCT_RATE_SEGMENT"); simulationObject.setAttributeValue("LoanSerialNo", relativeObject.getKeyString()); List list =relativeObject.getBusinessObjectsBySql(BUSINESSOBJECT_CONSTANTS.payment_schedule,"PSType='1'"); String rptTermID = RPTObject.getString("TERMID"); String rightType = "RPT-20".equals(rptTermID)?"":"ReadOnly";//灵活等额本息就要求可修改 double allPrincipalAmt = 0.0; double allInteAmt = 0.0; double allAmt = 0.0; String putoutDate = relativeObject.getString("PutOutDate"); String maturityDate = relativeObject.getString("MaturityDate"); int firstPeriodNo = list.get(0).getInt("PERIODNO"); int maxPeriodNo = list.size() + firstPeriodNo - 1; String defaultDueDay = ""; if("RPT-20".equals(rptTermID)){ List rptList = relativeObject.getBusinessObjects("jbo.acct.ACCT_RPT_SEGMENT"); if(rptList!=null &&rptList.size() > 0 ) { for(BusinessObject bo:rptList) { defaultDueDay = bo.getString("DefaultDueDay"); if(defaultDueDay.length() == 1) defaultDueDay = "0" + defaultDueDay; } } if(defaultDueDay.equals("")){ defaultDueDay = simulationObject.getString("PutOutDate").substring(8,10); } } %> <%/*~END~*/%>
<% if(list != null) { for(BusinessObject bo:list) { String payPrincipalColor = "black"; String payInteColor = "black"; String payDateColor = "black"; String fixInstallmentColor = "black"; String flag = ""; //1 为本金调整 2 为还款额调整 if( bo.getDouble("FixPayPrincipalAmt") != 0.0d) { payPrincipalColor = "red"; flag = "1"; } else if(bo.getDouble("FixPayInstalmentAmt") != 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"); allInteAmt += bo.getDouble("PAYINTERESTAMT"); allAmt += bo.getDouble("PayPrincipalAmt")+bo.getDouble("PAYINTERESTAMT"); %> " type=hidden value="<%=flag%>"/> <% } } %>
" onclick="reset()">
期次 还款日期 本金 利息 还款金额 剩余本金
<%=bo.getInt("PERIODNO")%>" type=hidden value="<%=bo.getString("SerialNo")%>"/> " style='text-align: right;WIDTH: 80px;COLOR: <%=payDateColor%>' class=fftdinput type=text readOnly value="<%=DataConvert.toString(bo.getString("PayDate"))%>" <%=rightType %> onclick=selectDate("<%=bo.getInt("PERIODNO")%>","PayDate") > " style='text-align: right;WIDTH: 80px;COLOR: <%=payPrincipalColor%>' class=fftdinput type=text value="<%=DataConvert.toMoney(bo.getDouble("PayPrincipalAmt"))%>" <%=rightType %> onchange=ChangeValue("<%=bo.getInt("PERIODNO")%>","PayPrincipalAmt")> " style='text-align: right;WIDTH: 80px;COLOR: <%=payInteColor%>; ' class=fftdinput type=text readOnly value="<%=DataConvert.toMoney(bo.getDouble("PAYINTERESTAMT"))%>" onchange=ChangeValue("<%=bo.getInt("PERIODNO")%>","PAYINTERESTAMT")> " style='text-align: right;WIDTH: 80px;COLOR: <%=fixInstallmentColor%>' class=fftdinput type=text value="<%=DataConvert.toMoney(bo.getDouble("PayPrincipalAmt")+bo.getDouble("PAYINTERESTAMT"))%>" <%=rightType %> onchange=ChangeValue("<%=bo.getInt("PERIODNO")%>","FixPayInstalmentAmt")> " style='text-align: right;WIDTH: 80px; COLOR: black;' class=fftdinput type=text readOnly value="<%=DataConvert.toMoney(bo.getDouble("PrincipalBalance"))%>" onchange=ChangeValue("<%=bo.getInt("PERIODNO")%>","PrincipalBalance")>
合计 <%=DataConvert.toMoney(allPrincipalAmt)%> <%=DataConvert.toMoney(allInteAmt)%> <%=DataConvert.toMoney(allAmt)%>
<%@ include file="/Frame/resources/include/include_end.jspf"%>