2018-06-03 22:26:41 +08:00

362 lines
15 KiB
Plaintext

<%@page import="com.amarsoft.app.base.util.DateHelper"%>
<%@page import="com.tenwa.util.SerialNumberUtil"%>
<%@page import="com.amarsoft.awe.control.model.Parameter"%>
<%@page import="com.tenwa.reckon.product.ProductCondition"%>
<%@page import="com.amarsoft.app.util.ProductParamUtil"%>
<%@ page import="com.amarsoft.app.lc.workflow.action.GetFlowAction" %>
<%@ page import="java.util.Vector" %>
<%@ page import="com.amarsoft.awe.dw.ui.validator.ValidateRule" %>
<%@ page import="com.tenwa.reckon.product.ASObjectWindowCalc" %>
<%@ page contentType="text/html; charset=GBK"%>
<%@ include file="/Frame/resources/include/include_begin_info.jspf"%>
<%
String sTempletNo = "LoanSimulationBasicInfo";//--Ä£°åºÅ--
ASObjectModel doTemp = new ASObjectModel(sTempletNo);
doTemp.setColumnAttribute("*", "colreadonly", "1");
doTemp.setColumnAttribute("START_DATE", "colreadonly", "0");
doTemp.setColumnAttribute("FIRST_PLAN_DATE", "colreadonly", "0");
doTemp.setColumnAttribute("SECOND_PLAN_DATE", "colreadonly", "0");
doTemp.setColumnAttribute("LAST_PLAN_DATE", "colreadonly", "0");
doTemp.setColumnAttribute("FIRST_INTEREST_DATE", "colreadonly", "0");
doTemp.setColumnAttribute("LAST_INTEREST_DATA", "colreadonly", "0");
String flowunid = CurPage.getParameter("FlowUnid");
String plannumber=CurPage.getParameter("plannumber");
BizObject flow=GetFlowAction.getFlowBussinessObject(flowunid);
String productId=flow.getAttribute("productId").getString();
String calType ="onHire_process";
String planCName="PAYMENT_NUMBER";
BizObject condtion=JBOFactory.createBizObjectQuery("jbo.app.tenwa.calc.LC_CALC_CONDITION_TEMP","flowunid=:flowunid and PAYMENT_NUMBER is not null").setParameter("flowunid", flowunid).getSingleResult(false);
if(condtion!=null){
plannumber=condtion.getAttribute(planCName).getString();
}
String RightType= CurPage.getParameter("RightType");
Vector<ValidateRule> vali=new Vector<ValidateRule>();
//·ÑÓùæÔò
ProductCondition pc=new ProductCondition();
String calcRules=pc.getProductRules(doTemp, productId,vali);
doTemp.setHtmlEvent("LEASE_AMT_DATE", "onchange", "changeLeaseAmtDate");//Ͷ·ÅÈÕ
doTemp.setHtmlEvent("START_DATE", "onchange", "changeStartDate");//Æð×âÈÕ
doTemp.setHtmlEvent("FIRST_PLAN_DATE", "onchange", "changeFistPlanDate");//µÚÒ»ÆÚ¼Æ»®ÈÕÆÚ
CurPage.getCurComp().setAttribute("RightType", null);
ASObjectWindowCalc dwTemp = new ASObjectWindowCalc(CurPage, doTemp,request);
Parameter p=new Parameter("plannumber",plannumber);
Vector<Parameter> v=CurPage.parameterList;
v.add(p);
String ishistory=CurPage.getParameter("IsHistory");
String nodeNo=CurPage.getParameter("NodeNo");
if(null!=ishistory&&ishistory.equals("true")){
doTemp.setDataQueryClass("com.tenwa.lease.flow.flowarchive.calcarchive.CalcCondtionInfoArachiveShow");//Èç¹ûÊÇÀúÊ·ÔòÐÂÏÔʾÀúÊ·Êý¾Ý
}
dwTemp.Style = "2";//freeform
if((null!=RightType&&RightType.equals("ReadOnly"))){
dwTemp.ReadOnly = "-2";//Ö»¶Áģʽ
isShowButton=false;
}else{
isShowButton=true;
}
dwTemp.setVali(vali);
dwTemp.setAttr("inputWidth","120");
dwTemp.setAttr("spanWidth","107");
dwTemp.setAttr("showRatio", true);
dwTemp.genHTMLObjectWindow(flowunid);
CurPage.getCurComp().setAttribute("RightType", RightType);
String compClientID = request.getParameter("CompClientID");
dwTemp.replaceColumn("condition_plan", "<iframe type='iframe' id='frame_list' name=\"frame_list\" width=\"100%\" height=\"600px\" frameborder=\"0\" src=\""+sWebRootPath+"/Accounting/LoanSimulation/condition_plan.jsp?CompClientID="+compClientID+"&flowunid="+flowunid+"&plannumber="+plannumber+"&planCName="+planCName+"&IsHistory="+ishistory+"&NodeNo="+nodeNo+"&RightType=ReadOnly&calType="+calType+"\"></iframe>", CurPage.getObjectWindowOutput());
dwTemp.replaceColumn("even_subsection", "<iframe type='iframe' id='frame_even_break' name=\"frame_even_subsection\" width=\"100%\" height=\"300px\" frameborder=\"0\" src=\""+sWebRootPath+"/Accounting/LoanSimulation/subsection/LCCalcSubsectionList.jsp?CompClientID="+compClientID+"&flowunid="+flowunid+"&plannumber="+plannumber+"&planCName="+planCName+"&IsHistory="+ishistory+"&NodeNo="+nodeNo+"&RightType=ReadOnly&calType="+calType+"\"></iframe>", CurPage.getObjectWindowOutput());
dwTemp.replaceColumn("knowing_config", "<iframe type='iframe' id='frame_list_knowing' name=\"frame_list_knowing\" width=\"100%\" height=\"200px\" frameborder=\"0\" src=\""+sWebRootPath+"/Accounting/LoanSimulation/KnowConfigList.jsp?CompClientID="+compClientID+"&flowunid="+flowunid+"&plannumber="+plannumber+"&planCName="+planCName+"&IsHistory="+ishistory+"&NodeNo="+nodeNo+"&RightType=ReadOnly&calType="+calType+"\"></iframe>", CurPage.getObjectWindowOutput());
String businessDate = DateHelper.getBusinessDate();
String sButtons[][] = {
//{"true","All","Button","ÖØÖÃ","ÖØÖÃ","reloadSelf()","","","",""},
{"true","All","Button","×â½ð²âËã","×â½ð²âËã","saveRecord()","","","","btn_icon_edit"}
};
%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%>
<script type="text/javascript">
var calcRules=eval("(<%=calcRules%>)");
$(function(){
console.info(calcRules);
document.getElementById('div_my0').innerHTML = '<div style="width:1160px;overflow: scroll;">'+document.getElementById('div_my0').innerHTML+'</div>';
changeSettleMethod3();
});
function saveRecord(sPostEvents){
var startDate=getItemValue(0,getRow(),"START_DATE");
var FIRST_PLAN_DATE=getItemValue(0,getRow(),"FIRST_PLAN_DATE");
var SECOND_PLAN_DATE=getItemValue(0,getRow(),"SECOND_PLAN_DATE");
if(SECOND_PLAN_DATE<FIRST_PLAN_DATE){
alert("µÚ¶þÆÚ×â½ð¼Æ»®ÈÕÆÚ²»ÄÜСÓÚµÚÒ»ÆÚ×â½ð¼Æ»®ÈÕÆÚ£¡");
return ;
}
if(FIRST_PLAN_DATE<startDate){
alert("µÚÒ»ÆÚ×â½ð¼Æ»®ÈÕÆÚ²»ÄÜСÓÚÆð×âÈÕ£¡");
return ;
}
as_save("myiframe0","run()");
}
function run()
{
var result = AsControl.RunJavaMethod("com.tenwa.reckon.executor.CreateTransactionExecutor","runOnhire","flowunid=<%=flowunid%>,plannumber=<%=plannumber%>,calType=<%=calType%>,productId=<%=productId%>");
document.all("frame_list").src = document.all("frame_list").src;
if(result.info){
for(var p in result.info){
setItemValue(0,getRow(),p.toUpperCase(),result.info[p]);
}
}
}
//¸ù¾ÝͶ·ÅÈÕËã Æð×âÈÕ µÚÒ»ÆÚ¼Æ»®ÈÕ µÚ¶þÆÚ¼Æ»®ÈÕ
function changeDate(leaseAmtDate){
var incomenumberyear = Number(getItemValue(0,getRow(),"INCOME_INTERVAL_MONTH"));//»ñÈ¡»¹¿î¼ä¸ô ÔÂ
var periodType = getItemValue(0,getRow(),"PERIOD_TYPE");//»ñÈ¡ ÆÚ³õ/ÆÚÄ©
var startDate=getItemValue(0,getRow(),"START_DATE");//Æð×âÈÕ
if(startDate.length>0){
leaseAmtDate=startDate;
}else{
setItemValue(0,0,"START_DATE",leaseAmtDate);//ĬÈÏÆð×âÈÕΪͶ·ÅÈÕ
}
if("period_type_1" == periodType){//ÆÚ³õ µÚÒ»ÆÚ»¹¿îÈÕΪͶ·ÅÈÕ
setItemValue(0,0,"FIRST_PLAN_DATE",leaseAmtDate);
setItemValue(0,0,"SECOND_PLAN_DATE",dateAdd('m',incomenumberyear,new Date(leaseAmtDate)).format('yyyy\/MM\/dd'));
}else{
changedate = dateAdd('m',incomenumberyear,new Date(leaseAmtDate));
setItemValue(0,0,"FIRST_PLAN_DATE",changedate.format('yyyy\/MM\/dd'));
setItemValue(0,0,"SECOND_PLAN_DATE",dateAdd('m',incomenumberyear,new Date(changedate)).format('yyyy\/MM\/dd'));
}
}
//strInterval Ôö¼ÓÈÕÆÚÀàÐÍ ,num ÊýÁ¿ ,date ÆðʼÈÕÆÚ
function dateAdd(strInterval, num, date){
date = arguments[2] || new Date();
switch (strInterval) {
case 's' :return new Date(date.getTime() + (1000 * num));
case 'n' :return new Date(date.getTime() + (60000 * num));
case 'h' :return new Date(date.getTime() + (3600000 * num));
case 'd' :return new Date(date.getTime() + (86400000 * num));
case 'w' :return new Date(date.getTime() + ((86400000 * 7) * num));
case 'm' :return new Date(date.getFullYear(), (date.getMonth()) + num, date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds());
case 'y' :return new Date((date.getFullYear() + num), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds());
}
}
var CalcControl={};
CalcControl.InitStartDate=function(){
var leaseAmtDate=getItemValue(0,getRow(),"LEASE_AMT_DATE");//Ͷ·ÅÈÕ
var startDate=getItemValue(0,getRow(),"START_DATE");//Æð×âÈÕ
//ĬÈÏÆð×âÈÕΪͶ·ÅÈÕ
if(startDate.length==""){
setItemValue(0,0,"START_DATE",leaseAmtDate);
}
CalcControl.InitFistPlanDate();
}
CalcControl.InitFistPlanDate=function(){
var incomenumberyear = Number(getItemValue(0,getRow(),"INCOME_INTERVAL_MONTH"));//»ñÈ¡»¹¿î¼ä¸ô ÔÂ
var periodType = getItemValue(0,getRow(),"PERIOD_TYPE");//»ñÈ¡ ÆÚ³õ/ÆÚÄ©
var startDate=getItemValue(0,getRow(),"START_DATE");//Æð×âÈÕ
if(!startDate)return;
if("period_type_1" == periodType){//ÆÚ³õ µÚÒ»ÆÚ»¹¿îÈÕΪͶ·ÅÈÕ
setItemValue(0,0,"FIRST_PLAN_DATE",startDate);
}else{
var firstPlanDate = dateAdd('m',incomenumberyear,new Date(startDate)).format('yyyy\/MM\/dd');
setItemValue(0,0,"FIRST_PLAN_DATE",firstPlanDate);
}
CalcControl.InitSecondPlanDate();
}
CalcControl.InitSecondPlanDate=function(){
var incomenumberyear = Number(getItemValue(0,getRow(),"INCOME_INTERVAL_MONTH"));//»ñÈ¡»¹¿î¼ä¸ô ÔÂ
var firstPlanDate=getItemValue(0,0,"FIRST_PLAN_DATE");
if(!firstPlanDate)return;
setItemValue(0,0,"SECOND_PLAN_DATE",dateAdd('m',incomenumberyear,new Date(firstPlanDate)).format('yyyy\/MM\/dd'));
}
//¸Ä±äͶ·ÅÈÕ
function changeLeaseAmtDate(){
CalcControl.InitStartDate();
}
//¸Ä±äÆð×âÈÕ
function changeStartDate(){
CalcControl.InitFistPlanDate();
}
//¸Ä±äµÚÒ»ÆÚ×â½ð¼Æ»®ÈÕÆÚ
function changeFistPlanDate(){
CalcControl.InitSecondPlanDate();
}
//¸Ä±äͶ·ÅÈÕ
function changeLeaseAmtDate(){
CalcControl.InitStartDate();
}
//¸Ä±äÆð×âÈÕ
function changeStartDate(){
CalcControl.InitFistPlanDate();
}
//¸Ä±äµÚÒ»ÆÚ×â½ð¼Æ»®ÈÕÆÚ
function changeFistPlanDate(){
CalcControl.InitSecondPlanDate();
}
//¸Ä±äͶ·ÅÈÕ
function changeLeaseAmtDate(){
CalcControl.InitStartDate();
}
//¸Ä±äÆð×âÈÕ
function changeStartDate(){
CalcControl.InitFistPlanDate();
}
//¸Ä±äµÚÒ»ÆÚ×â½ð¼Æ»®ÈÕÆÚ
function changeFistPlanDate(){
CalcControl.InitSecondPlanDate();
}
//¸Ä±äͶ·ÅÈÕ
function changeLeaseAmtDate(){
CalcControl.InitStartDate();
}
//¸Ä±äÆð×âÈÕ
function changeStartDate(){
CalcControl.InitFistPlanDate();
}
//¸Ä±äµÚÒ»ÆÚ×â½ð¼Æ»®ÈÕÆÚ
function changeFistPlanDate(){
CalcControl.InitSecondPlanDate();
}
function changeSettleMethod3(){
var method="<%=dwTemp.getData().get("SETTLE_METHOD")%>";
//°´¼ÆË㷽ʽ ÏÔʾ°´Å¥ ºÍ·Ö¶Î²âËã¼ÈëÒ³Ãæ
document.all("A_Group_even_subsection").style.display="none";
if(method=='even_subsection'){
document.all("A_Group_even_subsection").style.display="block";
}
<%-- var param="CompClientID=<%=compClientID%>&flowunid=<%=flowunid%>&plannumber=<%=plannumber%>&planCName=<%=planCName%>&IsHistory=<%=ishistory%>&NodeNo=<%=nodeNo%>&calType=<%=calType%>&method="+method;
AsControl.OpenView("/Accounting/LoanSimulation/condition_plan.jsp",param, "frame_list"); --%>
var rentOrRate ="<%=dwTemp.getData().get("RENT_OR_RATE")%>";//×â½ðÍÆË㷽ʽ
document.all("A_Group_calc_config").style.display="none";
if(rentOrRate == 'knowing_rent'){//ÒÑÖª×â½ð¹æÔò Ö»Ä̶ܹ¨ÀûÂÊ
document.all("A_Group_calc_config").style.display="block";
var param="CompClientID=<%=compClientID%>&flowunid=<%=flowunid%>&plannumber=<%=plannumber%>&planCName=<%=planCName%>&IsHistory=<%=ishistory%>&NodeNo=<%=nodeNo%>&calType=<%=calType%>&RightType=ReadOnly";
AsControl.OpenView("/Accounting/LoanSimulation/KnowConfigList.jsp",param,"frame_list_knowing");
}else if(rentOrRate== 'knowing_corpus'){//ÒÑÖª±¾½ð¹æÔò
document.all("A_Group_calc_config").style.display="block";
var param="CompClientID=<%=compClientID%>&flowunid=<%=flowunid%>&plannumber=<%=plannumber%>&planCName=<%=planCName%>&IsHistory=<%=ishistory%>&NodeNo=<%=nodeNo%>&calType=<%=calType%>&RightType=ReadOnly";
AsControl.OpenView("/Accounting/LoanSimulation/KnowConfigList.jsp",param,"frame_list_knowing");
}else if(rentOrRate=='rent_period'){//ÒÑÖª×â½ð±í
document.all("A_Group_calc_config").style.display="block";
var param="CompClientID=<%=compClientID%>&flowunid=<%=flowunid%>&plannumber=<%=plannumber%>&planCName=<%=planCName%>&IsHistory=<%=ishistory%>&NodeNo=<%=nodeNo%>&calType=<%=calType%>&RightType=ReadOnly";
AsControl.OpenView("/Accounting/LoanSimulation/reriod/LCCalcReriodList.jsp",param,"frame_list_knowing");
}else if(rentOrRate=='corpus_period'){//ÒÑÖª±¾½ð±í
document.all("A_Group_calc_config").style.display="block";
var param="CompClientID=<%=compClientID%>&flowunid=<%=flowunid%>&plannumber=<%=plannumber%>&planCName=<%=planCName%>&IsHistory=<%=ishistory%>&NodeNo=<%=nodeNo%>&calType=<%=calType%>&RightType=ReadOnly";
AsControl.OpenView("/Accounting/LoanSimulation/reriod/LCCalcReriodList.jsp",param,"frame_list_knowing");
}
//ÈÕÆÚ
//¼Æ»®ÈÕÆÚ
var plan;
if(method=="even_subsection"||method=="irregular_rent"||method==""){
plan="";
}else{
plan=calcRules['method'][method]["date_proc"].split(",");
}
var planflag={};
for(var i=0;i<plan.length;i++){
if(plan[i]==1){
showItem(0,"FIRST_PLAN_DATE");
//setItemRequired(0,"FIRST_PLAN_DATE",true);
planflag["FIRST_PLAN_DATE"]=0;
}
if(plan[i]==4){
showItem(0,"SECOND_PLAN_DATE");
//setItemRequired(0,"SECOND_PLAN_DATE",true);
planflag["SECOND_PLAN_DATE"]=0;
}
if(plan[i]==2){
showItem(0,"LAST_PLAN_DATE")
//setItemRequired(0,"LAST_PLAN_DATE",true);
planflag["LAST_PLAN_DATE"]=0;
}
if(plan[i]==3){
showItem(0,"PLAN_DATE_HOILDAY")
//setItemRequired(0,"PLAN_DATE_HOILDAY",true);
planflag["PLAN_DATE_HOILDAY"]=0;
}
}
var plana=["PLAN_DATE_HOILDAY","SECOND_PLAN_DATE","LAST_PLAN_DATE","PLAN_DATE_HOILDAY"];
for(var i=0;i<plana.length;i++){
if(planflag[plana[i]]!=0){
hideItem(0,plana[i]);
//setItemRequired(0,plana[i],false);
}
}
//¼ÆÏ¢ÈÕÆÚ
var interest;
if(method=="even_subsection"||method=="irregular_rent"||method==""){
interest="";
}else{
interest=calcRules['method'][method]["interest_date_proc"].split(",");
}
var interestflag={};
for(var i=0;i<interest.length;i++){
if(interest[i]==1){
showItem(0,"FIRST_INTEREST_DATE");
//setItemRequired(0,"FIRST_INTEREST_DATE",true);
interestflag["FIRST_INTEREST_DATE"]=0;
}
if(interest[i]==2){
showItem(0,"LAST_INTEREST_DATA")
//setItemRequired(0,"LAST_INTEREST_DATA",true);
interestflag["LAST_INTEREST_DATA"]=0;
}
if(interest[i]==3){
showItem(0,"INTEREST_DATE_HOLIDAY")
//setItemRequired(0,"INTEREST_DATE_HOLIDAY",true);
interestflag["INTEREST_DATE_HOLIDAY"]=0;
}
}
var interesta=["FIRST_INTEREST_DATE","LAST_INTEREST_DATA","INTEREST_DATE_HOLIDAY"];
for(var i=0;i<interesta.length;i++){
if(interestflag[interesta[i]]!=0){
hideItem(0,interesta[i]);
//setItemRequired(0,interesta[i],false);
}
}
var isShowRate;
if(method=="even_subsection"||method=="irregular_rent"||method==""){
isShowRate="";
}else{
isShowRate=calcRules['method'][method]["isShowRate"];
}
if(isShowRate=="Y"){
showItem(0,"RATE");
showItem(0,"ADDITIONAL_RATE");
//setItemRequired(0,"RATE",true);
//setItemRequired(0,"ADDITIONAL_RATE",true);
}else{
hideItem(0,"RATE");
hideItem(0,"ADDITIONAL_RATE");
//setItemRequired(0,"RATE",false);
//setItemRequired(0,"ADDITIONAL_RATE",false);
}
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>