import commonFunctions from '~/mixin/commonFunctions.js'; import commonDepend from "~/mixin/commonDepend"; import BigNumber from "bignumber.js"; import moment from "moment"; export default { mixins: [commonFunctions, commonDepend], methods: { addamtflg() { if ((this.model.bedgrp.cbs.max2.amt==null||(this.model.bedgrp.cbs.max2.amt != "" && new BigNumber(this.model.bedgrp.cbs.max2.amt).comparedTo(0) == 0)) && (this.model.bedgrp.cbs.opn2.amt==null||(this.model.bedgrp.cbs.opn2.amt != "" && new BigNumber(this.model.bedgrp.cbs.opn2.amt).comparedTo(0) == 0))) { this.model.betp.addamtflg = ""; } else { this.model.betp.addamtflg = "X"; } }, defaultsetmodRedamt() { if (this.model.bedgrp.rec.frepayflg != '') { this.model.setmod.redamt = this.model.setmod.docamt; } else { this.model.setmod.redamt = this.model.bedgrp.cbs.red.amt; } }, defaultAmt2okFlg(){ if(this.model.liaall.tensetmatdat == null || this.model.liaall.tensetmatdat ===''){ this.model.amt2okflg =""; }else{ this.model.amt2okflg ="X"; } }, // 设置UTLAMT, UTLAMT2的值 // reference to : default DefUtlamts ( UTLAMT, UTLAMT2 ) defUtlamts(){ if(this.model.bedgrp.cbs.opn2.amt != "" && new BigNumber(this.model.bedgrp.cbs.opn2.amt).comparedTo(new BigNumber(0))==0){ if(this.model.amt2okflg===''){ this.model.aamset.utlamt2 = 0; } if(!this.model.aamset.modifySet||!(this.model.aamset.modifySet!=null&&this.model.aamset.modifySet.includes("utlamt"))){ this.model.aamset.utlamt = new BigNumber(this.model.setmod.docamt).minus(new BigNumber(this.model.aamset.utlamt2)); } } else if((this.model.bedgrp.cbs.opn2.amt != "" && new BigNumber(this.model.bedgrp.cbs.opn2.amt).comparedTo(new BigNumber(0)) != 0)){ if(this.model.aamset.modifySet && this.model.aamset.modifySet!=null&&this.model.aamset.modifySet.includes("utlamt2")){ if(this.model.setmod.docamt!=null&&this.model.setmod.docamt!=''&&new BigNumber(this.model.setmod.docamt).comparedTo(0)!=0){ this.model.aamset.utlamt = new BigNumber(this.model.setmod.docamt).minus(new BigNumber(this.model.aamset.utlamt2)); } }else{ if(this.model.aamset.modifySet!=null&&this.model.aamset.modifySet.includes("utlamt")) { this.model.aamset.utlamt2 = new BigNumber(this.model.setmod.docamt).minus(new BigNumber(this.model.aamset.utlamt)); }else{ let totamt = new BigNumber(this.model.bedgrp.cbs.opn1.amt).plus(new BigNumber(this.model.bedgrp.cbs.opn2.amt)); this.model.aamset.utlamt2 = new BigNumber(this.model.setmod.docamt).multipliedBy(new BigNumber(this.model.bedgrp.cbs.opn2.amt).dividedBy(totamt)).toFixed(2); this.model.aamset.utlamt = new BigNumber(this.model.setmod.docamt).minus(new BigNumber(this.model.aamset.utlamt2)); } } } }, defaultDocsta() { // # If `Documents habe been refused and returned already` no other DOCSTA is possible // # Only in BETDCR DOCSTA R could be changed, in other BE-transactions ADVDOCFLG is not used if (this.model.bedgrp.rec.docsta === 'R') { if ((!this.model.bedgrp.rec.modifySet || this.model.bedgrp.rec.modifySet === null || this.model.bedgrp.rec.modifySet != null && !this.model.bedgrp.rec.modifySet.includes('advdocflg'))) { // if not "BETDCR" exit, no nothing return; } } // # Advice of Payment? if (this.model.bedgrp.rec.advdat != null && this.model.bedgrp.rec.advdat != '' && this.model.bedgrp.rec.advtyp === '754') { if (this.model.bedgrp.rec.rcvdat === null || this.model.bedgrp.rec.rcvdat === '') { //Advice of Payment received, wait for documents this.model.bedgrp.rec.docsta = 'A'; } else { //Advice of Payment received, documents received this.model.bedgrp.rec.docsta = 'B'; } } // # Advice of Discrepancy? if (this.model.bedgrp.rec.disdat != null && this.model.bedgrp.rec.disdat != '' && this.model.bedgrp.rec.advtyp === '750') { if (this.model.bedgrp.rec.rcvdat === null || this.model.bedgrp.rec.rcvdat === '') { //Advice of Discrepancy received, wait for documents this.model.bedgrp.rec.docsta = 'C'; } else { //Advice of Discrepancy received, documents received this.model.bedgrp.rec.docsta = 'D'; } } //# Documents are received, no discrepancies if (this.model.bedgrp.rec.rcvdat != null && this.model.bedgrp.rec.rcvdat != '' && (this.model.bedgrp.blk.docdis.trim() === '' || this.model.bedgrp.blk.docdis === null)) { // Clean documents received this.model.bedgrp.rec.docsta = "E"; } // # Documents are received with discrepancies if (this.model.bedgrp.rec.rcvdat != null && this.model.bedgrp.rec.rcvdat != '' && (this.model.bedgrp.blk.docdis&&this.model.bedgrp.blk.docdis.trim() != '')) { // Discrepant documents received this.model.bedgrp.rec.docsta = "F"; } //# Documents taken up? if (this.model.bedgrp.rec.acpnowflg != null && this.model.bedgrp.rec.acpnowflg != '') { // Documents taken up this.model.bedgrp.rec.docsta = "I"; } //# Free of Payment? if (this.model.bedgrp.rec.frepayflg != null && this.model.bedgrp.rec.frepayflg != '') { // Documents settled free of payment this.model.bedgrp.rec.docsta = "J"; } if (this.model.bedgrp.rec.advdocflg != null && this.model.bedgrp.rec.advdocflg != '') { // Documents have been refused and returned this.model.bedgrp.rec.docsta = "R"; } }, disableClsflg(){ let tmpclsflg = true; if (this.model.setmod.dspflg === 'CG') { this.model.liaall.liaallg.forEach((vo) => { if (vo.bussec === "BE" && Number(vo.amt) !== -Number(vo.oldamt)) { tmpclsflg = false; } }); if (tmpclsflg) { let modified = false; if (this.model && this.model.modifySet && this.model.modifySet.includes('clsflg')) { modified = true; } if(!modified){ this.model.clsflg = "C"; } this.model.disabledClsflg = "N"; } else { this.model.clsflg = "O"; this.model.disabledClsflg = "Y"; } }else{ this.model.clsflg = "O"; this.model.disabledClsflg = "Y"; } }, clsflgChange(){ if(this.model.clsflg==='O'){ this.model.bedgrp.rec.clsdat = null; }else if(this.model.clsflg ==='C'){ // if not IsEmpty( CONINF\CONEXEDAT ) then // $clsdat = CONINF\CONEXEDAT this.model.bedgrp.rec.clsdat = moment(new Date()).format("YYYY-MM-DD"); } }, }, }