default.js 4.77 KB
Newer Older
fukai committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
import commonFunctions from '~/mixin/commonFunctions.js';
import commonDepend from "~/mixin/commonDepend";
import BigNumber from "bignumber.js";
import Utils from "~/utils";
import Pts from '~/components/business/commonModel/Pts';
export default {
	mixins: [commonFunctions, commonDepend],
	methods: {

		ingdscDefault() {
			// ingdsc默认值为Y
			if (this.model.bedsnd.modifySet == null || !this.model.bedsnd.modifySet.includes("ingdsc")) {
				this.model.bedsnd.ingdsc = "Y";
			}
		},

		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";
			}
		},

		defaultFolwupopt() {
			// folwupopt is not modified
			if (!this.model.betp.modifySet || this.model.betp.modifySet == null || (this.model.betp.modifySet != null && !this.model.betp.modifySet.includes('folwupopt'))) {
				if (this.model.bedgrp.blk.docdis!=null && this.model.bedgrp.blk.docdis!='') {
					this.model.betp.folwupopt = "S";//# Send Advice of Discrepancy
				} else {
					this.model.betp.folwupopt = "W"; // # Wait for Response
				}
			}

		},

		// model.bedgrp.rec.payrol change, re-calculate OTH
		payrolChange(){
			//  re-calculate OTH
			this.model.bedgrp.oth.pts.rol = "OTH";
			switch (this.model.bedgrp.rec.payrol) {
				case "ISS":
					Utils.copyValueFromVoData(this.model.bedgrp.oth.pts, this.model.ledgrp.iss.pts);
					break;
				case "ADV":
					Utils.copyValueFromVoData(this.model.bedgrp.oth.pts, this.model.ledgrp.adv.pts);
					break;
				case "AVB":
					Utils.copyValueFromVoData(this.model.bedgrp.oth.pts, this.model.ledgrp.avb.pts);
					break;
				case "CON":
					Utils.copyValueFromVoData(this.model.bedgrp.oth.pts, this.model.ledgrp.con.pts);
					break;
				case "OTH":
					this.model.bedgrp.oth.pts = new Pts().data;
					break;
				default:
					this.model.bedgrp.oth.pts = new Pts().data;
					break;
			}

			if(this.model.bedgrp.oth.pts.ptainr!=''){
				this.model.bedgrp.oth.pts.rol = "OTH";
			}

		},

		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 === '' || 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 != null)) {
				// 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";
			}
		},

	}
}