Ext.namespace('Shipping'); Shipping.MsChPayapplicationIndex = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsChPayapplicationIndex.superclass.constructor.call(this); }; Ext.extend(Shipping.MsChPayapplicationIndex, Ext.Panel, { PageSize: 30, OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, sqlcontext: '', sortfield: '', sortdire: '', initUIComponents: function () { //定义数据集 this.formname = "formChPayapplicationIndex"; //页面名称 this.sqlcontext = ""; this.worksql = getUrlParam('worksql'); this.selectbeginindex = -1; this.selectendindex = -1; this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', { model: 'MsOP', proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' } }); this.StoreOpRange.load({ params: { optype: "modPaySettleAppList"} }); this.storeList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, model: 'MsChPayapplication', remoteSort: true, proxy: { type: 'ajax', url: '/Account/Chfee_payapplication/GetDataList', reader: { id: 'BILLNO', root: 'data', totalProperty: 'totalCount' } } }); this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); 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.initgirdcolums = [{ sortable: true, dataIndex: 'BILLNO', header: Zi.LAN.RequisitionNumber, //申请单号 width: 120, renderer: function (value, meta) { meta.tdCls = 'mblno'; btnurl = getGridCopyButton(value); return btnurl + value; } }, { sortable: true, dataIndex: 'BILLSTATUSREF', header: Zi.LAN.status, //状态 width: 60, renderer: function (value, meta, record) { value = record.data.BILLSTATUSREF; if (value == '审核通过') { meta.tdCls = 'feestatus_pass'; value = Zi.LAN.SHENHETONGGUO; } else if (value == '录入状态') { value = Zi.LAN.LURUZHUAGNTAI; } else if (value == '已提交') { meta.tdCls = 'feestatus_refer'; value = Zi.LAN.TIJIAOSHENHE; } else if (value == '部分结算') { meta.tdCls = 'feestatus_refer'; value = Zi.LAN.BUFENJIESUAN; } else if (value == '已结算') { meta.tdCls = 'feestatus_settle'; value = Zi.LAN.JIESUANWANBI; } return value; } }, { sortable: true, dataIndex: 'CUSTOMERNAME', header: Zi.LAN.SettlementUnit, //结算单位 width: 120 },{ sortable: true, dataIndex: 'SETTLETYPEREF', header: Zi.LAN.jstype, //结算单位 width: 120 },{ sortable: true, dataIndex: 'CURR', header: Zi.LAN.Currency, //币别 width: 50 }, { sortable: true, dataIndex: 'AMOUNTRMB', header: 'RMB', summaryType: 'sum', align: 'right', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, 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: 120 }, { sortable: true, dataIndex: 'AMOUNTUSD', header: 'USD', summaryType: 'sum', align: 'right', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, 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: 120 }, { sortable: true, dataIndex: 'AMOUNTOT', header: Zi.LAN.OtherBi, //其他外币 summaryType: 'sum', align: 'right', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, 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: 120 }, { sortable: true, dataIndex: 'SETTLERMB', header: Zi.LAN.jsuan + 'RMB', //结算RMB summaryType: 'sum', align: 'right', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, 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: 120 }, { sortable: true, dataIndex: 'SETTLEUSD', header: Zi.LAN.jsuan + 'USD', //结算USD summaryType: 'sum', align: 'right', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, 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: 120 }, { sortable: true, dataIndex: 'SETTLEOT', header: Zi.LAN.jsuanOther, //结算其他币别 summaryType: 'sum', align: 'right', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, 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: 120 }, { sortable: true, dataIndex: 'APPLYTIME', header: Zi.LAN.DateApplication, //申请日期 width: 100 }, { sortable: true, dataIndex: 'APPLICANTNAME', header: Zi.LAN.Applicant, //申请人 width: 100 }, { sortable: true, dataIndex: 'PAYABLETIME', header: Zi.LAN.ApplyPaymentDate, //申请支付日期 width: 100 }, { sortable: true, dataIndex: 'AUDITTIME', header: Zi.LAN.FinalReviewDate, //最后审核日期 width: 100 }, { sortable: true, dataIndex: 'AUDITUSER', header: Zi.LAN.lastReviewer, //最后审核人 width: 100 }, { sortable: true, dataIndex: 'CUSTBANKNAME', header: Zi.LAN.jsuanBank, //结算对象银行 width: 80 }, { sortable: true, dataIndex: 'CUSTACCOUNT', header: Zi.LAN.jsuanzh, //结算对象账户 width: 140 }, { sortable: true, dataIndex: 'REMARK', header: Zi.LAN.Remarks, //备注 width: 160 }, { sortable: true, dataIndex: 'ISINVOICE', header: Zi.LAN.Invoiced, //已开发票 width: 80 }, { sortable: true, dataIndex: 'INVNO', header: Zi.LAN.InvoiceNumber, //发票号 width: 80 }, { sortable: true, dataIndex: 'INVDATE', header: Zi.LAN.fpdate, //发票号 width: 80 }, { sortable: true, dataIndex: 'INVOICEAMOUNT', header: Zi.LAN.INVOICEAMOUNT, //发票号 width: 80 }, { sortable: true, dataIndex: 'PREAMOUNTRMB', header: Zi.LAN.yjsuan+'RMB', //预计结算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: 120 }, { sortable: true, dataIndex: 'PREAMOUNTUSD', header: Zi.LAN.yjsuan+'USD',//预计结算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: 120 }, { sortable: true, dataIndex: 'PREAMOUNTOT', header: Zi.LAN.yjsuanOther, //预计结算其他 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: 120 }, { sortable: true, dataIndex: 'BALAMOUNTRMB', header: Zi.LAN.weisq+'RMB', //未申请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: 120 }, { sortable: true, dataIndex: 'BALAMOUNTUSD', header: Zi.LAN.weisq+'USD', //未申请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: 120 }, { sortable: true, dataIndex: 'BALAMOUNTOT', header: Zi.LAN.weisqOther, //未申请其他 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: 120 }, { sortable: true, dataIndex: 'BS_CUSTOMERNAME', header: Zi.LAN.Requester, //委托单位 width: 160 }, { sortable: true, dataIndex: 'PAYTYPE', header: Zi.LAN.shfsi, //申请方式 width: 80 }, { sortable: true, id: '', dataIndex: 'ISPRINT', header: Zi.LAN.printy, //'应收费用', align: 'center', width: 60, renderer: function (value, meta) { if (value == '1') return Zi.LAN.YES; //是 else return ''; } }, { sortable: true, dataIndex: 'BALBILLNO', header: Zi.LAN.ruzsq, //入账申请编号 width: 80 }, { sortable: true, dataIndex: 'REASON', header: Zi.LAN.REASON, //驳回原因 width: 80 }, { sortable: true, dataIndex: 'APPLICANTDEPT', header: Zi.LAN.APPLICANTDEPT, //驳回原因 width: 80 }, { sortable: true, dataIndex: 'PRINTCOUNT', header: Zi.LAN.PRINTCOUNT, //驳回原因 width: 80 }, { sortable: true, dataIndex: 'SALECORP', header: Zi.LAN.DepartmentName, //驳回原因 width: 80 }, { sortable: true, dataIndex: 'ISREVINV', header: Zi.LAN.ISREVINV, width: 80, renderer: function (value, cellmeta) { if (value == 'true') { return Zi.LAN.YES; } } } ]; this.girdcolums = this.initgirdcolums; this.TtlSel = Ext.create('Ext.form.Label', { name: 'bottleslbl', labelAlign: 'right', width: 800 }); //定义Grid this.gridList = new Ext.grid.GridPanel({ store: this.storeList, enableHdMenu: false, region: 'center', loadMask: { msg: Zi.LAN.LoadData }, //数据加载中,请骚等 trackMouseOver: true, selModel: this.GridCheckBoxModel, disableSelection: false, viewConfig: { enableTextSelection: true }, features: [{ ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性 }], columns: this.girdcolums, // paging bar on the bottom bbar: [Ext.create('Ext.PagingToolbar', { store: this.storeList, displayInfo: true, displayMsg: Zi.LAN.FenYe, //当前显示条数据 emptyMsg: Zi.LAN.Nodata//没有数据 }), this.Pagenum, this.TtlSel] }); this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) { this.SelectedRecord = record; this.OprationStatus = 'edit'; var paytype = record.data.PAYTYPE; if (paytype == '入账申请')//入账申请 DsOpenEditWin('/Account/Chfee_payapplication/BalEdit', record.data.BILLNO); else { if (bltype == 'TruckIndex') DsOpenEditWin('/Account/Chfee_payapplication/TruckBLEdit', record.data.BILLNO); else DsOpenEditWin('/Account/Chfee_payapplication/BLEdit', record.data.BILLNO); } }, this); //this.gridList.addListener('itemmousedown', function (view, record, item, index, e, eOpts) { // this.selectbeginindex = index; //}, this); //this.gridList.addListener('itemmouseup', function (view, record, item, index, e, eOpts) { // this.selectendindex = index; // this.gridList.getSelectionModel().select(this.selectbeginindex); // alert(this.selectbeginindex + '-' + this.selectendindex); //}, this); 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('sortchange', function (ct, column, direction, eOpts) { this.sortfield = column.dataIndex; this.sortdire = direction; }, this); //#region formSearch //#region formSearch枚举参照相关 _this = this; var BLTYPEDFIELDNAME = 'EnumValueName'; if (strLANGUAGES == "en-us") { BLTYPEDFIELDNAME = 'EnumValueName_2'; } this.storeBILLSTATUS = Ext.create('DsExt.ux.RefEnumStore', {}); this.storeBILLSTATUS.load({ params: { enumTypeId: 97005} }); this.comboxBILLSTATUS = Ext.create('DsExt.ux.RefEnumCombox', { fieldLabel: Zi.LAN.sqdstat, //申请单状态 forceSelection: true, store: this.storeBILLSTATUS, valueField: 'EnumValueId', displayField: BLTYPEDFIELDNAME, name: 'BILLSTATUS' }); this.storeCust = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListRm' } }); // this.storeCust.load({ params: { condition: ""} }); this.comboxCust = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.SettlementUnit, //结算单位 store: this.storeCust, queryMode: 'remote', minChars: 1, queryParam: 'CODENAME', name: 'CustName', valueField: 'CustName', displayField: 'CodeAndName', enableKeyEvents: true, listeners: { 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/GetUserRefList' } }); this.storeOpCode.load(); // this.comboxAPPLICANT = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.Applicant, store: this.storeOpCode, forceSelection: true, name: 'APPLICANT', labelWidth: 50, valueField: 'GID', 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: 90, 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.ywnum, //业务编号 name: 'CustNo', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: Zi.LAN.sqnum, //申请编号 name: 'BsNo', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, this.comboxCust, this.comboxBILLSTATUS, { fieldLabel: Zi.LAN.InvoiceNumber, //发票号 name: 'InvNo', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { xtype: 'button', flex: 0.4, text: Zi.LAN.ExecuteQuery, //执行查询 iconCls: "btnrefresh", handler: function (button, event) { this.onRefreshClick(button, event); }, scope: this }, { xtype: 'button', flex:0.4, 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 } ] } , { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ { fieldLabel: Zi.LAN.FromDateApplication, //从付费申请日期 format: 'Y-m-d', xtype: 'datefield', name: 'ExpDateBgn', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: Zi.LAN.ToDateApplication, format: 'Y-m-d', xtype: 'datefield', name: 'ExpDateEnd', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, this.comboxAPPLICANT,{ xtype: 'hiddenfield', flex: 2.82 } ] } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); //#endregion formSearch //查询工具条 this.panelBtn = new Ext.Panel({ region: "north", tbar: [ { text: Zi.LAN.xnew, //新建 iconCls: "btnadd", handler: function (button, event) { this.OprationStatus = 'add'; if (bltype == 'TruckIndex') DsOpenEditWin('/Account/Chfee_payapplication/TruckBLEdit'); else DsOpenEditWin('/Account/Chfee_payapplication/BLEdit'); }, scope: this }, '-', { text: Zi.LAN.rzshenqing, //入账申请加入 iconCls: "btnadd", handler: function (button, event) { this.OprationStatus = 'add'; DsOpenEditWin('/Account/Chfee_payapplication/BalEdit'); }, scope: this }, '-', { text: Zi.LAN.ResetCondition, //重置条件 iconCls: "btnreset", handler: function (button, event) { var form = this.formSearch.getForm(); form.reset(); }, scope: this }, '-', { text: Zi.LAN.tjshe, //提交审核 tooltip: Zi.LAN.tjshe, id:'btnSubmitAudit', handler: function (button, event) { this.onSubmitAuditClick(); }, scope: this }, '-', { text: Zi.LAN.cxtijiao, //撤销提交 tooltip: Zi.LAN.cxtijiao, handler: function (button, event) { this.onSubmitAuditBackClick(); }, scope: this }, '-', { text: Zi.LAN.delete1, //删除 id: 'btndelete', iconCls: "btndelete", handler: function (button, event) { this.onDeleteClick(button, event); }, scope: this }, '-', { text: Zi.LAN.print, //打印 tooltip: Zi.LAN.printbb, //打印报表 menu: [ { text: Zi.LAN.printlb, //打印列表 handler: function (menu, event) { _this.printInvoice(menu, event, 1); } }, { text: Zi.LAN.printdp, //打印多票 handler: function (menu, event) { _this.printInvoice2(menu, event, 1); } }, { text: Zi.LAN.printxz, //打印选中 handler: function (menu, event) { _this.PrintSelect(menu, event, 1); } }], scope: this }, '-', { text: Zi.LAN.ExportExcel, //导出Excel id: "btnExportExcel", iconCls: 'btnexportexcel', handler: function (button, event) { this.onExportClick(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.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.initgirdcolums, 0, true); } }], scope: this }, { text: Zi.LAN.xswork, //显示工作流 id: "btnShowMap", iconCls: 'btnexportexcel', handler: function (button, event) { var selections = this.gridList.getSelectionModel().getSelection(); var record = selections[0]; var bsno = record.data.BILLNO; 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 = "../../Account/Chfee_payapplication/Map?bsno=" + bsno; window.open(openUrl, openType, openSet); }, scope: this }, { //text: Zi.LAN.songchat, //去送微信推送 id: "btnSendTM", iconCls: 'btnWeChat', handler: function (button, event) { var selections = this.gridList.getSelectionModel().getSelection(); var record = selections[0]; var bsno = record.data.BILLNO; Ext.Ajax.request({ waitMsg: Zi.LAN.onselect, //正在查询主表数据 url: '/Mobile/WeChatHandler/SendTM?bsno=' + bsno, callback: function (options, success, response) { if (success) { } }, scope: this }); //request over }, scope: this }, '-', { text: Zi.LAN.BIAOSHIINV, menu: [ { text: Zi.LAN.BIAOSHIINV, id: "btnPayAppAccBal", handler: function (menu, event) { _this.UpdateApp(menu, event, 1); } }, { text: Zi.LAN.QUXIAOBIAOSHIINV, id: "btnPayAppAccBalBack", handler: function (menu, event) { _this.UpdateApp(menu, event, 0); } }], scope: this } ] }); this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 105, 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); if (this.worksql != undefined && this.worksql != '') { this.worksql = this.worksql.replace(/@@/g, '=') this.sqlcontext = this.worksql; this.onDsQuery(); } else { this.onInitRefreshClick(); } this.gridList.on({ selectionchange: function (sm, selections) { _this.TtlSel.setText(''); if (selections.length == 0) { return; } var rmbcr = 0; var usdcr = 0; var otcr = 0; var rmblbcr = ""; var usdlbcr = ""; var otlbcr = ""; var j = selections.length; for (var i = 0; i < selections.length; i++) { var rec = selections[i]; var rmbcr = rmbcr + rec.data.AMOUNTRMB; var usdcr = usdcr + rec.data.AMOUNTUSD; var otcr = otcr + rec.data.AMOUNTOT; } if (rmbcr != 0) { rmblbcr ="RMB:" + returnfloat(rmbcr) + "|"; // rmblb = "统计信息(文字标题)(字段名-中文):(字段值-负值)(字段名-中文):(字段值-正值)"; } if (usdcr != 0) { usdlbcr = "USD:" + returnfloat(usdcr) + "|"; } if (otcr != 0) { otlbcr ="其他:" + returnfloat(otcr) + "|"; } _this.TtlSel.setText(Zi.LAN.selectsum + ' :' +rmblbcr + usdlbcr + otlbcr); } }); }, //end initUIComponents onInitRefreshClick: function (button, event) { var sql = ' cm.BILLSTATUS<>4 '; this.sqlcontext = sql; this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: Zi.LAN.onselect, //正在查询数据 scope: this }); }, 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.onselect, //正在查询数据 scope: this }); }, onDsQuery: function () { 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.onselect, //正在查询数据 scope: this }); }, onDeleteClick: function (button, event) { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) {//提示 请先选择单据 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 billstatus = record.data.BILLSTATUS; if (billstatus != '1' && billstatus != '6') { // 提示 当前状态无法删除此单据 Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.nodelete, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } //提示', '确定删除该记录吗? 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: '/Account/Chfee_payapplication/Delete', params: { 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); //Zi.LAN.Prompt, 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) {//Zi.LAN.Prompt, msg: Zi.LAN.SelectDanju, Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.SelectDanju, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var btnESubmitAudit = Ext.getCmp('btnSubmitAudit'); btnESubmitAudit.disable(); var BILLNOStr = ''; for (var i = 0; i < selections.length; i++) { var rec = selections[i]; var BILLNO = rec.data.BILLNO; if (rec.data.BILLSTATUS == '1' || rec.data.BILLSTATUS == '6') { if (BILLNOStr == '') BILLNOStr = BILLNO; else { BILLNOStr = BILLNOStr + ',' + BILLNO; } } } _this = this; if (BILLNOStr == '') { } else { Ext.Ajax.request({// '正在添加数据...', waitMsg: Zi.LAN.addnumnow, url: '/Account/Chfee_payapplication/SubmitAuditList', params: { bills: BILLNOStr }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({// Zi.LAN.Prompt title: Zi.LAN.Prompt, msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); btnESubmitAudit.enable(); return; } else { btnESubmitAudit.enable(); _this.storeList.reload(); } } else {//请求出现错误,请重试' btnESubmitAudit.enable(); 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.BILLNO; if (rec.data.BILLSTATUS == '2') { if (BILLNOStr == '') BILLNOStr = BILLNO; else { BILLNOStr = BILLNOStr + ',' + BILLNO; } } } _this = this; if (BILLNOStr == '') { } else { Ext.Ajax.request({//正在添加数据.. waitMsg: Zi.LAN.addnumnow, url: '/Account/Chfee_payapplication/SubmitAuditBackList', 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 }); }; }, UpdateApp: function (button, event, type) { 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 BILLNOStr = ''; for (var i = 0; i < selections.length; i++) { var rec = selections[i]; var BILLNO = rec.data.BILLNO; if (BILLNOStr == '') BILLNOStr = BILLNO; else { BILLNOStr = BILLNOStr + ',' + BILLNO; } } _this = this; if (BILLNOStr == '') { } else { Ext.Ajax.request({ waitMsg: '正在添加数据...', url: '/Account/Chfee_payapplication/UpdateISREVINV', params: { bills: BILLNOStr, type: type }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } else { _this.storeList.reload(); } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }; }, 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, "BILLNO like '%" + customNo + "%'"); var custName = form.findField('CustName').getValue(); sql = sql + getAndConSql(sql, custName, "CUSTOMERNAME like '%" + custName + "%'"); // var expDateBgn = form.findField('ExpDateBgn').getRawValue(); // sql = sql + getAndConSql(sql, expDateBgn, "APPLYTIME >='" + expDateBgn + "'"); // var expDateEnd = form.findField('ExpDateEnd').getRawValue(); // sql = sql + getAndConSql(sql, expDateEnd, "APPLYTIME <='" + expDateEnd + "'"); var InvNo = form.findField('InvNo').getValue(); sql = sql + getAndConSql(sql, InvNo, "INVNO like '%" + InvNo + "%'"); var CustNo = form.findField('CustNo').getValue(); sql = sql + getAndConSql(sql, CustNo, "exists (SELECT 1 FROM CH_FEE_DO d LEFT JOIN V_OP_BILL B ON (B.BSNO=D.BSNO) WHERE cm.BILLNO=d.BILLNO AND (b.CUSTNO+''+b.MBLNO+''+b.HBLNO+''+b.CUSTOMNO+''+b.ORDERNO) like '%" + CustNo + "%' )"); var BILLSTATUS = form.findField('BILLSTATUS').getValue(); sql = sql + getAndConSql(sql, BILLSTATUS, "BILLSTATUS= " + BILLSTATUS + ""); var expDateBgn = form.findField('ExpDateBgn').getRawValue(); sql = sql + getAndConSql(sql, expDateBgn, "APPLYTIME >='" + expDateBgn + "'"); var expDateEnd = form.findField('ExpDateEnd').getRawValue(); sql = sql + getAndConSql(sql, expDateEnd, "APPLYTIME <='" + expDateEnd + "'"); var APPLICANT = form.findField('APPLICANT').getValue(); sql = sql + getAndConSql(sql, APPLICANT, "APPLICANT= '" + APPLICANT + "'"); 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) { GridExportExcelPage(this.gridList); }, printInvoice: function () { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) { //Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.SelectDanju, 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('BILLNO') + "'"; if (feeGidSql == '') { feeGidSql = feeGId; } else { feeGidSql = feeGidSql + "," + feeGId; } }; var record = selections[0]; var billNo = record.data.BILLNO; var printType = 'MSCHFEEPAYAPPLICATIONSEL'; var sql1 = "SELECT p.*,(select ShowName from [user] where GID=p.APPLICANT) as APPLICANTNAME,(select bankname from info_client_bank where gid=p.CUSTACCOUNTGID) CUSTBANKNAME,"; sql1 = sql1 + "(select ACCOUNT from info_client_bank where gid=p.CUSTACCOUNTGID) CUSTACCOUNT,dbo.GetStlByPayNo(p.BILLNO) as BALBILLNO FROM ch_fee_payapplication p WHERE BILLNO IN (" + feeGidSql + ") "; var sql2 = ""; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); }, printInvoice2: function () { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) { //Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.SelectDanju, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var isaudit = 1; var isprint = 0; var feeGidSql = ''; for (var i = 0; i < selections.length; i++) { var record = selections[i]; var feeGId = "'" + record.get('BILLNO') + "'"; if (feeGidSql == '') { feeGidSql = feeGId; } else { feeGidSql = feeGidSql + "," + feeGId; } //审核通过 已结算 部分结算 if (record.data.BILLSTATUSREF != '审核通过' && record.data.BILLSTATUSREF != '已结算' && record.data.BILLSTATUSREF != '部分结算') { isaudit = 0; } if (record.data.ISPRINT == '1') { isprint = 1; } }; var record = selections[0]; var billNo = record.data.BILLNO; var printType = 'PayFeeAuditReport2'; var sql1 = "SELECT * FROM VW_PrintPayFeeAuditReport2 WHERE BILLNO in (" + feeGidSql + ") order by CUSTOMERNAME,MBLNO,FEENAME "; var sql2 = "select * from ch_fee_do where billno in( SELECT distinct billno FROM VW_PrintPayFeeAuditReport2 WHERE BILLNO in (" + feeGidSql + "))"; var sql3 = "SELECT u.GID as 惟一编号,u.USERNAME as 英文名,u.PASSWORD as 登录密码,u.CODENAME as 用户代码名,u.SHOWNAME as 显示用户名 "; sql3 = sql3 + " ,u.ENROLLTIME as 注册时间,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = u.CREATEUSER) as 操作人 "; sql3 = sql3 + " ,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = u.MODIFIEDUSER) as 更改操作人,u.MODIFIEDTIME as 更改操作时间,u.ISDELETED as 账户删除状态标志,u.ISDISABLE as 账户禁用状态标志 "; sql3 = sql3 + " ,b.COMPANYNAME as 公司简称,b.DEPTNAME as 部门名称,b.QQ as QQ,b.MSN as MSN,(CASE b.OFFICEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.OFFICEPHONE END) as 办公电话号码 "; sql3 = sql3 + " ,(CASE b.HOMEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.HOMEPHONE END) as 家庭电话号码,b.MOBILE as 手机号码 "; sql3 = sql3 + " ,(CASE b.FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.FAX END) as 传真号码,b.EMAIL1 as 主电子邮件地址,b.EMAIL2 as 次电子邮件地址,b.HOMEADDRESS as 家庭地址 "; sql3 = sql3 + " ,b.REMARK as 备注信息,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = b.CREATEUSER) as 创建人,b.CREATETIME as 创建时间,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = b.MODIFIEDUSER) as 最后一次操作人 "; sql3 = sql3 + " ,b.MODIFIEDTIME as 最后一次操作时间,b.EMERGUSER as 紧急联系人,(CASE b.EMERGPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.EMERGPHONE END) as 紧急联系人联系电话 "; sql3 = sql3 + " ,b.EMERGEMAIL as 紧急联系人邮箱,b.POSTCODE as 邮政编码,b.SIGNATURE as 签名图片,b.FINANCESOFTCODE as 财务软件代码,b.IMAGEURL as 头像url,b.SIGNATUREURL as 签名Url "; sql3 = sql3 + " FROM [user] as u INNER JOIN user_baseinfo as b ON u.GID = b.USERID where u.GID='" + USERID + "'"; var sql4 = "SELECT GID as 惟一编号,CODENAME as 公司代码名,NAME as 公司简称,FULLNAME as 公司全称,ENNAME as 公司英文名称,ADDRESS as 公司联络地址,ENADDRESS as 公司英文地址,POSTCODE as 邮政编码 "; sql4 = sql4 + " ,(CASE OFFICEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE OFFICEPHONE END) AS 公司办公电话,(CASE FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE FAX END) AS 传真号码"; sql4 = sql4 + " ,EMAIL as 电子邮箱,WEBSITEURL as 公司网址,LICENSECODE as 工商登记号,TAXCODE as 税务登记号,LOGO as 徽标,BillRises as 发票抬头,ChequePayable as 支票抬头"; sql4 = sql4 + " ,PRTHEADXML1 as 打印抬头1,PRTHEADXML2 as 打印抬头2,PRTHEADXML3 as 打印抬头3,PRTHEADXML4 as 打印抬头4,PRTHEADXML5 as 打印抬头5,CREATEUSER as 创建人gid,CREATETIME as 创建时间"; sql4 = sql4 + " ,MODIFIEDUSER as 更新人gid,MODIFIEDTIME as 更新时间,ISDELETED as 是否删除,ISDISABLE as 是否被禁用,PARENTID as 父公司GID,BANKSHEAD as 票号头字符 FROM [company] WHERE GID = '" + COMPANYID + "'"; var sql5 = ""; var sql6 = ""; if (isaudit == 1 && isprint == 0) { PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); Ext.Ajax.request({ waitMsg: '', url: '/Account/Chfee_payapplication/UpdatePrint', params: { billnos: feeGidSql }, callback: function (options, success, response) { if (success) { _this.storeList.reload(); } else { } }, scope: this }); } else { Ext.Ajax.request({ waitMsg: '', url: '/MvcShipping/MsSysParamSet/GetData', params: { condition: "PARAMNAME='PAYAPPPRINTAFTERAUDIT'" }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (result.Success != true) { } else { var data = result.data; if (data.PARAMVALUE == '1' && isaudit == 0) {//错误', msg: '付费申请必须审核通过后才能打印' Ext.Msg.show({ title: Zi.LAN.Error, msg: Zi.LAN.shtgprint, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } else { Ext.Ajax.request({ waitMsg: '', url: '/MvcShipping/MsSysParamSet/GetData', params: { condition: "PARAMNAME='PAYAPPONLYPRINTONE'" }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (result.Success != true) { } else { var data = result.data; if (data.PARAMVALUE == '1' && isprint == 1) {//Zi.LAN.Error, msg: '付费申请已打印过,不允许重复打印' Ext.Msg.show({ title: Zi.LAN.Error, msg: Zi.LAN.notcfprint, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } else { PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); Ext.Ajax.request({ waitMsg: '', url: '/Account/Chfee_payapplication/UpdatePrint', params: { billnos: feeGidSql }, callback: function (options, success, response) { if (success) { _this.storeList.reload(); } else { } }, scope: this }); } } } else { } }, scope: this }); // PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); } } } else { } }, scope: this }); } }, PrintSelect: function () { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) { //Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.SelectDanju, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var isaudit = 1; var isprint = 0; var feeGidSql = ''; for (var i = 0; i < selections.length; i++) { var record = selections[i]; var feeGId = "'" + record.get('BILLNO') + "'"; if (feeGidSql == '') { feeGidSql = feeGId; } else { feeGidSql = feeGidSql + "," + feeGId; } if (record.data.BILLSTATUSREF != '审核通过' && record.data.BILLSTATUSREF != '已结算' && record.data.BILLSTATUSREF != '部分结算') { isaudit = 0; } if (record.data.ISPRINT == '1') { isprint = 1; } }; var record = selections[0]; var billNo = record.data.BILLNO; var printType = 'MSCHFEEPAYAPPLICATIONSEL'; var sql1 = "SELECT p.*,(select ShowName from [user] where GID=p.APPLICANT) as APPLICANTNAME,(select bankname from info_client_bank where gid=p.CUSTACCOUNTGID) CUSTBANKNAME,"; sql1 = sql1 + "(select ACCOUNT from info_client_bank where gid=p.CUSTACCOUNTGID) CUSTACCOUNT,dbo.GetStlByPayNo(p.BILLNO) as BALBILLNO FROM ch_fee_payapplication p WHERE BILLNO IN (" + feeGidSql + ") "; var sql2 = ""; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; if (isaudit == 1 && isprint == 0) { PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); Ext.Ajax.request({ waitMsg: '', url: '/Account/Chfee_payapplication/UpdatePrint', params: { billnos: feeGidSql }, callback: function (options, success, response) { if (success) { _this.storeList.reload(); } else { } }, scope: this }); } else { Ext.Ajax.request({ waitMsg: '', url: '/MvcShipping/MsSysParamSet/GetData', params: { condition: "PARAMNAME='PAYAPPPRINTAFTERAUDIT'" }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (result.Success != true) { } else { var data = result.data; if (data.PARAMVALUE == '1' && isaudit == 0) { Ext.Msg.show({ title: Zi.LAN.Error, msg: Zi.LAN.shtgprint, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } else { Ext.Ajax.request({ waitMsg: '', url: '/MvcShipping/MsSysParamSet/GetData', params: { condition: "PARAMNAME='PAYAPPONLYPRINTONE'" }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (result.Success != true) { } else { var data = result.data; if (data.PARAMVALUE == '1' && isprint == 1) { Ext.Msg.show({ title: Zi.LAN.Error, msg: Zi.LAN.notcfprint, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } else { Ext.Ajax.request({ waitMsg: '', url: '/Account/Chfee_payapplication/UpdatePrint', params: { billnos: feeGidSql }, callback: function (options, success, response) { if (success) { _this.storeList.reload(); } else { } }, scope: this }); PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); } } } else { } }, scope: this }); // PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); } } } else { } }, scope: this }); } } });