Ext.namespace('Shipping'); Shipping.MsChRecvapplicationIndex = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsChRecvapplicationIndex.superclass.constructor.call(this); }; Ext.extend(Shipping.MsChRecvapplicationIndex, Ext.Panel, { PageSize: 30, OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, sqlcontext: '', selectbsnostr: '', selectfeestr: '', initUIComponents: function () { //#region 定义数据集 this.sqlcontext = ''; this.formname = "formChRecvapplicationIndex"; //页面名称 this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', { model: 'MsOP', proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' } }); this.StoreOpRange.load({ params: { optype: "modRecvSettleAppList"} }); this.storeList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, model: 'MsChRecvapplication', remoteSort: true, proxy: { type: 'ajax', url: '/Account/Chfee_recvapplication/GetDataList', reader: { id: 'BILLNO', root: 'data', totalProperty: 'totalCount' } } }); _this = this; //#endregion //#region 定义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.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); this.initgirdcolums = [{ sortable: true, dataIndex: 'BILLNO', header: Zi.LAN.RequisitionNumber, width: 120 }, { sortable: true, dataIndex: 'BILLSTATUSREF', header: Zi.LAN.status, width: 80, 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 == '未提交') { value = Zi.LAN.WEITIJIAO; }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: 'CURR', header: Zi.LAN.Currency, width: 50 }, { sortable: true, dataIndex: 'AMOUNTRMB', header: '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: 'AMOUNTUSD', header: Zi.LAN.OtherBi, 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: 'RECVTIME', header: Zi.LAN.RECVTIME, width: 100 }, { sortable: true, dataIndex: 'PREAMOUNTRMB', header: Zi.LAN.yjsuan + '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', 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', 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', 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: 'PRINTCOUNT', header: Zi.LAN.PRINTCOUNT, //驳回原因 width: 80 }, { sortable: true, dataIndex: 'REMARK', header: Zi.LAN.Remarks, width: 160 }, { sortable: true, dataIndex: 'SALECORP', header: Zi.LAN.DepartmentName, //驳回原因 width: 80 } ]; this.girdcolums = this.initgirdcolums; this.gridList = new Ext.grid.GridPanel({ store: this.storeList, enableHdMenu: false, region: 'center', loadMask: { msg: Zi.LAN.LoadData}, trackMouseOver: true, disableSelection: false, selModel: this.GridCheckBoxModel, viewConfig: { enableTextSelection: true, autoFill: true }, columns: this.girdcolums, // paging bar on the bottom bbar: [Ext.create('Ext.PagingToolbar', { store: this.storeList, displayMsg: Zi.LAN.FenYe, emptyMsg: Zi.LAN.Nodata }), this.Pagenum] }); this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) { this.SelectedRecord = record; this.OprationStatus = 'edit'; DsOpenEditWin('/Account/Chfee_recvapplication/BLEdit'); }, 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); //#endregion //#region formSearch //#region formSearch枚举参照相关 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.SettlementUnit, store: this.storeCustCode, allowBlank: true, queryMode: 'remote', forceSelection: true, minChars: 1, queryParam: 'CODENAME', name: 'CustName', valueField: 'CustName', displayField: 'CodeAndName' }); 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: 'EnumValueName', displayField: BLTYPEDFIELDNAME, name: 'BILLSTATUS', listeners: { specialkey: 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.sqnum, name: 'BillNo', listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: Zi.LAN.ywnum, name: 'BsNo', listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: Zi.LAN.SettNo, name: 'SettNo', listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } } , this.comboxCustCode, this.comboxBILLSTATUS, { xtype: 'button', text: Zi.LAN.ExecuteQuery, width: 90, iconCls: "btnrefresh", handler: function (button, event) { this.onRefreshClick(button, event); }, scope: this } ] } ]//end items(fieldset 1) }//end fieldset 1 , {//fieldset 2 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: Zi.LAN.Amount_min, name: 'Amount_min', 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; }, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: Zi.LAN.Amount_max , name: 'Amount_max', 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; }, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: Zi.LAN.ExpDateBgn, format: 'Y-m-d', xtype: 'datefield', name: 'ExpDateBgn', listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: Zi.LAN.ExpDateEnd, format: 'Y-m-d', xtype: 'datefield', name: 'ExpDateEnd', listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } } , { xtype: 'hiddenfield', flex: 1 }, { xtype: 'button', text: Zi.LAN.AdvancedSearch, width: 90, iconCls: "btnmore", handler: function (button, event) { var sql = this.getCondition(); var winAccess = new Shipping.DsQuery({ }); winAccess.StoreList = this.storeList; winAccess.formname = this.formname; winAccess.condition = sql; winAccess.show(); return; }, scope: this } ] } ]//end items(fieldset 1) }//end fieldset 2 ]//end root items }); var menu1 = new Ext.menu.Menu({ id: 'basicMenu', items: [{ text: '收款分组统计', handler: clickHandler }] }); function clickHandler() { panelIndex.Print(); }; this.panelBtn = new Ext.Panel({ region: "north", tbar: [ { text: Zi.LAN.xnew, iconCls: "btnadd", handler: function (button, event) { this.OprationStatus = 'add'; DsOpenEditWin('/Account/Chfee_recvapplication/BLEdit'); }, 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, 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.ExaminationPassed, //审核通过 iconCls: "btnadd", id:'btnAuditPass', handler: function (button, event) { this.onAuditPassClick(); }, scope: this }, '-', { text: Zi.LAN.DismissedSubmission , //审核通过 iconCls: "btndelete", id: 'btnAuditBack', handler: function (button, event) { this.onAuditBackClick(); }, scope: this }, '-', { text: Zi.LAN.delete1, id: 'btndelete', iconCls: "btndelete", handler: function (button, event) { this.onDeleteClick(button, event); }, scope: this }, '-', { text: Zi.LAN.print, handler: function (button, event) { this.PrintSelect(); }, 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, 1, true); } }], scope: this }, '-', { text: Zi.LAN.printlb, menu: menu1, scope: this }, '-', { text: Zi.LAN.ExportExcel, id: "btnExportExcel", iconCls: 'btnexportexcel', handler: function (button, event) { this.onExportClick(button, event); }, scope: this }, '-', { text: Zi.LAN.CreateInvApp, handler: function (button, event) { this.onCreateInvAppClick(button, event); }, scope: this } ] }); //#endregion 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.getCondition(); var sql = this.sqlcontext; Ext.apply(store.proxy.extraParams, { condition: sql }); }, this); Ext.getCmp('btnAuditPass').disable(); Ext.getCmp('btnAuditBack').disable(); Ext.Ajax.request({ waitMsg: '', url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable', params: { modulename: "modRevcAppAudit" }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (result.Success) { Ext.getCmp('btnAuditPass').enable(); Ext.getCmp('btnAuditBack').enable(); } } else { } }, scope: this }); this.onRefreshClick(); }, //end initUIComponents 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: "正在查询数据...", scope: this }); }, onDsQuery: function (button, event) { 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: "正在查询数据...", scope: this }); }, onDeleteClick: function (button, event) { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: Zi.LAN.TiShi, 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_recvapplication/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); 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) { 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 onCreateInvAppClick: function (button, event) { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.SelectDanju, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var record = selections[0]; var invcust = record.data.CUSTOMERNAME; var Curr = record.data.CURR; this.selectbsnostr = " f.GID IN (SELECT FEEID FROM CH_FEE_DO WHERE BILLNO='" + record.data.BILLNO + "') "; this.selectfeestr = " f.GID IN (SELECT FEEID FROM CH_FEE_DO WHERE BILLNO='" + record.data.BILLNO + "') "; DsOpenEditWin("/Account/Chfee_invoiceapplication/BLEdit?handle=check&bsnosql=recapplist&bsCurr=" + Curr + "&bsCust=" + invcust, '发票申请'); }, //onDeleteClick onSubmitAuditClick: function () { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: Zi.LAN.TiShi, 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 == '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_recvapplication/SubmitAuditList', 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.TiShi, msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } else { _this.onRefreshClick(); } } else { Ext.MessageBox.alert(Zi.LAN.FuWuQiError, response.responseText); } }, scope: this }); } }, onSubmitAuditBackClick: function () { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: Zi.LAN.TiShi, 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_recvapplication/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.TiShi, msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } else { _this.onRefreshClick(); } } else { Ext.MessageBox.alert(Zi.LAN.FuWuQiError, response.responseText); } }, scope: this }); }; }, onAuditPassClick: function () { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.SelectDanju, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var isAuditExrate = false; var bodyAddDatas = []; for (var i = 0; i < selections.length; i++) { var rec = selections[i]; var BILLSTATUS = rec.data.BILLSTATUS; if ((BILLSTATUS == '6' || BILLSTATUS == '2')) { bodyAddDatas.push(rec); } else { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.ZHIYOUTIJHEBOHUICAINENGSHENHE, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; } var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); _this = this; Ext.MessageBox.confirm(Zi.LAN.TiShi, Zi.LAN.QUEDINGYAOSHENHEMA, function (btn) { if (btn == 'yes') { Ext.Msg.wait(Zi.LAN.NowShenHe); Ext.Ajax.request({ waitMsg: Zi.LAN.NowShenHe, url: '/Account/Chfee_recvapplication/AuditList', params: { data: jsonbodyAddDatas }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { _this.storeList.reload(); Ext.Msg.show({ title: Zi.LAN.TiShi, msg: jsonresult.Message, 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) { Ext.Msg.show({ title: Zi.LAN.Error, msg: Zi.LAN.FuWuQiError, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); }, success: function (response, options) { }, scope: this }); //end Ext.Ajax.request } }, this); }, onAuditBackClick: function () { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.SelectDanju, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var isAuditExrate = false; var bodyAddDatas = []; for (var i = 0; i < selections.length; i++) { var rec = selections[i]; var BILLSTATUS = rec.data.BILLSTATUS; if ((BILLSTATUS == '0' || BILLSTATUS == '2')) { bodyAddDatas.push(rec); } else { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.ZHIYOUTIJHEBOHUICAINENGBOHUI, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; } var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); _this = this; Ext.MessageBox.confirm(Zi.LAN.TiShi, Zi.LAN.QUEDINGYAOBOHUI, function (btn) { if (btn == 'yes') { Ext.Msg.wait(Zi.LAN.NowShenHe); Ext.Ajax.request({ waitMsg: Zi.LAN.NowShenHe, url: '/Account/Chfee_recvapplication/AuditBackList', params: { data: jsonbodyAddDatas }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { _this.storeList.reload(); Ext.Msg.show({ title: Zi.LAN.TiShi, msg: jsonresult.Message, 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) { Ext.Msg.show({ title: Zi.LAN.Error, msg: Zi.LAN.FuWuQiError, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); }, success: function (response, options) { }, scope: this }); //end Ext.Ajax.request } }, this); }, getCondition: function () { var form = this.formSearch.getForm(); if (!form.isValid()) { Ext.Msg.alert(Zi.LAN.TiShi, '查询条件赋值错误,请检查。'); return ''; } var sql = ''; var BillNo = form.findField('BillNo').getValue(); sql = sql + getAndConSql(sql, BillNo, " BillNo like '%" + BillNo + "%' "); var BsNo = form.findField('BsNo').getValue(); sql = sql + getAndConSql(sql, BsNo, " Billno in (select BILLNO from ch_fee_do where bsno in(select bsno from v_op_bs where Custno like '%" + BsNo + "%' OR MBLNO like '%" + BsNo + "%')) "); var SettNo = form.findField('SettNo').getValue(); sql = sql + getAndConSql(sql, SettNo, " Billno in (select PAYBILLNO from ch_fee_do_payapplication where Billno like '%" + SettNo + "%' )"); 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 Amount_max = form.findField('Amount_max').getValue(); if (parseFloat(Amount_max) == 0 || Amount_max == "") { var Amount_min = form.findField('Amount_min').getValue(); sql = sql + getAndConSql(sql, Amount_min, "(AmountRMB = " + Amount_min + " or AmountUSD = " + Amount_min + ")"); } else { var Amount_min = form.findField('Amount_min').getValue(); sql = sql + getAndConSql(sql, Amount_min, "((AmountRMB<>0 and AmountRMB >= " + Amount_min + ") or (AmountUSD<>0 and AmountUSD >= " + Amount_min + "))"); var Amount_max = form.findField('Amount_max').getValue(); sql = sql + getAndConSql(sql, Amount_max, "((AmountRMB<>0 and AmountRMB <= " + Amount_max + ") or (AmountUSD<>0 and AmountUSD<= " + Amount_max + "))"); } var BILLSTATUS = form.findField('BILLSTATUS').getValue(); sql = sql + getAndConSql(sql, BILLSTATUS, " BILLSTATUS= " + BILLSTATUS + ""); return sql; }, 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; }, onExportClick: function (button, event) { _this = this; GridExportExcelPage(this.gridList); }, PrintSelect: function () { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: Zi.LAN.TiShi, 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 = 'MSCHFEERECAPPLICATIONSEL'; var sql1 = "SELECT p.*,(select ShowName from [user] where GID=p.APPLICANT) as APPLICANTNAME FROM ch_fee_recvapplication p WHERE BILLNO IN (" + feeGidSql + ") "; var sql2 = ""; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); Ext.Ajax.request({ waitMsg: '', url: '/Account/Chfee_recvapplication/UpdatePrint', params: { billnos: feeGidSql }, callback: function (options, success, response) { if (success) { _this.storeList.reload(); } else { } }, scope: this }); }, Print: function () { var form = this.formSearch.getForm(); var sql = ""; 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 + "'"); if (custName == "" || expDateBgn == "" || expDateBgn == "") { alert("必须选择客户和申请起止日期"); return; } var printType = 'Report_CustRecv'; var sql1 = "select bsno,sum(amount*EXCHANGERATE) amount, c.FEEGROUP "; sql1 = sql1 + " into #recvt1 from ch_fee_do d "; sql1 = sql1 + " left join code_fee c on c.NAME=d.FEENAME "; sql1 = sql1 + " where BILLNO in( "; sql1 = sql1 + " select billno from ch_fee_recvapplication where CUSTOMERNAME='" + custName + "' "; sql1 = sql1 + " and APPLYTIME >='" + expDateBgn + "' and APPLYTIME <='" + expDateEnd + "' "; sql1 = sql1 + " )group by bsno,c.FEEGROUP "; sql1 = sql1 + " select distinct m.hth,(select amount from #recvt1 where #recvt1.bsno=t1.bsno and #recvt1.feegroup='代理费') 代理费 "; sql1 = sql1 + " ,(select amount from #recvt1 where #recvt1.bsno=t1.bsno and #recvt1.feegroup='货款') 货款 "; sql1 = sql1 + " ,(select amount from #recvt1 where #recvt1.bsno=t1.bsno and #recvt1.feegroup='税金') 税金 "; sql1 = sql1 + " ,(select amount from #recvt1 where #recvt1.bsno=t1.bsno and #recvt1.feegroup not in('代理费','货款','税金')) 其他 "; sql1 = sql1 + " from #recvt1 t1 left join import_main m on m.contractno=t1.bsno"; sql1 = sql1 + " drop table #recvt1 "; var sql2 = "select '" + custName + "' as custName,'" + expDateBgn + "' as expDateBgn,'" + expDateEnd + "' as expDateEnd"; // var sql3 = " select * from company where gid=(select top 1 companyid from ch_fee_do where BILLNO='" + billNo + "') "; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); } });