//欠费统计 Ext.namespace('Shipping'); Shipping.MsRptZjTotalIndex = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsRptZjTotalIndex.superclass.constructor.call(this); }; Ext.extend(Shipping.MsRptZjTotalIndex, Ext.Panel, { PageSize: 100, OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, sqlcontext: '1=2', bslistdrsortfield: '', bslistdrsortdire: '', bslistcrsortfield: '', bslistcrsortdire: '', feelistdrsortfield: '', feelistdrsortdire: '', initUIComponents: function () { //定义数据集 Ext.Ajax.timeout = 12000000; this.formname = 'MsRptZjTotalIndex'; this.sqlcontext = '1=2'; this.storeList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, fields: [ { name: 'BSNO', type: 'string' }, { name: 'OPLB', type: 'string' }, { name: 'OPLBNAME', type: 'string' }, { name: 'ORDERNO', type: 'string' }, { name: 'BSTYPE', type: 'string' }, { name: 'BLTYPE', type: 'string' }, { name: 'CUSTOMERNAME', 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: 'YARD', type: 'string' }, { name: 'INPUTBY', type: 'string' }, { name: 'CREATETIME', type: 'string' }, { name: 'BSSTATUSREF', type: 'string' }, { name: 'FEESTATUSREF', type: 'string' }, { name: 'DRFEESTATUSREF', type: 'string' }, { name: 'CRFEESTATUSREF', type: 'string' }, { name: 'BLISSUESTATUS', 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: 'DESTINATION', type: 'string' }, { name: 'CUSTOMNO', type: 'string' }, { name: 'ACCDATE', type: 'string' }, { name: 'CARRIER', type: 'string' }, { name: 'BSSOURCE', type: 'string' }, { name: 'CNTRTOTAL', type: 'string' }, { name: 'OPDATE', type: 'string' }, { name: 'CUSTOMDATE', type: 'string' }, { name: 'STLDRDATE', type: 'string' }, { name: 'STLCRDATE', type: 'string' }, { name: 'ZYDAY', 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: 'TTLTAXDR', type: 'number' }, { name: 'TTLTAXCR', type: 'number' }, { name: 'TTLTAXPROFIT', type: 'number' }, { name: 'RMBPROFIT', type: 'number' }, { name: 'USDPROFIT', type: 'number' }, { name: 'OTPROFIT', type: 'number' }, { name: 'TTLPROFIT', type: 'number' }, { name: 'STLRMBDR', type: 'number' }, { name: 'STLUSDDR', type: 'number' }, { name: 'STLOTDR', type: 'number' }, { name: 'STLTTLDR', type: 'number' }, { name: 'STLRMBCR', type: 'number' }, { name: 'STLUSDCR', type: 'number' }, { name: 'STLOTCR', type: 'number' }, { name: 'STLTTLCR', type: 'number' }, { name: 'ZJZYF', type: 'number' }, { name: 'ExceedDays', type: 'number' } ], remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsRptOpProfit/ZjZyListData', reader: { id: '', root: 'data', totalProperty: 'totalCount' } } }); //定义Grid this.Pagenum = Ext.create('Ext.form.field.Number', { name: 'bottles', fieldLabel: '每页记录数', labelAlign: 'right', value: this.PageSize, maxValue: 100000, width: 170, minValue: 0 }) this.initgirdcolums = [{ sortable: true, dataIndex: 'OPLBNAME', text: '业务类型', width: 70 }, { sortable: true, dataIndex: 'BSTYPE', text: '运输类型', width: 70 }, { sortable: true, dataIndex: 'BLTYPE', text: '装运方式', width: 70 }, { sortable: true, dataIndex: 'ETD', text: '开船日期', width: 86 }, { sortable: true, dataIndex: 'CUSTOMERNAME', text: '委托单位', width: 120 }, { sortable: true, dataIndex: 'CUSTNO', text: '委托编号', width: 136 }, { sortable: true, dataIndex: 'FEESTATUSREF', text: '费用锁定', width: 68 }, { sortable: true, dataIndex: 'MBLNO', text: '主提单号', width: 120 }, { sortable: true, dataIndex: 'HBLNO', text: '分提单号', width: 120 }, { sortable: true, dataIndex: 'VESSEL', text: '船名', width: 200 }, { sortable: true, dataIndex: 'VOYNO', text: '航次', width: 50 }, { sortable: true, dataIndex: 'SALE', text: '揽货人', width: 80 } , { sortable: true, dataIndex: 'OP', text: '操作', width: 80 }, { sortable: true, dataIndex: 'PORTLOAD', text: '起运港', width: 80 }, { sortable: true, dataIndex: 'PORTDISCHARGE', text: '卸货港', width: 150 }, { sortable: true, dataIndex: 'DESTINATION', text: '目的地', width: 150 }, { sortable: true, dataIndex: 'ACCDATE', text: '会计期间', width: 80 }, { sortable: true, dataIndex: 'CARRIER', text: '船公司', width: 80 }, { sortable: true, dataIndex: 'CNTRTOTAL', text: '箱型箱量', width: 120 } , { sortable: true, dataIndex: 'RMBDR', text: '应收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', text: '应付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', text: '应收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', text: '应付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: 'STLRMBDR', text: '已收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: 'STLUSDDR', text: '已收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: 'STLRMBCR', text: '已付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: 'STLUSDCR', text: '已付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: 'STLDRDATE', text: '收款时间', width: 120 }, { sortable: true, dataIndex: 'STLCRDATE', text: '最早付款时间', width: 120 }, { sortable: true, dataIndex: 'ZYDAY', text: '资金占用时间差', width: 120 }, { sortable: true, dataIndex: 'ZJZYF', text: '资金占用费', align: 'right', width: 120 } ]; this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname , this.initgirdcolums, 1); this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); this.gridList = new Ext.grid.GridPanel({ store: this.storeList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, selModel: this.GridCheckBoxModel, viewConfig: { enableTextSelection: true, //允许复制数据 autoFill: true }, disableSelection: false, 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.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.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 = ""; openUrl = "../../MvcShipping/MsOpBill/MsOpFeeView?handle=check&bsno=" + record.data.BSNO; window.open(openUrl, openType, openSet); }, this); this.gridList.addListener('sortchange', function (ct, column, direction, eOpts) { this.feelistdrsortfield = column.dataIndex; this.feelistdrsortdire = direction; }, this); //#region formSearch //#region formSearch枚举参照相关 _this = this; this.comboxOp = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '操 作', store: this.storeSalesCode, forceSelection: true, name: 'PS_OP', valueField: 'UserName', displayField: 'CodeAndName', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.storeLANE = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.Lane', proxy: { url: '/CommMng/BasicDataRef/GetCodeLaneList' } }); this.storeLANE.load(); this.comboxLANE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '航线', //'航线', store: this.storeLANE, // forceSelection: true, name: 'LANE', valueField: 'LANE', displayField: 'LANE' }); //客户加载_船公司 this.storeCARRIER = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListCARRIER' } }); //船公司 this.comboxCARRIER = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '船公司', //'船公司', store: this.storeCARRIER, // labelWidth: 48, // flex: 0.7, forceSelection: true, queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', name: 'CARRIER', valueField: 'CustName', displayField: 'CodeAndName', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListController' } }); this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel:'委托单位', store: this.storeCustCode, name: 'PS_CUSTOMERNAME', queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', valueField: 'CustName', displayField: 'CodeAndName', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); //是否生成凭证 //#endregion 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: 'PS_MBLNO', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, this.comboxCustCode,this.comboxOp, this.comboxLANE, this.comboxCARRIER ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ { fieldLabel: '从ETD', format: 'Y-m-d', xtype: 'datefield', name: 'PS_ETDDATEBGN', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '到ETD', format: 'Y-m-d', xtype: 'datefield', name: 'PS_ETDDATEEND', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '会计期间', xtype: 'monthfield', name: 'PS_ACCDATEBGN', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '至', xtype: 'monthfield', name: 'PS_ACCDATEEND', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { xtype: 'hiddenfield' } ] } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); //#endregion formSearch //查询工具条 this.CheckSaveQuery = new Ext.form.Checkbox({ fieldLabel: '记忆查询条件', checked: true, width: 120 }); _this = this; this.SearchBtn = new Ext.Button({ text: '隐藏查询', handler: function () { if (_this.SearchBtn.text == '隐藏查询') { _this.panelSearch.hide(); _this.SearchBtn.setText("显示查询"); } else { _this.panelSearch.show(); _this.SearchBtn.setText("隐藏查询"); } } }); this.panelBtn = new Ext.Panel({ region: "north", tbar: [ { text: "执行查询", iconCls: "btnrefresh", id: "btnrefresh", handler: function (button, event) { this.onRefreshClick(button, event); var isvisible = true; var issavevalue = false; if (_this.SearchBtn.text == '隐藏查询') isvisible = true else isvisible = false; if (this.CheckSaveQuery.checked) issavevalue = true saveQuerySetting(this.formname, this.formSearch, isvisible, issavevalue); }, scope: this }, { text: "导出Excel", id: "btnExportExcel", iconCls: 'btnexportexcel', handler: function (button, event) { _this.onExportClick(button, event); }, scope: this }, '-', { text: "打印", iconCls: 'btnprint', handler: function (button, event) { this.Print(); }, scope: this }, '-', this.SearchBtn, { xtype: 'button', width: 90, text: "清空条件", iconCls: "btnreset", handler: function (button, event) { this.onClearSql(button, event); }, scope: this }, this.CheckSaveQuery, '-', { text: "保存列表样式", id: "btntest", menu: [ { text: "保存列表", handler: function (button, event) { _this.onSaveGridClick(button, event); } }, { text: "刷新列表", handler: function (button, event) { _this.oninitGridClick(button, event); } }], scope: this } ] }); this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 29, items: [this.panelBtn] }); this.panelSearch = new Ext.Panel({ layout: "border", region: "north", height: 75, items: [this.formSearch] }); this.panelList = new Ext.Panel({ // title: '冲抵明细', layout: "border", region: 'center', margin: '0 0', frame: true, items: [this.gridList] }); this.tabpanel = new Ext.TabPanel ({ activeTab: 0, autoWidth: true, border: false, frame: false, region: 'center', id: "TabPanelID", enableTabScroll: true, items: [ this.panelList ] }); Ext.apply(this, { items: [this.panelTop, this.panelSearch, this.tabpanel] }); this.storeList.on('beforeload', function (store) { var sql = this.sqlcontext; Ext.apply(store.proxy.extraParams, { condition: sql }); }, this); // this.onRefreshClick(); }, //end initUIComponents onRefreshClick: function (button, event) { var sql = this.getCondition(); this.PageSize = this.Pagenum.getValue(); this.sqlcontext = sql; this.storeList.load({ params: { start: 0, limit: this.PageSize, condition: sql }, waitMsg: "正在查询数据...", scope: this }); }, onDsQuery: function (button, event) { this.PageSize = this.Pagenum.getValue(); var sql = this.sqlcontext; this.storeList.load({ params: { start: 0, limit: this.PageSize, condition: sql }, waitMsg: "正在查询数据...", scope: this }); }, onClearSql: function () { var form = this.formSearch.getForm(); form.reset(); }, getCondition: function () { var form = this.formSearch.getForm(); var data = this.formSearch.getForm().getValues(false, false, false); var sql = ''; /* var sqldata = form.getValues(); sql = Ext.JSON.encode(sqldata); */ var mblNo = form.findField('PS_MBLNO').getValue(); sql = sql + getAndConSql(sql, mblNo, " (CUSTNO like '%" + mblNo + "%' or MBLNO like '%" + mblNo + "%' or HBLNO like '%" + mblNo + "%' ) "); var etdDate_Min = form.findField('PS_ETDDATEBGN').getRawValue(); sql = sql + getAndConSql(sql, etdDate_Min, " ETD>='" + etdDate_Min + "'"); var etdDate_Max = form.findField('PS_ETDDATEEND').getRawValue(); sql = sql + getAndConSql(sql, etdDate_Max, " ETD<='" + etdDate_Max + " 23:59:59'"); var accDate_Min = form.findField('PS_ACCDATEBGN').getRawValue(); sql = sql + getAndConSql(sql, accDate_Min, " ACCDATE>='" + accDate_Min + "'"); var accDate_Max = form.findField('PS_ACCDATEEND').getRawValue(); sql = sql + getAndConSql(sql, accDate_Max, " ACCDATE<='" + accDate_Max + "'"); var OP = form.findField('PS_OP').getValue(); sql = sql + getAndConSql(sql, OP, "OP='" + OP + "'"); var LANE = form.findField('LANE').getValue(); sql = sql + getAndConSql(sql, LANE, "LANE='" + LANE + "'"); var CARRIER = form.findField('CARRIER').getValue(); sql = sql + getAndConSql(sql, CARRIER, "CARRIER='" + CARRIER + "'"); var PS_CUSTOMERNAME = form.findField('PS_CUSTOMERNAME').getValue(); sql = sql + getAndConSql(sql, PS_CUSTOMERNAME, "CUSTOMERNAME='" + PS_CUSTOMERNAME + "'"); return sql; }, checkSearchCondition: function () { var form = this.formSearch.getForm(); if (!form.isValid()) { Ext.Msg.alert('提示', '查询条件赋值错误,请检查。'); return false; } return true; }, OprationSwap: function () { var ret = new Array(); ret[0] = this.OprationStatus; ret[1] = this.storeList; ret[2] = this.SelectedRecord; ret[3] = this.SelectedRecord.data.BSNO; ret[4] = "MsRptZjIndex"; return ret; }, onSaveGridClick: function (button, event) { this.girdcolumsfeedr = DsTruck.SaveGridPanel(USERID, this.formname, this.gridList.columns, this.girdcolums, 1, true); }, oninitGridClick: function (button, event) { this.gridList.reconfigure(this.storeList, this.initgirdcolums); this.girdcolums = DsTruck.SaveGridPanel(USERID, this.formname, this.gridList.columns, this.initgirdcolums, 1, true); }, onExportClick: function (button, event) { _this = this; GridExportExcelPage(this.gridList); }, Print: function () { var sql = this.sqlcontext; var Crsql = sql; var Drsql = sql; _this = this; if (this.storeList.getCount() == 0) { return; } var sortstr = ''; if (this.feelistdrsortfield != '' && this.feelistdrsortdire != '') { sortstr = this.feelistdrsortfield + ' ' + this.feelistdrsortdire; } Ext.Msg.wait('正在组织数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在组织数据...', url: '/MvcShipping/MsRptNoTotal/BsHyfListData', scope: this, params: { start: 0, limit: this.PageSize, condition: Drsql, printstr: 'true', sortstr: 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 printType = 'MSRPTNOTOTALHYFLIS'; var sql1 = returnstr; var sql2 = ""; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); } 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 }); } } }); } });