Ext.namespace('Shipping'); Shipping.MsChInvoiceAppEdit = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsChInvoiceAppEdit.superclass.constructor.call(this); }; Ext.extend(Shipping.MsChInvoiceAppEdit, Ext.Panel, { PageSize: 15, OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, addstore: false, isAudit: '', InvStoreList: null, billno: '', sqlcontext: '', initUIComponents: function () { //定义数据集 this.formname = "ChInvoiceapplicationAdd" this.billno = ''; this.sqlcontext = ''; _this = this; this.ParentWin = window.parent.opener; 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.StoreCurr = Ext.create('DsExt.ux.RefTableStore', { model: 'MsFeeCurr', proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' } }); this.StoreCurr.load({ params: { condition: "" } }); this.StoreDateCurr = Ext.create('DsExt.ux.RefTableStore', { model: 'MsFeeCurr', proxy: { url: '/MvcShipping/MsChFee/GetFeeNowInvCurrList' } }); this.StoreDateCurr.load({ params: { condition: "" } }); 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: '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: '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.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.storeCurrExrate = Ext.create('Ext.data.Store', { fields: ['CURR', 'EXRATE', 'DFEXRATE'] }); //#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(); } } } }, { fieldLabel: '业务编号', name: 'MblNo' }, 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 ] } ]//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.gridListdetail = new Ext.grid.GridPanel({ store: this.storeBodyListdetail, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, columns: [{ 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 } ] }); this.gridListdetail.addListener('itemdblclick', function (dataview, record, item, index, e, b) { //this.SelectedRecord = record; //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); }, this); 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: "发票开出", handler: function (button, event) { _this.onAuditPassClick(); } },{ 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 }, '-', , '-', { 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 } ] }); 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); //#region发票开票明细 this.storeListINVCLIENT2 = Ext.create('Ext.data.Store', { model: 'MsInfoClientINV', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsInfoClient/GetALLINVList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.storeListINVCLIENT2.on('beforeload', function (store) { var cust = this.formEdit.getForm().findField('CUSTOMERNAME').getValue(); var sql = "CUSTNAME='" + cust + "'"; Ext.apply(store.proxy.extraParams, { condition: sql }); }, this); this.comboxINVOICECUSTNAME2 = Ext.create('DsExt.ux.RefTableCombox', { allowBlank: false, queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', store: this.storeListINVCLIENT2, name: 'INVOICECUSTNAME', valueField: 'INVOICECUSTNAME', displayField: 'INVOICECUSTNAME', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var recs = DsStoreQueryBy(this.storeListINVCLIENT, 'INVOICECUSTNAME', records[0].data.INVOICECUSTNAME); var CUSTRATENO = this.formEdit.getForm().findField('CUSTRATENO'); var CUSTADDRTEL = this.formEdit.getForm().findField('CUSTADDRTEL'); var CUSTBANK = this.formEdit.getForm().findField('CUSTBANK'); var CURR = this.formEdit.getForm().findField('RECVCURR').getValue(); if (recs.getCount() > 0) { var data = recs.getAt(0).data; CUSTRATENO.setValue(data.CUSTRATENO); CUSTADDRTEL.setValue(data.CUSTADDRTEL); if (CURR == 'RMB') { CUSTBANK.setValue(data.CUSTBANK); } else if (CURR == 'USD') { CUSTBANK.setValue(data.CUSTUSDBANK); } } else { CUSTRATENO.setValue(''); CUSTADDRTEL.setValue(''); CUSTBANK.setValue(''); } } } } }); this.StoreCurr3 = Ext.create('DsExt.ux.RefTableStore', { model: 'MsFeeCurr', proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' } }); this.StoreCurr3.load({ params: { condition: "" } }); this.comboxCurr3 = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreCurr3, forceSelection: true, name: 'CURRENCY', valueField: 'CURR', displayField: 'CURR' }); this.GridAppDetailCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); //明细表-数据集 this.storeAppDetailList = Ext.create('Ext.data.Store', { model: 'ChInvoiceapplicationDetail', remoteSort: true, proxy: { type: 'ajax', url: '/Account/Chfee_invoiceapplication/GetApplicationDetailList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); //明细表表格 this.gridAppDetailCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.gridAppDetailList = new Ext.grid.GridPanel({ store: this.storeAppDetailList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, // columnLines: true, selModel: this.GridAppDetailCheckBoxModel, plugins: [this.gridAppDetailCellEditing], tbar: [{ text: '添加发票开票', tooltip: '添加发票开票', id: 'btnAddInvdetail', iconCls: "btnadddetail", handler: function (button, event) { this.onAddInvAppDetailClick(); }, scope: this }, { text: '删除发票开票信息', tooltip: '删除发票开票', id: 'btndelInvdetail', iconCls: "btndeletedetail", handler: function (button, event) { this.onDelInvAppDetailClick(); }, scope: this }], columns: [{ sortable: true, dataIndex: 'GID', header: 'GID', hidden: true, width: 100 }, { sortable: true, dataIndex: 'LINKGID', header: 'LINKGID', hidden: true, width: 100 }, { sortable: true, dataIndex: 'BILLSTATUS', header: '开票状态', //'币别', width: 80 }, { sortable: true, dataIndex: 'CURRENCY', header: '发票币别', //'币别', editor: this.comboxCurr3, width: 100 }, { sortable: true, dataIndex: 'AMOUNT', header: '开票金额', //'单价', editor: { xtype: 'numberfield', keyNavEnabled: false, selectOnFocus: true, hideTrigger: true, mouseWheelEnabled: false, enableKeyEvents: true }, align: 'right', width: 80 }, { sortable: false, dataIndex: 'INVOICECUSTNAME', header: '发票抬头', editor: this.comboxINVOICECUSTNAME2, width: 180 }, { sortable: false, dataIndex: 'REMARK', header: '发票备注', editor: { xtype: 'textfield', allowBlank: false, selectOnFocus: true }, width: 160 }, { sortable: false, dataIndex: 'CUSTRATENO', header: '纳税人识别号', editor: { xtype: 'textfield', allowBlank: false, selectOnFocus: true }, width: 180 }, { sortable: false, dataIndex: 'CUSTTEL', header: '电话', editor: { xtype: 'textfield', allowBlank: false, selectOnFocus: true }, width: 150 }, { sortable: false, dataIndex: 'CUSTADDR', header: '地址', editor: { xtype: 'textfield', allowBlank: false, selectOnFocus: true }, width: 180 }, { sortable: false, dataIndex: 'CUSTBANK', header: '银行', editor: { xtype: 'textfield', allowBlank: false, selectOnFocus: true }, width: 180 } ] }); this.gridAppDetailList.on('edit', function (editor, e, eOpts) { this.gridListAppDetailAfterEdit(editor, e, eOpts); }, this); //#endregion this.panelInvAppDetail = new Ext.Panel({ title: "发票开出明细", layout: "border", region: "north", height:380, margin: '0 0 0 0', items: [this.gridAppDetailList] }); me = this; this.winModifyShow = Ext.create('Ext.window.Window', { title: "确定开出", width: 760, //height : 120, //plain : true, iconCls: "addicon", resizable: false, // 是否可以拖动 // draggable:false, collapsible: true, // 允许缩放条 closeAction: 'close', closable: true, modal: 'true', buttonAlign: "center", bodyStyle: "padding:0 0 0 0", items: [this.panelInvAppDetail], buttons: [{ text: "确定", minWidth: 70, handler: function () { me.onKaiChuClick() } }, { text: "关闭", minWidth: 70, handler: function () { me.winModifyShow.close(); } }] }); this.InitData(); }, //end initUIComponents InitData: function () { this.opStatus = 'add'; var condition = ''; if (this.ParentWin) { var ret = this.ParentWin.OprationSwap(); this.InvStoreList = ret[1]; } }, //end InitData onAuditPassClick: function () { this.addstore = true; 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 GID = selections[0].data.GID; this.storeAppDetailList.load({ params: { condition: " LINKGID='" + GID + "'" } }); this.winModifyShow.show(); }, onKaiChuClick: function () { if (this.storeAppDetailList.getCount() == 0) { Ext.Msg.show({ title: '提示', msg: '发票开出明细,不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var selectedRecords = this.GridAppDetailCheckBoxModel.selected.items; if (this.addstore) { this.storeCurrExrate.removeAll(); this.addstore = false; } _this = this; //var bodydatas2 = []; //for (var i = 0; i < this.storeAppDetailList.getCount(); i += 1) { // var member = this.storeAppDetailList.getAt(i); // bodydatas2.push(member); //} //var jsonBody2 = ConvertRecordsToJsonAll(bodydatas2); var bodyDatas2 = []; for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (rec.data.BILLSTATUS!='已开') bodyDatas2.push(rec); } var jsonBody2 = ConvertRecordsToJsonAll(bodyDatas2); var bodydatas = []; for (var i = 0; i < this.storeCurrExrate.getCount(); i += 1) { var member = this.storeCurrExrate.getAt(i); if (member.data.EXRATE == 0) { _this.ExrateConversion(member.CURR, billcurr, 'bill', 0); return; } bodydatas.push(member); } var currBody = ConvertRecordsToJsonAll(bodydatas); //Ext.MessageBox.confirm('提示', '确定选中的发票申请开出发票吗?', function (btn) { // if (btn == 'yes') { Ext.Msg.wait('正在处理数据...'); Ext.Ajax.request({ waitMsg: '正在处理数据...', url: '/Account/Chfee_invoiceapplication/CreateInvList', params: { data: jsonBody2, storeCurrExrate: currBody }, 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 { dataList = result.Data; if (dataList == null) { _this.storeAppDetailList.reload(); _this.storeList.reload(); _this.InvStoreList.reload(); Ext.MessageBox.hide(); this.winModifyShow.close(); //Ext.Msg.show({ title: '提示', msg: '开出成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } else { if (dataList.lenght != 0) { for (var i = 0; i < dataList.length; i++) { var record = dataList[i]; _this.storeCurrExrate.add(record); } _this.ExrateConversion(record.CURR,'RMB', 'bill', 0); return; } } } } }, 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 }); }, gridListAppDetailAfterEdit: function (editor, e, eOpts) { if (e.value == e.originalValue) return; if (e.field == 'INVOICECUSTNAME') { var selectrecords = DsStoreQueryBy(this.storeListINVCLIENT2, 'INVOICECUSTNAME', e.value); if (selectrecords.getCount() > 0) { var CURRENCY = e.record.data['CURRENCY']; var selectdata = selectrecords.getAt(0).data; e.record.set('CUSTRATENO', selectdata.CUSTRATENO); if (CURRENCY == 'USD') e.record.set('CUSTBANK', selectdata.CUSTUSDBANK); else e.record.set('CUSTBANK', selectdata.CUSTBANK); if (!isNullorEmpty(getEndTel(selectdata.CUSTADDRTEL))) { e.record.set('CUSTTEL', getEndTel(selectdata.CUSTADDRTEL)); e.record.set('CUSTADDR', selectdata.CUSTADDRTEL.replace(getEndTel(selectdata.CUSTADDRTEL), "")); } else { } } else { e.record.set('CUSTRATENO', ''); e.record.set('CUSTBANK', ''); e.record.set('CUSTTEL', ''); e.record.set('CUSTADDR', ''); } } }, onAddInvAppDetailClick: 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 GID = selections[0].data.GID; var BILLNO = selections[0].data.BILLNO; var INVOICECUSTNAME = selections[0].data.INVOICECUSTNAME; var CURRENCY = selections[0].data.RECVCURR; var REMARK = selections[0].data.REMARK; var CUSTRATENO = selections[0].data.CUSTRATENO; var CUSTADDRTEL = selections[0].data.CUSTADDRTEL; var CUSTBANK = selections[0].data.CUSTBANK; var record = Ext.create('ChInvoiceapplicationDetail', { GID: '', LINKGID: '*', INVOICECUSTNAME: INVOICECUSTNAME, CURRENCY: CURRENCY, AMOUNT: 0, REMARK: REMARK, CUSTRATENO: CUSTRATENO, CUSTADDRTEL: CUSTADDRTEL, CUSTTEL: getEndTel(CUSTADDRTEL), CUSTADDR: CUSTADDRTEL.replace(getEndTel(CUSTADDRTEL), ""), CUSTBANK: CUSTBANK }); this.storeAppDetailList.add(record); var n = this.storeAppDetailList.getCount(); this.gridAppDetailCellEditing.startEditByPosition({ row: n - 1, column: 1 }); }, onDelInvAppDetailClick: function () { var selectedRecords = this.GridAppDetailCheckBoxModel.selected.items; var GID = this.formEdit.getForm().findField('GID').getValue(); Ext.MessageBox.confirm('提示', '确定要删除选中的明细吗?', function (btn) { if (btn == 'yes') { var bodyDatas = []; for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (rec.GID == "" || rec.PID == "*") //如果是新增但没有保存的数据,没有必要提交到后台 { this.storeAppDetailList.remove(selectedRecords[i]); } else { if (rec.data.BILLSTATUS != '已开') bodyDatas.push(rec); } } if (bodyDatas.length == 0) { Ext.Msg.show({ title: '提示', msg: '没有要删除的开票明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var jsonBody = ConvertRecordsToJsonAll(bodyDatas); _this = this; Ext.Msg.wait('正在删除数据...'); Ext.Ajax.request({ waitMsg: '正在删除数据...', url: '/Account/Chfee_invoiceapplication/DelInvAppDetail', params: { bsno: GID, body: jsonBody }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { for (var i = 0; i < selectedRecords.length; i++) { this.storeAppDetailList.remove(selectedRecords[i]); } 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); }, ExrateConversion: function (bfcurr, afcurr, fntype, dfexrate) { var EXRATE = 0; var achange = true; var bchange = true; formExrateConversion = 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: '1' + bfcurr + '=', xtype: 'numberfield', name: 'bfcurr', decimalPrecision: 6, value: 0, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 6, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, listeners: { change: function () { if (bchange) { var bfcurr = formExrateConversion.getForm().findField('bfcurr').getValue(); var field = formExrateConversion.getForm().findField('afcurr'); if (bfcurr == 0) { field.setValue(0); } else { var taxrate = (parseFloat(1).div(parseFloat(bfcurr))).toFixed(6); achange = false; field.setValue(taxrate); } } achange = true; } } }, { xtype: 'label', width: 120, text: afcurr, name: 'bfcurr2' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '1' + afcurr + '=', xtype: 'numberfield', name: 'afcurr', decimalPrecision: 6, value: 0, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 6, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, listeners: { change: function () { if (achange) { var afcurr = formExrateConversion.getForm().findField('afcurr').getValue(); var field = formExrateConversion.getForm().findField('bfcurr'); if (afcurr == 0) { field.setValue(0); } else { var taxrate = (parseFloat(1).div(parseFloat(afcurr))).toFixed(6); bchange = false; field.setValue(taxrate); } } bchange = true; } } }, { xtype: 'label', width: 120, text: bfcurr, name: 'afcurr2' }] }] //end items(fieldset 1) } //end fieldset 1 ] //end root items }); me = this; winExrateShow = Ext.create('Ext.window.Window', { title: "币别汇率折算", width: 450, iconCls: "addicon", resizable: false, collapsible: true, // 允许缩放条 closeAction: 'close', closable: true, modal: 'true', buttonAlign: "center", bodyStyle: "padding:0 0 0 0", items: [formExrateConversion], buttons: [{ text: "确定", minWidth: 70, handler: function () { var form = formExrateConversion.getForm(); var UsdExrate = form.findField('bfcurr').getValue(); if (UsdExrate == '' || UsdExrate == null || UsdExrate == undefined) { Ext.Msg.show({ title: '提示', msg: '必须填折算汇率!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; var recs = DsStoreQueryBy(me.storeCurrExrate, 'CURR', bfcurr); if (recs.getCount() > 0) { for (var i = 0; i < me.storeCurrExrate.getCount(); i += 1) { var member = me.storeCurrExrate.getAt(i); if (member.data.CURR == bfcurr) { member.set('EXRATE', UsdExrate); member.commit(); } } } else { me.storeCurrExrate.add({ "CURR": bfcurr, "EXRATE": UsdExrate }) } winExrateShow.close(); me.onKaiChuClick(); return; } }, { text: "关闭", minWidth: 70, handler: function () { winExrateShow.close(); Ext.MessageBox.hide(); return; } }] }); if (bfcurr == 'RMB') { var FFrecords = DsStoreQueryBy(this.StoreDateCurr, 'CURR', afcurr); if (FFrecords.getCount() > 0) { var ffdata = FFrecords.getAt(0).data; var DEFRATE = ffdata.DEFRATE; } else { var DFrecords = DsStoreQueryBy(this.StoreCurr, 'CURR', afcurr); if (DFrecords.getCount() > 0) { var dfdata = DFrecords.getAt(0).data; var DEFRATE = dfdata.DEFRATE; } else { var DEFRATE = 1; } } var field = formExrateConversion.getForm().findField('afcurr'); achange = true; field.setValue(DEFRATE); } else if (afcurr == 'RMB') { var FFrecords = DsStoreQueryBy(this.StoreDateCurr, 'CURR', bfcurr); if (FFrecords.getCount() > 0) { var ffdata = FFrecords.getAt(0).data; var DEFRATE = ffdata.DEFRATE; } else { var recs = DsStoreQueryBy(this.StoreCurr, 'CURR', bfcurr); if (recs.getCount() > 0) { var dfdata = recs.getAt(0).data; var DEFRATE = dfdata.DEFRATE; } else var DEFRATE = dfexrate; } var field = formExrateConversion.getForm().findField('bfcurr'); achange = true; field.setValue(DEFRATE); } else { var field = formExrateConversion.getForm().findField('bfcurr'); var recs = DsStoreQueryBy(this.StoreCurr, 'CURR', bfcurr); if (recs.getCount() > 0) { var dfdata = recs.getAt(0).data; var DEFRATE = dfdata.DEFRATE; } else var DEFRATE = dfexrate; bchange = true; field.setValue(DEFRATE); } winExrateShow.show(); }, getCondition: function () { var form = this.formSearch.getForm(); if (!form.isValid()) { Ext.Msg.alert('提示', '查询条件赋值错误,请检查。'); return ''; } var sql = " (BILLSTATUS=0 or BILLSTATUS=6) "; 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 + "%'"); var MblNo = form.findField('MblNo').getValue(); sql = sql + getAndConSql(sql, MblNo, " EXISTS(select 1 from ch_fee_do where BILLNO=cm.BILLNO and EXISTS(select 1 from v_op_bs where bsno=ch_fee_do.BSNO and (CUSTNO like '%" + MblNo + "%' or MBLNO like '%" + MblNo + "%' or HBLNO like '%" + MblNo + "%') ))"); return sql; } });