Ext.namespace('Shipping'); Shipping.OrderFeeGrid = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.OrderFeeGrid.superclass.constructor.call(this); }; Ext.extend(Shipping.OrderFeeGrid, Ext.Panel, { ParentWin: null, //弹出式 ParentPanel: null, //Tab页编辑模式 OpStatus: 'add', StoreBill: null, StoreCustType: null, EditRecord: null, RefBillNo: '*', DataLoading: true, stroplb: '', strBSNO: '', feeType: 0, OprationSwap: function () { var ret = new Array(); ret[0] = this.stroplb; ret[1] = this.feeType; ret[2] = this.storeDrChFee; ret[3] = this.storeCrChFee; return ret; }, // region: 'center', initUIComponents: function () { this.feeDrSerialNo = 0; this.feeDrBodyDel = []; this.feeCrSerialNo = 0; this.feeCrBodyDel = []; this.StoreDrOpRange = Ext.create('DsExt.ux.RefTableStore', { model: 'MsFeeOP', proxy: { url: '/MvcShipping/MsChFee/GetFeeOpRang' } }); this.StoreCrOpRange = Ext.create('DsExt.ux.RefTableStore', { model: 'MsFeeOP', proxy: { url: '/MvcShipping/MsChFee/GetFeeOpRang' } }); this.StoreCustType = Ext.create('Ext.data.Store', { fields: ['SCUSTTYPE', 'CUSTTYPE', 'CUSTNAME'] }); this.comboxCustType = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreCustType, forceSelection: true, name: 'CustomerType', valueField: 'CUSTTYPE', displayField: 'SCUSTTYPE' }); this.StoreFeeFrt = Ext.create('Ext.data.Store', { fields: ['Frt'] }); this.StoreFeeFrt.add({ "Frt": "PP" }); this.StoreFeeFrt.add({ "Frt": "CC" }); this.comboxFeeFrt = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreFeeFrt, forceSelection: true, name: 'FeeFrt', valueField: 'Frt', displayField: 'Frt' }); this.storeFeeNameRef = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.FeeTypeRefModel', proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefList' } }); this.comboxFeeNameRef = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeFeeNameRef, forceSelection: true, name: 'FeeName', valueField: 'Name', displayField: 'CodeAndName' }); this.storeFeeNameRefCr = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.FeeTypeRefModel', proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefList' } }); this.comboxFeeNameRefCr = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeFeeNameRefCr, forceSelection: true, name: 'FeeName', valueField: 'Name', displayField: 'CodeAndName' }); this.storeCustomerNameRef = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeCustomerNameRef.load({ params: { condition: ""} }); this.comboxCustomerNameRef = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeCustomerNameRef, forceSelection: true, name: 'CustomerName', valueField: 'CustName', displayField: 'CodeAndName' }); this.storeCustomerNameRefCr = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeCustomerNameRefCr.load({ params: { condition: ""} }); this.comboxCustomerNameRefCr = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeCustomerNameRefCr, forceSelection: true, name: 'CustomerName', valueField: 'CustName', displayField: 'CodeAndName' }); this.StoreUnit = Ext.create('DsExt.ux.RefTableStore', { model: 'MsFeeUnit', proxy: { url: '/MvcShipping/MsChFee/GetCtnUnitList' } }); this.comboxUnit = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreUnit, name: 'Unit', valueField: 'UNIT', displayField: 'SUNIT' }); this.StoreDateCurr = Ext.create('DsExt.ux.RefTableStore', { model: 'MsFeeCurr', proxy: { url: '/MvcShipping/MsChFee/GetFeeDateCurrList' } }); this.StoreCurr = Ext.create('DsExt.ux.RefTableStore', { model: 'MsFeeCurr', proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' } }); this.StoreCurr.load({ params: { condition: ""} }); this.comboxCurr = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreCurr, forceSelection: true, name: 'Currency', valueField: 'CURR', displayField: 'CURR' }); this.StoreCurrCr = Ext.create('DsExt.ux.RefTableStore', { model: 'MsFeeCurr', proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' } }); this.StoreCurrCr.load({ params: { condition: ""} }); this.comboxCurrCr = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreCurrCr, forceSelection: true, name: 'Currency', valueField: 'CURR', displayField: 'CURR' }); //明细表-数据集 this.storeDrChFee = Ext.create('Ext.data.Store', { model: 'MsChFee', remoteSort: false, proxy: { type: 'ajax', url: '/MvcShipping/MsChFee/GetOrderDataList', reader: { id: 'GId', root: 'data', totalProperty: 'totalCount' } } }); this.storeCrChFee = Ext.create('Ext.data.Store', { model: 'MsChFee', remoteSort: false, proxy: { type: 'ajax', url: '/MvcShipping/MsChFee/GetOrderDataList', reader: { id: 'GId', root: 'data', totalProperty: 'totalCount' } } }); _thisfee = this; this.cellEditingDrChFee = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.initgirdDrcolums = [{ sortable: true, dataIndex: 'GId', header: '惟一编号', hidden: true, width: 160 }, { sortable: true, dataIndex: 'BsNo', header: '业务编号', hidden: true, width: 200 } , { sortable: true, dataIndex: 'FeeName', header: '应收费用名称', editor: this.comboxFeeNameRef, width: 100 }, { sortable: true, dataIndex: 'CustomerType', header: '客户类别', editor: this.comboxCustType, // hidden: true, width: 80 }, { sortable: true, dataIndex: 'CustomerName', header: '结算对象', editor: this.comboxCustomerNameRef, width: 120 }, { sortable: true, dataIndex: 'Unit', header: '单位标准', editor: this.comboxUnit, width: 60 }, { sortable: true, dataIndex: 'UnitPrice', header: '不含税单价', editor: { xtype: 'numberfield', keyNavEnabled: false, selectOnFocus: true, hideTrigger: true, mouseWheelEnabled: false, enableKeyEvents: true, listeners: { keydown: function (textfield, e) { if (e.getKey() == 40) { _thisorderfee.onNextKeyClick(1, 8) } } } }, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, align: 'right', width: 80 }, { sortable: true, dataIndex: 'TaxRate', header: '税率', editor: { xtype: 'numberfield', keyNavEnabled: false, selectOnFocus: true, hideTrigger: true, mouseWheelEnabled: false, enableKeyEvents: true, listeners: { keydown: function (textfield, e) { if (e.getKey() == 40) { _thisorderfee.onNextKeyClick(1, 9) } } } }, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, align: 'right', width: 60 }, { sortable: true, dataIndex: 'TaxUnitPrice', header: '单价', editor: { xtype: 'numberfield', keyNavEnabled: false, selectOnFocus: true, hideTrigger: true, mouseWheelEnabled: false, enableKeyEvents: true, listeners: { keydown: function (textfield, e) { if (e.getKey() == 40) { _thisorderfee.onNextKeyClick(1, 10) } } } }, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, align: 'right', width: 80 }, { sortable: true, dataIndex: 'Quantity', header: '数量', editor: { xtype: 'numberfield', keyNavEnabled: false, allowDecimals: true, decimalPrecision: 3, selectOnFocus: true, hideTrigger: true, mouseWheelEnabled: false, enableKeyEvents: true, listeners: { keydown: function (textfield, e) { if (e.getKey() == 40) { _thisorderfee.onNextKeyClick(1, 11) } } } }, width: 60 }, { sortable: true, dataIndex: 'NoTaxAmount', header: '不含税金额', editor: { xtype: 'numberfield', keyNavEnabled: false, selectOnFocus: true, hideTrigger: true, mouseWheelEnabled: false, enableKeyEvents: true, listeners: { keydown: function (textfield, e) { if (e.getKey() == 40) { _thisorderfee.onNextKeyClick(1, 12) } } } }, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, align: 'right', width: 80 }, { sortable: true, dataIndex: 'Amount', header: '金额', editor: { xtype: 'numberfield', keyNavEnabled: false, selectOnFocus: true, hideTrigger: true, mouseWheelEnabled: false, enableKeyEvents: true, listeners: { keydown: function (textfield, e) { if (e.getKey() == 40) { _thisorderfee.onNextKeyClick(1, 13) } } } }, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, align: 'right', width: 80 }, { sortable: true, dataIndex: 'Currency', header: '币别', editor: this.comboxCurr, width: 40 }, { sortable: true, dataIndex: 'ExChangerate', header: '汇率', editor: { xtype: 'numberfield', keyNavEnabled: false, selectOnFocus: true, hideTrigger: true, mouseWheelEnabled: false, enableKeyEvents: true, listeners: { keydown: function (textfield, e) { if (e.getKey() == 40) { _thisorderfee.onNextKeyClick(1, 15) } } } }, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 4, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, align: 'right', width: 60 }, { sortable: true, dataIndex: 'AccTaxRate', header: '销项税率', editor: { xtype: 'numberfield', keyNavEnabled: false, selectOnFocus: true, hideTrigger: true, mouseWheelEnabled: false, enableKeyEvents: true, listeners: { keydown: function (textfield, e) { if (e.getKey() == 40) { _thisorderfee.onNextKeyClick(1, 16) } } } }, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, align: 'right', width: 80 }, { sortable: true, dataIndex: 'Remark', header: '备注', editor: { xtype: 'textfield', selectOnFocus: true, enableKeyEvents: true, listeners: { keydown: function (textfield, e) { if (e.getKey() == 40) { _thisorderfee.onNextKeyClick(1, 17) } } } }, width: 150 }, { sortable: true, dataIndex: 'IsAdvancedpay', header: '是否垫付', editor: { xtype: 'checkboxfield' // selectOnFocus: true }, width: 60 }, { sortable: true, dataIndex: 'FeeFrt', header: 'FRT', editor: this.comboxFeeFrt, width: 40 }, { sortable: true, dataIndex: 'Commissionrate', header: '佣金比率', editor: { xtype: 'numberfield', keyNavEnabled: false, selectOnFocus: true, mouseWheelEnabled: false, enableKeyEvents: true, listeners: { keydown: function (textfield, e) { if (e.getKey() == 40) { _thisorderfee.onNextKeyClick(1, 19) } } } }, width: 60 }, { sortable: true, dataIndex: 'OpName', header: '录入人', width: 60 }, { sortable: true, dataIndex: 'EnterDate', header: '录入日期', renderer: Ext.util.Format.dateRenderer('Y-m-d'), width: 80 } ]; this.girdDrcolums = this.initgirdDrcolums; this.feeDrGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); _thisorderfee = this; var storeFee11 = this.storeDrChFee; this.gridDrChFee = new Ext.grid.GridPanel({ store: this.storeDrChFee, enableHdMenu: false, region: 'center', id: 'gridDrChFee' + Math.random(), loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.cellEditingDrChFee], selModel: this.feeDrGridCheckBoxModel, selType: 'cellmodel', viewConfig: { autoFill: true, //getRowClass: function (record, rowIndex, rowParams, store) { // var feeStatus = record.get('FeeStatus'); // return Shipping.FeeGetRowClass(feeStatus); //} }, tbar: [{ xtype: 'label', text: '应收费用', //'应收费用', style: 'font-size:18px', labelColor: '#000', //style:'background-color: #4b9bf5', x: '5%', y: '5%' }, { text: '', tooltip: '添加应收费用', // id:"btnadddrfee", iconCls: "btnadd", handler: function (button, event) { this.onAddDetailClick(button, event, 1); }, scope: this }, '-', { text: '', tooltip: '保存应收费用', // id: "btnpostdrfee", iconCls: "btnsave", handler: function (button, event) { this.onPostDetailClick(button, event, 1); this.onPostDetailClick(button, event, 2); }, scope: this }, '-', { text: '', tooltip: '删除应收费用', // id: "btndeldrfee", iconCls: "btndelete", handler: function (button, event) { this.onDelDetailClick(button, event, 1); }, scope: this }, '-', { text: '', tooltip: '取消修改', iconCls: "btncancel", handler: function (button, event) { this.onCancelDetailClick(button, event, 1); }, scope: this }, '-', { text: '', tooltip: '刷新应收', iconCls: "btnrefresh", handler: function (button, event) { storeFee11.load({ params: { billno: this.strBSNO, type: 1, optype: this.stroplb} }); }, scope: this }, '-', { text: '历史引入', tooltip: '', iconCls: "btnadd", handler: function (button, event) { var allow = this.getAllowOperationDetail(); if (allow == false) { return; } this.onPostDetailClick(button, event, 1); this.feeType = 1; DsOpenEditWin("/MvcShipping/MsSeaeOrder/HistryFeeIndex", "历史引入费用"); }, scope: this }, '-', { text: "保存列表样式", //"保存列表样式", menu: [ { text: "保存", //"保存", handler: function (button, event) { _thisfee.girdDrcolums = DsTruck.SaveGridPanel(GID, 'ORDERFEEDRGRID', _thisfee.gridDrChFee.columns, _thisfee.girdDrcolums, 0, true); } }, { text: "初始化", //"初始化", handler: function (menu, event) { _thisfee.gridDrChFee.reconfigure(_thisfee.storeDrChFee, _thisfee.initgirdDrcolums); _thisfee.girdDrcolums = DsTruck.SaveGridPanel(GID, 'ORDERFEEDRGRID', _thisfee.gridDrChFee.columns, _thisfee.initgirdDrcolums, 0, true); } }], scope: this }], columns: this.girdDrcolums }); this.girdDrcolums = DsTruck.GetGridPanel(GID, 'ORDERFEEDRGRID', this.girdDrcolums, 0); //使用者id,表名,中间column数组,跳过一开始的几列 _thisfee.gridDrChFee.reconfigure(_thisfee.storeDrChFee, this.girdDrcolums); this.gridDrChFee.on('edit', function (editor, e, eOpts) { this.gridListChFeeAfterEdit(editor, e, eOpts); }, this); this.cellEditingDrChFee.on('beforeedit', function (editor, e) { return this.cellEditingChFeeBeforeEdit(editor, e); }, this); this.cellEditingCrChFee = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.initgirdCrcolums = [{ sortable: true, dataIndex: 'GId', header: '惟一编号', hidden: true, width: 160 }, { sortable: true, dataIndex: 'BsNo', header: '业务编号', hidden: true, width: 200 } , { sortable: true, dataIndex: 'FeeName', header: '应付费用名称', editor: this.comboxFeeNameRefCr, width: 100 }, { sortable: true, dataIndex: 'CustomerType', header: '客户类别', editor: this.comboxCustType, // hidden: true, width: 80 }, { sortable: true, dataIndex: 'CustomerName', header: '结算对象', editor: this.comboxCustomerNameRefCr, width: 120 }, { sortable: true, dataIndex: 'Unit', header: '单位标准', editor: this.comboxUnit, width: 60 }, { sortable: true, dataIndex: 'UnitPrice', header: '不含税单价', editor: { xtype: 'numberfield', keyNavEnabled: false, selectOnFocus: true, hideTrigger: true, mouseWheelEnabled: false, enableKeyEvents: true, listeners: { keydown: function (textField, e) { if (e.getKey() == 40) { _thisorderfee.onNextKeyClick(2, 8) } } } }, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 3, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, align: 'right', width: 80 }, { sortable: true, dataIndex: 'TaxRate', header: '税率', editor: { xtype: 'numberfield', keyNavEnabled: false, selectOnFocus: true, hideTrigger: true, mouseWheelEnabled: false, enableKeyEvents: true, listeners: { keydown: function (textField, e) { if (e.getKey() == 40) { _thisorderfee.onNextKeyClick(2, 9) } } } }, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, align: 'right', width: 60 }, { sortable: true, dataIndex: 'TaxUnitPrice', header: '单价', editor: { xtype: 'numberfield', keyNavEnabled: false, selectOnFocus: true, hideTrigger: true, mouseWheelEnabled: false, enableKeyEvents: true, listeners: { keydown: function (textField, e) { if (e.getKey() == 40) { _thisorderfee.onNextKeyClick(2, 10) } } } }, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 3, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, align: 'right', width: 80 }, { sortable: true, dataIndex: 'Quantity', header: '数量', editor: { xtype: 'numberfield', keyNavEnabled: false, selectOnFocus: true, hideTrigger: true, mouseWheelEnabled: false, enableKeyEvents: true, listeners: { keydown: function (textField, e) { if (e.getKey() == 40) { _thisorderfee.onNextKeyClick(2, 11) } } } }, width: 60 }, { sortable: true, dataIndex: 'NoTaxAmount', header: '不含税金额', editor: { xtype: 'numberfield', keyNavEnabled: false, selectOnFocus: true, enableKeyEvents: true, hideTrigger: true, mouseWheelEnabled: false, listeners: { keydown: function (textField, e) { if (e.getKey() == 40) { _thisorderfee.onNextKeyClick(2, 12) } } } }, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, align: 'right', width: 80 }, { sortable: true, dataIndex: 'Amount', header: '金额', editor: { xtype: 'numberfield', keyNavEnabled: false, selectOnFocus: true, hideTrigger: true, mouseWheelEnabled: false, enableKeyEvents: true, listeners: { keydown: function (textField, e) { if (e.getKey() == 40) { _thisorderfee.onNextKeyClick(2, 13) } } } }, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, align: 'right', width: 80 }, { sortable: true, dataIndex: 'Currency', header: '币别', editor: this.comboxCurrCr, width: 40 }, { sortable: true, dataIndex: 'ExChangerate', header: '汇率', editor: { xtype: 'numberfield', keyNavEnabled: false, selectOnFocus: true, hideTrigger: true, mouseWheelEnabled: false, enableKeyEvents: true, listeners: { keydown: function (textField, e) { if (e.getKey() == 40) { _thisorderfee.onNextKeyClick(2, 15) } } } }, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, align: 'right', width: 60 }, { sortable: true, dataIndex: 'AccTaxRate', header: '进项税率', editor: { xtype: 'numberfield', keyNavEnabled: false, selectOnFocus: true, hideTrigger: true, mouseWheelEnabled: false, enableKeyEvents: true, listeners: { keydown: function (textField, e) { if (e.getKey() == 40) { _thisorderfee.onNextKeyClick(2, 16) } } } }, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, align: 'right', width: 80 }, { sortable: true, dataIndex: 'Remark', header: '备注', editor: { xtype: 'textfield', selectOnFocus: true, enableKeyEvents: true, listeners: { keydown: function (textField, e) { if (e.getKey() == 40) { _thisorderfee.onNextKeyClick(2, 17) } } } }, width: 150 }, { sortable: true, dataIndex: 'IsAdvancedpay', header: '是否垫付', editor: { xtype: 'checkboxfield' // selectOnFocus: true }, width: 60 }, { sortable: true, dataIndex: 'FeeFrt', header: 'FRT', editor: this.comboxFeeFrt, width: 40 }, { sortable: true, dataIndex: 'Commissionrate', header: '佣金比率', editor: { xtype: 'numberfield', keyNavEnabled: false, selectOnFocus: true, enableKeyEvents: true, hideTrigger: true, mouseWheelEnabled: false, listeners: { keydown: function (textField, e) { if (e.getKey() == 40) { _thisorderfee.onNextKeyClick(2, 20) } } } }, width: 60 }, { sortable: true, dataIndex: 'OpName', header: '录入人', width: 60 }, { sortable: true, dataIndex: 'EnterDate', header: '录入日期', renderer: Ext.util.Format.dateRenderer('Y-m-d'), width: 80 } ]; this.girdCrcolums = this.initgirdCrcolums; this.feeCrGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); _thisorderfee = this; this.gridCrChFee = new Ext.grid.GridPanel({ store: this.storeCrChFee, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.cellEditingCrChFee], selModel: this.feeCrGridCheckBoxModel, selType: 'cellmodel', viewConfig: { autoFill: true, //getRowClass: function (record, rowIndex, rowParams, store) { // var feeStatus = record.get('FeeStatus'); // return Shipping.FeeGetRowClass(feeStatus); // } }, tbar: [{ xtype: 'label', text: '应付费用', //'应收费用', style: 'font-size:18px', labelColor: '#000', //style:'background-color: #4b9bf5', x: '5%', y: '5%' }, { text: '', tooltip: '添加应付费用', iconCls: "btnadd", // id: 'btnaddcrfee', handler: function (button, event) { this.onAddDetailClick(button, event, 2); }, scope: this }, '-', { text: '', tooltip: '保存应付费用', iconCls: "btnsave", // id: 'btnpostcrfee', handler: function (button, event) { this.onPostDetailClick(button, event, 2); this.onPostDetailClick(button, event, 1); }, scope: this }, '-', { text: '', tooltip: '删除应付费用', iconCls: "btndelete", // id: 'btndelcrfee', handler: function (button, event) { this.onDelDetailClick(button, event, 2); }, scope: this }, '-', { text: '', tooltip: '取消修改', iconCls: "btncancel", handler: function (button, event) { this.onCancelDetailClick(button, event, 2); }, scope: this }, '-', { text: '', tooltip: '刷新应付', iconCls: "btnrefresh", handler: function (button, event) { this.storeCrChFee.load({ params: { billno: this.strBSNO, type: 2, optype: this.stroplb} }); }, scope: this }, '-', { text: '历史引入', tooltip: '', // id: 'btnaddhscrfee', iconCls: "btnadd", handler: function (button, event) { var allow = this.getAllowOperationDetail(); if (allow == false) { return; } this.onPostDetailClick(button, event, 1); this.feeType = 2; var store = null; store = this.storeCrChFee; DsOpenEditWin("/MvcShipping/MsSeaeOrder/HistryFeeIndex", "历史引入费用"); }, scope: this }, '-', { text: "保存列表样式", //"保存列表样式", menu: [ { text: "保存", //"保存", handler: function (button, event) { _thisfee.girdCrcolums = DsTruck.SaveGridPanel(GID, 'ORDERFEECRGRID', _thisfee.gridCrChFee.columns, _thisfee.girdCrcolums, 0, true); } }, { text: "初始化", //"初始化", handler: function (menu, event) { _thisfee.gridCrChFee.reconfigure(_thisfee.storeCrChFee, _thisfee.initgirdCrcolums); _thisfee.girdCrcolums = DsTruck.SaveGridPanel(GID, 'ORDERFEECRGRID', _thisfee.gridCrChFee.columns, _thisfee.initgirdCrcolums, 0, true); } }], scope: this }], columns: this.girdCrcolums }); this.gridCrChFee.on('edit', function (editor, e, eOpts) { this.gridListChFeeAfterEdit(editor, e, eOpts); }, this); this.cellEditingCrChFee.on('beforeedit', function (editor, e) { return this.cellEditingChFeeBeforeEdit(editor, e); }, this); this.girdCrcolums = DsTruck.GetGridPanel(GID, 'FEECRGRID', this.girdCrcolums, 0); //使用者id,表名,中间column数组,跳过一开始的几列 _thisfee.gridCrChFee.reconfigure(_thisfee.storeCrChFee, this.girdCrcolums); //#endregion this.storeBodySum = Ext.create('Ext.data.Store', { model: 'MsOPGain', remoteSort: false, proxy: { type: 'ajax', url: '/MvcShipping/MsChFee/GetOrderGainList', reader: { root: 'data', totalProperty: 'totalCount' } } }); this.gridSum = new Ext.grid.GridPanel({ store: this.storeBodySum, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, columns: [{ header: "总 计", sortable: false, align: 'center', dataIndex: 'CURR', width: 160 }, { text: '应 收', columns: [{ header: '不含税', dataIndex: 'NORATEDR', renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, align: 'right', width: 160 }, { header: '含税', dataIndex: 'DR', align: 'right', renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, width: 160 }] }, { text: '应 付', columns: [{ header: '不含税', dataIndex: 'NORATECR', align: 'right', renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, width: 160 }, { header: '含税', dataIndex: 'CR', align: 'right', renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, width: 160 }] }, { text: '利 润', columns: [{ header: '不含税', dataIndex: 'NORATEPR', renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, align: 'right', width: 160 }, { header: '含税', dataIndex: 'PR', align: 'right', renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, width: 160 }] } ] }); this.formtotal = Ext.widget('form', { region: 'south', height: 150, collapsed: true, collapsible: true, split: true, enableTabScroll: true, items: [this.gridSum] }); this.panelDrChFee = new Ext.Panel({ // title: '应收费用', layout: "border", anchor: '100% 50%', frame: true, split: true, items: [this.gridDrChFee] }); this.panelCrChFee = new Ext.Panel({ // title: '应付费用', layout: "border", anchor: '100% 50%', // region: 'center', frame: true, items: [this.gridCrChFee] }); this.panelFee1 = new Ext.Panel({ // layout: "border", layout: "anchor", // region: 'north', // height: 560, region: 'center', items: [ this.panelDrChFee, this.panelCrChFee ] }); //#region 布局 Ext.apply(this, { items: [this.panelFee1, this.formtotal] }); //#endregion this.opStatus = 'add'; _thisorderfee = this; this.InitData(); }, //end initUIComponents //#region 加载数据 InitData: function () { var condition = ''; this.LoadData(this.opStatus, condition, this.RefBillNo); }, //end InitData LoadData: function (opstatus, condition, refbillno) { this.feeCrSerialNo = 0; this.feeCrBodyDel = []; this.feeCrSerialNo = 0; this.feeCrBodyDel = []; this.opStatus = opstatus; }, //#endregion //#region 明细操作 onNextKeyClick: function (type, col) { if (type == 1) { var rows = this.gridDrChFee.getSelectionModel().getSelection(); var row = rows[rows.length - 1]; var s = this.gridDrChFee.getStore(); var number = s.indexOf(row) + 1; if (number == this.gridDrChFee.getStore().getCount()) { this.onAddDetailClick(s, event, type); } else { this.cellEditingDrChFee.startEditByPosition({ row: number, column: col }); } } else { var rows = this.gridCrChFee.getSelectionModel().getSelection(); var row = rows[rows.length - 1]; var s = this.gridCrChFee.getStore(); var number = s.indexOf(row) + 1; if (number == this.gridCrChFee.getStore().getCount()) { this.onAddDetailClick(s, event, type); } else { this.cellEditingCrChFee.startEditByPosition({ row: number, column: col }); } } }, onAddDetailClick: function (button, event, type) { var allow = this.getAllowOperationDetail(); if (allow == false) { return; } var store = null; if (type == 1) { store = this.storeDrChFee; } else if (type == 2) { store = this.storeCrChFee; } else { alert('函数(onAddDetailClick)的参数type类型设置的不对'); return; } var custtype = ''; if (type == 1) custtype = '委托单位' else custtype = '订舱代理' var records = DsStoreQueryBy(this.StoreCustType, 'CUSTTYPE', custtype); if (records.getCount() > 0) { var data = records.getAt(0).data; var custname = this.EditRecord.get(data.CUSTNAME); } else { var custname = ''; } var newSerialno = this.GetHandleSerialNo(store, type); var newsort = store.getCount() + 1; var myDate = new Date(); var record = null; record = Ext.create('MsChFee', { GId: NewGuid(), BsNo: '*', FeeStatus: 1, FeeStatus_Ref: '录入状态', FeeType: type, FeeName: '', FeeDescription: '', CustomerType: custtype, CustomerName: custname, Unit: '', UnitPrice: 0, TaxUnitPrice: 0, Quantity: 1, TaxRate: 0, NoTaxAmount: 0, Amount: 0, AccTaxRate: 0, Currency: 'RMB', ExChangerate: 1, Reason: '', Remark: '', Commissionrate: 0, Settlement: 0, Invoice: 0, OrderAmount: 0, OrderInvoice: 0, SubmitDate: null, Auditoperator: '', AuditDate: null, EnteroPerator: GetCookie_UserId(), OpName: SHOWNAME, EnterDate: myDate, DebitNo: '', IsDebit: "0", IsOpen: "0", IsAdvancedpay: "false", Sort: newSerialno, IsInvoice: "0", FeeFrt: '', IsCrmOrderFee: "0", AuditStatus: 0, InvoiceNum: '', ChequeNum: '', WmsOutBsNo: '' }); store.add(record); var editColumnIndex = 0; var cellediting = null; if (type == 1) { cellediting = this.cellEditingDrChFee; editColumnIndex = 3; } else if (type == 2) { cellediting = this.cellEditingCrChFee; editColumnIndex = 3; } var n = store.getCount(); cellediting.startEditByPosition({ row: n - 1, column: editColumnIndex }); }, onAddSelectDetailClick: function (button, event, type) { var allow = this.getAllowOperationDetail(); if (allow == false) { return; } var allow = this.getAllowOperationDetail(); if (allow == false) { return; } var selectedRecords = []; var storeadd = null; if (type == 2) { selectedRecords = this.feeDrGridCheckBoxModel.selected.items; storeadd = this.storeCrChFee; } else if (type == 1) { selectedRecords = this.feeCrGridCheckBoxModel.selected.items; storeadd = this.storeDrChFee; } else { alert('函数(onAddDetailClick)的参数type类型设置的不对'); return; } if (selectedRecords.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择要删除的费用!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var myDate = new Date(); for (var i = 0; i < selectedRecords.length; i++) { var memberyf = selectedRecords[i]; var custtype = ''; if (type == 1) custtype = '委托单位' else custtype = '订舱代理' var records = DsStoreQueryBy(this.StoreCustType, 'CUSTTYPE', custtype); if (records.getCount() > 0) { var data = records.getAt(0).data; var custname = this.EditRecord.get(data.CUSTNAME); } else { var custname = ''; } var newSerialno = this.GetHandleSerialNo(storeadd, type); var newsort = storeadd.getCount() + 1; var record = null; record = Ext.create('MsChFee', { GId: NewGuid(), BsNo: '*', FeeStatus: 1, FeeStatus_Ref: '录入状态', FeeType: type, FeeName: memberyf.data.FeeName, FeeDescription: memberyf.data.FeeDescription, CustomerType: custtype, CustomerName: custname, Unit: memberyf.data.Unit, UnitPrice: memberyf.data.UnitPrice, TaxUnitPrice: memberyf.data.TaxUnitPrice, Quantity: memberyf.data.Quantity, TaxRate: memberyf.data.TaxRate, NoTaxAmount: memberyf.data.NoTaxAmount, Amount: memberyf.data.Amount, AccTaxRate: memberyf.data.AccTaxRate, Currency: memberyf.data.Currency, ExChangerate: memberyf.data.ExChangerate, Reason: '', Remark: '', Commissionrate: memberyf.data.Commissionrate, Settlement: 0, Invoice: 0, OrderAmount: 0, OrderInvoice: 0, SubmitDate: null, Auditoperator: '', AuditDate: null, EnteroPerator: GetCookie_UserId(), OpName: SHOWNAME, EnterDate: myDate, DebitNo: '', IsDebit: "0", IsOpen: "0", IsAdvancedpay: "false", Sort: newSerialno, IsInvoice: "0", FeeFrt: memberyf.data.FeeFrt, IsCrmOrderFee: "0", AuditStatus: 0, InvoiceNum: '', ChequeNum: '', WmsOutBsNo: '' }); storeadd.add(record); }; var editColumnIndex = 0; var cellediting = null; if (type == 2) { cellediting = this.cellEditingDrChFee; editColumnIndex = 4; } else if (type == 1) { cellediting = this.cellEditingCrChFee; editColumnIndex = 4; } var n = storeadd.getCount(); cellediting.startEditByPosition({ row: n - 1, column: editColumnIndex }); this.calcDetailTotal(); }, onAddAllDetailClick: function (button, event, type) { var allow = this.getAllowOperationDetail(); if (allow == false) { return; } var store = null; var storeadd = null; if (type == 2) { store = this.storeDrChFee; storeadd = this.storeCrChFee; } else if (type == 1) { store = this.storeCrChFee; storeadd = this.storeDrChFee; } else { alert('函数(onAddDetailClick)的参数type类型设置的不对'); return; } var myDate = new Date(); for (i = 0; i < store.getCount(); i += 1) { var memberyf = store.getAt(i); var custtype = ''; if (type == 1) custtype = '委托单位' else custtype = '订舱代理' var records = DsStoreQueryBy(this.StoreCustType, 'CUSTTYPE', custtype); if (records.getCount() > 0) { var data = records.getAt(0).data; var custname = this.EditRecord.get(data.CUSTNAME); } else { var custname = ''; } var newSerialno = this.GetHandleSerialNo(storeadd, type); var newsort = storeadd.getCount() + 1; var record = null; record = Ext.create('MsChFee', { GId: NewGuid(), BsNo: '*', FeeStatus: 1, FeeStatus_Ref: '录入状态', FeeType: type, FeeName: memberyf.data.FeeName, FeeDescription: memberyf.data.FeeDescription, CustomerType: custtype, CustomerName: custname, Unit: memberyf.data.Unit, UnitPrice: memberyf.data.UnitPrice, TaxUnitPrice: memberyf.data.TaxUnitPrice, Quantity: memberyf.data.Quantity, TaxRate: memberyf.data.TaxRate, NoTaxAmount: memberyf.data.NoTaxAmount, Amount: memberyf.data.Amount, AccTaxRate: memberyf.data.AccTaxRate, Currency: memberyf.data.Currency, ExChangerate: memberyf.data.ExChangerate, Reason: '', Remark: '', Commissionrate: memberyf.data.Commissionrate, Settlement: 0, Invoice: 0, OrderAmount: 0, OrderInvoice: 0, SubmitDate: null, Auditoperator: '', AuditDate: null, EnteroPerator: GetCookie_UserId(), OpName: SHOWNAME, EnterDate: myDate, DebitNo: '', IsDebit: "0", IsOpen: "0", IsAdvancedpay: "false", Sort: newSerialno, IsInvoice: "0", FeeFrt: memberyf.data.FeeFrt, IsCrmOrderFee: "0", AuditStatus: 0, InvoiceNum: '', ChequeNum: '', WmsOutBsNo: '' }); storeadd.add(record); }; var editColumnIndex = 0; var cellediting = null; if (type == 2) { cellediting = this.cellEditingDrChFee; editColumnIndex = 4; } else if (type == 1) { cellediting = this.cellEditingCrChFee; editColumnIndex = 4; } var n = storeadd.getCount(); cellediting.startEditByPosition({ row: n - 1, column: editColumnIndex }); this.calcDetailTotal(); }, onHistryAddDetailClick: function (menu, event, type) { var allow = this.getAllowOperationDetail(); if (allow == false) { return; } this.feeType = type; var store = null; if (type == 1) { store = this.storeDrChFee; } else if (type == 2) { store = this.storeCrChFee; } else { alert('函数(onAddDetailClick)的参数type类型设置的不对'); return; } if (this.stroplb == 'op_Seae') { DsOpenEditWin("/MvcShipping/MsSeaeFee/HistryIndex", "历史引入费用"); } else if (this.stroplb == 'op_Apply') { DsOpenEditWin("/MvcShipping/MsOpApply/HistryFeeIndex", "历史引入费用"); } else if (this.stroplb == 'op_Seai') { DsOpenEditWin("/MvcShipping/MsSeaiFee/HistryIndex", "历史引入费用"); } else if (this.stroplb == 'op_Bulk') { DsOpenEditWin("/MvcShipping/MsOpBulk/HistryFeeIndex", "历史引入费用"); } else if (this.stroplb == 'op_other') { DsOpenEditWin("/MvcShipping/MsOpOther/HistryFeeIndex", "历史引入费用"); } }, onTemplateAddDetailClick: function (menu, event, type) { var allow = this.getAllowOperationDetail(); if (allow == false) { return; } this.feeType = type; var store = null; if (type == 1) { store = this.storeDrChFee; } else if (type == 2) { store = this.storeCrChFee; } else { alert('函数(onAddDetailClick)的参数type类型设置的不对'); return; } DsOpenEditWin("/MvcShipping/MsFeeTemplate/AddFeeIndex", "模板引入费用"); }, onCancelDetailClick: function (menu, event, type) { var store = null; if (type == 1) { store = this.storeDrChFee; } else if (type == 2) { store = this.storeCrChFee; } else { alert('函数(onCancelDetailClick)的参数type类型设置的不对'); return; } for (var i = 0; i < store.getCount(); i += 1) { var member = store.getAt(i); member.reject(); } this.calcDetailTotal(); }, GetHandleSerialNo: function (store, type) { var result = 0; if (result == 0) { for (var i = 0; i < store.getCount(); i += 1) { var member = store.getAt(i); if (member.data.Sort > result) { result = member.data.Sort; } } } result = parseInt(result) + 1; return result; }, onDelDetailClick: function (button, event, type) { var allow = this.getAllowOperationDetail(); if (allow == false) { return; } var feeGidSql = ''; var selectedRecords = []; if (type == '1') { selectedRecords = this.feeDrGridCheckBoxModel.selected.items; var candelete = this.CheckChFeeDelete(selectedRecords, 1); if (candelete == false) return; } else if (type == '2') { selectedRecords = this.feeCrGridCheckBoxModel.selected.items; var candelete = this.CheckChFeeDelete(selectedRecords, 2); if (candelete == false) return; } if (selectedRecords.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择要删除的费用!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } Ext.MessageBox.confirm('提示', '确定要删除选中的费用吗?', function (btn) { if (btn == 'yes') { if (selectedRecords.length > 0) { for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (rec.data.BsNo == "*") //如果是新增但没有保存的数据,没有必要提交到后台 { if (type == '1') { this.storeDrChFee.remove(selectedRecords[i]); } else if (type == '2') { this.storeCrChFee.remove(selectedRecords[i]); } } else { var feeGId = "'" + rec.data.GId + "'"; if (feeGidSql == '') { feeGidSql = feeGId; } else { feeGidSql = feeGidSql + "," + feeGId; } } } } _thisorderfee = this; Ext.Msg.wait('正在删除数据...'); if (feeGidSql != '') { Ext.Ajax.request({ waitMsg: '正在删除数据...', url: '/MvcShipping/MsChFee/OrderDelete', params: { bsno: _thisorderfee.strBSNO, data: feeGidSql }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { for (var i = 0; i < selectedRecords.length; i++) { if (type == '1') { this.storeDrChFee.remove(selectedRecords[i]); } else if (type == '2') { this.storeCrChFee.remove(selectedRecords[i]); } } Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }, failure: function (response, options) { Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); }, success: function (response, options) { }, scope: this }); //end Ext.Ajax.request } else { Ext.Msg.show({ title: '提示', msg: "删除成功!", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } } }, this); this.calcDetailTotal(); }, CheckChFeeDelete: function (records, type) { for (var i = 0; i < records.length; i++) { var rec = records[i]; var feeStatus = rec.data.FeeStatus; var canDelete = true; if (canDelete == false) { Ext.Msg.show({ title: '提示', msg: '只能删除费用状态为[录入状态]和[驳回提交]的费用,请重新选择', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); if (canDelete) { var op = rec.data.EnteroPerator; var opname = rec.data.OpName; if (type == 1) { var recop = DsStoreQueryBy(this.StoreDrOpRange, 'OPID', op); if (recop.getCount() > 0) { } else { Ext.Msg.show({ title: '提示', msg: '你没有权限删除' + opname + '录入的费用!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); canDelete = false; } } else if (type == 2) { var recop = DsStoreQueryBy(this.StoreCrOpRange, 'OPID', op); if (recop.getCount() > 0) { } else { Ext.Msg.show({ title: '提示', msg: '你没有权限删除' + opname + '录入的费用!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); canDelete = false; } } } return false; } } return true; }, onPostDetailClick: function (button, event, type) { var bodyDrChFeeDatas = []; var i; if (type == '1') { for (i = 0; i < this.storeDrChFee.getCount(); i += 1) { var memberyf = this.storeDrChFee.getAt(i); bodyDrChFeeDatas.push(memberyf); var ExChangerate = memberyf.data.ExChangerate; var amount = memberyf.data.Amount; if (amount == 0) { Ext.Msg.show({ title: '警告', msg: '费用的金额不允许为0,请修改后再保存', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } if (ExChangerate == 0) { Ext.Msg.show({ title: '警告', msg: '汇率不允许为0,请修改后再保存', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } }; var jsonChFeeBody = ConvertFeeRecordsToJson(bodyDrChFeeDatas); } else if (type == '2') { for (i = 0; i < this.storeCrChFee.getCount(); i += 1) { var memberyf = this.storeCrChFee.getAt(i); bodyDrChFeeDatas.push(memberyf); var amount = memberyf.data.Amount; var ExChangerate = memberyf.data.ExChangerate; if (amount == 0) { Ext.Msg.show({ title: '警告', msg: '费用的金额不允许为0,请修改后再保存', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } if (ExChangerate == 0) { Ext.Msg.show({ title: '警告', msg: '汇率不允许为0,请修改后再保存', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } }; var jsonChFeeBody = ConvertFeeRecordsToJson(bodyDrChFeeDatas); }; if (jsonChFeeBody == '') return; _thisorderfee = this; Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcShipping/MsChFee/SaveOrderFee', scope: this, params: { bsno: _thisorderfee.strBSNO, type: type, OrderFeeBody: jsonChFeeBody }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { if (type == '1') { for (var i = 0; i < this.storeDrChFee.getCount(); i += 1) { var member = this.storeDrChFee.getAt(i); member.set("BsNo", _thisorderfee.strBSNO); member.commit(); } } else if (type == '2') { for (var i = 0; i < this.storeCrChFee.getCount(); i += 1) { var member = this.storeCrChFee.getAt(i); member.set("BsNo", _thisorderfee.strBSNO); member.commit(); } } } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } else { Ext.Msg.show({ title: '请重试', msg: '服务器响应出错', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }); }, //end save onViewDetailClick: function (button, event, type) { var openSet = "height=540, width=890, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " + (screen.height - 540) / 2 + ",Left= " + (screen.width - 890) / 2 var openType = "_blank"; //打开费用“历史信息查询”页面 var openUrl = "../../Shipping/FeeHistory.aspx?bsno=" + this.strBSNO + "&oplb=" + this.stroplb + "&type=" + type; window.open(openUrl, openType, openSet); }, getAllowOperationDetail: function () { var feeStatus = this.getFeeStatus(); if (feeStatus == '9' || feeStatus == '2') { //Ext.Msg.show({ title: '错误', msg: "当前状态,不允许操作费用!", icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return true; } else { Ext.Msg.show({ title: '错误', msg: "当前状态,不允许操作费用!", icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return false; } }, //#endregion //#region 表格的AfterEdit gridListChFeeAfterEdit: function (editor, e, eOpts) { if (e.value == e.originalValue) return; //var BSNO = e.record.get('BSNO'); if (e.field == 'UnitPrice') { var unitPrice = e.record.data['UnitPrice']; var quantity = e.record.data['Quantity']; var taxrate = e.record.data['TaxRate']; if (taxrate != null) { var taxrateb = Add(1, Div(taxrate, 100)); //parseFloat(1 + parseFloat(taxrate).mul(0.01)); var TaxUnitPrice = Mul(unitPrice, taxrateb); //(parseFloat(unitPrice).mul(taxrateb)).toFixed(2); e.record.set('TaxUnitPrice', TaxUnitPrice); } var notaxamount = Mul(unitPrice, quantity); //(parseFloat(unitPrice).mul(quantity)).toFixed(2); e.record.set('NoTaxAmount', notaxamount); ////taxrate = Div(taxrate, 100); //parseFloat(taxrate).mul(0.01); // tax = notaxamount * taxrate; var tax = Div(Mul(notaxamount, taxrate), 100); //parseFloat(notaxamount).mul(taxrate); e.record.set('Tax', tax); var amount = Add(notaxamount, tax); //(parseFloat(notaxamount).add(parseFloat(tax))).toFixed(2);// e.record.set('Amount', Ext.util.Format.number(amount, '0.00')); e.record.set('Amount', amount); this.calcDetailTotal(); } else if (e.field == 'TaxUnitPrice') { var TaxUnitPrice = e.record.data['TaxUnitPrice']; if (e.value != 0) { var quantity = e.record.data['Quantity']; var taxrate = e.record.data['TaxRate']; var taxrateb = Add(1, Div(taxrate, 100), 4); //parseFloat(1 + parseFloat(taxrate).mul(0.01)); var unitPrice = Div(TaxUnitPrice, taxrateb); //(parseFloat(TaxUnitPrice).div(parseFloat(taxrateb))).toFixed(2); e.record.set('UnitPrice', unitPrice); if (quantity != null) { var amount = Mul(TaxUnitPrice, quantity); //(parseFloat(TaxUnitPrice).mul(quantity)).toFixed(2); e.record.set('Amount', amount); var notaxamount = Div(amount, taxrateb); //(parseFloat(amount).div(taxrateb)).toFixed(2); e.record.set('NoTaxAmount', notaxamount); var tax = Div(Mul(notaxamount, taxrate), 100); //parseFloat(notaxamount).mul(taxrate); e.record.set('Tax', tax); } this.calcDetailTotal(); } } else if (e.field == 'Quantity') { var unitPrice = e.record.data['UnitPrice']; var quantity = e.record.data['Quantity']; var TaxUnitPrice = e.record.data['TaxUnitPrice']; var taxrate = e.record.data['TaxRate']; if (taxrate != null) { var taxrateb = Add(1, Div(taxrate, 100)); if ((TaxUnitPrice == null || TaxUnitPrice == 0 || TaxUnitPrice == NaN) && (unitPrice != null)) { var TaxUnitPrice = Mul(unitPrice, taxrateb); e.record.set('TaxUnitPrice', TaxUnitPrice); } } if (unitPrice != null) { var notaxamount = Mul(unitPrice, quantity); //(parseFloat(unitPrice).mul(quantity)).toFixed(2); e.record.set('NoTaxAmount', notaxamount); var tax = Div(Mul(notaxamount, taxrate), 100); //parseFloat(notaxamount).mul(taxrate); e.record.set('Tax', tax); } if (TaxUnitPrice != null) { var amount = Mul(TaxUnitPrice, quantity); //(parseFloat(unitPrice).mul(quantity)).toFixed(2); e.record.set('Amount', amount); } this.calcDetailTotal(); } else if (e.field == 'FeeName') { var records = DsStoreQueryBy(this.storeFeeNameRef, 'Name', e.value); var FEENAME = e.value; if (records.getCount() > 0) { var data = records.getAt(0).data; var Currency = data.DefaultCurr; var Description = data.Description; var DEFAULTUNIT = data.DefaultUnit; var UNIT = ''; var custtype = ''; var FeeType = e.record.data['FeeType']; var codeFEETYPE = data.FEETYPE; //alert(codeFEETYPE); e.record.set('Currency', Currency); e.record.set('FeeDescription', Description); if (DEFAULTUNIT == "1" || DEFAULTUNIT == "11") { e.record.set('Unit', "单票"); e.record.set('Quantity', 1); UNIT = '单票'; } else if (DEFAULTUNIT == "2") { e.record.set('Unit', "重量"); UNIT = '重量'; //设置重量,如果是进口的设置净重 Quantity //获取业务类型 获取重量 设置 } else if (DEFAULTUNIT == "5") { e.record.set('Unit', "TEU"); UNIT = 'TEU'; //设置数量 //获取业务类型 获取所有集装箱信息 折算TEU } else if (DEFAULTUNIT == "6") { e.record.set('Unit', "净重"); UNIT = '净重'; //如果是进口的设置净重 } else if (DEFAULTUNIT == "10" || DEFAULTUNIT == "3") { e.record.set('Unit', "尺码"); UNIT = '尺码'; //如果是进口的设置净重 } else if (DEFAULTUNIT == "9") { var Unitrecords = DsStoreQueryLikeBy(this.StoreUnit, 'UNIT', 1, '2'); if (Unitrecords.getCount() > 0) { var ffdata = Unitrecords.getAt(0).data; var aUNIT = ffdata.UNIT; e.record.set('Unit', aUNIT); UNIT = aUNIT; } else { var Unitrecords = DsStoreQueryLikeBy(this.StoreUnit, 'UNIT', 1, '4'); if (Unitrecords.getCount() > 0) { var ffdata = Unitrecords.getAt(0).data; var aUNIT = ffdata.UNIT; e.record.set('Unit', aUNIT); UNIT = aUNIT; } } //如果是进口的设置净重 } else { e.record.set('Unit', DEFAULTUNIT); UNIT = DEFAULTUNIT; } if (Currency != 'RMB') { var FeeType = e.record.data['FeeType']; var FFrecords = DsStoreQueryBy(this.StoreDateCurr, 'CURR', Currency); if (FFrecords.getCount() > 0) { var ffdata = FFrecords.getAt(0).data; if (FeeType == 2) var DEFRATE = ffdata.CRDEFRATE; else var DEFRATE = ffdata.DEFRATE; e.record.set('ExChangerate', DEFRATE); } else { var DFrecords = DsStoreQueryBy(this.StoreCurr, 'CURR', Currency); if (DFrecords.getCount() > 0) { var dfdata = DFrecords.getAt(0).data; if (FeeType == 2) var DEFRATE = dfdata.CRDEFRATE; else var DEFRATE = dfdata.DEFRATE; e.record.set('ExChangerate', DEFRATE); } else { e.record.set('ExChangerate', 0); } } } else { e.record.set('ExChangerate', 1); }; var Unitrecords = DsStoreQueryBy(this.StoreUnit, 'UNIT', UNIT); var QUANTITY = 1; if (Unitrecords.getCount() > 0) { var Unitdata = Unitrecords.getAt(0).data; QUANTITY = Unitdata.QUANTITY; if ((UNIT == '重量') && (QUANTITY == 0)) { Unitrecords = DsStoreQueryBy(this.StoreUnit, 'UNIT', '净重'); if (Unitrecords.getCount() > 0) { Unitdata = Unitrecords.getAt(0).data; QUANTITY = Unitdata.QUANTITY; } } e.record.set('Quantity', QUANTITY); } else { e.record.set('Quantity', 1); } var taxrate = e.record.data['TaxRate']; if (taxrate == null) taxrate = 0; var unitPrice = e.record.data['UnitPrice']; var notaxamount = Mul(unitPrice, QUANTITY); //(parseFloat(unitPrice).mul(QUANTITY)).toFixed(2); if (notaxamount == null || notaxamount == NaN) notaxamount = 0; e.record.set('NoTaxAmount', notaxamount); //taxrate = parseFloat(taxrate) / 100; var tax = Mul3(notaxamount, taxrate, 0.01); //parseFloat(notaxamount).mul(taxrate); var amount = Add(notaxamount, tax); //(parseFloat(notaxamount).add(parseFloat(tax))).toFixed(2); if (amount == null || amount == NaN) amount = 0; e.record.set('Amount', amount); // var tax = Div(Mul(notaxamount, taxrate), 100); //parseFloat(notaxamount).mul(taxrate); e.record.set('Tax', tax); this.calcDetailTotal(); // if (codeFEETYPE == "普通") { // e.record.set('IsAdvancedpay', "0"); // } else { // e.record.set('IsAdvancedpay', "1"); // } } else { e.record.set('Currency', 'RMB'); e.record.set('FeeDescription', ''); } } else if (e.field == 'TaxRate') { var taxrate = e.record.data['TaxRate']; var unitPrice = e.record.data['UnitPrice']; var quantity = e.record.data['Quantity']; if (unitPrice != null) { var taxrateb = Add(1, Div(taxrate, 100, 4), 4); //parseFloat(1 + parseFloat(taxrate).mul(0.01)); var TaxUnitPrice = Mul(unitPrice, taxrateb); //(parseFloat(unitPrice).mul(taxrateb)).toFixed(2); e.record.set('TaxUnitPrice', TaxUnitPrice); } var notaxamount = e.record.data['NoTaxAmount']; ////taxrate = Div(taxrate, 100); //parseFloat(taxrate).mul(0.01); var tax = Div(Mul(notaxamount, taxrate), 100); //parseFloat(notaxamount).mul(taxrate); var amount = Add(notaxamount, tax); //(parseFloat(notaxamount).add(parseFloat(tax))).toFixed(2); e.record.set('Amount', amount); e.record.set('Tax', tax); this.calcDetailTotal(); } else if (e.field == 'NoTaxAmount') { var taxrate = e.record.data['TaxRate']; var notaxamount = e.record.data['NoTaxAmount']; ////taxrate = parseFloat(taxrate).mul(0.01); var tax = Div(Mul(notaxamount, taxrate), 100); //parseFloat(notaxamount).mul(taxrate); var amount = Add(notaxamount, tax); //(parseFloat(notaxamount).add(parseFloat(tax))).toFixed(2); e.record.set('Amount', amount); e.record.set('Tax', tax); /* var amount = parseFloat(notaxamount) + parseFloat(notaxamount * taxrate / 100); e.record.set('Amount', Ext.util.Format.number(amount, '0.00')); */ this.calcDetailTotal(); } else if (e.field == 'Amount') { var taxrate = e.record.data['TaxRate']; var amount = e.record.data['Amount']; if (taxrate != null) { var taxrateb = Add(1, Mul(taxrate, 0.01)); //parseFloat(1 + parseFloat(taxrate.mul(0.01))); var notaxamount = Div(amount, taxrateb); //(parseFloat(amount).div(taxrateb)).toFixed(2); e.record.set('NoTaxAmount', notaxamount); var quantity = e.record.data['Quantity']; if (quantity != null && quantity != 0) { var unitPrice = Div(notaxamount, quantity); //(parseFloat(notaxamount).div(parseFloat(quantity))).toFixed(2); e.record.set('UnitPrice', unitPrice); var TaxUnitPrice = Div(amount, quantity); e.record.set('TaxUnitPrice', TaxUnitPrice); } var tax = Div(Mul(notaxamount, taxrate), 100); //parseFloat(notaxamount).mul(taxrate); e.record.set('Tax', tax); }; this.calcDetailTotal(); } else if (e.field == 'Unit') { var records = DsStoreQueryBy(this.StoreUnit, 'UNIT', e.value); var QUANTITY = 1; if (records.getCount() > 0) { var data = records.getAt(0).data; QUANTITY = data.QUANTITY; e.record.set('Quantity', QUANTITY); } else { e.record.set('Quantity', 1); } var taxrate = e.record.data['TaxRate']; if (taxrate == null) taxrate = 0; var unitPrice = e.record.data['UnitPrice']; var notaxamount = Mul(unitPrice, QUANTITY); //(parseFloat(unitPrice).mul(QUANTITY)).toFixed(2); e.record.set('NoTaxAmount', notaxamount); //taxrate = parseFloat(taxrate) / 100; var tax = Mul3(notaxamount, taxrate, 0.01); //parseFloat(notaxamount).mul(taxrate); var amount = Add(notaxamount, tax); //(parseFloat(notaxamount).add(parseFloat(tax))).toFixed(2); e.record.set('Amount', amount); e.record.set('Tax', tax); this.calcDetailTotal(); } else if (e.field == 'Currency') { var FeeType = e.record.data['FeeType']; if (e.value == 'RMB') { e.record.set('ExChangerate', 1); } else { var FFrecords = DsStoreQueryBy(this.StoreDateCurr, 'CURR', e.value); if (FFrecords.getCount() > 0) { var ffdata = FFrecords.getAt(0).data; if (FeeType == 2) var DEFRATE = ffdata.CRDEFRATE; else var DEFRATE = ffdata.DEFRATE; e.record.set('ExChangerate', DEFRATE); } else { var DFrecords = DsStoreQueryBy(this.StoreCurr, 'CURR', e.value); if (DFrecords.getCount() > 0) { var dfdata = DFrecords.getAt(0).data; if (FeeType == 2) var DEFRATE = dfdata.CRDEFRATE; else var DEFRATE = dfdata.DEFRATE; e.record.set('ExChangerate', DEFRATE); } else { e.record.set('ExChangerate', 0); } } } this.calcDetailTotal(); } else if (e.field == 'CustomerType') { var records = DsStoreQueryBy(this.StoreCustType, 'CUSTTYPE', e.value); if (records.getCount() > 0) { var data = records.getAt(0).data; var CUSTNAME = this.EditRecord.get(data.CUSTNAME); e.record.set('CustomerName', CUSTNAME); } else { // e.record.set('CustomerName', 0); } } }, // gridListChFeeAfterEdit: function (editor, e, eOpts) { // if (e.value == e.originalValue) return; // if (e.field == 'UnitPrice' || e.field == 'Quantity') { // var unitPrice = e.record.data['UnitPrice']; // var quantity = e.record.data['Quantity']; // var taxrate = e.record.data['TaxRate']; // if (taxrate != null) { // var taxrateb = parseFloat(1 + parseFloat(taxrate / 100)); // var TaxUnitPrice = (parseFloat(unitPrice).mul(taxrateb)).toFixed(2); // e.record.set('TaxUnitPrice', TaxUnitPrice); // } // var notaxamount = (parseFloat(unitPrice).mul(quantity)).toFixed(2); // e.record.set('NoTaxAmount', notaxamount); // taxrate = parseFloat(taxrate) / 100; // // tax = notaxamount * taxrate; // var tax = parseFloat(notaxamount).mul(taxrate); // var amount = (parseFloat(notaxamount).add(parseFloat(tax))).toFixed(2); // // e.record.set('Amount', Ext.util.Format.number(amount, '0.00')); // e.record.set('Amount', amount); // this.calcDetailTotal(); // } else if (e.field == 'TaxUnitPrice') { // var TaxUnitPrice = e.record.data['TaxUnitPrice']; // if (e.value != 0) { // var quantity = e.record.data['Quantity']; // var taxrate = e.record.data['TaxRate']; // var taxrateb = parseFloat(1 + parseFloat(taxrate / 100)); // var unitPrice = (parseFloat(TaxUnitPrice).div(parseFloat(taxrateb))).toFixed(2); // e.record.set('UnitPrice', unitPrice); // if (quantity != null) { // var amount = (parseFloat(TaxUnitPrice).mul(quantity)).toFixed(2); // e.record.set('Amount', amount); // var notaxamount = (parseFloat(amount).div(taxrateb)).toFixed(2); // e.record.set('NoTaxAmount', notaxamount); // } // this.calcDetailTotal(); // } // } else if (e.field == 'FeeName') { // var records = DsStoreQueryBy(this.storeFeeNameRef, 'Name', e.value); // if (records.getCount() > 0) { // var data = records.getAt(0).data; // var Currency = data.DefaultCurr; // var Description = data.Description; // e.record.set('Currency', Currency); // e.record.set('FeeDescription', Description); // if (Currency != 'RMB') { // var FFrecords = DsStoreQueryBy(this.StoreDateCurr, 'CURR', Currency); // if (FFrecords.getCount() > 0) { // var ffdata = FFrecords.getAt(0).data; // var DEFRATE = ffdata.DEFRATE; // e.record.set('ExChangerate', DEFRATE); // } else { // var DFrecords = DsStoreQueryBy(this.StoreCurr, 'CURR', Currency); // if (DFrecords.getCount() > 0) { // var dfdata = DFrecords.getAt(0).data; // var DEFRATE = dfdata.DEFRATE; // e.record.set('ExChangerate', DEFRATE); // } else { // e.record.set('ExChangerate', 0); // } // } // } else { e.record.set('ExChangerate', 1); }; // this.calcDetailTotal(); // } else { // e.record.set('Currency', 'RMB'); // e.record.set('FeeDescription', ''); // } // } else if (e.field == 'TaxRate') { // var taxrate = e.record.data['TaxRate']; // var unitPrice = e.record.data['UnitPrice']; // var quantity = e.record.data['Quantity']; // if (unitPrice != null) { // var taxrateb = parseFloat(1 + parseFloat(taxrate / 100)); // var TaxUnitPrice = (parseFloat(unitPrice).mul(taxrateb)).toFixed(2); // e.record.set('TaxUnitPrice', TaxUnitPrice); // } // var notaxamount = e.record.data['NoTaxAmount']; // taxrate = parseFloat(taxrate) / 100; // var tax = parseFloat(notaxamount).mul(taxrate); // var amount = (parseFloat(notaxamount).add(parseFloat(tax))).toFixed(2); // e.record.set('Amount', amount); // this.calcDetailTotal(); // } else if (e.field == 'NoTaxAmount') { // var taxrate = e.record.data['TaxRate']; // var notaxamount = e.record.data['NoTaxAmount']; // taxrate = parseFloat(taxrate) / 100; // var tax = parseFloat(notaxamount).mul(taxrate); // var amount = (parseFloat(notaxamount).add(parseFloat(tax))).toFixed(2); // e.record.set('Amount', amount); // /* // var amount = parseFloat(notaxamount) + parseFloat(notaxamount * taxrate / 100); // e.record.set('Amount', Ext.util.Format.number(amount, '0.00')); // */ // this.calcDetailTotal(); // } else if (e.field == 'Amount') { // var taxrate = e.record.data['TaxRate']; // var amount = e.record.data['Amount']; // if (taxrate != null) { // var taxrateb = parseFloat(1 + parseFloat(taxrate / 100)); // var notaxamount = (parseFloat(amount).div(taxrateb)).toFixed(2); // e.record.set('NoTaxAmount', notaxamount); // var quantity = e.record.data['Quantity']; // if (quantity != null && quantity != 0) { // var unitPrice = (parseFloat(notaxamount).div(parseFloat(quantity))).toFixed(2); // e.record.set('UnitPrice', unitPrice); // } // }; // this.calcDetailTotal(); // } else if (e.field == 'Unit') { // var records = DsStoreQueryBy(this.StoreUnit, 'UNIT', e.value); // if (records.getCount() > 0) { // var data = records.getAt(0).data; // var QUANTITY = data.QUANTITY; // e.record.set('Quantity', QUANTITY); // } else { // e.record.set('Quantity', 0); // } // var taxrate = e.record.data['TaxRate']; // if (taxrate == null) taxrate = 0; // var unitPrice = e.record.data['UnitPrice']; // var notaxamount = (parseFloat(unitPrice).mul(QUANTITY)).toFixed(2); // e.record.set('NoTaxAmount', notaxamount); // taxrate = parseFloat(taxrate) / 100; // var tax = parseFloat(notaxamount).mul(taxrate); // var amount = (parseFloat(notaxamount).add(parseFloat(tax))).toFixed(2); // e.record.set('Amount', amount); // this.calcDetailTotal(); // } else if (e.field == 'Currency') { // if (e.value == 'RMB') { // e.record.set('ExChangerate', 1); // } else { // var FFrecords = DsStoreQueryBy(this.StoreDateCurr, 'CURR', e.value); // if (FFrecords.getCount() > 0) { // var ffdata = FFrecords.getAt(0).data; // var DEFRATE = ffdata.DEFRATE; // e.record.set('ExChangerate', DEFRATE); // } else { // var DFrecords = DsStoreQueryBy(this.StoreCurr, 'CURR', e.value); // if (DFrecords.getCount() > 0) { // var dfdata = DFrecords.getAt(0).data; // var DEFRATE = dfdata.DEFRATE; // e.record.set('ExChangerate', DEFRATE); // } else { // e.record.set('ExChangerate', 0); // } // } // } // this.calcDetailTotal(); // } else if (e.field == 'CustomerType') { // var records = DsStoreQueryBy(this.StoreCustType, 'CUSTTYPE', e.value); // if (records.getCount() > 0) { // var data = records.getAt(0).data; // var CUSTNAME = this.EditRecord.get(data.CUSTNAME); // e.record.set('CustomerName', CUSTNAME); // } else { // // e.record.set('CustomerName', 0); // } // } // }, calcDetailTotal: function () { var rmbdr = 0; var rmbcr = 0; var usddr = 0; var usdcr = 0; var otdr = 0; var otcr = 0; var ttldr = 0; var ttlcr = 0; var notaxrmbdr = 0; var notaxrmbcr = 0; var notaxusddr = 0; var notaxusdcr = 0; var notaxotdr = 0; var notaxotcr = 0; var notaxttldr = 0; var notaxttlcr = 0; for (var i = 0; i < this.storeDrChFee.getCount(); i += 1) { var member = this.storeDrChFee.getAt(i); var value = member.get('Amount'); var notaxvalue = member.get('NoTaxAmount'); var curr = member.get('Currency'); var rate = member.get('ExChangerate'); if (curr == 'RMB') { rmbdr = parseFloat(rmbdr) + parseFloat(value); notaxrmbdr = parseFloat(notaxrmbdr) + parseFloat(notaxvalue); } else if (curr == 'USD') { usddr = parseFloat(usddr) + parseFloat(value); notaxusddr = parseFloat(notaxusddr) + parseFloat(notaxvalue); } else { otdr = parseFloat(otdr) + parseFloat(value); notaxotdr = parseFloat(notaxotdr) + parseFloat(notaxvalue); } ttldr = parseFloat(ttldr) + parseFloat(value) * parseFloat(rate); notaxttldr = parseFloat(notaxttldr) + parseFloat(notaxvalue) * parseFloat(rate); } for (var i = 0; i < this.storeCrChFee.getCount(); i += 1) { var member = this.storeCrChFee.getAt(i); var value = member.get('Amount'); var curr = member.get('Currency'); var rate = member.get('ExChangerate'); var notaxvalue = member.get('NoTaxAmount'); if (curr == 'RMB') { rmbcr = parseFloat(rmbcr) + parseFloat(value); notaxrmbcr = parseFloat(notaxrmbcr) + parseFloat(notaxvalue); } else if (curr == 'USD') { usdcr = parseFloat(usdcr) + parseFloat(value); notaxusdcr = parseFloat(notaxusdcr) + parseFloat(notaxvalue); } else { otcr = parseFloat(otcr) + parseFloat(value); notaxotcr = parseFloat(notaxotcr) + parseFloat(notaxvalue); } ttlcr = parseFloat(ttlcr) + parseFloat(value) * parseFloat(rate); notaxttlcr = parseFloat(notaxttlcr) + parseFloat(notaxvalue) * parseFloat(rate); } var rmbprofit = parseFloat(rmbdr) - parseFloat(rmbcr); var usdprofit = parseFloat(usddr) - parseFloat(usdcr); var otprofit = parseFloat(otdr) - parseFloat(otcr); var ttlprofit = parseFloat(ttldr) - parseFloat(ttlcr); var notaxrmbprofit = parseFloat(notaxrmbdr) - parseFloat(notaxrmbcr); var notaxusdprofit = parseFloat(notaxusddr) - parseFloat(notaxusdcr); var notaxotprofit = parseFloat(notaxotdr) - parseFloat(notaxotcr); var notaxttlprofit = parseFloat(notaxttldr) - parseFloat(notaxttlcr); for (i = 0; i < this.storeBodySum.getCount(); i += 1) { var memberyf = this.storeBodySum.getAt(i); if (memberyf.data.CURR == '人民币') { memberyf.set("NORATEDR", notaxrmbdr); memberyf.set("DR", rmbdr); memberyf.set("NORATECR", notaxrmbcr); memberyf.set("CR", rmbcr); memberyf.set("NORATEPR", notaxrmbprofit); memberyf.set("PR", rmbprofit); memberyf.commit(); } else if (memberyf.data.CURR == '美元') { memberyf.set("NORATEDR", notaxusddr); memberyf.set("DR", usddr); memberyf.set("NORATECR", notaxusdcr); memberyf.set("CR", usdcr); memberyf.set("NORATEPR", notaxusdprofit); memberyf.set("PR", usdprofit); memberyf.commit(); } if (memberyf.data.CURR == '其他币别') { memberyf.set("NORATEDR", notaxotdr); memberyf.set("DR", otdr); memberyf.set("NORATECR", notaxotcr); memberyf.set("CR", otcr); memberyf.set("NORATEPR", notaxotprofit); memberyf.set("PR", otprofit); memberyf.commit(); } if (memberyf.data.CURR == '合计') { memberyf.set("NORATEDR", notaxttldr); memberyf.set("DR", ttldr); memberyf.set("NORATECR", notaxttlcr); memberyf.set("CR", ttlcr); memberyf.set("NORATEPR", notaxttlprofit); memberyf.set("PR", ttlprofit); memberyf.commit(); } } }, setHeadFieldValue: function (fieldName, value) { var field = this.formtotal.getForm().findField(fieldName); field.setValue(value); }, //#endregion cellEditingChFeeBeforeEdit: function (editor, e) { var allow = this.getAllowOperationDetail(); if (allow == false) { return; } var chfeefeeStatus = e.record.get('FeeStatus'); var canedit = true; var IsDebit = e.record.get('IsDebit'); if (canedit) { if (IsDebit == 'True') { Ext.Msg.show({ title: '提示', msg: '当前费用已対帐无法修改!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); canedit = true; } }; if (canedit) { var type = e.record.get('FeeType'); var op = e.record.get('EnteroPerator'); var opname = e.record.get('OpName'); if (type == 1) { var records = DsStoreQueryBy(this.StoreDrOpRange, 'OPID', op); if (records.getCount() > 0) { } else { Ext.Msg.show({ title: '提示', msg: '你没有权限修改' + opname + '录入的费用!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); canedit = false; } } else if (type == 2) { var records = DsStoreQueryBy(this.StoreCrOpRange, 'OPID', op); if (records.getCount() > 0) { } else { Ext.Msg.show({ title: '提示', msg: '你没有权限修改' + opname + '录入的费用!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); canedit = false; } } } return canedit; }, refBillNoSeChange: function (field, newValue, oldValue) { // if (newValue != oldValue) { // alert(newValue + "," + oldValue); // } }, getFeeStatus: function () { var feeStatus = this.EditRecord.get('ORSTATUS'); return feeStatus; }, getBillStatus: function () { // var basicForm = this.formEdit.getForm(); // var billStatus = basicForm.findField('BillStatus').value; // return billStatus; }, getCustName: function () { // var custName = this.formEdit.getForm().findField('RefCustomerName'); //return custName.getValue(); }, getModifyStatus: function () { var drmodify = this.storeDrChFee.getModifiedRecords(); var crmodify = this.storeCrChFee.getModifiedRecords(); if (drmodify.length != 0 || crmodify.length != 0) { return true } else { for (i = 0; i < this.storeDrChFee.getCount(); i += 1) { var memberyf = this.storeDrChFee.getAt(i); if (memberyf.data.BsNo == "*") return true } for (i = 0; i < this.storeCrChFee.getCount(); i += 1) { var memberyf = this.storeCrChFee.getAt(i); if (memberyf.data.BsNo == "*") return true } return false; } }, getModifyStatusDr: function () { var drmodify = this.storeDrChFee.getModifiedRecords(); if (drmodify.length != 0) { return true } else { for (i = 0; i < this.storeDrChFee.getCount(); i += 1) { var memberyf = this.storeDrChFee.getAt(i); if (memberyf.data.BsNo == "*") return true } return false; } }, getModifyStatusCr: function () { var crmodify = this.storeCrChFee.getModifiedRecords(); if (crmodify.length != 0) { return true } else { for (i = 0; i < this.storeCrChFee.getCount(); i += 1) { var memberyf = this.storeCrChFee.getAt(i); if (memberyf.data.BsNo == "*") return true } return false; } }, setSaveBtnStatus: function (enable) { var bsbtnSave = Ext.getCmp('pcbtnSave'); var bsbtnSaveAndClose = Ext.getCmp('pcbtnSaveAndClose'); var bsbtnSaveAndNew = Ext.getCmp('pcbtnSaveAndNew'); var pcbtnNew = Ext.getCmp('pcbtnNew'); if (enable) { bsbtnSave.enable(); bsbtnSaveAndClose.enable(); bsbtnSaveAndNew.enable(); pcbtnNew.enable(); } else { //bsbtnSave.disable(); //bsbtnSaveAndClose.disable(); bsbtnSaveAndNew.disable(); pcbtnNew.disable(); } } });