Ext.namespace('Shipping'); Shipping.MsChDuiIndex = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsChDuiIndex.superclass.constructor.call(this); }; Ext.extend(Shipping.MsChDuiIndex, Ext.Panel, { PageSize: 100, OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, selectbsnostr: '', selectfeestr: '', sqlcontext: '', sortfield: '', sortdire: '', initUIComponents: function () { this.formname = 'MsChDuiIndex'; this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', { model: 'MsOP', proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' } }); this.StoreOpRange.load({ params: { optype: "modChDuiFeeList"} }); //定义数据集 this.storeList = Ext.create('Ext.data.Store', { model: 'MsChDui', pageSize: this.PageSize, remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsChDui/GetDataList', reader: { id: 'DUINO', root: 'data', totalProperty: 'totalCount' } } }); this.initgirdcolums = [{ sortable: true, dataIndex: 'DUINO', header: Zi.LAN.duiznum, //对账编号 width: 120, renderer: function (value, meta) { meta.tdCls = 'mblno'; btnurl = getGridCopyButton(value); return btnurl + value; } }, { sortable: true, dataIndex: 'CUSTNAME', header: Zi.LAN.kehname, //客户名称 width: 160 }, { sortable: true, dataIndex: 'DUIDATE', header: Zi.LAN.duizdate, //对账日期 width: 160 }, { sortable: true, dataIndex: 'OP', header: Zi.LAN.duizmen, //对账人 width: 160 }, { sortable: true, dataIndex: 'BILLSTATUSREF', header: Zi.LAN.status, //状态 width: 60 }, { sortable: true, dataIndex: 'DUINAME', header: Zi.LAN.zdmiaoshu, //账单描述 width: 160 }, { sortable: true, dataIndex: 'ISINVOICE', header: Zi.LAN.Invoiced, //已开发票 width: 60, renderer: function (value, meta) { if (value == '是') { return Zi.LAN.YES; } else { return ""; } } }, { sortable: true, dataIndex: 'RMBDR', header: Zi.LAN.yshouRmbi, //应收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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80 }, { sortable: true, dataIndex: 'BALRMBDR', header: Zi.LAN.weishourmb, //未收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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80 }, { sortable: true, dataIndex: 'USDDR', header: Zi.LAN.yingsUsd, //应收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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80 }, { sortable: true, dataIndex: 'BALUSDDR', header: Zi.LAN.wsUSD, //未收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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80 }, { sortable: true, dataIndex: 'OTDR', header: Zi.LAN.yingsOT, //应收OT 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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80 }, { sortable: true, dataIndex: 'BALOTDR', header: Zi.LAN.weisOT, //未收OT 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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80 }, { sortable: true, dataIndex: 'TTLDR', header: Zi.LAN.countyings, //应收合计 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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80 }, { sortable: true, dataIndex: 'BALTTLDR', header: Zi.LAN.countweis, //未收合计 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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80 }, { sortable: true, dataIndex: 'RMBCR', header: Zi.LAN.tingfRmbi, //应付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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80 }, { sortable: true, dataIndex: 'BALRMBCR', header: Zi.LAN.weifuRmbi, //未付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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80 }, { sortable: true, dataIndex: 'USDCR', header: Zi.LAN.yingfuusd, //应付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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80 }, { sortable: true, dataIndex: 'BALUSDCR', header: Zi.LAN.weifuusd, //未付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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80 }, { sortable: true, dataIndex: 'OTCR', header: Zi.LAN.yingfuot, //应付OT 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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80 }, { sortable: true, dataIndex: 'BALOTCR', header: Zi.LAN.weifuot, //未付OT 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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80 }, { sortable: true, dataIndex: 'TTLCR', header: Zi.LAN.yingfusum, //应付合计 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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80 }, { sortable: true, dataIndex: 'BALTTLCR', header: Zi.LAN.weifusum, //未付合计 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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80 }, { sortable: true, dataIndex: 'REMARKS', header: Zi.LAN.shuoming, //说明 width: 160 } ]; this.girdcolums = this.initgirdcolums; this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); //定义Grid this.Pagenum = Ext.create('Ext.form.field.Number', { name: 'bottles', fieldLabel: Zi.LAN.NumberOfpage, //每页记录数 labelAlign: 'right', value: this.PageSize, maxValue: 100000, width: 180, minValue: 0, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.TtlSel = Ext.create('Ext.form.Label', { name: 'bottleslbl', labelAlign: 'right', width: 800 }); this.gridList = new Ext.grid.GridPanel({ store: this.storeList, enableHdMenu: false, region: 'center', loadMask: { msg: Zi.LAN.LoadData }, //数据加载中,请稍等... trackMouseOver: true, disableSelection: false, columns: this.girdcolums, selModel: this.GridCheckBoxModel, features: [{ ftype: 'summary' }], viewConfig: { autoFill: true, enableTextSelection: true, //允许复制数据 getRowClass: function (record, rowIndex, rowParams, store) { var BILLSTATUSREF = record.get('BILLSTATUSREF'); if (BILLSTATUSREF == "锁定") return 'feestatus_refer'; } }, // paging bar on the bottom bbar: [Ext.create('Ext.PagingToolbar', { store: this.storeList, displayInfo: true, displayMsg: Zi.LAN.FenYe, //当前显示 {0} - {1}条记录 /共 {2}条记录 emptyMsg: Zi.LAN.Nodata//没有数据 }), this.Pagenum, this.TtlSel] }); this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id,表名,中间column数组,跳过一开始的几列 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('/MvcShipping/MsChDui/Edit'); }, this); //#region formSearch //#region formSearch枚举参照相关 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: Zi.LAN.chuanname, //船 名 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.storeCustCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListRm' } }); // this.storeCustCode.load({ params: { condition: ""} }); //委托单位 this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.duizkehu, //对账客户 store: this.storeCustCode, forceSelection: true, name: 'CustName', queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', valueField: 'CustName', displayField: 'CodeAndName', enableKeyEvents: true, listeners: { //specialkey: function (field, e) { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefList' } }); this.storeOpCode.load(); this.comboxOP= Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.duizmen, //'揽货人', store: this.storeOpCode, labelWidth: 50, name: 'OP', valueField: 'UserName', displayField: 'CodeAndName' }); this.storeBILLSTATUS = Ext.create('Ext.data.Store', { fields: ['DC', 'NAME'] }); this.storeBILLSTATUS.add({ "DC": "", "NAME": Zi.LAN.FEERANGALL }); this.storeBILLSTATUS.add({ "DC": "1", "NAME": Zi.LAN.SubmitAudit }); this.storeBILLSTATUS.add({ "DC": "2", "NAME": Zi.LAN.NotSubmitAudit }); this.comboxBILLSTATUS = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.status, //是否含税 store: this.storeBILLSTATUS, forceSelection: true, labelWidth: 50, name: 'BILLSTATUS', flex: 0.5, valueField: 'DC', displayField: 'NAME' }); //#endregion _this = this; this.formSearch = Ext.widget('form', { frame: true, region: 'center', bodyPadding: 5, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 80, msgTarget: 'qtip' }, items: [ {//fieldset 1 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: Zi.LAN.duiznum, //对账编号 name: 'BsNo', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, this.comboxCustCode, { fieldLabel: Zi.LAN.cduizdate, //从对账日期 format: 'Y-m-d', xtype: 'datefield', name: 'ExpDateBgn', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: Zi.LAN.dduizdate, //到对账日期 format: 'Y-m-d', xtype: 'datefield', name: 'ExpDateEnd', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: Zi.LAN.zdshuoming, //对账描述 name: 'DUINAME', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, this.comboxOP ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: Zi.LAN.yewuxgnum, //业务相关编号 name: 'MblNo', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: Zi.LAN.cyewudate, //从业务日期 format: 'Y-m-d', xtype: 'datefield', name: 'BsDateBgn', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: Zi.LAN.dyewudate, //到业务日期 format: 'Y-m-d', xtype: 'datefield', name: 'BsDateEnd', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, this.comboxVoyVeg, { fieldLabel: Zi.LAN.vessel, //航次 name: 'VOYNO', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, this.comboxBILLSTATUS, { fieldLabel: Zi.LAN.Remarks, //对账描述 name: 'REMARKS', labelWidth: 30, flex: 0.5, enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } } ] } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); //#endregion formSearch //查询工具条 _this = this; this.panelBtn = new Ext.Panel({ region: "north", tbar: [ { text: Zi.LAN.xnew, //新建 iconCls: "btnadd", handler: function (button, event) { this.OprationStatus = 'add'; DsOpenEditWin('/MvcShipping/MsChDui/Edit'); }, scope: this }, '-', { text: Zi.LAN.ExecuteQuery, //执行查询 iconCls: "btnrefresh", handler: function (button, event) { this.onRefreshClick(button, event); }, scope: this }, { text: Zi.LAN.ResetCondition, //重置条件 iconCls: "btnreset", handler: function (button, event) { this.onClearSql(button, event); }, scope: this }, { text: Zi.LAN.delete1, //删除 iconCls: "btndeletce", id: 'btndelete', handler: function (button, event) { this.onDeleteListClick(button, event); }, scope: this }, '-', { text: Zi.LAN.Saveliststyle, //保存列表样式 id: "btntest", menu: [ { text: Zi.LAN.Save, //保存 handler: function (button, event) { this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.girdcolums, 1, true); } }, { text: Zi.LAN.Initialization, 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: Zi.LAN.tjsuod, //提交锁定 tooltip: Zi.LAN.tjsuod, id: 'btnSubmitAudit', handler: function (button, event) { this.onSubmitAuditClick(); }, scope: this }, '-', { text: Zi.LAN.cxiaosuoding, //撤销锁定 tooltip: Zi.LAN.cxiaosuoding, id: 'btnSubmitAuditBack', handler: function (button, event) { this.onSubmitAuditBackClick(); }, scope: this }, '-', { text: Zi.LAN.scfapiao, //生成发票申请 handler: function (button, event) { this.onCreateInvAppClick(button, event); }, scope: this }, '-', { text: Zi.LAN.ExportExcel, //导出Excel id: "btnExportExcel", iconCls: 'btnexportexcel', handler: function (button, event) { this.onExportClick(button, event); }, scope: this }, '-', { text: Zi.LAN.SubmitFee, //提交锁定 tooltip: Zi.LAN.SubmitFee, id: 'btnSubmitFee', handler: function (button, event) { this.onSubmitFeeClick(); }, scope: this }, { xtype: 'button', text: Zi.LAN.AdvancedSearch, 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 }, '-', { text: Zi.LAN.Print, tooltip: Zi.LAN.Print, menu: [ { text: Zi.LAN.PrintAll, handler: function (menu, event) { _this.Print(menu, event); } }, { text: Zi.LAN.PrintSelect, handler: function (menu, event) { _this.PrintSelect(menu, event); } }], scope: this } ] }); this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 100, items: [this.formSearch, this.panelBtn] }); Ext.apply(this, { items: [this.panelTop, this.gridList] }); this.storeList.on('beforeload', function (store) { var sql = this.sqlcontext; Ext.apply(store.proxy.extraParams, { condition: sql }); }, this); this.gridList.getSelectionModel().on('select', function (model, record, index) { var opname = record.data.OP; var btnESubmitAudit = Ext.getCmp('btnSubmitAudit'); var btndelete = Ext.getCmp('btndelete'); var bsstatus = record.data.BILLSTATUS; var records = DsStoreQueryBy(this.StoreOpRange, 'OPID', opname); if (records.getCount() > 0) { if (bsstatus == 1) { btndelete.disable(); btnESubmitAudit.disable(); } else { btndelete.enable(); btnESubmitAudit.enable(); } } else { btndelete.disable(); btnESubmitAudit.disable(); } }, this); this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: 'BILLSTATUS<>1' }, waitMsg: Zi.LAN.NowSelect, //正在查询数据 scope: this }); this.sqlcontext = 'BILLSTATUS<>1'; this.gridList.on({ selectionchange: function (sm, selections) { _this.TtlSel.setText(''); if (selections.length == 0) { return; } var rmbdr = 0; var rmbcr = 0; var usddr = 0; var usdcr = 0; var otdr = 0; var otcr = 0; var balrmbdr = 0; var balrmbcr = 0; var balusddr = 0; var balusdcr = 0; var balotdr = 0; var balotcr = 0; var rmblb = ""; var usdlb = ""; var otlb = ""; var rmblbcr = ""; var usdlbcr = ""; var otlbcr = ""; var j = selections.length; for (var i = 0; i < selections.length; i++) { var rec = selections[i]; var rmbdr = rmbdr + rec.data.RMBDR; var rmbcr = rmbcr + rec.data.RMBCR; var usddr = usddr + rec.data.USDDR; var usdcr = usdcr + rec.data.USDCR; var otdr = otdr + rec.data.OTDR; var otcr = otcr + rec.data.OTCR; var balrmbdr = balrmbdr + rec.data.BALRMBDR; var balrmbcr = balrmbcr + rec.data.BALRMBCR; var balusddr = balusddr + rec.data.BALUSDDR; var balusdcr = balusdcr + rec.data.BALUSDCR; var balotdr = balotdr + rec.data.BALOTDR; var balotcr = balotcr + rec.data.BALOTCR; } if (rmbdr != 0 || balrmbdr != 0) { rmblb = Zi.LAN.yshouRmbi + ":" + returnfloat(rmbdr) +Zi.LAN.weishourmb+ ";:" + returnfloat(balrmbdr) + "|"; // rmblb = "统计信息(文字标题)(字段名-中文):(字段值-负值)(字段名-中文):(字段值-正值)"; } if (usddr != 0 || balrmbdr != 0) { usdlb = Zi.LAN.yingsUsd + ":" + returnfloat(usddr) + ";" +Zi.LAN.wsUSD+":" + returnfloat(balusddr) + "|"; } if (otdr != 0 || balotdr != 0) { otlb = Zi.LAN.OtherBiyings+":" + returnfloat(otdr) + Zi.LAN.otherbiweishou+";:" + returnfloat(balotdr) + "|"; } if (rmbcr != 0 || balrmbcr != 0) { rmblbcr = Zi.LAN.tingfRmbi+":" + returnfloat(rmbcr) + Zi.LAN.weifuRmbi+";:" + returnfloat(balrmbcr) + "|"; // rmblb = "统计信息(文字标题)(字段名-中文):(字段值-负值)(字段名-中文):(字段值-正值)"; } if (usdcr != 0 || balrmbcr != 0) { usdlbcr =Zi.LAN.yingfuusd + ":" + returnfloat(usdcr) + Zi.LAN.weifuusd+";:" + returnfloat(balusdcr) + "|"; } if (otcr != 0 || balotcr != 0) { otlbcr = Zi.LAN.oterbyingfu+":" + returnfloat(otcr) + Zi.LAN.otherbweifu+";:" + returnfloat(balotcr) + "|"; } _this.TtlSel.setText(Zi.LAN.selectsum+' :' + rmblb + usdlb + otlb + rmblbcr + usdlbcr + otlbcr); } }); Ext.Ajax.request({ waitMsg: '', url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable', params: { modulename: "modChduiCancelAudit" }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (result.Success != true) { var btnESubmitAuditBack = Ext.getCmp('btnSubmitAuditBack'); btnESubmitAuditBack.disable(); } else { var btnESubmitAuditBack = Ext.getCmp('btnSubmitAuditBack'); btnESubmitAuditBack.enable(); } } else { } }, scope: this }); }, //end initUIComponents InitGrid: function (grid) { var agirdcolums = grid; this.gridList.reconfigure(this.storeList, agirdcolums); }, onClearSql: function () { var form = this.formSearch.getForm(); form.reset(); }, //onDeleteClick onRefreshClick: function (button, event) { var sql = this.getCondition(); this.sqlcontext = sql; this.PageSize = this.Pagenum.getValue(); this.storeList.pageSize = this.PageSize; this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: Zi.LAN.NowSelect, //正在查询数据... scope: this }); }, onDsQuery: function (button, event) { //var girdcolums = this.gridList.getColumnMode(); var sql = this.sqlcontext; this.PageSize = this.Pagenum.getValue(); this.storeList.pageSize = this.PageSize; this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: Zi.LAN.NowSelect, //正在查询数据... scope: this }); }, onDeleteListClick: function (button, event) { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) {//提示', msg: '请先选择单据! Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.SelectDanju, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var bodyAddDatas = []; var icount = 0; for (var i = 0; i < selections.length; i++) { var record = selections[i]; if (record.data.BILLSTATUS == '1') { //提示', msg: '当前状态无法删除此单据! Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.nodelete, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } bodyAddDatas.push(record); icount = icount + 1; } Ext.MessageBox.confirm(Zi.LAN.Prompt, Zi.LAN.suredelete, function (btn) { if (btn == 'yes') { Ext.Msg.wait(Zi.LAN.nowdelete); //正在删除数据... var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); Ext.Ajax.request({ waitMsg: Zi.LAN.nowdelete, url: '/MvcShipping/MsChDui/DeleteList', params: { data: jsonbodyAddDatas }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { this.storeList.reload(); //提示', msg: '删除成功 Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.truedelete, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } else {//错误 Ext.Msg.show({ title: Zi.LAN.Error, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }, failure: function (response, options) {//警告', msg: '服务器响应出错,请重试 Ext.Msg.show({ title: Zi.LAN.Caveat, msg: Zi.LAN.FuWuQiError, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); }, success: function (response, options) { }, scope: this }); //end Ext.Ajax.request } }, this); }, //onDeleteClick onDeleteClick: function (button, event) { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) {//提示', msg: '请先选择单据! Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.SelectDanju, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var record = selections[0]; if (record.data.BILLSTATUS == '1') { //提示', msg: '当前状态无法删除此单据! Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.nodelete, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var duino = record.data.DUINO; //提示', '确定删除该记录吗? Ext.MessageBox.confirm(Zi.LAN.Prompt, Zi.LAN.suredelete, function (btn) { if (btn == 'yes') { Ext.Msg.wait(Zi.LAN.nowdelete); //正在删除数据... Ext.Ajax.request({ waitMsg: Zi.LAN.nowdelete, url: '/MvcShipping/MsChDui/Delete', params: { duino: duino, feesql: '1=1', data: Ext.JSON.encode(record.data) }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { this.storeList.remove(record); //提示', msg: '删除成功 Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.truedelete, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } else {//错误 Ext.Msg.show({ title: Zi.LAN.Error, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }, failure: function (response, options) {//警告', msg: '服务器响应出错,请重试 Ext.Msg.show({ title: Zi.LAN.Caveat, msg: Zi.LAN.FuWuQiError, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); }, success: function (response, options) { }, scope: this }); //end Ext.Ajax.request } }, this); }, //onDeleteClick onSubmitAuditClick: function () { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) {//提示', msg: '请先选择单据! Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.SelectDanju, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var BILLNOStr = ''; for (var i = 0; i < selections.length; i++) { var rec = selections[i]; var BILLNO = rec.data.DUINO; if (rec.data.BILLSTATUS != '1') { if (BILLNOStr == '') BILLNOStr = BILLNO; else { BILLNOStr = BILLNOStr + ',' + BILLNO; } } } _this = this; if (BILLNOStr == '') { } else { Ext.Ajax.request({//正在添加数据... waitMsg:Zi.LAN.addnumnow, url: '/MvcShipping/MsChDui/LockList', params: { bills: BILLNOStr }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: Zi.LAN.Prompt,//提示 msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } else { _this.storeList.reload(); } } else {//请求出现错误,请重试 Ext.MessageBox.alert(Zi.LAN.FuWuQiError, response.responseText); } }, scope: this }); } }, onSubmitAuditBackClick: function () { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) {//提示', msg: '请先选择单据! Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.SelectDanju, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var BILLNOStr = ''; for (var i = 0; i < selections.length; i++) { var rec = selections[i]; var BILLNO = rec.data.DUINO; if (rec.data.BILLSTATUS == '1') { if (BILLNOStr == '') BILLNOStr = BILLNO; else { BILLNOStr = BILLNOStr + ',' + BILLNO; } } } _this = this; if (BILLNOStr == '') { } else { Ext.Ajax.request({//'正在添加数据... waitMsg:Zi.LAN.addnumnow, url: '/MvcShipping/MsChDui/UnLockList', params: { bills: BILLNOStr }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: Zi.LAN.Prompt, //提示 msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } else { _this.storeList.reload(); } } else {//请求出现错误,请重试 Ext.MessageBox.alert(Zi.LAN.FuWuQiError, response.responseText); } }, scope: this }); }; }, onSubmitFeeClick: function () { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) {//提示', msg: '请先选择单据! Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.SelectDanju, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var BILLNOStr = ''; for (var i = 0; i < selections.length; i++) { var rec = selections[i]; var BILLNO = rec.data.DUINO; if (rec.data.BILLSTATUS != '1') { if (BILLNOStr == '') BILLNOStr = BILLNO; else { BILLNOStr = BILLNOStr + ',' + BILLNO; } } } _this = this; if (BILLNOStr == '') { } else { Ext.Ajax.request({//正在添加数据... waitMsg: Zi.LAN.addnumnow, url: '/MvcShipping/MsChDui/SubmitFeeList', params: { bills: BILLNOStr }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: Zi.LAN.Prompt,//提示 msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } else { Ext.Msg.show({ title: Zi.LAN.Prompt, msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } } else {//请求出现错误,请重试 Ext.MessageBox.alert(Zi.LAN.FuWuQiError, response.responseText); } }, scope: this }); } }, onCreateInvAppClick: function (button, event) { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) {//提示', msg: '请先选择单据! Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.SelectDanju, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var record = selections[0]; var invcust = record.data.CUSTNAME; this.selectbsnostr = " f.GID IN (SELECT GID FROM V_DUI_FEE WHERE DUINO='" + record.data.DUINO + "') "; this.selectfeestr = " f.GID IN (SELECT GID FROM V_DUI_FEE WHERE DUINO='" + record.data.DUINO + "') "; var StoreCurr = Ext.create('DsExt.ux.RefTableStore', { model: 'MsFeeCurr', proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' } }); StoreCurr.load({ params: { condition: ""} }); this.comboxInvCurr = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.shishoubibie, //实收币别 store: StoreCurr, id: 'ShenCurr', forceSelection: true, allowBlank: false, name: 'CURR', value: 'RMB', valueField: 'CURR', displayField: 'CURR' }); this.formIFTMBFSShow = Ext.widget('form', { frame: true, region: 'center', bodyPadding: 5, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 80, msgTarget: 'qtip' }, items: [{ xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [this.comboxInvCurr] }] }); me = this; var winIFTMBFShow = Ext.create('Ext.window.Window', { width: 250, height: 160, //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.formIFTMBFSShow], buttons: [{ text: Zi.LAN.suisc, //确认生成 minWidth: 70, handler: function () { var ShenCurr = Ext.getCmp('ShenCurr'); var Curr = ShenCurr.getValue(); _this.onCreateInvShenClick(Curr, invcust); } }, { text: Zi.LAN.close, //关闭 minWidth: 70, handler: function () { winIFTMBFShow.close(); } }] }); winIFTMBFShow.show(); }, onCreateInvShenClick: function (Curr, invcust) { DsOpenEditWin("/Account/Chfee_invoiceapplication/BLEdit?handle=check&bsnosql=recapplist&bsCurr=" + Curr + "&bsCust=" + invcust, '发票申请'); }, getCondition: function () { var form = this.formSearch.getForm(); if (!form.isValid()) { Ext.Msg.alert(Zi.LAN.Prompt, Zi.LAN.SelectError); //提示', '查询条件赋值错误,请检查 return ''; } var sql = ''; var customNo = form.findField('BsNo').getValue(); sql = sql + getAndConSql(sql, customNo, "DUINO like '%" + customNo + "%'"); var custName = form.findField('CustName').getValue(); sql = sql + getAndConSql(sql, custName, "CUSTNAME='" + custName + "'"); var DUINAME = form.findField('DUINAME').getValue(); sql = sql + getAndConSql(sql, DUINAME, "DUINAME like '%" + DUINAME + "%'"); var REMARKS = form.findField('REMARKS').getValue(); sql = sql + getAndConSql(sql, REMARKS, "REMARKS like '%" + REMARKS + "%'"); var BILLSTATUS = form.findField('BILLSTATUS').getValue(); sql = sql + getAndConSql(sql, BILLSTATUS, "BILLSTATUS='" + BILLSTATUS + "'"); var OP = form.findField('OP').getValue(); sql = sql + getAndConSql(sql, OP, "OP='" + OP + "'"); var expDateBgn = form.findField('ExpDateBgn').getRawValue(); sql = sql + getAndConSql(sql, expDateBgn, "DUIDATE >='" + expDateBgn + "'"); var expDateEnd = form.findField('ExpDateEnd').getRawValue(); sql = sql + getAndConSql(sql, expDateEnd, "DUIDATE <='" + expDateEnd + "'"); var bssql = this.getBsCondition(); // sql = sql + getAndConSql(sql, bssql, " DUINO IN (SELECT DISTINCT DUINO FROM ch_dui_bill WHERE BSNO IN (SELECT BSNO FROM V_OP_BILL WHERE "+bssql+"))"); sql = sql + getAndConSql(sql, bssql, " EXISTS (SELECT 1 FROM CH_DUI_BILL D LEFT JOIN V_OP_BILL B ON (B.BSNO=D.BSNO) WHERE D.DUINO=CH_DUI.DUINO AND " + bssql + ")"); return sql; }, getBsCondition: function () { var form = this.formSearch.getForm(); if (!form.isValid()) { Ext.Msg.alert(Zi.LAN.Prompt, Zi.LAN.SelectError); //提示', '查询条件赋值错误,请检查 return ''; } var sql = ''; var MblNo = form.findField('MblNo').getValue(); sql = sql + getAndConSql(sql, MblNo, " (B.CUSTNO like '%" + MblNo + "%' or B.MBLNO like '%" + MblNo + "%' or B.HBLNO like '%" + MblNo + "%')"); var VESSEL = form.findField('VESSEL').getValue(); sql = sql + getAndConSql(sql, VESSEL, "B.VESSEL='" + VESSEL + "'"); var VOYNO = form.findField('VOYNO').getValue(); sql = sql + getAndConSql(sql, VOYNO, "B.VOYNO like '%" + VOYNO + "%'"); var expDateBgn = form.findField('BsDateBgn').getRawValue(); sql = sql + getAndConSql(sql, expDateBgn, "B.OPDATE >='" + expDateBgn + "'"); var expDateEnd = form.findField('BsDateEnd').getRawValue(); sql = sql + getAndConSql(sql, expDateEnd, "B.OPDATE <='" + expDateEnd + "'"); return sql; }, Print: function () { _this = this; if (this.storeList.getCount() == 0) { return; } var sortstr = ' DUIDATE DESC '; if (this.sortfield != '' && this.sortdire != '') { sortstr = this.sortfield + ' ' + this.sortdire; } Ext.Msg.wait('正在组织数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在组织数据...', url: '/MvcShipping/MsChDui/GetDataListStr', //(int start, int limit, string sort, string condition, int billtype) scope: this, params: { sort: sortstr, condition: _this.sqlcontext }, 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 = 'MsChDuiIndexList'; 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 }); } } }); }, PrintSelect: 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 feeGidSql = ''; for (var i = 0; i < selections.length; i++) { var record = selections[i]; var feeGId = "'" + record.get('DUINO') + "'"; if (feeGidSql == '') { feeGidSql = feeGId; } else { feeGidSql = feeGidSql + "," + feeGId; } }; var record = selections[0]; var billNo = record.data.DUINO; var printType = 'MsChDuiIndexListSel'; var sql1 = "SELECT * FROM ch_dui WHERE DUINO IN (" + feeGidSql + ") "; var sql2 = ""; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); }, onExportClick: function (button, event) { GridExportExcelPage(this.gridList); }, OprationSwap: function () { var ret = new Array(); ret[0] = this.OprationStatus; ret[1] = this.storeList; ret[2] = this.SelectedRecord; ret[3] = this.SelectedRecord; ret[4] = this.selectbsnostr; ret[5] = this.selectfeestr; return ret; } });