/**箱使费报表国内部分***/ Ext.namespace('Shipping'); Shipping.MsOpCtnFeeReportIndex = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsOpCtnFeeReportIndex.superclass.constructor.call(this); }; Ext.extend(Shipping.MsOpCtnFeeReportIndex, Ext.Panel, { OpStatus: null, //仅当弹出界面时使用 SelectedRecord: null, initUIComponents: function () { //定义数据集 this.storeList = Ext.create('Ext.data.Store', { model: 'MsOpCtnFeeReport', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsOpCtnFeeReportIn/GetDataList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.RPTCB = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true }); //定义Grid this.gridList = new Ext.grid.GridPanel({ store: this.storeList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据 加载中,请稍等..." }, trackMouseOver: true, selModel: this.RPTCB, disableSelection: false, columns: [{ sortable: false, dataIndex: 'MBLNO', header: '提单号', width: 160 }, { sortable: false, dataIndex: 'XiangXing', header: '箱型', width: 160 }, { sortable: false, dataIndex: 'TEU', header: 'TEU', width: 100 }, { sortable: false, dataIndex: 'XiangHao', header: '箱号', width: 100 }, { sortable: false, dataIndex: 'MuDiGang', header: '起始港', width: 160 }, { sortable: false, dataIndex: 'KongXiangChuChangRiQi', header: '空箱出场日期', width: 160 }, { sortable: false, dataIndex: 'ZhuangChuanRiQi', header: '装船日期', width: 160 }, { text: '用箱时间', columns: [{ sortable: false, dataIndex: 'YongXiangShiJianGangNei', header: '港内', width: 160 }, { sortable: false, dataIndex: 'YongXiangShiJianGangWai', header: '港外', width: 160 }] } , { text: '免箱使', columns: [ { sortable: false, dataIndex: 'MianXiangShiGangNei', header: '港内', width: 160 }, { sortable: false, dataIndex: 'MianXiangShiGangWai', header: '港外', width: 160 } ] }, { text: '超期时间', columns: [{ sortable: false, dataIndex: 'ChaoQiShiJianGangNei', header: '港内', width: 160 }, { sortable: false, dataIndex: 'ChaoQiShiJianGangWai', header: '港外', width: 160 }] }, { text: '超期费用', columns: [{ sortable: false, dataIndex: 'ChaoQiFeiYongGangNei', header: '港内', width: 160 }, { sortable: false, dataIndex: 'ChaoQiFeiYongGangWai', header: '港外', width: 160 }] }, { sortable: false, dataIndex: 'HeJi', header: '超期箱使费合计', width: 160 } ] }); this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) { // this.SelectedRecord = record; // this.OpStatus = 'edit'; // DsOpenEditWin('/MvcShipping/MsOpCtnFeeSearch/Edit'); }, this); //#region formSearch //#region formSearch枚举参照相关 //#endregion this.storeMuDiGang = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeDisportModel', proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportListRm' } }); this.comboxMuDiGang = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '起始港', //'起始港', store: this.storeMuDiGang, id: 'MuDiGang', name: 'MuDiGang', //forceSelection: true, valueField: 'EDICODE', queryMode: 'remote', minChars: 1, queryParam: 'PORT', displayField: 'CodeAndName' }); this.formSearch = Ext.widget('form', { frame: true, region: 'center', 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.comboxMuDiGang, { fieldLabel: '装船日期(从)', name: 'DaoGangRiQiFrom', format: 'Y-m-d', xtype: 'datefield' }, { fieldLabel: '装船日期(到)', name: 'DaoGangRiQiTo', format: 'Y-m-d', xtype: 'datefield' }, { fieldLabel: '对账客户', name: 'DuiZhangKeHu' }, { xtype: 'hidden' }, { xtype: 'hidden' } ] } ]//end items(fieldset 1) }//end 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: "对账", handler: function (button, event) { this.DuiZhang(); }, scope: this } ] }); this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 80, items: [this.formSearch, this.panelBtn] }); Ext.apply(this, { items: [this.panelTop, this.gridList] }); this.storeList.on('beforeload', function (store) { var sql = this.getCondition(); Ext.apply(store.proxy.extraParams, { condition: sql }); }, this); }, //end initUIComponents onRefreshClick: function (button, event) { var sql = this.getCondition(); this.storeList.load({ params: { start: 0, limit: 500, sort: '', condition: sql }, waitMsg: "正在查询数据...", scope: this }); }, getCondition: function () { var form = this.formSearch.getForm(); if (!form.isValid()) { Ext.Msg.alert('提示', '查询条件赋值错误,请检查。'); return ''; } var sql = ''; var MuDiGang = this.comboxMuDiGang.getValue(); if (MuDiGang != '' && MuDiGang != null) { sql = sql + getAndConSql(sql, MuDiGang, " (box_no in (select box_no from container_business where cz = '" + MuDiGang + "' and jcyy='装船')) "); } var timeP1 = '(box_no in (select box_no from container_business where 1=1 ' var timeP2 = ''; var timeP3 = ''; var DaoGangRiQiFrom = form.findField('DaoGangRiQiFrom').getRawValue(); if (DaoGangRiQiFrom != '' && DaoGangRiQiFrom != null) { timeP2 += " jctime >= '" + DaoGangRiQiFrom + "'"; // sql = sql + getAndConSql(sql, DaoGangRiQiFrom, " jctime >= '" + DaoGangRiQiFrom + "'"); } var DaoGangRiQiTo = form.findField('DaoGangRiQiTo').getRawValue(); if (DaoGangRiQiTo != '' && DaoGangRiQiTo != null) { timeP3 += " jctime <= '" + DaoGangRiQiTo + "'"; //sql = sql + getAndConSql(sql, DaoGangRiQiTo, " jctime <= '" + DaoGangRiQiTo + "'"); } var timeSql = timeP1 + (timeP2 == '' ? '' : 'and ' + timeP2) + (timeP3 == '' ? '' : 'and ' + timeP3) + ' and jcyy=\'装船\'))'; return sql; }, OprationSwap: function () { var ret = new Array(); ret[0] = this.OpStatus; ret[1] = this.storeList; ret[2] = this.SelectedRecord; return ret; }, DuiZhang: function () { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择记录!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var selectedRecords = []; selectedRecords = this.gridList.selModel.getSelection(); var selectStores = []; for (var i = 0; i < selectedRecords.length; i++) { selectStores.push(selectedRecords[i].data); } var msg = '确定进行入账操作?'; Ext.MessageBox.confirm('提示', msg, function (btn) { if (btn == 'yes') { Ext.Msg.wait('正在操作...'); Ext.Ajax.request({ waitMsg: '正在操作...', url: '/MvcShipping/MsOpCtnFeeReportIn/RuZhang', params: { data: Ext.JSON.encode(selectStores) }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { this.storeList.remove(record); 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 } }, this); } });