Ext.namespace('Shipping'); Shipping.MsOpCtnBsCardProfitIndex = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsOpCtnBsCardProfitIndex.superclass.constructor.call(this); }; Ext.extend(Shipping.MsOpCtnBsCardProfitIndex, Ext.Panel, { OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, sqlcontext: '', PageSize: 100, sortfield: '', sortdire: '', initUIComponents: function () { this.formname = "formMsOpCtnBsCardProfitIndex"; //页面名称 Ext.Ajax.timeout = 120000; //定义数据集 this.storeList = Ext.create('Ext.data.Store', { model: 'MsOpCtnBsCard', pageSize: this.PageSize, remoteSort: true, proxy: { type: 'ajax', timeout: 120000, url: '/MvcContainer/MsOpCtnBsCard/GetDataFeeList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, { width: 30 }); this.Pagenum = Ext.create('Ext.form.field.Number', { name: 'bottles', fieldLabel: '每页记录数', labelAlign: 'right', value: this.PageSize, maxValue: 100000, width: 170, minValue: 0, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }) this.initgirdcolums = [{ sortable: true, id: '', dataIndex: '', header: '', width: 0 }, { sortable: true, dataIndex: 'GID', header: 'GID', hidden: true, width: 120 }, { sortable: true, dataIndex: 'COMPANYID', header: 'COMPANYID', hidden: true, width: 120 }, { sortable: true, dataIndex: 'PORTLOAD', header: '起运港', width: 200 }, { sortable: true, dataIndex: 'DESTPORT', header: '目的港', width: 130 }, { sortable: true, dataIndex: 'CTNNO', header: '罐号', width: 100 }, { sortable: true, dataIndex: 'CUSTNO', header: '委托编号', width: 120 }, { sortable: true, dataIndex: 'CUSTOMERNAME', header: '委托单位', width: 200 }, { sortable: true, dataIndex: 'GOODSNAME', header: '货物名称', width: 100 }, { sortable: true, dataIndex: 'AGENTNAME', header: '代理', width: 100 }, { sortable: true, dataIndex: 'LINES', header: '线路', width: 200 }, { sortable: true, dataIndex: 'PORTLOAD_CNT_TIME', header: '提箱日期', width: 100 }, { sortable: true, dataIndex: 'ETD', header: '开船日期', width: 100 }, { sortable: true, dataIndex: 'RTCNT_TIME', header: '空罐返场站日期', width: 100 }, { sortable: true, dataIndex: 'NPORTLOAD_CNT_TIME', header: '下循环提箱日期', width: 100 }, { sortable: true, dataIndex: 'NETD', header: '下循环开船日期', width: 100 }, { sortable: true, dataIndex: 'CYCLE_CNTDAY', header: '闲置天数', width: 100 }, { sortable: true, dataIndex: 'CYCLE_DAY', header: '周期', width: 100 }, { sortable: true, dataIndex: 'APPLYNO', header: '放箱申请单号', width: 100 }, { sortable: true, dataIndex: 'GXFUSDDR', text: '罐箱收入', 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: 'XSFDRTTLINUSD', text: '超期箱使费收入', 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: 'HDFDR', text: '换单费收入', 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: 'OTDRTTLINUSD', text: '其他收入', 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: 'TTLCRINUSD', text: '成本', 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: 'PROFITINUSD', text: '总租金收入', 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: 'DAYPROFITINUSD', text: '日租金收入', 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: 'RENTPROFITINUSD', text: '实际租金', 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: 'OPPROFITINUSD', text: '租金盈亏', 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: 'OILXS', text: '燃油系数', 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: 'IS_RETURE_EMPTY', header: '是否返空', width: 100 }, { sortable: true, dataIndex: 'IMPFEESTATUS', header: '有未引入费用', width: 140 }, { sortable: true, dataIndex: 'N_FACTRY', header: '送货工厂', width: 100 }, { sortable: true, dataIndex: 'N_FACTRYADDR', header: '送货地址', width: 100 }, { sortable: true, dataIndex: 'N_DELIVERYDATE', header: '送货时间', width: 100 }, { sortable: true, dataIndex: 'BSNO', header: '业务编号', width: 200 }, { sortable: true, dataIndex: 'MBLNO', header: '主提单号', width: 200 }, { sortable: true, dataIndex: 'PORTLOAD_FREE_DAYS', header: '起运港免箱使天数', width: 100 }, { sortable: true, dataIndex: 'PORTLOAD_OVER_DAYS', header: '起运港超期天数', width: 100 }, { sortable: true, dataIndex: 'PORTLOAD_OVER_DAYS_FEE', header: '起运港箱使费/天', width: 100 }, { sortable: true, dataIndex: 'PORTLOAD_OVER_DAYS_AMT', header: '起运港箱使费', width: 100 }, { sortable: true, dataIndex: 'PORTLOAD_STATOIN', header: '起运港场站', width: 200 }, { sortable: true, dataIndex: 'DESTPORT_FREE_DAYS', header: '目的港免箱使天数', width: 100 }, { sortable: true, dataIndex: 'DESTPORT_OVER_DAYS', header: '目的港超期天数', width: 100 }, { sortable: true, dataIndex: 'DESTPORT_OVER_DAYS_FEE', header: '目的港箱使费/天', width: 100 }, { sortable: true, dataIndex: 'DESTPORT_OVER_DAYS_AMT', header: '目的港箱使费', width: 100 }, { sortable: true, dataIndex: 'DESTPORT_STATOIN', header: '目的港场站', width: 200 }, { sortable: true, dataIndex: 'I_CUSTNO', header: '空返委托编号', width: 100 }, { sortable: true, dataIndex: 'I_MBLNO', header: '空返提单号', width: 120 }, { sortable: true, dataIndex: 'I_PORTLOAD_CNT_TIME', header: '空返起运港提箱日期', width: 100 }, { sortable: true, dataIndex: 'I_PORTLOAD', header: '空返起运港', width: 100 }, { sortable: true, dataIndex: 'I_DESTPORT', header: '空返目的港', width: 100 }, { sortable: true, dataIndex: 'I_DEST_CNT_TIME', header: '空返目的港提箱日期', width: 100 }, { sortable: true, dataIndex: 'I_DEST_RTCNT_TIME', header: '空返目的港还箱日期', width: 100 }, { sortable: true, dataIndex: 'I_ETD', header: '空返开船日期', width: 100 }, { sortable: true, dataIndex: 'I_ETA', header: '空返到港日期', width: 100 }, { sortable: true, dataIndex: 'ETDSTATUS', header: '开船日期超期', width: 140, renderer: function (value, meta, record) { var acolor = '#000000'; if (value === '超期') { acolor = '#B87070'; } else { acolor = ' #000000'; } returnValue = '' + value + ''; return returnValue; } }, { sortable: true, dataIndex: 'ISSHORTRENTCTN', header: '短租箱', width: 100 }, { sortable: true, dataIndex: 'ETA', header: '到港日期', width: 100 }, { sortable: true, dataIndex: 'CUR_DATE', header: '当前时间', width: 100 }, { sortable: true, dataIndex: 'OP', header: '操作', width: 200 }, { sortable: true, dataIndex: 'SALE', header: '揽货人', width: 100 } ]; this.girdcolums = this.initgirdcolums; this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); _this = this; //定义Grid this.gridList = new Ext.grid.GridPanel({ store: this.storeList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, selModel: this.GridCheckBoxModel, columns: this.girdcolums , // paging bar on the bottom bbar: [Ext.create('Ext.PagingToolbar', { store: this.storeList, displayInfo: true, displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录', emptyMsg: "没有数据" }), this.Pagenum] }); this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id,表名,中间column数组,跳过一开始的几列 this.girdcolums.unshift(new Ext.grid.RowNumberer()); this.gridList.reconfigure(this.storeList, this.girdcolums); this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) { this.SelectedRecord = record; this.OprationStatus = 'edit'; DsOpenEditWin('/MvcContainer/MsOpCtnBsCard/CtnStatusEdit', record.data.GID); }, this); // this.gridList.columns[1] = new Ext.grid.RowNumberer(); //#region formSearch 查询面板 _this = this; //客户加载_委托单位 this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} }); //委托单位 _this = this; this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '委托单位', store: this.storeCustCode, forceSelection: true, name: 'CUSTOMERNAME', valueField: 'CustName', displayField: 'CodeAndName', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.StoreDateType = Ext.create('Ext.data.Store', { fields: ['ID', 'NAME'] }); this.StoreDateType.add({ "ID": "CNT", "NAME": "提箱日期" }); this.StoreDateType.add({ "ID": "ETD", "NAME": "开船日期" }); this.comboxDateType = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '周期计算', store: this.StoreDateType, forceSelection: true, name: 'DATETYPE', value:'ETD', valueField: 'ID', displayField: 'NAME', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.storeListGood = Ext.create('Ext.data.Store', { model: 'MsCodeMSDS', remoteSort: true, proxy: { type: 'ajax', url: '/MvcContainer/MsCodeMSDS/GetDataListRm', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.comboxGoods = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeListGood, fieldLabel: '品名', queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', // forceSelection: true, name: 'GOODSNAME', valueField: 'CHEMICALCGOODSNAME', displayField: 'GOODNAMEANDCNAME', listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.formSearch = Ext.widget('form', { frame: true, region: 'center', bodyPadding: 5, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 60, msgTarget: 'qtip' }, items: [{//fieldset 1 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '箱号', name: 'CTNNO', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '编号', name: 'BSNO', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, this.comboxCustCode, { fieldLabel: '开船日期', format: 'Y-m-d', xtype: 'datefield', name: 'ETDbgn', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '到', format: 'Y-m-d', xtype: 'datefield', name: 'ETDend', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } },this.comboxDateType,{ xtype: 'button', width: 90, text: "执行查询", iconCls: "btnrefresh", handler: function (button, event) { this.onRefreshClick(button, event); }, scope: this }, { xtype: 'button', width: 90, text: "高级查询", iconCls: "btnmore", handler: function (button, event) { var sql = this.getCondition(); var winAccess = new Shipping.DsQuery({ }); winAccess.StoreList = this.storeList; winAccess.formname = this.formname; winAccess.condition = sql; winAccess.show(); return; }, scope: this }] } ]//end items(fieldset 1) }]//end root items }); //#endregion formSearch //查询工具条 this.panelBtn = new Ext.Panel({ region: "north", tbar: [ { text: "执行查询", iconCls: "btnrefresh", handler: function (button, event) { this.onRefreshClick(button, event); }, scope: this }, { text: "重置条件", iconCls: "btnreset", handler: function (button, event) { }, scope: this }, '-', { text: "打印", iconCls: 'btnprint', menu: [ { text: "全部", handler: function (menu, event) { _this.Print(); } }, { text: "选择打印", handler: function (menu, event) { _this.PrintSelect(); } }], scope: this }, '-', { text: "保存列表样式", id: "btntest", menu: [ { text: "保存", handler: function (button, event) { this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.girdcolums, 1, true); } }, { text: "初始化", handler: function (menu, event) { _this.InitGrid(_this.initgirdcolums); _this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.initgirdcolums, 1, true); } }], scope: this }, '-', { text: "导出Excel", id: "btnExportExcel", iconCls: 'btnexportexcel', handler: function (button, event) { this.onExportClick(button, event); }, scope: this } ] }); this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 75, items: [this.formSearch, this.panelBtn] }); Ext.apply(this, { items: [this.panelTop, this.gridList] }); this.sqlcontext =''; this.storeList.on('beforeload', function (store) { var datetype = this.formSearch.getForm().findField('DATETYPE').getValue(); Ext.apply(store.proxy.extraParams, { condition: _this.sqlcontext,datatype:datetype }); }, this); this.onRefreshClick(); }, //end initUIComponents InitGrid: function (grid) { var agirdcolums = grid; this.gridList.reconfigure(this.storeList, agirdcolums); }, onRefreshClick: function (button, event) { var sql = this.getCondition(); this.sqlcontext = sql; this.PageSize = this.Pagenum.getValue(); this.storeList.pageSize = this.PageSize; var datetype = this.formSearch.getForm().findField('DATETYPE').getValue(); this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql, datetype: datetype }, waitMsg: "正在查询数据...", scope: this }); }, onDsQuery: function () { var sql = this.sqlcontext; var datetype = this.formSearch.getForm().findField('DATETYPE').getValue(); this.PageSize = this.Pagenum.getValue(); this.storeList.pageSize = this.PageSize; this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql, datetype: datetype }, waitMsg: "正在查询数据...", scope: this }); }, getCondition: function () { var form = this.formSearch.getForm(); if (!form.isValid()) { Ext.Msg.alert('提示', '查询条件赋值错误,请检查。'); return ''; } var sql = ''; var BSNO = form.findField('BSNO').getValue(); sql = sql + getAndConSql(sql, BSNO, " (b.BSNO like '%" + BSNO + "%' or b.CUSTNO like '%" + BSNO + "%' or b.I_CUSTNO like '%" + BSNO + "%' or b.MBLNO like '%" + BSNO + "%' ) "); var CTNNO = form.findField('CTNNO').getValue(); sql = sql + getAndConSql(sql, CTNNO, "b.CTNNO like '%" + CTNNO + "%'"); var CUSTOMERNAME = form.findField('CUSTOMERNAME').getValue(); sql = sql + getAndConSql(sql, CUSTOMERNAME, "b.CUSTOMERNAME='" + CUSTOMERNAME + "'"); var expDateBgn = form.findField('ETDbgn').getRawValue(); sql = sql + getAndConSql(sql, expDateBgn, "b.ETD>='" + expDateBgn + "'"); var expDateEnd = form.findField('ETDend').getRawValue(); sql = sql + getAndConSql(sql, expDateEnd, "b.ETD<='" + expDateEnd + " 23:59:59'"); return sql; }, OprationSwap: function () { var ret = new Array(); ret[0] = this.OprationStatus; ret[1] = this.storeList; ret[2] = this.SelectedRecord; return ret; }, onExportClick: function (button, event) { _this = this; if (this.storeList.getCount() == 0) { return; } var bsno = '11111'; var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length != 0) { var record = selections[0]; bsno = record.data.GID; } var datetype = this.formSearch.getForm().findField('DATETYPE').getValue(); var sortstr = ''; if (this.sortfield != '' && this.sortdire != '') { sortstr = this.sortfield + ' ' + this.sortdire; } Ext.Msg.wait('正在组织数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在组织数据...', url: '/MvcContainer/MsOpCtnBsCard/GetDataFeeListStr', scope: this, params: { condition: _this.sqlcontext, printstr: 'true', datetype: datetype, sort: sortstr }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var returnstr = jsonresult.data; var sql1 = returnstr; sql1 = sql1.replace(/\+/g, "@@@") sql1 = sql1.replace(/\>/g, "&&&") sql1 = sql1.replace(/\