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: '每页记录数', 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: '申请单号', width: 120 }, { sortable: true, dataIndex: 'BILLSTATUSREF', header: '状态', width: 80, renderer: function (value, meta, record) { value = record.data.BILLSTATUSREF; if (value == '审核通过') { meta.tdCls = 'feestatus_pass'; } else if (value == '录入状态') { } else if (value == '已提交') { meta.tdCls = 'feestatus_refer'; } else if (value == '部分结算') { meta.tdCls = 'feestatus_refer'; } else if (value == '已结算') { meta.tdCls = 'feestatus_settle'; } return record.data.BILLSTATUSREF; } }, { sortable: true, dataIndex: 'CUSTOMERNAME', header: '结算单位', width: 120 }, { sortable: true, dataIndex: 'CURR', header: '币别', 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: '外币', 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: '申请日期', width: 100 }, { sortable: true, dataIndex: 'APPLICANTNAME', header: '申请人', width: 100 }, { sortable: true, dataIndex: 'RECVTIME', header: '申请收款日期', width: 100 }, { sortable: true, dataIndex: 'PREAMOUNTRMB', 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: 'PREAMOUNTUSD', header: '预计结算外币', 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: '未申请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: '未申请外币', 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:'打印次数', //驳回原因 width: 80 }, { sortable: true, dataIndex: 'REMARK', header: '备注', width: 160 } ]; this.girdcolums = this.initgirdcolums; this.gridList = new Ext.grid.GridPanel({ store: this.storeList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, 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: '当前显示 {0} - {1}条记录 /共 {2}条记录', emptyMsg: "没有数据" }), 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: '结算单位', store: this.storeCustCode, allowBlank: true, queryMode: 'remote', forceSelection: true, minChars: 1, queryParam: 'CODENAME', name: 'CustName', valueField: 'CustName', displayField: 'CodeAndName' }); this.storeBILLSTATUS = Ext.create('DsExt.ux.RefEnumStore', {}); this.storeBILLSTATUS.load({ params: { enumTypeId: 97005} }); this.comboxBILLSTATUS = Ext.create('DsExt.ux.RefEnumCombox', { fieldLabel: '申请单状态', forceSelection: true, store: this.storeBILLSTATUS, 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: '申请编号', name: 'BillNo', listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '业务编号', name: 'BsNo', listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '结算编号', name: 'SettNo', listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } } , this.comboxCustCode, this.comboxBILLSTATUS, { xtype: 'button', text: "执行查询", 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: '从..金额', 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: '到..金额', 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: '从申请日期', format: 'Y-m-d', xtype: 'datefield', name: 'ExpDateBgn', listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '到申请日期', 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: "高级查询", 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: "新建", iconCls: "btnadd", handler: function (button, event) { this.OprationStatus = 'add'; DsOpenEditWin('/Account/Chfee_recvapplication/BLEdit'); }, scope: this }, { text: "重置条件", iconCls: "btnreset", handler: function (button, event) { var form = this.formSearch.getForm(); form.reset(); }, scope: this }, '-', { text: '提交申请', tooltip: '提交申请', handler: function (button, event) { this.onSubmitAuditClick(); }, scope: this }, '-', { text: '撤销提交', tooltip: '撤销提交', handler: function (button, event) { this.onSubmitAuditBackClick(); }, scope: this }, '-', { text: '审核通过', //审核通过 iconCls: "btnadd", id:'btnAuditPass', handler: function (button, event) { this.onAuditPassClick(); }, scope: this }, '-', { text: '驳回提交', //审核通过 iconCls: "btndelete", id: 'btnAuditBack', handler: function (button, event) { this.onAuditBackClick(); }, scope: this }, '-', { text: "删除", id: 'btndelete', iconCls: "btndelete", handler: function (button, event) { this.onDeleteClick(button, event); }, scope: this }, '-', { text: "打印", handler: function (button, event) { this.PrintSelect(); }, scope: this }, '-', { text: "保存列表样式", id: "btntest", menu: [ { text: "保存", handler: function (button, event) { this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.girdcolums, 1, true); } }, { text: "初始化", handler: function (menu, event) { _this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.initgirdcolums, 1, true); } }], scope: this }, '-', { text: "打印报表", menu: menu1, scope: this }, '-', { text: "导出Excel", id: "btnExportExcel", iconCls: 'btnexportexcel', handler: function (button, event) { this.onExportClick(button, event); }, scope: this }, '-', { text: "生成发票申请", 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: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var record = selections[0]; var billstatus = record.data.BILLSTATUS; if (billstatus != '1') { Ext.Msg.show({ title: '提示', msg: '当前状态无法删除此单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) { if (btn == 'yes') { Ext.Msg.wait('正在删除数据...'); Ext.Ajax.request({ waitMsg: '正在删除数据...', 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: '提示', msg: '删除成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }, failure: function (response, options) { Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); }, success: function (response, options) { }, scope: this }); //end Ext.Ajax.request } }, this); }, //onDeleteClick onCreateInvAppClick: function (button, event) { 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 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: '提示', 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 (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: '正在添加数据...', 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: '提示', msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } else { _this.onRefreshClick(); } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); } }, onSubmitAuditBackClick: 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 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: '正在添加数据...', 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: '提示', msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } else { _this.onRefreshClick(); } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }; }, onAuditPassClick: 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 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:'提示', msg:'只有提交审核和驳回审核的才能审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; } var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); _this = this; Ext.MessageBox.confirm('提示', '确认要审核吗?', function (btn) { if (btn == 'yes') { Ext.Msg.wait('正在审核...'); Ext.Ajax.request({ waitMsg: '正在审核...', 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: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }, failure: function (response, options) { Ext.Msg.show({ title:'错误', msg:'服务器响应出错!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); }, success: function (response, options) { }, scope: this }); //end Ext.Ajax.request } }, this); }, onAuditBackClick: 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 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: '提示', msg: '只有提交审核或审核通过的才能驳回!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; } var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); _this = this; Ext.MessageBox.confirm('提示', '确认要驳回审核吗?', function (btn) { if (btn == 'yes') { Ext.Msg.wait('正在驳回审核...'); Ext.Ajax.request({ waitMsg: '正在驳回审核...', 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: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }, failure: function (response, options) { Ext.Msg.show({ title: '错误', msg: '服务器响应出错!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); }, success: function (response, options) { }, scope: this }); //end Ext.Ajax.request } }, this); }, getCondition: function () { var form = this.formSearch.getForm(); if (!form.isValid()) { Ext.Msg.alert('提示', '查询条件赋值错误,请检查。'); 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: '提示', 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('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); } });