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

152 lines
6.5 KiB
JavaScript

var aheadPaymentScheFlag = false;//控制是否需要贷款进行还款计划测算
/*~[Describe=保存前校验方法;InputParam=无;OutPutParam=无;]~*/
function beforeSave(){
var transDate = getItemValue(0,getRow(),"TransDate");
/*if(transDate < businessDate){
alert("生效日期不能早于当前日期");
return false;
}*/
var MaturityDate = getItemValue(0,getRow(),"MaturityDate");
var OLDMaturityDate = getItemValue(0,getRow(),"OLDMaturityDate");
//做展期使用此段代码
/*setItemValue(0,0,"TransDate",OLDMaturityDate);
if(MaturityDate<=OLDMaturityDate)
{
alert("新到期日必须大于原到期日!");
return false;
}*/
if(MaturityDate == OLDMaturityDate){
alert("到期日与调整前一致,请重新选择!");
return false;
}
if(MaturityDate<=transDate)
{
alert("到期日必须大于生效日期!");
return false;
}
//需手动指定贷款的利率时,使用这段代码
/*try{
myiframe0.RatePart.saveRecord();
}catch(e){
}*/
var changeFlag = getItemValue(0,getRow(),"RateChangeFlag");
if(changeFlag=="1"){
if(!RATFrame.getValues()) return false;
if(!FINFrame.iV_all("myiframe0")) return false;
RATFrame.saveRecord();
}
return true;
}
/*~[Describe=打开利率信息;InputParam=无;OutPutParam=无;]~*/
function openRAT(){
var changeFlag = getItemValue(0,getRow(),"RateChangeFlag");
if(changeFlag!="1"){
document.all("A_Group_NewRatePart").style.display="none";
document.all("A_Group_NewFINPart").style.display="none";
return;
}
if(changeFlag=="1"){
document.all("A_Group_NewRatePart").style.display="";
var obj = document.getElementById("RATFrame");
if(typeof(obj) == "undefined" || obj == null) return;
obj.CHANGED=false;
document.all("A_Group_NewFINPart").style.display="";
var obj = document.getElementById("FINFrame");
if(typeof(obj) == "undefined" || obj == null) return;
obj.CHANGED=false;
var currency = getItemValue(0,getRow(),"Currency");
var putoutDate = getItemValue(0,getRow(),"PutOutDate");
var maturityDate = getItemValue(0,getRow(),"MaturityDate");
var serialNo = getItemValue(0,getRow(),"SerialNo");
AsControl.OpenView("/Accounting/LoanDetail/LoanTerm/TermChangeRATInfo.jsp","ObjectType=jbo.acct.ACCT_LOAN_CHANGE&ObjectNo="+serialNo+"&Status=0,1&MaturityDate="+maturityDate,"RATFrame","");
AsControl.OpenView("/Accounting/LoanDetail/LoanTerm/TermChangeFINInfo.jsp","ObjectType=jbo.acct.ACCT_LOAN_CHANGE&ObjectNo="+serialNo+"&Status=0,1&MaturityDate="+maturityDate,"FINFrame","");
}
}
openRAT();
/*~[Describe=保存后续逻辑;InputParam=无;OutPutParam=无;]~*/
function afterSave(){
if(aheadPaymentScheFlag)
{
aheadPaymentScheFlag = false;
AsDialog.PopView("/Accounting/Transaction/ViewPrepaymentConsult.jsp","TransSerialNo="+transactionSerialNo,"",function(){
aheadPaymentScheFlag = false;
});
}
/* calcLoanRateTermID();*/
/*calcLoanRateTermID();//需手动指定变更贷款的利率时,使用这段代码
calcFINTermID();*/
// openFeeList();
}
/*~[Describe=还款计划测算;InputParam=无;OutPutParam=无;]~*/
function viewConsult(){
aheadPaymentScheFlag = true;
saveRecord("afterSave();");
}
/*~[Describe=费用信息;InputParam=无;OutPutParam=无;]~*/
//function openFeeList(){
// var obj = frames['myiframe0'].document.getElementById('ContentFrame_NEWFEEPart');
// if(typeof(obj) == "undefined" || obj == null) return;
// OpenComp("AcctFeeList","/Accounting/LoanDetail/LoanTerm/AcctFeeList.jsp","Status=0@1&ToInheritObj=y&ObjectNo="+documentSerialNo+"&ObjectType="+documentType+"","NEWFEEPart","");
//}
//当手动指定变更利率时,使用此代码
/*~[Describe=利率信息;InputParam=无;OutPutParam=无;]~*/
/*function calcLoanRateTermID(){
var RateFrame = document.getElementById('RateFrame');
if(typeof(RateFrame) == "undefined" || RateFrame == null) return;
var objectType = getItemValue(0,getRow(),"RelativeObjectType");
if(typeof(objectType) == "undefined" || objectType.length == 0) return;
var objectNo = getItemValue(0,getRow(),"RelativeObjectNo");
if(typeof(objectNo) == "undefined" || objectNo.length == 0) return;
AsControl.OpenView("/Accounting/LoanDetail/LoanTerm/RATTermView.jsp","Status=1&ObjectType="+objectType+"&ObjectNo="+objectNo,"RateFrame","");
}*/
/*~[Describe=罚息信息;InputParam=无;OutPutParam=无;]~*/
/*function calcFINTermID(){
var obj = frames['myiframe0'].document.getElementById('ContentFrame_FINPart');
if(typeof(obj) == "undefined" || obj == null) return;
OpenComp("FinTermList","/Accounting/LoanDetail/LoanTerm/FinTermList.jsp","Status=0@1&ToInheritObj=y&ObjectNo="+documentSerialNo+"&ObjectType="+documentType+"","FINPart","");
}*/
/*~[Describe=初始化;InputParam=无;OutPutParam=无;]~*/
function initRow(){
if (getRowCount(0)==0) {
as_add("myiframe0");//新增记录
}
setItemValue(0,getRow(),"INPUTUSERID",curUserID);
setItemValue(0,getRow(),"INPUTUSERNAME",curUserName);
setItemValue(0,getRow(),"INPUTORGID",curOrgID);
setItemValue(0,getRow(),"INPUTORGNAME",curOrgName);
setItemValue(0,getRow(),"INPUTDATE",businessDate);
setItemValue(0,getRow(),"UPDATEUSERID",curUserID);
setItemValue(0,getRow(),"UPDATEUSERNAME",curUserName);
setItemValue(0,getRow(),"UPDATEORGID",curOrgID);
setItemValue(0,getRow(),"UPDATEORGNAME",curOrgName);
setItemValue(0,getRow(),"UPDATEDATE",businessDate);
//手动指定变更利率时使用此代码
calcLoanRateTermID();
// calcFINTermID();
}
function changeTerm(){
setItemValue(0,getRow(),"RateChangeFlag","0");
document.all("A_Group_NewRatePart").style.display="none";
document.all("A_Group_NewFINPart").style.display="none";
}
/*数据库操作:
1手动指定期限变更利率
update DATAOBJECT_LIBRARY set colhtmlstyle='onChange=parent.calcLoanRateTermID()' WHERE DONO='Transaction_2017' and colindex='0100';
update code_library set itemattribute='com.amarsoft.app.accounting.trans.script.loan.change.LoanTermExtend' where codeno='T_Transaction_Def' and itemno='2017'
update dataobject_group set styleid='width:100%;height:110%;' where dono='Transaction_2017' and dockid in( 'RatePart' ,'FINPart')
update dataobject_library set colvisible=1,colrequired=1 where dono='Transaction_2017' and colindex='0140';
update dataobject_library set colvisible=0 where dono='Transaction_2017' and colindex='0130';
2、非手动指定期限变更利率
update dataobject_group set styleid='display:none;' where dono='Transaction_2017' and dockid in( 'RatePart' ,'FINPart');
update code_library set itemattribute='com.amarsoft.app.accounting.trans.script.loan.change.LoanTermChange' where codeno='T_Transaction_Def' and itemno='2017';
update dataobject_library set colvisible=0,colrequired=0 where dono='Transaction_2017' and colindex='0140';
update DATAOBJECT_LIBRARY set colhtmlstyle=null WHERE DONO='Transaction_2017' and colindex='0100';
update dataobject_library set colvisible=1 where dono='Transaction_2017' and colindex='0130';*/