//月末结账 Ext.namespace('Shipping'); Shipping.Monthlock = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.Monthlock.superclass.constructor.call(this); }; Ext.extend(Shipping.Monthlock, Ext.Panel, { PageSize: 100, OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, sqlcontext: '1=2', AccDate: null, IsAccDate: '', initUIComponents: function () { //定义数据集 this.storeList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, fields: [ { name: 'BSNO', type: 'string' }, { name: 'OPLB', type: 'string' }, { name: 'OPLBNAME', type: 'string' }, { name: 'BSTYPE', type: 'string' }, { name: 'CUSTOMERNAME', type: 'string' }, { name: 'ACCDATE', type: 'string' }, { name: 'CUSTNO', type: 'string' }, { name: 'MBLNO', type: 'string' }, { name: 'HBLNO', type: 'string' }, { name: 'ETD', type: 'string' }, { name: 'VESSEL', type: 'string' }, { name: 'VOYNO', type: 'string' }, { name: 'INPUTBY', type: 'string' }, { name: 'CREATETIME', type: 'string' }, { name: 'BSSTATUS', type: 'string' }, { name: 'FEESTATUS', type: 'string' }, { name: 'BSSTATUSREF', type: 'string' }, { name: 'FEESTATUSREF', type: 'string' }, { name: 'SALE', type: 'string' }, { name: 'OP', type: 'string' }, { name: 'DOC', type: 'string' }, { name: 'CUSTSERVICE', type: 'string' }, { name: 'PORTLOAD', type: 'string' }, { name: 'PORTDISCHARGE', type: 'string' }, { name: 'CUSTOMNO', type: 'string' }, { name: 'ACCDATE', type: 'string' }, { name: 'CARRIER', type: 'string' }, { name: 'BSSOURCE', type: 'string' }, { name: 'LANE', type: 'string' }, { name: 'FORWARDER', type: 'string' }, { name: 'CNTRTOTAL', type: 'string' }, { name: 'TRADETYPE', type: 'string' }, { name: 'GOODSNAME', type: 'string' }, { name: 'OPDATE', type: 'string' }, { name: 'CUSTOMDATE', type: 'string' }, { name: 'ENTERP', type: 'string' }, { name: 'NETWEIGHT', type: 'number' }, { name: 'KGS', type: 'number' }, { name: 'TEU', type: 'number' }, { name: 'CNTR1', type: 'number' }, { name: 'CNTR2', type: 'number' }, { name: 'CNTR3', type: 'number' }, { name: 'CNTR4', type: 'number' }, { name: 'CNTR5', type: 'number' }, { name: 'CNTR6', type: 'number' }, { name: 'CNTR7', type: 'number' }, { name: 'CNTR8', type: 'number' }, { name: 'CNTR9', type: 'number' }, { name: 'CNTR10', type: 'number' }, { name: 'OTCNTR', type: 'number' }, { name: 'RMBDR', type: 'number' }, { name: 'RMBCR', type: 'number' }, { name: 'USDDR', type: 'number' }, { name: 'USDCR', type: 'number' }, { name: 'OTDR', type: 'number' }, { name: 'OTCR', type: 'number' }, { name: 'TTLDR', type: 'number' }, { name: 'TTLCR', type: 'number' }, { name: 'RMBPROFIT', type: 'number' }, { name: 'USDPROFIT', type: 'number' }, { name: 'OTPROFIT', type: 'number' }, { name: 'TTLPROFIT', type: 'number' }, { name: 'PROFITRATE', type: 'string' } ], remoteSort: true, proxy: { type: 'ajax', url: '/Account/Account_MonthLock/BsListData', reader: { id: '', root: 'data', totalProperty: 'totalCount' } } }); //定义Grid this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); this.gridList = new Ext.grid.GridPanel({ store: this.storeList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, selModel: this.GridCheckBoxModel, columns: [{ sortable: true, dataIndex: 'BSNO', header: '编号', hidden: true, width: 130 }, { sortable: true, id: '', align: 'center', dataIndex: 'BSSTATUSREF', header: '业务锁定', width: 60, renderer: function (value, cellmeta) { if (value == '已锁定') { return ""; } } }, { sortable: true, id: '', align: 'center', dataIndex: 'FEESTATUSREF', header: '费用锁定', width: 60, renderer: function (value, cellmeta) { if (value == '已锁定') { return ""; } } }, { sortable: true, dataIndex: 'OPLBNAME', header: '业务类型', width: 70 }, { sortable: true, dataIndex: 'BSTYPE', header: '运输类型', width: 70 }, { sortable: true, dataIndex: 'ACCDATE', header: '会计期间', width: 86 }, { sortable: true, dataIndex: 'OPDATE', header: '业务日期', width: 86 }, { sortable: true, dataIndex: 'CUSTOMDATE', header: '报关日期', width: 86 }, { sortable: true, dataIndex: 'CUSTOMERNAME', header: '委托单位', width: 120 }, { sortable: true, dataIndex: 'CUSTNO', header: '委托编号', width: 136 }, { sortable: true, dataIndex: 'CUSTOMNO', header: '报关单号', width: 136 }, { sortable: true, dataIndex: 'ENTERP', header: '经营单位', width: 100 }, { sortable: true, dataIndex: 'MBLNO', header: '主提单号', width: 120 }, { sortable: true, dataIndex: 'HBLNO', header: '分提单号', width: 120 }, { sortable: true, dataIndex: 'ETD', header: '开船日期', width: 86 }, { sortable: true, dataIndex: 'VESSEL', header: '船名', width: 200 }, { sortable: true, dataIndex: 'VOYNO', header: '航次', width: 50 }, { sortable: true, dataIndex: 'SALE', header: '业务员', width: 80 }, { sortable: true, dataIndex: 'OP', header: '操作', width: 80 }, { sortable: true, dataIndex: 'PORTLOAD', header: '起运港', width: 80 }, { sortable: true, dataIndex: 'PORTDISCHARGE', header: '目的港', width: 150 }, { sortable: true, dataIndex: 'ACCDATE', header: '会计期间', width: 80 }, { sortable: true, dataIndex: 'CARRIER', header: '船公司', width: 80 }, { sortable: true, dataIndex: 'BSSOURCE', header: '业务来源', width: 120 }, { sortable: true, dataIndex: 'TEU', header: 'TEU', width: 80 }, { sortable: true, dataIndex: 'KGS', header: 'KGS', width: 80 }, { sortable: true, dataIndex: 'GOODSNAME', header: '品名', width: 80 }, { sortable: true, dataIndex: 'RMBDR', header: 'RMB应收', 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: 'RMBCR', header: 'RMB应付', 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: 'RMBPROFIT', header: 'RMB利润', 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: 'USDDR', header: 'USD应收', 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: 'USDCR', header: 'USD应付', 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: 'USDPROFIT', header: 'USD利润', 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: 'OTDR', header: '其他币别应收', 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: 'OTCR', header: '其他币别应付', 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: 'OTPROFIT', header: '其他币别利润', 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: 'TTLDR', header: '合计应收', 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: 'TTLCR', header: '合计应付', 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: 'TTLPROFIT', header: '合计利润', 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: 'PROFITRATE', header: '利润率', width: 80 } ], // paging bar on the bottom bbar: Ext.create('Ext.PagingToolbar', { store: this.storeList, displayInfo: true, displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录', emptyMsg: "没有数据" }) }); this.gridList.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 = "/Account/Chfee_lock/Chfee_lockDetail"; window.open(openUrl, openType, openSet); }, this); this.MonthDate = new Ext.ux.form.MonthField({ fieldLabel: '本次结账期间', xtype: 'monthfield', readOnly: true, name: 'ACCDATE' }); this.panelBtn = new Ext.Panel({ region: "north", tbar: [this.MonthDate, '-', { xtype: 'button', width: 90, text: "月末结账", iconCls: "btnsubmit", handler: function (button, event) { this.onMonthClose(button, event); }, scope: this }, '-', { xtype: 'button', width: 100, text: "月末反结账", handler: function (button, event) { this.onMonthNoClose(button, event); }, scope: this }, '-', { xtype: 'button', width: 100, text: "更改会计期间", handler: function (button, event) { this.onMonthNoClose(button, event); }, scope: this } ] }); this.formAccMonthShow = Ext.widget('form', { frame: true, region: 'center', bodyPadding: 5, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 85, msgTarget: 'qtip' }, items: [ {//fieldset 1 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '会计期间', xtype: 'monthfield', name: 'AccDate' } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ xtype: 'radiogroup', id: 'rLOCKTYPE', defaults: { flex: 1 }, layout: 'hbox', items: [ { boxLabel: '选择', name: 'LOCKTYPE', checked: true, inputValue: 'S', id: 'radio1' }, { boxLabel: '全部', name: 'LOCKTYPE', inputValue: 'A', id: 'radio2' } ] } ] } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); me = this; this.winFeeCloseShow = Ext.create('Ext.window.Window', { title: "更改会计期间", width: 420, //height : 120, //plain : true, iconCls: "addicon", resizable: false, // 是否可以拖动 // draggable:false, collapsible: true, // 允许缩放条 closeAction: 'close', closable: true, modal: 'true', buttonAlign: "center", bodyStyle: "padding:0 0 0 0", items: [this.formAccMonthShow], buttons: [{ text: "确认更改", minWidth: 70, handler: function () { var form = me.formAccMonthShow.getForm(); var cgLOCKTYPE = Ext.getCmp('rLOCKTYPE'); var LOCKTYPE = cgLOCKTYPE.getValue(); me.AccDate = form.findField('AccDate').getRawValue(); if (me.AccDate == '' || me.AccDate == null || me.AccDate == undefined) { Ext.Msg.show({ title: '提示', msg: '必须会计期间!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; var monthdate = _this.MonthDate.getValue() var gaccdate = form.findField('AccDate').getValue(); if (gaccdate