diff --git a/DSWeb/Areas/Account/Viewsjs/Chfee_settlement/ChRecvAppBLsettlementEdit.js b/DSWeb/Areas/Account/Viewsjs/Chfee_settlement/ChRecvAppBLsettlementEdit.js index 7db60bbb..43fa4ba1 100644 --- a/DSWeb/Areas/Account/Viewsjs/Chfee_settlement/ChRecvAppBLsettlementEdit.js +++ b/DSWeb/Areas/Account/Viewsjs/Chfee_settlement/ChRecvAppBLsettlementEdit.js @@ -157,6 +157,8 @@ Ext.extend(Shipping.MsChRecvAppSettlementEdit, Ext.Panel, { var curr = this.formADVANCE.getForm().findField('ADVANCE_CURRENCY'); curr.setValue(records[0].data.CURR); + + this.LoadDateCurr(true); } } } @@ -173,6 +175,7 @@ Ext.extend(Shipping.MsChRecvAppSettlementEdit, Ext.Panel, { this.comboxStlMode = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.SettlementType, store: this.StoreStlMode, + flex:0.5, forceSelection: true, name: 'SETTLETYPE', valueField: 'STLCODE', @@ -325,11 +328,13 @@ Ext.extend(Shipping.MsChRecvAppSettlementEdit, Ext.Panel, { }, { fieldLabel: 'HXBILLNO', name: 'HXBILLNO', flex: 0, hidden: true, margins: '0' - }, { - fieldLabel: '汇率', - hidden: true, - name: 'RATE' - }, + }, + + // { + // fieldLabel: '汇率', + // hidden: true, + // name: 'RATE' + //}, { fieldLabel: Zi.LAN.BillNo, @@ -343,7 +348,12 @@ Ext.extend(Shipping.MsChRecvAppSettlementEdit, Ext.Panel, { fieldLabel: Zi.LAN.SettlementTime, format: 'Y-m-d H:i:s', xtype: 'datefield', - name: 'SETTLETIME' + name: 'SETTLETIME', + listeners: { + change: function () { + _this.LoadDateCurr(true); + } + } }, { fieldLabel: Zi.LAN.SettlementUser, readOnly: true, @@ -377,7 +387,14 @@ Ext.extend(Shipping.MsChRecvAppSettlementEdit, Ext.Panel, { } return value; } - }, this.comboxStlMode, this.comboxBANK, { + }, this.comboxStlMode, { + fieldLabel: Zi.LAN.ExchangeRate, + flex: 0.5, + labelWidth: 50, + name: 'RATE' + }, this.comboxBANK + + , { fieldLabel: Zi.LAN.SettlementNo, flex: 1, name: 'SETTLENO' @@ -3182,6 +3199,8 @@ Ext.extend(Shipping.MsChRecvAppSettlementEdit, Ext.Panel, { _this.storeChfeeFile.load({ params: { start: 0, limit: 9999, BillNo: data.BILLNO } }); if (_this.opStatus == 'add') { _this.formEdit.getForm().findField('CURR').setValue(''); + _this.formEdit.getForm().findField('RATE').setValue(1); + } _this.storeBodyList.load({ params: { billno: billno }, callback: function (r, options, success) { @@ -3471,11 +3490,14 @@ Ext.extend(Shipping.MsChRecvAppSettlementEdit, Ext.Panel, { var CUSTOMERNAME = this.formEdit.getForm().findField('CUSTOMERNAME').getValue(); var CURR = this.formEdit.getForm().findField('CURR').getValue(); if (addcurr == '') { - if ((CURR == '') || (CURR == null)) + if ((CURR == '') || (CURR == null)) { this.formEdit.getForm().findField('CURR').setValue('RMB'); + this.formEdit.getForm().findField('RATE').setValue(1); + } } else { - if ((CURR == '') || (CURR == null)) + if ((CURR == '') || (CURR == null)) { this.formEdit.getForm().findField('CURR').setValue(addcurr); + } } //if ((CUSTOMERNAME == '') || (CUSTOMERNAME == null) || (CURR == '') || (CURR == null)) { var selectedRecords = this.gridAddFeeList.selModel.getSelection(); @@ -3485,12 +3507,61 @@ Ext.extend(Shipping.MsChRecvAppSettlementEdit, Ext.Panel, { var addcurr2 = rec.data.CURR; if ((CUSTOMERNAME == '') || (CUSTOMERNAME == null)) this.formEdit.getForm().findField('CUSTOMERNAME').setValue(cust); - if ((CURR == '') || (CURR == null)) { - if (addcurr2 != '') - this.formEdit.getForm().findField('CURR').setValue(addcurr2); - else { - if (rec.data.BALAMOUNT != 0) this.formEdit.getForm().findField('CURR').setValue('RMB'); - else if (rec.data.USDBALAMOUNT != 0) this.formEdit.getForm().findField('CURR').setValue('USD'); + //if ((CURR == '') || (CURR == null)) { + // if (addcurr2 != '') + // this.formEdit.getForm().findField('CURR').setValue(addcurr2); + // else { + // if (rec.data.BALAMOUNT != 0) this.formEdit.getForm().findField('CURR').setValue('RMB'); + // else if (rec.data.USDBALAMOUNT != 0) this.formEdit.getForm().findField('CURR').setValue('USD'); + // } + //} + if (CURR != curr) { + this.formEdit.getForm().findField('CURR').setValue(curr); + if (curr == 'RMB') { + this.formEdit.getForm().findField('RATE').setValue(1); + } else { + //var FFrecords = DsStoreQueryBy(this.StoreDateCurr, 'CURR', curr); + //if (FFrecords.getCount() > 0) { + // var ffdata = FFrecords.getAt(0).data; + // var DEFRATE = ffdata.DEFRATE; + // this.formEdit.getForm().findField('RATE').setValue(DEFRATE); + //} else { + // var DFrecords = DsStoreQueryBy(this.StoreCurr, 'CURR', curr); + // if (DFrecords.getCount() > 0) { + // var dfdata = DFrecords.getAt(0).data; + // var DEFRATE = dfdata.DEFRATE; + // this.formEdit.getForm().findField('RATE').setValue(DEFRATE); + // } else { + // this.formEdit.getForm().findField('RATE').setValue(1); + // } + //} + this.LoadDateCurr() + } + //this.LoadDateCurr(); + ////等待300毫秒后重新执行 + //_return = true; + //setTimeout(this.addDetail, 300); + + } else { + + var CUST = this.formEdit.getForm().findField('CUSTOMERNAME').getValue(); + var recs = DsStoreQueryBy(this.storeCustCode, 'CustName', CUST); + var CUSTBANK = this.formEdit.getForm().findField('CUSTBANK'); + var CUSTACCOUNT = this.formEdit.getForm().findField('CUSTACCOUNT'); + var CURR = this.formEdit.getForm().findField('CURR').getValue(); + if (recs.getCount() > 0) { + var data = recs.getAt(0).data; + if (CURR == 'RMB') { + CUSTBANK.setValue(data.RMBBank); + CUSTACCOUNT.setValue(data.RMBAccount); + } else if (CURR == 'USD') { + CUSTBANK.setValue(data.USDBank); + CUSTACCOUNT.setValue(data.USDAccount); + + } + } else { + CUSTBANK.setValue(''); + CUSTACCOUNT.setValue(''); } } this.formEdit.getForm().findField('SETTLETYPE').setValue(rec.data.SETTLETYPE); @@ -5389,7 +5460,125 @@ Ext.extend(Shipping.MsChRecvAppSettlementEdit, Ext.Panel, { } win.show(); } -//#endregion + //#endregion + + //#region 载入汇率信息 + , + async LoadDateCurr(needload = false) { + + _this = this; + + var DateStr = _this.formEdit.getForm().findField("SETTLETIME").getRawValue(); + + if (needload) { + this.StoreDateCurr.load({ + async: false, + params: { + DateStr: DateStr + }, + callback: function (r, options, success) { + if (success) { + if (_this.StoreDateCurr.getCount() > 0) { + + for (var i = 0; i < _this.StoreDateCurr.getCount(); i += 1) { + var member = _this.StoreDateCurr.getAt(i); + if (member.data.CURR == CURR) { + this.formEdit.getForm().findField('RATE').setValue(member.data.DEFRATE); + } + } + + } else { + var DFrecords = DsStoreQueryBy(this.StoreCurr, 'CURR', CURR); + if (DFrecords.getCount() > 0) { + var dfdata = DFrecords.getAt(0).data; + var DEFRATE = dfdata.DEFRATE; + this.formEdit.getForm().findField('RATE').setValue(DEFRATE); + } else { + this.formEdit.getForm().findField('RATE').setValue(1); + } + } + } + }, + scope: this + }); + } + + + var CURR = this.formEdit.getForm().findField('CURR').getValue(); + if (CURR == 'RMB') { + this.StoreDateCurr.load({ + params: { + DateStr: DateStr + }, + callback: function (r, options, success) { + if (success) { + //_this.LoadDateCurr(); + } + }, + scope: this + }); + this.formEdit.getForm().findField('RATE').setValue(1); + } else { + if (_this.StoreDateCurr.getCount() > 0) { + + for (var i = 0; i < _this.StoreDateCurr.getCount(); i += 1) { + var member = _this.StoreDateCurr.getAt(i); + if (member.data.CURR == CURR) { + this.formEdit.getForm().findField('RATE').setValue(member.data.DEFRATE); + } + } + return; + } else { + this.StoreDateCurr.load({ + async: false, + params: { + DateStr: DateStr + }, + callback: function (r, options, success) { + if (success) { + _this.LoadDateCurr(); + } + }, + scope: this + }); + } + + //await this.StoreDateCurr.load({ + // async:false, + // params: { + // DateStr: DateStr + // }, + // callback: function (r, options, success) { + // if (success) { + // if (_this.StoreDateCurr.getCount() > 0) { + + // for (var i = 0; i < _this.StoreDateCurr.getCount(); i += 1) { + // var member = _this.StoreDateCurr.getAt(i); + // if (member.data.CURR == CURR) { + // this.formEdit.getForm().findField('RATE').setValue(member.data.DEFRATE); + // } + // } + + // } else { + // var DFrecords = DsStoreQueryBy(this.StoreCurr, 'CURR', CURR); + // if (DFrecords.getCount() > 0) { + // var dfdata = DFrecords.getAt(0).data; + // var DEFRATE = dfdata.DEFRATE; + // this.formEdit.getForm().findField('RATE').setValue(DEFRATE); + // } else { + // this.formEdit.getForm().findField('RATE').setValue(1); + // } + // } + // } + // }, + // scope: this + //}); + + + + } + } + //#endregion }); diff --git a/DSWeb/Areas/Account/Viewsjs/Chfee_settlement/ChRecvsettlementBLEdit.js b/DSWeb/Areas/Account/Viewsjs/Chfee_settlement/ChRecvsettlementBLEdit.js index 5e53b80b..2cc268c2 100644 --- a/DSWeb/Areas/Account/Viewsjs/Chfee_settlement/ChRecvsettlementBLEdit.js +++ b/DSWeb/Areas/Account/Viewsjs/Chfee_settlement/ChRecvsettlementBLEdit.js @@ -4096,6 +4096,7 @@ Ext.extend(Shipping.MsChRecvSettlementBLEdit, Ext.Panel, { } var data = result.data; + _this.formEdit.getForm().findField('BILLSTATUS').setDisabled(false); _this.formEdit.getForm().findField('SETTLEUSERREF').setDisabled(false); _this.formEdit.getForm().reset(); @@ -4114,6 +4115,7 @@ Ext.extend(Shipping.MsChRecvSettlementBLEdit, Ext.Panel, { _this.formREMITTANCE.getForm().setValues(data); if (_this.opStatus == 'add') { _this.formEdit.getForm().findField('CURR').setValue(''); + _this.formEdit.getForm().findField('RATE').setValue(1); } _this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true); _this.formEdit.getForm().findField('SETTLEUSERREF').setDisabled(true);