Ext.namespace('Shipping'); Shipping.ChInvoiceapplicationAudit = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.ChInvoiceapplicationAudit.superclass.constructor.call(this); }; Ext.extend(Shipping.ChInvoiceapplicationAudit, Ext.Panel, { PageSize: 15, OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, isAudit: '', billno: '', sqlcontext: '', initUIComponents: function () { //定义数据集 this.formname = "ChInvoiceapplicationAudit" this.billno = ''; this.sqlcontext = ''; _this = this; Ext.Ajax.timeout = 1200000; this.storeList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, model: 'MsChInvoiceapplication', remoteSort: true, proxy: { type: 'ajax', url: '/Account/Chfee_invoiceapplication/GetAuditDataList', reader: { id: 'BILLNO', root: 'data', totalProperty: 'totalCount' } } }); //定义Grid var _this = this; 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 }, { sortable: true, dataIndex: 'CUSTOMERNAME', header: '开票单位', width: 120 }, { sortable: true, dataIndex: 'INVOICECUSTNAME', header: '发票抬头', width: 160 }, { sortable: true, dataIndex: 'CURRENCY', header: '币别', width: 60 }, { sortable: true, dataIndex: 'APPLYAMOUNT', header: '申请金额', align: 'right', width: 100, 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; } }, { sortable: true, dataIndex: 'INVAMOUNT', header: '开票金额', align: 'right', width: 100, 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; } }, { sortable: true, dataIndex: 'RECVCURR', header: '实收币别', width: 60 }, { sortable: true, dataIndex: 'FEEAMOUNT', header: '原币金额', width: 120, 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; } }, { sortable: true, dataIndex: 'APPLYTIME', header: '申请开票日期', width: 100 }, { sortable: true, dataIndex: 'APPLICANTNAME', header: '申请人', width: 100 }, { sortable: true, dataIndex: 'OPERATETIME', header: '申请时间', width: 100 }, { sortable: true, dataIndex: 'INVOICECATEGORYREF', header: '申请类型', width: 100 }, { sortable: true, dataIndex: 'RATE', header: '开票税率', width: 100 }, { sortable: true, dataIndex: 'INVOICENO', header: '发票号', width: 120 }, { sortable: true, dataIndex: 'REMARK', header: '备注', width: 360 }, { sortable: true, dataIndex: 'SHENREMARK', header: '开票要求', width: 360 }, { sortable: true, dataIndex: 'PAYCOMPANYREF', header: '所属分部', width: 120 } ]; this.girdcolums = this.initgirdcolums; this.gridList = new Ext.grid.GridPanel({ store: this.storeList, enableHdMenu: false, height: 180, region: 'north', split: true, loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, selModel: this.GridCheckBoxModel, columns: this.girdcolums , // paging bar on the bottom bbar: [Ext.create('Ext.PagingToolbar', { store: this.storeList, 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_invoiceapplication/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); //#region formSearch //#region formSearch枚举参照相关 //#endregion this.storeAddDCType = Ext.create('Ext.data.Store', { fields: ['DC', 'NAME'] }); this.storeAddDCType.add({ "DC": "", "NAME": "全部" }); this.storeAddDCType.add({ "DC": "1", "NAME": "待审核" }); this.storeAddDCType.add({ "DC": "2", "NAME": "已审核" }); this.comboxaddDCType = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '审核状态', store: this.storeAddDCType, valueField: 'DC', displayField: 'NAME', forceSelection: true, name: 'DC', value: '1' }); this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomInvRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomInvRefListRm' } }); // this.storeCust.load({ params: { condition: ""} }); this.comboxCust = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '开票单位', store: this.storeCustCode, queryMode: 'remote', minChars: 1, queryParam: 'CODENAME', // forceSelection: true, 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: '申请人', store: this.storeOpCode, forceSelection: true, name: 'APPLICANT', valueField: 'GID', displayField: 'CodeAndName' }); 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: 'BsNo', listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, this.comboxCust, { 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(); } } } }, this.comboxAPPLICANT, this.comboxaddDCType ] } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); this.storeDetailList = Ext.create('Ext.data.Store', { model: 'MsChInvoiceDetail', remoteSort: true, proxy: { type: 'ajax', url: '/Account/Chfee_invoiceapplication/GetDetailList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.gridDetailList = new Ext.grid.GridPanel({ store: this.storeDetailList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, features: [{ ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性 }], columns: [{ sortable: true, dataIndex: 'GID', header: 'GID', hidden: true, width: 100 }, { sortable: true, dataIndex: 'PID', header: 'PID', hidden: true, width: 100 }, { sortable: true, dataIndex: 'SERIALNO', header: 'SERIALNO', hidden: true, width: 100 }, { sortable: false, dataIndex: 'GOODSNAMEREF', header: '货物或应税劳务名称', summaryType: 'count', width: 120 }, { sortable: false, dataIndex: 'SPEC', header: '规格型号', width: 120 }, { sortable: false, dataIndex: 'UNIT', header: '单位', width: 100 }, { sortable: false, dataIndex: 'PKGS', header: '数量', width: 80 }, { sortable: false, dataIndex: 'TAXPRICE', header: '含税单价', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80, 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; } }, { sortable: false, dataIndex: 'PRICE', header: '单价', width: 80, 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; } }, { sortable: false, dataIndex: 'AMOUNT', summaryType: 'sum', header: '金额', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80, 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; } }, { sortable: false, dataIndex: 'TAXRATE', header: '税率', width: 80 }, { sortable: false, dataIndex: 'TAX', header: '税额', summaryType: 'sum', width: 80, 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; }, summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, } ] }); this.storeBodyListdetail = Ext.create('Ext.data.Store', { model: 'Chfee_do_detail', remoteSort: true, proxy: { type: 'ajax', url: '/Account/Chfee_invoiceapplication/GetBillList', reader: { id: 'BSNO,FEEDOID', root: 'data', totalProperty: 'totalCount' } } }); this.initgirdbillcolums = [{ sortable: true, dataIndex: 'BILLNO', header: 'BILL', hidden: true, width: 100 }, { sortable: true, dataIndex: 'BSNO', header: 'BSNO', hidden: true, width: 100 }, { sortable: true, dataIndex: 'FEEDOID', header: 'FEEDOID', hidden: true, width: 100 }, { sortable: true, dataIndex: 'CUSTNO', header: '委托编号', width: 120 }, { sortable: true, dataIndex: 'MBLNO', header: '主提单号', width: 120 }, { sortable: true, dataIndex: 'CUSTOMERNAME', header: '委托单位', width: 100 }, { sortable: true, dataIndex: 'ETD', header: '开船日期', renderer: Ext.util.Format.dateRenderer('Y-m-d'), width: 80 }, { sortable: true, dataIndex: 'BSSOURCE', header: '业务来源', width: 80 }, { sortable: true, dataIndex: 'FEENAME', header: '费用名称', width: 80 }, { sortable: true, dataIndex: 'FEETYPEREF', header: '收付', width: 40 }, { sortable: true, dataIndex: 'AMOUNT', header: '申请金额', width: 80, 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; } }, { sortable: true, dataIndex: 'ORIGCURRENCY', header: '原始币别', width: 80 }, { sortable: true, dataIndex: 'ORIGEXCHANGERATE', header: '原始汇率', width: 80 }, { sortable: true, dataIndex: 'EXCHANGERATE', header: '折算汇率', width: 80 }, { sortable: true, dataIndex: 'ORIGAMOUNT', header: '原始金额', width: 80, 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; } }, { sortable: true, dataIndex: 'SALE', header: '揽货人', width: 80 }, { sortable: true, dataIndex: 'SALECORP', header: '核算单位', width: 80 }, { sortable: true, dataIndex: 'ORDERNO', header: '订舱编号', width: 80 }, { sortable: true, dataIndex: 'TaxUnitPrice', header: '单价', width: 80, 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; } }, { sortable: true, dataIndex: 'Quantity', header: '数量', width: 80, 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; } }, { sortable: true, dataIndex: 'TaxRate', header: '税率', width: 80, 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; } }, { sortable: true, dataIndex: 'Tax', header: '税额', width: 80, 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; } } ]; this.girdbillcolums = this.initgirdbillcolums; this.gridListdetail = new Ext.grid.GridPanel({ store: this.storeBodyListdetail, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, tbar: [{ text: '保存列表样式', //保存列表样式 id: "btntestbody", menu: [ { text: '保存', //保存 handler: function (button, event) { _this.girdbillcolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'bill', _this.gridListdetail.columns, _this.girdbillcolums, 1, true); } }, { text: '初始化', //初始化 handler: function (menu, event) { _this.girdbillcolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'bill', _this.gridListdetail.columns, _this.initgirdbillcolums, 1, true); } }], scope: this }], columns: this.girdbillcolums }); this.gridListdetail.addListener('itemdblclick', function (dataview, record, item, index, e, b) { var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2 var openType = "_blank"; var openUrl = ""; openUrl = "../../MvcShipping/MsOpBill/MsOpFeeView?handle=check&bsno=" + record.data.BSNO; window.open(openUrl, openType, openSet); // DsOpenEditWin("/TruckMng/MsWlPc/Edit"); }, this); this.girdbillcolums = DsTruck.GetGridPanel(USERID, this.formname + 'bill', this.girdbillcolums, 1); //使用者id,表名,中间column数组,跳过一开始的几列 this.girdbillcolums.unshift(new Ext.grid.RowNumberer()); this.gridListdetail.reconfigure(this.storeBodyListdetail, this.girdbillcolums); this.storeBodyListdetail.on('beforeload', function (store) { var sql = " BILLNO='" + this.billno + "'"; Ext.apply(store.proxy.extraParams, { condition: sql }); }, this); this.storeBodySum = Ext.create('Ext.data.Store', { model: 'Chfee_do_sum', remoteSort: true, proxy: { type: 'ajax', url: '/Account/Chfee_invoiceapplication/GetBillSum', reader: { root: 'data', totalProperty: 'totalCount' } } }); this.gridSum = new Ext.grid.GridPanel({ store: this.storeBodySum, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, tbar: [{ xtype: 'label', width: 120, height: 22, text: '申请金额合计' }], columns: [{ sortable: true, dataIndex: 'FEETYPEREF', header: '收付', width: 40 }, { sortable: true, dataIndex: 'CURRENCY', header: '币 别', width: 80 }, { sortable: true, dataIndex: 'AMOUNT', header: '金额', width: 80, 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; } } ] }); //#endregion formSearch //查询工具条 this.panelBtn = new Ext.Panel({ region: "north", tbar: [ { text: "执行查询", iconCls: "btnrefresh", handler: function (button, event) { this.onRefreshClick(button, event); }, scope: this }, { text: "重置条件", iconCls: "btnreset", handler: function (button, event) { this.onClearSql(button, event); }, scope: this }, '-', { text: "审核通过", iconCls: "btnadd", handler: function (button, event) { this.onAuditPassClick(); }, scope: this }, '-', { text: "驳回提交", iconCls: "btndelete", handler: function (button, event) { this.onAuditBackClick(); }, scope: this }, '-', { xtype: 'button', width: 90, text: "高级查询", 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: "保存列表样式", 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:'设置未打印', //打印 handler: function (button, event) { this.SetNoPrint(); }, scope: this } ] }); this.storeCompany = Ext.create('DsExt.ux.RefTableStore', { model: 'companymb', proxy: { url: '/CommMng/BasicDataRef/GetcompanyList' } }); this.storeCompany.load({ params: { condition: ""} }); this.comboxCompany = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '所属分部', labelWidth: 78, forceSelection: true, store: this.storeCompany, id: 'PAYCOMPANYID', name: 'PAYCOMPANYID', valueField: 'gid', displayField: 'name' }); this.formEdit = Ext.widget('form', { region: 'north', height: 120, frame: true, bodyPadding: 3, trackResetOnLoad: true, // autoScroll: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 70, msgTarget: 'qtip' }, items: [{ xtype: 'container',//fieldset defaultType: 'textfield', layout: 'hbox', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'anchor', flex: 3, defaultType: 'textfield', items: [ { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '发票抬头', labelWidth: 90, readOnly: true, name: 'INVOICECUSTNAME' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '纳税人识别号', labelWidth: 90, readOnly: true, name: 'CUSTRATENO' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '地址、电话', labelWidth: 90, readOnly: true, name: 'CUSTADDRTEL' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '开户行及账号', labelWidth: 90, readOnly: true, name: 'CUSTBANK' }] } ] }, { xtype: 'fieldset', defaultType: 'textfield', flex: 5, layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [{ fieldLabel: '申请类型', labelWidth: 60, readOnly: true, name: 'INVOICECATEGORYREF' }, { fieldLabel: '发票币别', labelWidth: 60, readOnly: true, name: 'RECVCURR' }, { fieldLabel: '发票号', readOnly: true, name: 'INVOICENO' }, { fieldLabel: '开票单位', readOnly: true, name: 'CUSTOMERNAME' }, { fieldLabel: '代开客户', readOnly: true, name: 'ACTUALCUSTOMERNAME' }] }, { xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [{ fieldLabel: '币别', labelWidth: 60, // flex: 0.5, readOnly: true, name: 'CURRENCY' }, { fieldLabel: '税率', readOnly: true, labelWidth: 40, // flex: 0.5, name: 'RATE' }, { fieldLabel: '申请金额', readOnly: true, name: 'APPLYAMOUNT', 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; } }, { fieldLabel: '开票金额', readOnly: true, name: 'INVAMOUNT', 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; } }, this.comboxCompany] } , { xtype: 'container', layout: 'hbox', flex: 2, defaultType: 'textfield', items: [{ xtype: 'textareafield', grow: true, labelWidth: 60, name: 'REMARK', fieldLabel: '备注', anchor: '100%' }] } ] } ]//end items(fieldset 2) } ]//end root items }); //end this.formEdit //#region 附件信息 Ext.define('FeeFileModel', { extend: 'Ext.data.Model', idProperty: 'GID', fields: [ { name: 'GID', type: 'string' }, { name: 'BillNo', type: 'string' }, { name: 'File_Type', type: 'number' }, { name: 'UpdateTime', type: 'string' }, { name: 'Operator', type: 'string' }, { name: 'File_Path', type: 'string' }, { name: 'File_Name', type: 'string' }, { name: 'File_OriginalName', type: 'string' } ] }); this.storeChfeeFile = Ext.create('Ext.data.Store', { model: 'FeeFileModel', remoteSort: false, proxy: { type: 'ajax', url: '/Account/Chfee_payapplication/GetFileList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); //表格 this.FeeFileColumns = [ { sortable: true, hidden: true, dataIndex: 'GID', readOnly: true, header: 'GID', width: 80 }, { sortable: true, hidden: false, dataIndex: 'File_OriginalName', readOnly: true, header: '文件名称', renderer: function (value, p, record) { return '' + value + ''; }, width: 180 }, { sortable: true, hidden: false, dataIndex: 'UpdateTime', readOnly: true, header: '上传日期', width: 80 }, { sortable: true, hidden: false, dataIndex: 'Operator', readOnly: true, header: '上传者', width: 80 }, { sortable: true, hidden: true, dataIndex: 'File_Name', readOnly: true, header: '文件物理名称', width: 80 }, { sortable: true, hidden: true, dataIndex: 'File_Path', header: 'File_Path', width: 80 }, { xtype: 'actioncolumn', width: 50, text: "操作", items: [{ icon: '/images/icons/btnSearch.gif', // Use a URL in the icon config tooltip: '预览', handler: function (grid, rowIndex, colIndex) { var rec = grid.getStore().getAt(rowIndex); var filePath = "/Areas/Account/Files/" + rec.get('BillNo') + '/' + rec.get('File_Name'); //var imgView = new Shipping.FileView({ filePath: filePath }); //imgView.show(); DsOpenEditWin("/Account/Chfee_payapplication/FileView?path=" + filePath, "", "650", "1250"); } }] } ]; var selCertModel = Ext.create('Ext.selection.CheckboxModel'); this.fileGrid = new Ext.grid.GridPanel({ store: this.storeChfeeFile, enableHdMenu: false, layout: 'border', region: 'center', loadMask: { msg:"正在加载..."}, trackMouseOver: true, disableSelection: false, selModel: selCertModel, singleSelect: true, selType: 'rowmodel', columns: this.FeeFileColumns }); this.page_2 = new Ext.Panel({ id: "page_2", title: "附件", // autoScroll: true, layout: "border", region: 'center', //closable:true, items: [this.fileGrid] }); //#endregion this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 80, items: [this.formSearch, this.panelBtn] }); this.panelSum = new Ext.Panel({ layout: "border", region: 'east', width: 260, split: true, margin: '2 2', items: [this.gridSum] }); this.paneldetail = new Ext.Panel({ title: '申请费用明细', layout: "border", region: "center", height: 420, items: [ this.gridListdetail, this.panelSum ] }); this.panelInvDetail = new Ext.Panel({ title: '发票明细', layout: "border", region: "center", margin: '2 2', items: [this.formEdit, this.gridDetailList] }); this.tabpanel = new Ext.TabPanel ({ activeTab: 0, autoWidth: true, border: false, frame: false, region: 'center', id: "TabPanelID", enableTabScroll: true, split: true, items: [ this.panelInvDetail, this.paneldetail, this.page_2 ] }); Ext.apply(this, { items: [this.panelTop, this.gridList, this.tabpanel] }); this.storeList.on('beforeload', function (store) { // var sql = this.getCondition(); Ext.apply(store.proxy.extraParams, { condition: _this.sqlcontext, isaudit: _this.isAudit }); }, this); this.onRefreshClick(); this.storeList.on('load', function (store, records) { if (store.getCount() > 0) { this.gridList.getSelectionModel().select(0); } }, this); _this = this; this.gridList.getSelectionModel().on('select', function (model, record, index) { this.billno = record.data.BILLNO; var GID = record.data.GID; var sql = ""; sql = " BILLNO='" + this.billno + "'"; _this.formEdit.getForm().loadRecord(record); _this.storeBodyListdetail.load({ params: { condition: sql} }); _this.storeBodySum.load({ params: { condition: sql} }); _this.storeDetailList.load({ params: { condition: " PID='" + GID + "'"} }); _this.storeChfeeFile.load({ params: { start: 0, limit: 9999, BillNo: _this.billno} }); }, this); }, //end initUIComponents 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 bodyAddDatas = []; var j = 0; for (var i = 0; i < selections.length; i++) { var rec = selections[i]; var BILLSTATUS = rec.data.BILLSTATUS; var IsAudit = rec.data.IsAudit; if (BILLSTATUS == '2' || BILLSTATUS == '4') { if (IsAudit == 0) { Ext.Msg.show({ title: '提示', msg: '你没有审核此申请的权限!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } else { bodyAddDatas.push(rec); j = j + 1; } } else { Ext.Msg.show({ title: '提示', msg: '当前状态不允许审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; } if (j == 0) { Ext.Msg.show({ title: '提示', msg: '没有要审核的申请!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var PAYCOMPANYID = this.formEdit.getForm().findField('PAYCOMPANYID').getValue(); var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); _this = this; Ext.MessageBox.confirm('提示', '确定审核通过选中的业务吗?', function (btn) { if (btn == 'yes') { Ext.Msg.wait('正在审核数据...'); Ext.Ajax.request({ waitMsg: '正在审核数据...', timeout: 1200000, url: '/Account/Chfee_invoiceapplication/AuditList', params: { data: jsonbodyAddDatas, PAYCOMPANYID: PAYCOMPANYID }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { _this.onRefreshClick(); Ext.Msg.hide(); // 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); }, 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 bodyAddDatas = []; for (var i = 0; i < selections.length; i++) { var rec = selections[i]; var BILLSTATUS = rec.data.BILLSTATUS; if (BILLSTATUS == '2' || BILLSTATUS == '0') { 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.show({ title: "确认驳回!", msg: "请输入驳回原因!", width: 300, buttons: Ext.MessageBox.OKCANCEL, multiline: true, fn: function (btn, text) { if (btn == "ok") { Ext.Ajax.request({ waitMsg: '正在驳回数据...', url: '/Account/Chfee_invoiceapplication/AuditBackList', params: { data: jsonbodyAddDatas, reason: text }, 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: '驳回成功!', 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 } } }); //Ext.MessageBox.confirm('提示', '确定驳回选中的业务吗?', function (btn) { // if (btn == 'yes') { // Ext.Msg.wait('正在驳回数据...'); // Ext.Ajax.request({ // waitMsg: '正在驳回数据...', // url: '/Account/Chfee_invoiceapplication/AuditBackList', // params: { // data: jsonbodyAddDatas // }, // callback: function (options, success, response) { // if (success) { // var jsonresult = Ext.JSON.decode(response.responseText); // if (jsonresult.Success) { // _this.onRefreshClick(); // 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); }, SetNoPrint: 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; } } Ext.Ajax.request({ waitMsg: '', url: '/Account/Chfee_invoiceapplication/UpdateNoPrint', params: { billnos: feeGidSql }, 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 { Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); _this.storeList.reload(); } } else {//请求出现错误,请重试 Ext.MessageBox.alert('服务器错误', response.responseText); } }, scope: this }); }, onClearSql: function () { var form = this.formSearch.getForm(); form.reset(); }, //onDeleteClick onRefreshClick: function (button, event) { var sql = this.getCondition(); this.PageSize = this.Pagenum.getValue(); this.sqlcontext = sql; this.storeList.pageSize = this.PageSize; this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql, isaudit: this.isAudit }, waitMsg: "正在查询数据...", callback: function (r, options, success) { if (success) { if (r.length == 0) { var sql = " BILLNO='11111111' "; this.formEdit.getForm().reset(); this.storeBodyListdetail.load({ params: { condition: sql} }); this.storeBodySum.load({ params: { condition: sql} }); this.storeDetailList.load({ params: { condition: " PID='11'"} }); } } }, 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, isaudit: this.isAudit }, waitMsg: "正在查询数据...", callback: function (r, options, success) { if (success) { if (r.length == 0) { var sql = " BILLNO='11111111' "; this.formEdit.getForm().reset(); this.storeBodyListdetail.load({ params: { condition: sql} }); this.storeBodySum.load({ params: { condition: sql} }); this.storeDetailList.load({ params: { condition: " PID='11'"} }); } } }, scope: this }); }, getCondition: function () { var form = this.formSearch.getForm(); if (!form.isValid()) { Ext.Msg.alert('提示', '查询条件赋值错误,请检查。'); 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 APPLICANT = form.findField('APPLICANT').getValue(); sql = sql + getAndConSql(sql, APPLICANT, "APPLICANT like '%" + APPLICANT + "%'"); this.isAudit = form.findField('DC').getValue(); return sql; }, OprationSwap: function () { var ret = new Array(); ret[0] = this.OprationStatus; ret[1] = this.storeList; ret[2] = this.SelectedRecord; ret[3] = INVOICEPORT; return ret; } });