Ext.namespace('Shipping'); Shipping.ChPaysettlementBLEdit = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.ChPaysettlementBLEdit.superclass.constructor.call(this); }; Ext.extend(Shipping.ChPaysettlementBLEdit, Ext.Panel, { ParentWin: null, OpStatus: 'add', StoreList: null, EditRecord: null, addstore: false, PageSize: 100, initUIComponents: function () { this.serialNo = 0; this.workSerialNo = 0; this.bodyDel = []; this.FeeSql = ''; this.BillSql = ''; this.DuiBillSql = ''; this.IsDebit = '0'; //#region 编辑form //枚举参照相关(编辑form) //表参照相关(编辑form) this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomInvRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomInvRefList' } }); this.storeCustCode.load({ params: { condition: ""} }); this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '结算单位', store: this.storeCustCode, allowBlank: false, forceSelection: true, name: 'CUSTOMERNAME', valueField: 'CustName', displayField: 'CodeAndName', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var CUSTOMERNAME = this.formEdit.getForm().findField('CUSTOMERNAME').getValue(); if (CUSTOMERNAME == '') return; var CUSTNAME = this.formSearch.getForm().findField('CUSTNAME'); var tmpcust = CUSTNAME.getValue(); if (tmpcust == '' || tmpcust == null || tmpcust == undefined) { CUSTNAME.setValue(CUSTOMERNAME); } var recs = DsStoreQueryBy(this.storeCustCode, 'CustName', records[0].data.CustName); 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.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', { model: 'MsOP', proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' } }); this.StoreCurr = Ext.create('DsExt.ux.RefTableStore', { model: 'MsFeeCurr', proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' } }); this.StoreCurr.load({ params: { condition: ""} }); this.StoreDateCurr = Ext.create('DsExt.ux.RefTableStore', { model: 'MsFeeCurr', proxy: { url: '/MvcShipping/MsChFee/GetFeeNowCurrList' } }); this.StoreDateCurr.load({ params: { condition: ""} }); this.comboxCurr = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '币别', store: this.StoreCurr, forceSelection: true, allowBlank: false, name: 'CURR', valueField: 'CURR', displayField: 'CURR', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { 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(''); } var curr = this.formACCOUNTS.getForm().findField('ACCOUNTS_CURRENCY'); curr.setValue(records[0].data.CURR); var curr = this.formPREPAY.getForm().findField('PREPAY_CURRENCY'); curr.setValue(records[0].data.CURR); var curr = this.formAHSR.getForm().findField('AHSR_CURRENCY'); curr.setValue(records[0].data.CURR); var curr = this.formFINANCIAL.getForm().findField('FINANCIAL_CURRENCY'); curr.setValue(records[0].data.CURR); var curr = this.formADVANCE.getForm().findField('ADVANCE_CURRENCY'); curr.setValue(records[0].data.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.StoreStlMode = Ext.create('DsExt.ux.RefTableStore', { model: 'STLMODE', proxy: { url: '/MvcShipping/MsBaseInfo/GetStlModeList' } }); this.StoreStlMode.load({ params: { condition: ""} }); this.comboxStlMode = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '结算方式', store: this.StoreStlMode, forceSelection: true, name: 'SETTLETYPE', valueField: 'STLCODE', displayField: 'STLNAME' }); this.StoreBANK = Ext.create('DsExt.ux.RefTableStore', { model: 'BANK', proxy: { url: '/MvcShipping/MsBaseInfo/GetBANKList' } }); this.StoreBANK.load({ params: { condition: ""} }); this.comboxBANK = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '银行账号', store: this.StoreBANK, forceSelection: true, name: 'ACCOUNT', valueField: 'GID', displayField: 'BANKNAME' }); //编辑form this.formEdit = Ext.widget('form', { region: 'center', frame: true, bodyPadding: 3, trackResetOnLoad: true, // autoScroll: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 90, msgTarget: 'qtip' }, items: [ {//fieldset 1 xtype: 'fieldset', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: 'GID', name: 'GID', flex: 0, hidden: true, margins: '0' }, { fieldLabel: 'BILLSTATUS', name: 'BILLSTATUS', flex: 0, hidden: true, margins: '0' }, { fieldLabel: 'BILLDATE', name: 'BILLDATE', flex: 0, hidden: true, margins: '0' }, { fieldLabel: 'SETTLEUSER', name: 'SETTLEUSER', flex: 0, hidden: true, margins: '0' }, { fieldLabel: 'COMPANYID', name: 'COMPANYID', flex: 0, hidden: true, margins: '0' }, { fieldLabel: 'SETTLEMODE', name: 'SETTLEMODE', flex: 0, hidden: true, margins: '0' }, { fieldLabel: 'BILLTYPE', name: 'BILLTYPE', flex: 0, hidden: true, margins: '0' }, { fieldLabel: 'ISEXPORT', name: 'ISEXPORT', flex: 0, hidden: true, margins: '0' }, { fieldLabel: 'CREATEUSER', name: 'CREATEUSER', flex: 0, hidden: true, margins: '0' }, { fieldLabel: 'CREATETIME', name: 'CREATETIME', flex: 0, hidden: true, margins: '0' }, { fieldLabel: '结算单号', readOnly: true, name: 'BILLNO' }, { fieldLabel: '状态', readOnly: true, name: 'BILLSTATUSREF' }, this.comboxCustCode, { fieldLabel: '结算日期', // readOnly: true, format: 'Y-m-d', xtype: 'datefield', name: 'SETTLETIME' }, { fieldLabel: '结算人', readOnly: true, name: 'SETTLEUSERREF' } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxCurr, { fieldLabel: '金额', readOnly: true, name: 'AMOUNT', 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; } }, this.comboxStlMode, this.comboxBANK, { fieldLabel: '凭证备注', name: 'VOUCHERNO' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '结算单位银行', flex: 1, name: 'CUSTBANK' }, { fieldLabel: '结算单位账户', flex: 1, name: 'CUSTACCOUNT' }, { fieldLabel: '汇率', flex: 1, name: 'RATE' }, { fieldLabel: '备注', flex: 2, name: 'REMARK' }] } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); //end this.formEdit //#endregion //#region 按钮Toolbar this.panelBtn = new Ext.Panel({ region: "north", tbar: [{ text: "生成凭证", id: "btnAddCwVouchers", iconCls: "btnadd", handler: function (button, event) { this.onAddCwVouchers(); }, scope: this }] }); //end 按钮Toolbar //#endregion //#region 明细表 //明细表表格相关 this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); //明细表-数据集 this.storeBodyList = Ext.create('Ext.data.Store', { model: 'Chfee_do_detail', remoteSort: true, proxy: { type: 'ajax', url: '/Account/Chfee_settlement/GetBillList', reader: { id: 'BSNO,FEEDOID', root: 'data', totalProperty: 'totalCount' } } }); //明细表表格 this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.gridList = new Ext.grid.GridPanel({ store: this.storeBodyList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, selModel: this.GridCheckBoxModel, columns: [{ sortable: true, dataIndex: 'BILLNO', header: 'BILL', hidden: true, width: 100 }, { sortable: true, dataIndex: 'BSNO', header: 'BSNO', hidden: true, width: 100 }, { sortable: true, dataIndex: 'FEEDOID', header: 'FEEDOID', hidden: true, width: 100 }, { sortable: true, dataIndex: 'CUSTNO', header: '委托编号', width: 120 }, { sortable: true, dataIndex: 'MBLNO', header: '主提单号', width: 120 }, { sortable: true, dataIndex: 'CUSTOMERNAME', header: '委托单位', width: 100 }, { sortable: true, dataIndex: 'ETD', header: '开船日期', renderer: Ext.util.Format.dateRenderer('Y-m-d'), width: 100 }, { sortable: true, dataIndex: 'BSSOURCE', header: '业务来源', width: 80 }, { sortable: true, dataIndex: 'FEENAME', header: '费用名称', width: 80 }, { sortable: true, dataIndex: 'FEETYPEREF', header: '收付', width: 40 }, { sortable: true, dataIndex: 'AMOUNT', header: '结算金额', width: 80, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }, { sortable: true, dataIndex: 'ORIGCURRENCY', header: '原始币别', width: 80 }, { sortable: true, dataIndex: 'ORIGAMOUNT', header: '原始金额', width: 80, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }, { sortable: true, dataIndex: 'SALE', header: '揽货人', width: 80 }, { sortable: true, dataIndex: 'ENTERP', header: '经营单位', width: 80 }, { sortable: true, dataIndex: 'CUSTOMNO', header: '报关单号', width: 108 } ] }); this.storeBodySum = Ext.create('Ext.data.Store', { model: 'Chfee_do_sum', remoteSort: true, proxy: { type: 'ajax', url: '/Account/Chfee_settlement/GetBillSum', reader: { root: 'data', totalProperty: 'totalCount' } } }); this.gridSum = new Ext.grid.GridPanel({ store: this.storeBodySum, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, tbar: [{ xtype: 'label', width: 120, height: 22, text: '结算金额合计' }], columns: [{ sortable: true, dataIndex: 'FEETYPEREF', header: '收付', width: 40 }, { sortable: true, dataIndex: 'CURRENCY', header: '币 别', width: 80 }, { sortable: true, dataIndex: 'AMOUNT', header: '金额', width: 80, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } } ] }); //明细表表格 //#endregion 明细表 //#region 添加业务列表 this.storeBodyAddList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, model: 'MsAddBillCustFee', remoteSort: true, proxy: { type: 'ajax', url: '/Account/Chfee_settlement/GetBillDataList', reader: { id: 'BSNO', root: 'data', totalProperty: 'totalCount' } } }); this.AddGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); this.gridAddList = new Ext.grid.GridPanel({ store: this.storeBodyAddList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, selModel: this.AddGridCheckBoxModel, tbar: [{ text: '添加结算明细', tooltip: '添加结算明细', id: 'btnaddbill', iconCls: "btnadddetail", handler: function (button, event) { this.onAddClick(button, event); }, scope: this }], columns: [{ sortable: true, dataIndex: 'BSNO', header: 'BSNO', hidden: true, width: 100 }, { sortable: true, dataIndex: 'CUSTNO', header: '委托编号', width: 108 }, { sortable: true, dataIndex: 'MBLNO', header: '主提单号', width: 108 }, { sortable: true, dataIndex: 'FEEOBJNAME', header: '结费单位', width: 90 }, { sortable: true, dataIndex: 'RMBCrBalAmount', header: 'RMB未付', width: 70 }, { sortable: true, dataIndex: 'USDCrBalAmount', header: 'USD未付', width: 70 }, { sortable: true, dataIndex: 'OTCrBalAmount', header: '其他未付', width: 70 }, { sortable: true, dataIndex: 'RMBDrBalAmount', header: 'RMB未收', width: 70 }, { sortable: true, dataIndex: 'USDDrBalAmount', header: 'USD未收', width: 70 }, { sortable: true, dataIndex: 'OTDrBalAmount', header: '其他未收', width: 70 }, { sortable: true, dataIndex: 'BALRMBINVCR', header: 'RMB付未开票', width: 70 }, { sortable: true, dataIndex: 'BALUSDINVCR', header: 'USD付未开票', width: 70 }, { sortable: true, dataIndex: 'OPLBNAME', header: '业务类别', width: 80 }, { sortable: true, dataIndex: 'CUSTOMERNAME', header: '委托单位', width: 100 }, { sortable: true, dataIndex: 'ETD', header: '开船日期', renderer: Ext.util.Format.dateRenderer('Y-m-d'), width: 100 }, { sortable: true, dataIndex: 'CUSTOMNO', header: '报关单号', width: 80 }, { sortable: true, dataIndex: 'ENTERP', header: '经营单位', width: 100 }, { sortable: true, dataIndex: 'SALE', header: '揽货人', width: 80 }, { sortable: true, dataIndex: 'ACCDATE', header: '会计期间', width: 80 }, { sortable: true, dataIndex: 'OP', header: '操作', width: 80 }, { sortable: true, dataIndex: 'INPUTBY', header: '录入人', width: 80 }, { sortable: true, dataIndex: 'PORTLOAD', header: '起运港', width: 120 }, { sortable: true, dataIndex: 'PORTDISCHARGE', header: '目的港', width: 120 }, { sortable: true, dataIndex: 'VESSEL', header: '船名', width: 150 }, { sortable: true, dataIndex: 'VOYNO', header: '航次', width: 60 } ], // paging bar on the bottom bbar: Ext.create('Ext.PagingToolbar', { store: this.storeBodyAddList, displayInfo: true, displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录', emptyMsg: "没有数据" }) }); this.gridAddList.addListener('itemdblclick', function (dataview, record, item, index, e, b) { this.SelectedRecord = record; var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2 var openType = "_blank"; var openUrl = ""; if (record.data.OPLBNAME == "海运出口") { openUrl = "/baseinfo/opseaebaseinfo.aspx?handle=check&bsno=" + record.data.BSNO; } else if (record.data.OPLBNAME == "海运进口" || record.data.OPLBNAME == "海运进口散货") { openUrl = "/baseinfo/opseaibaseinfo.aspx?handle=check&bsno=" + record.data.BSNO; } else if (record.data.OPLBNAME == "报关业务") { openUrl = "/MvcShipping/MsOpApply/ApplyFeeView?handle=check&bsno=" + record.data.BSNO; } window.open(openUrl, openType, openSet); // DsOpenEditWin("/TruckMng/MsWlPc/Edit"); }, this); _this = this; this.CurrGroup = new Ext.form.RadioGroup({ id: 'CurrGroup', xtype: 'radiogroup', fieldLabel: '折算币别', columns: 2, items: [ { boxLabel: 'RMB', name: 'Curr', inputValue: 'RMB', checked: true }, { boxLabel: 'USD', name: 'Curr', inputValue: 'USD' } ] }); //#endregion //#region 添加费用列表 this.storeAddFeeList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, model: 'Chfee_add_detail', remoteSort: true, proxy: { type: 'ajax', url: '/Account/Chfee_settlement/GetFeeDetailList', reader: { id: 'BSNO', root: 'data', totalProperty: 'totalCount' } } }); this.AddFeeGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); this.cellEditingFee = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1, listeners: { 'edit': function (editor, e) { } } }); this.gridAddFeeList = new Ext.grid.GridPanel({ store: this.storeAddFeeList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.cellEditingFee], selModel: this.AddFeeGridCheckBoxModel, tbar: [{ text: '添加申请费用明细', tooltip: '添加申请费用明细', iconCls: "btnadddetail", id: "btnadddetail", handler: function (button, event) { this.onAddDetailClick(button, event); }, scope: this },{ xtype: "label", id: "zongshu", text: "", handler: function () { ; } }], columns: [{ sortable: true, dataIndex: 'CH_ID', header: 'CH_ID', hidden: true, width: 100 }, { sortable: true, dataIndex: 'BSNO', header: 'BSNO', hidden: true, width: 100 }, { sortable: false, dataIndex: 'CustomerName', header: '客户名称', width: 90 }, { sortable: false, dataIndex: 'FeeType_Ref', header: '收付', width: 40 }, { sortable: false, dataIndex: 'FeeName', header: '费用名称', width: 90 }, { sortable: false, dataIndex: 'Amount', header: '金额', width: 70, 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; } }, { sortable: false, dataIndex: 'Currency', header: '币别', width: 40 }, { sortable: false, dataIndex: 'BalAmount', header: '未结金额', width: 70, 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; } }, { sortable: false, dataIndex: 'StlAmount', header: '本次结算金额', editor: { xtype: 'numberfield', keyNavEnabled: false, allowDecimals: true, decimalPrecision: 2, selectOnFocus: true, mouseWheelEnabled: false, enableKeyEvents: true, listeners: { keyup: function (textfield, e) { if (e.getKey() == 40) { _this.onNextKeyClick(9) } else if (e.getKey() == 38) { _this.onUpKeyClick(9) } } } }, width: 70, 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; } }, { sortable: false, dataIndex: 'ExChangerate', header: '原始汇率', width: 60 }, { sortable: false, dataIndex: 'Invoice', header: '开票金额', width: 60, 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; } } ], // paging bar on the bottom bbar: Ext.create('Ext.PagingToolbar', { store: this.storeAddFeeList, displayInfo: true, displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录', emptyMsg: "没有数据" }) }); this.gridAddFeeList.on('edit', function (editor, e, eOpts) { this.gridAddFeeListAfterEdit(editor, e, eOpts); }, this); this.gridAddFeeList.on('cellclick', function (button, event) { this.onSelectFee(button, event); }, this); this.storeSelectSum = Ext.create('Ext.data.Store', { model: 'Chfee_do_selectsum' }); this.gridSelectSum = new Ext.grid.GridPanel({ store: this.storeSelectSum, enableHdMenu: false, // anchor: '100% 50%', region: 'south', height: 80, loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, tbar: [{ xtype: 'label', width: 220, id: 'SelectGrid', height: 22, text: '所选费用合计' }], columns: [{ sortable: true, dataIndex: 'RMBDRAMOUNT', header: 'RMB未收', width: 80 }, { sortable: true, dataIndex: 'RMBCRAMOUNT', header: 'RMB未付', width: 80 }, { sortable: true, dataIndex: 'USDDRAMOUNT', header: 'USD未收', width: 80 }, { sortable: true, dataIndex: 'USDCRAMOUNT', header: 'USD未付', width: 80 }, { sortable: true, dataIndex: 'OTDRAMOUNT', header: '其他未收', width: 80 }, { sortable: true, dataIndex: 'OTCRAMOUNT', header: '其他未付', width: 80 } ] }); //#endregion //#region 查询 _this = this; this.storeCustCodefee = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeCustCodefee.load({ params: { condition: ""} }); this.comboxAddCustCode = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '费用对象', store: this.storeCustCodefee, forceSelection: true, name: 'CUSTNAME', valueField: 'CustName', displayField: 'CodeAndName', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { //_this.onRefreshClick(); } } } }); this.StoreOpLb = Ext.create('Ext.data.Store', { fields: ['OPLBNAME'] }); this.StoreOpLb.add({ "OPLBNAME": "海运出口" }); this.StoreOpLb.add({ "OPLBNAME": "海运进口" }); this.StoreOpLb.add({ "OPLBNAME": "报关业务" }); this.StoreOpLb.add({ "OPLBNAME": "进口贸易" }); this.StoreOpLb.add({ "OPLBNAME": "大宗散货" }); this.StoreOpLb.add({ "OPLBNAME": "综合业务" }); this.comboxOpLb = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '业务类别', store: this.StoreOpLb, valueField: 'OPLBNAME', displayField: 'OPLBNAME', forceSelection: true, name: 'OPLBNAME' }); this.storeAddDCType = Ext.create('Ext.data.Store', { fields: ['DC', 'NAME'] }); this.storeAddDCType.add({ "DC": "", "NAME": "全部" }); this.storeAddDCType.add({ "DC": "1", "NAME": "应收" }); this.storeAddDCType.add({ "DC": "2", "NAME": "应付" }); this.comboxaddDCType = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '收/付', store: this.storeAddDCType, valueField: 'DC', displayField: 'NAME', forceSelection: true, name: 'DC', value: '2', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { //_this.onRefreshClick(); } } } }); this.comboxCurr2 = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '币别', store: this.StoreCurr, forceSelection: true, name: 'Currency', valueField: 'CURR', displayField: 'CURR', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { //_this.onRefreshClick(); } } } }); this.storeFeeNameRef = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.FeeTypeRefModel', proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefList' } }); this.comboxFeeNameRef = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '费用名称', store: this.storeFeeNameRef, forceSelection: true, name: 'FeeName', valueField: 'Name', displayField: 'CodeAndName', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { //_this.onRefreshClick(); } } } }); this.storeFeeNameRef.load({ params: { condition: ""} }); this.storeCurrExrate = Ext.create('Ext.data.Store', { fields: ['CURR', 'EXRATE', 'DFEXRATE'] }); this.storeVoyVeg = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.VesselModel', proxy: { url: '/CommMng/BasicDataRef/GetVesselList' } }); this.storeVoyVeg.load({ params: { condition: ""} }); this.comboxVoyVeg = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '船 名', store: this.storeVoyVeg, name: 'VESSEL', valueField: 'VESSEL', flex: 1, displayField: 'VESSEL', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { //_this.onRefreshClick(); } } } }); this.formSearch = Ext.widget('form', { frame: true, region: 'north', bodyPadding: 5, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 90, msgTarget: 'qtip' }, items: [ {//fieldset 1 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxAddCustCode, this.comboxOpLb, { fieldLabel: '编号检索', name: 'CustomNo', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { //_this.onRefreshClick(); } } } }, { fieldLabel: '从业务日期', format: 'Y-m-d', xtype: 'datefield', name: 'ExpDateBgn', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { //_this.onRefreshClick(); } } } }, { fieldLabel: '到业务日期', format: 'Y-m-d', xtype: 'datefield', name: 'ExpDateEnd', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { //_this.onRefreshClick(); } } } }, this.comboxFeeNameRef, { xtype: 'button', width: 90, text: "重置条件", iconCls: "btnreset", handler: function (button, event) { this.onClearSql(button, event); }, scope: this } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxaddDCType, this.comboxCurr2, { fieldLabel: '会计期间', xtype: 'monthfield', name: 'ACCDATEFR', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { //_this.onRefreshClick(); } } } }, { fieldLabel: '会计期间', xtype: 'monthfield', name: 'ACCDATETO', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { //_this.onRefreshClick(); } } } }, this.comboxVoyVeg, { fieldLabel: '航次', name: 'VOYNO', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { //_this.onRefreshClick(); } } } }, { xtype: 'button', width: 90, text: "执行查询", iconCls: "btnrefresh", handler: function (button, event) { //this.onRefreshClick(button, event); }, scope: this } ] } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); //#endregion //#region 布局 this.panelService = new Ext.Panel({ layout: "border", region: 'center', margin: '2 2', items: [this.gridList] }); this.panelSum = new Ext.Panel({ layout: "border", region: 'east', width: 235, split: true, margin: '2 2', items: [this.gridSum] }); this.paneldetail = new Ext.Panel({ // title: '结算明细', layout: "border", region: "center", split: true, items: [ this.panelService, this.panelSum ] }); this.panelAddService = new Ext.Panel({ layout: "border", region: 'center', margin: '2 2', items: [this.gridAddList] }); this.panelAddfee = new Ext.Panel({ layout: "border", region: 'east', width: 550, split: true, margin: '2 2', items: [this.gridAddFeeList, this.gridSelectSum] }); this.paneladddetail = new Ext.Panel({ layout: "border", region: 'center', items: [this.panelAddService, this.panelAddfee ] }); this.paneladd = new Ext.Panel({ title: '添加支付结算明细', layout: "border", // region: 'south', region: "center", // height: 420, items: [ this.formSearch, this.paneladddetail ] }); //#endregion //#region 预收预付 this.formACCOUNTS = Ext.widget('form', { anchor: '20% 100%', columnWidth: .20, frame: true, trackResetOnLoad: true, bodyPadding: 5, title: "记账资料", fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 40, msgTarget: 'qtip' }, items: [ {//fieldset 1 xtype: 'fieldset', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '币别', labelWidth: 40, readOnly: true, name: 'ACCOUNTS_CURRENCY' } ]//end items(fieldset 1) }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '汇率', labelWidth: 40, name: 'ACCOUNTS_RATE' } ]//end items(fieldset 1) }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '金额', labelWidth: 40, name: 'ACCOUNTS_MONEY', 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; }, listeners: { scope: this, 'blur': function (textfield, eOpts) { if (textfield.value == textfield.originalValue) return; var curr = this.formPREPAY.getForm().findField('PREPAY_MONEY'); var allamount = textfield.value; var amount = this.formEdit.getForm().findField('AMOUNT').getValue(); var aftamount = parseFloat(allamount) - parseFloat(amount); curr.setValue(aftamount); this.formACCOUNTS.getForm().findField('ACCOUNTS_MONEY').setValue(amount); var financialamount = this.formFINANCIAL.getForm().findField('FINANCIAL_MONEY').getValue(); var advanceamount = this.formADVANCE.getForm().findField('ADVANCE_MONEY').getValue(); amount = parseFloat(allamount).add(parseFloat(-advanceamount)); amount = parseFloat(amount).add(parseFloat(-financialamount)); this.formAHSR.getForm().findField('AHSR_MONEY').setValue(amount); } } } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }] }); this.comboxCurrPREPAY = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '币别', store: this.StoreCurr, forceSelection: true, name: 'PREPAY_CURRENCY', valueField: 'CURR', displayField: 'CURR' }); this.formPREPAY = Ext.widget('form', { anchor: '20% 100%', columnWidth: .20, frame: true, trackResetOnLoad: true, bodyPadding: 5, title: "+预付支资料", fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 40, msgTarget: 'qtip' }, items: [ {//fieldset 1 xtype: 'fieldset', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxCurrPREPAY ]//end items(fieldset 1) }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '汇率', labelWidth: 40, name: 'PREPAY_RATE' } ]//end items(fieldset 1) }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '金额', labelWidth: 40, name: 'PREPAY_MONEY', 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; } }]//end items(fieldset 1) }//end fieldset 1 ]//end root items }] }); this.comboxCurrAHSR = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '币别', store: this.StoreCurr, forceSelection: true, name: 'AHSR_CURRENCY', valueField: 'CURR', displayField: 'CURR' }); this.formAHSR = Ext.widget('form', { anchor: '20% 100%', columnWidth: .20, frame: true, trackResetOnLoad: true, bodyPadding: 5, title: "=实付支资料", fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 40, msgTarget: 'qtip' }, items: [ {//fieldset 1 xtype: 'fieldset', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxCurrAHSR ]//end items(fieldset 1) }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '汇率', name: 'AHSR_RATE' } ]//end items(fieldset 1) }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '金额', name: 'AHSR_MONEY', 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; } } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }] }); this.comboxCurrFINANCIAL = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '币别', store: this.StoreCurr, forceSelection: true, name: 'FINANCIAL_CURRENCY', valueField: 'CURR', displayField: 'CURR' }); this.formFINANCIAL = Ext.widget('form', { anchor: '20% 100%', columnWidth: .20, frame: true, trackResetOnLoad: true, bodyPadding: 5, title: "+财务费用", fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 40, msgTarget: 'qtip' }, items: [ {//fieldset 1 xtype: 'fieldset', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxCurrFINANCIAL] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '汇率', readOnly: true, name: 'FINANCIAL_RATE' } ]//end items(fieldset 1) }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '金额', name: 'FINANCIAL_MONEY', 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; }, listeners: { scope: this, 'blur': function (textfield, eOpts) { if (textfield.value == textfield.originalValue) return; var curr = this.formAHSR.getForm().findField('AHSR_MONEY'); var accamount = this.formACCOUNTS.getForm().findField('ACCOUNTS_MONEY').getValue(); var prepamount = this.formPREPAY.getForm().findField('PREPAY_MONEY').getValue(); var advanceamount = this.formADVANCE.getForm().findField('ADVANCE_MONEY').getValue(); var amount = parseFloat(accamount).add(parseFloat(prepamount)); amount = parseFloat(amount).add(parseFloat(-advanceamount)); amount = parseFloat(amount).add(parseFloat(-textfield.value)); curr.setValue(amount); } } } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }] }); this.comboxCurrADVANCE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '币别', store: this.StoreCurr, forceSelection: true, name: 'ADVANCE_CURRENCY', valueField: 'CURR', displayField: 'CURR' }); _this = this; this.formADVANCE = Ext.widget('form', { anchor: '20% 100%', columnWidth: .20, frame: true, trackResetOnLoad: true, bodyPadding: 5, title: "+预付支取用资料", fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 40, msgTarget: 'qtip' }, items: [ {//fieldset 1 xtype: 'fieldset', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxCurrADVANCE ]//end items(fieldset 1) }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '汇率', name: 'ADVANCE_RATE' } ]//end items(fieldset 1) }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '金额', readOnly: true, name: 'ADVANCE_MONEY', 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; } }]//end items(fieldset 1) }//end fieldset 1 ]//end root items }] }); //#endregion this.panelAcc = new Ext.Panel({ layout: "column", region: "north", height: 140, items: [this.formACCOUNTS, this.formPREPAY, this.formAHSR, this.formFINANCIAL, this.formADVANCE] }); //#region 预付取用 this.storePaymentList = Ext.create('Ext.data.Store', { model: 'CWAdvancePaymentmb', remoteSort: true, proxy: { type: 'ajax', url: '/Account/Chfee_settlement/GetAdvancePayment', reader: { id: 'BILLNO', root: 'data', totalProperty: 'totalCount' } } }); this.GridAccCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); //明细表-数据集 this.storeAccBodyList = Ext.create('Ext.data.Store', { model: 'CWAdvancePaymentmb', remoteSort: true, proxy: { type: 'ajax', url: '/Account/Chfee_settlement/GetAdvancePayment', reader: { id: 'BILLNO', root: 'data', totalProperty: 'totalCount' } } }); //明细表表格 this.gridListAccCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.gridListAcc = new Ext.grid.GridPanel({ store: this.storeAccBodyList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.gridListAccCellEditing], selModel: this.GridAccCheckBoxModel, tbar: [{ text: '添加取用明细', tooltip: '添加取用明细', iconCls: "btnadddetail", handler: function (button, event) { this.onAddAPDetailClick(button, event); }, scope: this }], columns: [{ sortable: true, dataIndex: 'GID', header: 'GID', width: 80, hidden: true }, { sortable: true, dataIndex: 'LINKGID', header: 'LINKGID', width: 80, hidden: true }, { sortable: true, dataIndex: 'BILLNO', header: '结算单号', width: 120 }, { sortable: true, dataIndex: 'CUSTOMERNAME', header: '结算对象', width: 100 }, { sortable: true, dataIndex: 'CURRENCY', header: '币别', width: 60 }, { sortable: true, dataIndex: 'AMOUNT', header: '金额', width: 80, 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; } }, { sortable: true, dataIndex: 'DOAMOUNT', header: '已核销金额', width: 80, 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; } }, { sortable: true, dataIndex: 'REMAIN', header: '本次核销', editor: { xtype: 'numberfield', keyNavEnabled: false, allowDecimals: true, decimalPrecision: 2, selectOnFocus: true, mouseWheelEnabled: false, enableKeyEvents: true }, width: 80 }, { sortable: true, dataIndex: 'CREATEUSERREF', header: '录入人', width: 80 }, { sortable: true, dataIndex: 'CREATETIME', header: '录入时间', width: 80 }, { sortable: true, dataIndex: 'REMARK', header: '备注', width: 120 } ] }); this.storeBodyListAcc = Ext.create('Ext.data.Store', { model: 'CWAdvancePaymentBodymb', remoteSort: true, proxy: { type: 'ajax', url: '/Account/Chfee_settlement/GetAPBodyList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.GridBodyAccCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); this.gridBodyListAcc = new Ext.grid.GridPanel({ store: this.storeBodyListAcc, enableHdMenu: false, region: 'center', //height: 600, loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, selModel: this.GridBodyAccCheckBoxModel, viewConfig: { autoFill: true, enableTextSelection: true }, tbar: [{ text: '删除取用明细', tooltip: '删除取用明细', iconCls: "btnadddetail", handler: function (button, event) { this.onDeleteApClick(button, event); }, scope: this }], columns: [ { sortable: true, dataIndex: 'GID', header: 'GID', hidden: true, width: 80 }, { sortable: true, dataIndex: 'LINKGID', header: 'LINKGID', hidden: true, width: 80 }, { sortable: true, dataIndex: 'BILLNO', header: '结算单号', width: 120 }, { sortable: true, dataIndex: 'SETTLELINKGID', header: 'SETTLELINKGID', hidden: true, width: 80 }, { sortable: true, dataIndex: 'SETTLEBILLNO', header: '核销使用单号', width: 120 }, { sortable: true, dataIndex: 'FEETYPEREF', header: '收付', width: 80 }, { sortable: true, dataIndex: 'CUSTOMERNAME', header: '结算对象', hidden: true, width: 80 }, { sortable: true, dataIndex: 'CURRENCY', header: '币别', width: 80 }, { sortable: true, dataIndex: 'DOAMOUNT', header: '核销金额', width: 80, 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; } }, { sortable: true, dataIndex: 'SETTLEUSERREF', header: '核销人', width: 80 }, { sortable: true, dataIndex: 'SETTLETIME', header: '核销时间', width: 80 }, { sortable: true, dataIndex: 'REMARK', header: '备注', width: 80 }, { sortable: true, dataIndex: 'VOUCHERNO', header: '凭证号', width: 80 } ] }); this.storeBodyListAcc2 = Ext.create('Ext.data.Store', { model: 'CWAdvancePaymentBodymb', remoteSort: true, proxy: { type: 'ajax', url: '/Account/Chfee_settlement/GetAPBodyList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.gridBodyListAcc2 = new Ext.grid.GridPanel({ store: this.storeBodyListAcc2, enableHdMenu: false, region: 'center', //height: 600, loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, selType: 'cellmodel', viewConfig: { autoFill: true, enableTextSelection: true }, columns: [ { sortable: true, dataIndex: 'GID', header: 'GID', hidden: true, width: 80 }, { sortable: true, dataIndex: 'LINKGID', header: 'LINKGID', hidden: true, width: 80 }, { sortable: true, dataIndex: 'BILLNO', header: '结算单号', width: 80 }, { sortable: true, dataIndex: 'SETTLELINKGID', header: 'SETTLELINKGID', hidden: true, width: 80 }, { sortable: true, dataIndex: 'SETTLEBILLNO', header: '核销使用单号', width: 80 }, { sortable: true, dataIndex: 'CUSTOMERNAME', header: '结算对象', hidden: true, width: 80 }, { sortable: true, dataIndex: 'CURRENCY', header: '币别', width: 80 }, { sortable: true, dataIndex: 'DOAMOUNT', header: '核销金额', width: 80, 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; } }, { sortable: true, dataIndex: 'SETTLEUSER', header: '核销人', width: 80 }, { sortable: true, dataIndex: 'SETTLETIME', header: '核销时间', width: 80 }, { sortable: true, dataIndex: 'REMARK', header: '备注', width: 80 }, { sortable: true, dataIndex: 'VOUCHERNO', header: '凭证号', width: 80 } ] }); this.paneldetailacc = new Ext.Panel({ // title: '结算明细', layout: "border", height: 160, region: "north", split: true, items: [ this.gridBodyListAcc ] }); this.panelAddacc = new Ext.Panel({ layout: "border", height: 160, region: "north", margin: '2 2', items: [this.gridListAcc] }); this.paneldetailacc2 = new Ext.Panel({ title: '核销明细', layout: "border", height: 160, region: "north", hidden: true, items: [ this.gridBodyListAcc2 ] }); this.panelaccdetail = new Ext.Panel({ title: '取用或撤销预付明细', layout: "border", hidden: true, height: 360, region: "north", split: true, items: [ this.paneldetailacc, this.panelAddacc ] }); //#endregion //#region 布局 //控件布局 this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 130, items: [this.panelBtn, this.formEdit] }); this.panelBody = new Ext.Panel({ title: "结算明细", layout: "border", region: "center", items: [this.paneldetail]//, this.paneladd }); this.panelAccAll = new Ext.Panel({ title: "预收预付信息", layout: "border", region: "north", items: [this.panelAcc, this.panelaccdetail, this.paneldetailacc2] }); this.tabpanel = new Ext.TabPanel ({ activeTab: 0, autoWidth: true, border: false, frame: false, region: 'center', id: "TabPanelID", enableTabScroll: true, items: [ this.panelBody, this.panelAccAll ] }); Ext.apply(this, { items: [this.panelTop, this.tabpanel] }); //#endregion //绑定查询窗体 this.ParentWin = window.parent.opener; //初始化数据 this.InitData(); //绑定事件 var billno = '*'; if (this.opStatus == 'edit') { billno = this.editRecord.get('BILLNO'); }; this.storeBodyList.on('beforeload', function (store) { var sql = " BILLNO='" + billno + "'"; Ext.apply(store.proxy.extraParams, { condition: sql }); }, this); this.storeBodyList.on('load', function (store, records) { if (store.getCount() > 0) { this.gridList.getSelectionModel().select(0); } }, this); this.storeBodyAddList.on('beforeload', function (store) { var sql = this.getCondition(); Ext.apply(store.proxy.extraParams, { condition: this.BillSql, billtype: 2 }); }, this); this.storeBodyAddList.on('load', function (store, records) { if (store.getCount() > 0) { this.gridAddList.getSelectionModel().select(0); } else { this.storeAddFeeList.removeAll(); } }, this); this.gridAddList.getSelectionModel().on('select', function (model, record, index) { var bsno = record.data.BSNO; var feeobjname = record.data.FEEOBJNAME; var sql = ""; sql = " BSNO='" + bsno + "' AND CUSTOMERNAME='" + feeobjname + "'"; sql = sql + getAndConSql(sql, this.FeeSqlStr, this.FeeSqlStr); this.storeAddFeeList.load({ params: { condition: sql, billtype: 2} }); this.onSelectFee(button, event); }, this); this.storeAddFeeList.on('beforeload', function (store) { var sql = this.getCondition(); Ext.apply(store.proxy.extraParams, { condition: this.BillSql, billtype: 2 }); }, this); _this = this; this.gridAddList.on({ selectionchange: function (sm, selections) { var SelectGridtext = Ext.getCmp('SelectGrid'); _this.storeSelectSum.removeAll(); SelectGridtext.setText('所选费用合计'); if (selections.length == 0) { return; } _this.storeSelectSum.add({ "RMBDRAMOUNT": 0, "RMBCRAMOUNT": 0, "USDDRAMOUNT": 0, "USDCRAMOUNT": 0, "OTDRAMOUNT": 0, "OTCRAMOUNT": 0 }); var R = selections.length; for (var i = 0; i < selections.length; i++) { var rec = selections[i]; var memberyf = _this.storeSelectSum.getAt(0); var amount = memberyf.data.RMBDRAMOUNT; var cramount = memberyf.data.RMBCRAMOUNT; amount = (parseFloat(amount).add(parseFloat(rec.data.RMBDrBalAmount))).toFixed(2); cramount = (parseFloat(cramount).add(parseFloat(rec.data.RMBCrBalAmount))).toFixed(2); var usdamount = memberyf.data.USDDRAMOUNT; var usdcramount = memberyf.data.USDCRAMOUNT; usdamount = (parseFloat(usdamount).add(parseFloat(rec.data.USDDrBalAmount))).toFixed(2); usdcramount = (parseFloat(usdcramount).add(parseFloat(rec.data.USDCrBalAmount))).toFixed(2); var otamount = memberyf.data.OTDRAMOUNT; var otcramount = memberyf.data.OTCRAMOUNT; otamount = (parseFloat(otamount).add(parseFloat(rec.data.OTDrBalAmount))).toFixed(2); otcramount = (parseFloat(otcramount).add(parseFloat(rec.data.OTCrBalAmount))).toFixed(2); memberyf.set("RMBDRAMOUNT", amount); memberyf.set("RMBCRAMOUNT", cramount); memberyf.set("USDDRAMOUNT", usdamount); memberyf.set("USDCRAMOUNT", usdcramount); memberyf.set("OTDRAMOUNT", otamount); memberyf.set("OTCRAMOUNT", otcramount); memberyf.commit(); } SelectGridtext.setText('所选费用合计(选中' + R + '票业务)'); } }); //#region 生成凭证_汇率列表 //#region 加载数据 //权限加载 this.StoreIsCwVouchers = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.ModuleModel', proxy: { url: '/MvcShipping/MsBaseInfo/GetSysModuleList' } }); this.StoreIsCwVouchers.load({ params: { condition: "[name]='modChPaySettlementIndexCwVouchers'" }, waitMsg: '正在查询数据...', callback: function (options, success, response) { if (success) { //判断是否显示凭证按钮 if (options.length > 0) { Ext.getCmp('btnAddCwVouchers').show(); } else { Ext.getCmp('btnAddCwVouchers').hide(); } } }, scope: this }); //制单人 this.storePREPAREDCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' } }); this.storePREPAREDCode.load(); this.comboxPREPARED = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '制单人', store: this.storePREPAREDCode, forceSelection: true, id: 'PREPARED', name: 'PREPARED', valueField: 'UserName', displayField: 'CodeAndName', value: SHOWNAME }); //键值维护表_凭证字//需求编号:SR2017080200007 this.storeCrmKeyCodeCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CrmKeyCodeModel', proxy: { url: '/CommMng/BasicDataRef/GetCrmKeyCodeList' } }); this.storeCrmKeyCodeCode.load({ params: { condition: " and KEYTYPE='凭证字'"} }); this.comboxVKNO = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '凭证字', store: this.storeCrmKeyCodeCode, forceSelection: true, name: 'VKNO', valueField: 'KEYVALUE', displayField: 'KEYVALUE' }); //#endregion //#region 定义数据集 this.storeListCw = Ext.create('Ext.data.Store', { pageSize: this.PageSize, model: 'MsCodeCurrencyList', remoteSort: true, proxy: { type: 'ajax', url: '/Account/Chfee_settlement/GetCodeCurrencyList', reader: { id: 'CURR', root: 'data', totalProperty: 'totalCount' } } }); //#endregion //#region 列定义 this.girdcolums = [{ sortable: false, text: '币别', dataIndex: 'CURR', width: 100, align: 'center' }, { sortable: false, text: '调整汇率', dataIndex: 'FCYEXRATE', width: 118, align: 'right', renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 5, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, editor: { xtype: 'numberfield', selectOnFocus: true, //得到焦点时自动选择文本 allowDecimals: true, //允许输入小数 decimalPrecision: 5, //允许保留的小数位数,并四舍五入 nanText: '请输入有效数值', hideTrigger: true //是否隐藏上下调节按钮 } }]; //#endregion //#region gridList列表显示信息 this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 //1单击,2双击 }); this.gridListCw = new Ext.grid.GridPanel({ region: 'center', width: 220, store: this.storeListCw, enableHdMenu: false, //是否显示表格列的菜单 hideHeaders: false, //是否隐藏表头 rowLines: true, columnLines: true, loadMask: { msg: "数据加载中,请稍等..." }, plugins: [this.gridListCellEditing], selType: 'cellmodel', columns: this.girdcolums }); //#endregion //#endregion }, //end initUIComponents InitData: function () { this.opStatus = 'add'; var condition = ''; if (this.ParentWin) { var ret = this.ParentWin.OprationSwap(); this.opStatus = ret[0]; this.StoreList = ret[1]; this.editRecord = ret[2]; } if (this.opStatus == 'edit') condition = " BILLNO='" + this.editRecord.get('BILLNO') + "'"; this.LoadData(this.opStatus, condition); }, //end InitData LoadData: function (opstatus, condition) { this.serialNo = 0; this.workSerialNo = 0; this.bodyDel = []; this.opStatus = opstatus; var billno = '*'; if (this.opStatus == 'edit') { billno = this.editRecord.get('BILLNO'); }; _this = this; Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/Account/Chfee_settlement/GetData', params: { handle: opstatus, condition: condition }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } var data = result.data; _this.formEdit.getForm().findField('BILLSTATUS').setDisabled(false); _this.formEdit.getForm().findField('SETTLEUSERREF').setDisabled(false); _this.formEdit.getForm().reset(); _this.formACCOUNTS.getForm().reset(); _this.formPREPAY.getForm().reset(); _this.formAHSR.getForm().reset(); _this.formFINANCIAL.getForm().reset(); _this.formADVANCE.getForm().reset(); _this.formEdit.getForm().setValues(data); _this.formACCOUNTS.getForm().setValues(data); _this.formPREPAY.getForm().setValues(data); _this.formAHSR.getForm().setValues(data); _this.formFINANCIAL.getForm().setValues(data); _this.formADVANCE.getForm().setValues(data); _this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true); _this.formEdit.getForm().findField('SETTLEUSERREF').setDisabled(true); //_this.GetEditStatus(); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); _this.storeBodyList.load({ params: { condition: " BILLNO='" + billno + "'" }, callback: function (r, options, success) { if (success) { if (_this.storeBodyList.getCount() > 0) { _this.comboxCurr.setReadOnly(true); _this.comboxCustCode.setReadOnly(true); } else { _this.comboxCurr.setReadOnly(false); _this.comboxCustCode.setReadOnly(false); } } }, scope: this }); this.storeBodySum.load({ params: { condition: " BILLNO='" + billno + "'"} }); this.storePaymentList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: "BILLNO='" + billno + "'" }, callback: function (r, options, success) { if (success) { if (this.storePaymentList.getCount() > 0) { var member = this.storePaymentList.getAt(0); if (member.data.ISVOU) { this.formACCOUNTS.getForm().findField('ACCOUNTS_MONEY').readOnly = true; this.formPREPAY.getForm().findField('PREPAY_MONEY').readOnly = true; } } } }, scope: this }); // this.storeFeeList.load({ params: { condition: " DUINO='" + billno + "'"} }); }, // end LoadDate //#region 生成凭证 onAddCwVouchers: function (button, event) { var billNo = this.formEdit.getForm().findField('BILLNO').value; if (billNo == '*' || billNo == '') { Ext.Msg.show({ title: '提示', msg: '请先保存单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } // // var strGids = ""; // var VOUCHERNO = this.formEdit.getForm().findField('VOUCHERNO').value; //凭证号 // var BILLSTATUS = this.formEdit.getForm().findField('BILLSTATUS').value; //是否锁定 // var SETTLETYPEREF = this.formEdit.getForm().findField('SETTLETYPE').value; //结算方式 // var ACCOUNTREF = this.formEdit.getForm().findField('ACCOUNT').value; //结算账户 // if (VOUCHERNO == "" && BILLSTATUS == 1 && ((SETTLETYPEREF != "现金" && ACCOUNTREF != "") || SETTLETYPEREF == "现金")) { // strGids = this.editRecord.data.GID.toString(); // } // if (strGids == "") { // Ext.Msg.show({ title: '提示', msg: '请选择已锁定、结算账户不为空(结算方式为现金除外),且未生成凭证的单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); // return; // } // this.storeListCw.load({ params: { strGids: strGids }, waitMsg: "正在刷新数据...", scope: this }); // this.showContactForm(false, strGids, this); // Ext.Ajax.request({ waitMsg: '正在预读数据,请稍候...', url: '/Account/Chfee_settlement/GetIsVoucher', params: { strGids: this.editRecord.data.GID.toString() }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } // this.storeListCw.load({ params: { strGids: this.editRecord.data.GID.toString() }, waitMsg: "正在刷新数据...", scope: this }); this.showContactForm(false, this.editRecord.data.GID.toString(), this); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, //#endregion //#region 层_显示信息 showContactForm: function (win, strGids, _this) { var required = '*'; if (!win) { //#region 编辑formDiv 基本信息 var formDiv = Ext.widget('form', { border: false, bodyPadding: 10, fieldDefaults: { labelAlign: 'right', labelWidth: 60, labelStyle: 'font-weight:bold' }, items: [this.comboxPREPARED, { fieldLabel: '记账日期', format: 'Y-m-d', xtype: 'datefield', allowBlank: false, name: 'VOUDATE', value: Ext.util.Format.date(Ext.Date.add(new Date(), Ext.Date.MONTH - 1, 1), "Y-m-d") }, this.comboxVKNO //需求编号:SR2017080200007 , { xtype: "checkbox", //checkbox控件 name: "ButtSettlement", boxLabel: "对抵结算是否生成银行账款", width: 200, inputValue: "true", //选中的值 uncheckedValue: "false" //未选中的值 }, { xtype: "checkbox", //checkbox控件 name: "ISRATE", boxLabel: "是否按照系统录入汇率", width: 200, inputValue: "true", //选中的值 uncheckedValue: "false", //未选中的值 checked: true, //绘制时的选中状态, listeners: { 'change': function (field, newValue, oldValue, eOpts) { if (field.checked.toString() == "false") { this.gridListCw.show(); } else { this.gridListCw.hide(); } }, scope: this } }, this.gridListCw ], buttons: [{ text: '生成凭证', handler: function (options, success, response) { if (!this.up('form').getForm().isValid()) { return; } var dataDiv = this.up('form').getForm().getValues(false, false, false); // var j = 0; var bodydatas = []; for (var i = 0; i < _this.storeListCw.getCount(); i += 1) { var member = _this.storeListCw.getAt(i); bodydatas.push(member); } var jsonBody; if (bodydatas.length > 0) { jsonBody = ConvertRecordsToJsonAll(bodydatas); } // Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/Account/Chfee_settlement/onAddCwVouchers', scope: this, params: { strGids: strGids, dataDiv: Ext.JSON.encode(dataDiv), jsonBody: jsonBody }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.MessageBox.INFO, buttons: Ext.Msg.OK }); //刷新页面 var billno = _this.formEdit.getForm().findField('BILLNO').getValue(); Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/Account/Chfee_settlement/GetData', params: { handle: 'edit', condition: " BILLNO='" + billno + "'" }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } var data = result.data; _this.formEdit.getForm().findField('BILLSTATUS').setDisabled(false); _this.formEdit.getForm().reset(); _this.formEdit.getForm().setValues(data); _this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true); var editp = Ext.create('MsChSettlement', data); _this.editRecord.fields.each(function (field) { if (field.persist) { name = field.name; if (name != 'id') this.editRecord.set(name, editp.get(name)); } }, this); _this.editRecord.commit(); //_this.GetEditStatus(); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); //Ext.getCmp('btnAddCwVouchers').setText("撤销凭证"); return; } 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 }); } } }); // this.up('form').getForm().reset(); this.up('window').hide(); } }, { text: '取消', handler: function () { this.up('form').getForm().reset(); this.up('window').hide(); } }], listeners: { scope: this, 'render': function (thisDiv, thisExtend) { //var ISRATE = thisDiv.form.findField('ISRATE').getValue().toString(); //if (ISRATE == "false") { // this.gridListCw.show(); //} //else { // this.gridListCw.hide(); //} this.gridListCw.hide(); // Ext.Ajax.request({ waitMsg: '正在查询委托编号状态...', url: '/MvcShipping/MsBaseInfo/GetCwVOUNO', params: { VKNO: "记" }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.MessageBox.INFO, buttons: Ext.Msg.OK }); return; } // data = result.data; var arrayList = new Array(); arrayList = data.split("~"); var strY = arrayList[0].toString(); var strM = arrayList[1].toString(); var sVOUNO = arrayList[2].toString(); var strVOUNO = arrayList[3].toString(); var strVOUDATE = arrayList[4].toString(); var strACCDATE = arrayList[5].toString(); // thisDiv.form.findField('VOUDATE').setValue(strVOUDATE); thisDiv.form.findField('VOUDATE').setMinValue(strACCDATE + "-01"); //Ext.getCmp('VOUDATE').setValue(strVOUDATE); //Ext.getCmp('VOUDATE').setMinValue(strACCDATE + "-01"); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); } } }); //#endregion win = Ext.widget('window', { title: '辅助核算', closeAction: 'hide', width: 250, height: 250, layout: 'fit', resizable: true, modal: true, closable: false, items: formDiv }); } win.show(); } //#endregion });