/// Ext.namespace('DsTruck'); var C_cargoinfo_id = ""; var HTHCount = 0; DsTruck.Chfee_managementEdit = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.DsTruck.Chfee_managementEdit.superclass.constructor.call(this); }; Date.prototype.format = function (format) { var o = { "M+": this.getMonth() + 1, //month "d+": this.getDate(), //day "h+": this.getHours(), //hour "m+": this.getMinutes(), //minute "s+": this.getSeconds(), //second "q+": Math.floor((this.getMonth() + 3) / 3), //quarter "S": this.getMilliseconds() //millisecond } if (/(y+)/.test(format)) format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); for (var k in o) if (new RegExp("(" + k + ")").test(format)) format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length)); return format; } var xhr = new XMLHttpRequest(); var currdate = new Date(); if (!xhr) { //...其他生成xmlhttprequest方法 } xhr.open("HEAD", location.href, true); xhr.onreadystatechange = function () { if (xhr.readyState == 4 && xhr.status == 200) { var datestr = xhr.getResponseHeader("Date"); currdate = new Date(datestr); // alert(currdate.format('yyyy-MM-dd')); } } xhr.send(null); function getSaved() { var feedirty = DsTruck.GetDirty(panelEdit.storeBodyChfee, panelEdit.storeBodyChfeeDel); if (panelEdit.formEdit.getForm().isDirty() == true) { return true; } else return false; } Ext.extend(DsTruck.Chfee_managementEdit, Ext.Panel, { parentWin: null, OpStatus: 'add', StoreList: null, editRecord: null, BXSTATUS: 1, // parentfunction: null, _First: true, VISIBLERANGE: 0, OPERATERANGE: 0, WorkFlowName: "", WorkFlowID: "", initUIComponents: function () { this.feeSerialNo = 0; this.feeBodyDel = []; this.feeBodyUnUnion = []; this.PayBodyDel = []; //枚举参照相关(编辑form) WorkFlowName = 'BaoxiaoMod'; Ext.define('PayTypeMd', { extend: 'Ext.data.Model', fields: [ { name: 'PayTypeID', type: 'string' }, { name: 'PayTypeName', type: 'string' } ] }); var PayTypeData = [{ "PayTypeID": "成本", "PayTypeName": "C-成本" }, { "PayTypeID": "费用", "PayTypeName": "F-费用" }, { "PayTypeID": "垫付", "PayTypeName": "D-垫付" }, { "PayTypeID": "押箱", "PayTypeName": "Y-押箱(垫付供应商)" }, { "PayTypeID": "退押箱", "PayTypeName": "T-退押箱费"}/*, { "PayTypeID": "押箱转成本", "PayTypeName": "N-押箱转成本(内扣)" }*/ ]; this.storePayType = Ext.create('Ext.data.Store', { model: 'PayTypeMd', data: PayTypeData }); this.comboxPayType = Ext.create('DsExt.ux.RefEnumCombox', { //fieldLabel: '收付类型', forceSelection: true, store: this.storePayType, name: 'Reason', valueField: 'PayTypeID', displayField: 'PayTypeName' }); //抵扣:Deductible Ext.define('DeductibleMd', { extend: 'Ext.data.Model', fields: [ { name: 'IsOpen', type: 'string' }, { name: 'IsOpen_REF', type: 'string' } ] }); var IsOpenData = [{ "IsOpen": "0", "IsOpen_REF": "否" }, { "IsOpen": "1", "IsOpen_REF": "是"}]; this.storeIsOpenType = Ext.create('Ext.data.Store', { model: 'DeductibleMd', data: IsOpenData }); this.comboxIsOpen = Ext.create('DsExt.ux.RefEnumCombox', { //fieldLabel: '是否抵扣销项税', forceSelection: true, store: this.storeIsOpenType, name: 'IsOpen', valueField: 'IsOpen', displayField: 'IsOpen_REF' }); this.storeUser = Ext.create('DsExt.ux.RefTableStore', { model: 'DsTruckMng.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' } }); this.storeUser.load({ params: { condition: " 1=1 "} }); this.comboxCreator = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '制单人', forceSelection: true, store: this.storeUser, name: 'CREATEUSER', id: "CREATEUSER", valueField: 'UserName', displayField: 'CodeAndName', allowBlank: false }); //通过mblno获取bsno this.storeBS = Ext.create('DsExt.ux.RefTableStore', { model: 'BSmb', proxy: { url: '/OA/Baoxiao/GetAllBSNO' } }); //this.storeBS.load({ params: { COMPANYID: COMPANYID} }); this.comboxCUSTNO = Ext.create('DsExt.ux.RefTableCombox', { //fieldLabel: '业务编号', forceSelection: true, store: this.storeBS, name: 'BsNo', valueField: 'BSNO', displayField: 'CUSTNO', allowBlank: false }); this.comboxMBLNO = Ext.create('DsExt.ux.RefTableCombox', { //fieldLabel: '业务编号', forceSelection: true, store: this.storeBS, name: 'MBLNO', valueField: 'MBLNO', displayField: 'MBLNO', allowBlank: false }); this.comboxAuditor = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '审核人', forceSelection: true, store: this.storeUser, name: 'AUDITOR', id: "AUDITOR", valueField: 'UserCode', displayField: 'CodeAndName' }); this.storecurr = Ext.create('DsExt.ux.RefTableStore', { model: 'currRef', proxy: { url: '/CommMng/BasicDataRef/GetcurrRefList' } }); this.storecurr.load({ params: { condition: ""} }); this.comboxcurr = Ext.create('DsExt.ux.RefTableCombox', { forceSelection: true, fieldLabel: '币别', store: this.storecurr, name: 'Currency', valueField: 'codename', displayField: 'codename', value: "RMB" }); this.storeBXSTATUS = Ext.create('DsExt.ux.RefEnumStore', {}); this.storeBXSTATUS.load({ params: { enumTypeId: 99024} }); this.comboxBXSTATUS = Ext.create('DsExt.ux.RefEnumCombox', { fieldLabel: '报销单状态', //forceSelection :true, store: this.storeBXSTATUS, name: 'BXSTATUS', readOnly: true, id: "BXSTATUS" }); this.storeFEESTATUS = Ext.create('DsExt.ux.RefEnumStore', {}); this.storeFEESTATUS.load({ params: { enumTypeId: 99024} }); this.comboxFEESTATUS = Ext.create('DsExt.ux.RefEnumCombox', { fieldLabel: '费用状态', forceSelection: true, store: this.storeFEESTATUS, name: 'FEESTATUS', readOnly: true, id: "STATUS" }); this.storeAccitems = Ext.create('DsExt.ux.RefTableStore', { model: 'Accitemsmb', proxy: { url: '/CommMng/BasicDataRef/GetAccitems' } }); this.storeAccitems.load({ params: { condition: ""} }); this.storeAmount = Ext.create('DsExt.ux.RefTableStore', { model: 'selectChFeemb', proxy: { url: '/OA/Baoxiao/GetThisFee' } }); //this.storeAmount.load({ params: { BSNO: BSNO} }); this.comboxAmount = Ext.create('DsExt.ux.RefTableCombox', { //fieldLabel: '费用',来自该提单号下的录入状态的费用 //forceSelection: true, store: this.storeAmount, name: 'Amount', valueField: 'Amount', displayField: 'FeeNameAmount', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var BXGID = this.editRecord.get('BXGID'); //alert(BXGID); var ThisFee = this.formFeeBody.getSelectionModel().getLastSelected(); var editp = Ext.create('selectChFeemb', records[0].data); ThisFee.fields.each(function (field) { if (field.persist) { name = field.name; //alert(name + ' -- ' + editp.get(name)); if (name != 'MBLNO' || name != 'CUSTNO') ThisFee.set(name, editp.get(name)); } }, this); ThisFee.set('BXGID', BXGID); ThisFee.commit(); } else { //清空数据 var record = null; record = Ext.create('MsChFee', { GId: '', BsNo: '', MBLNO: '', BXGID: '', FeeStatus: 1, FeeStatus_Ref: '录入状态', FeeType: 2, FeeType_Ref: '', FeeName: '', FeeName_Ref: '', FeeDescription: '', CustomerType: '', CustomerName: '', CustomerName_Ref: '', Unit: '单票', UnitPrice: 0, Quantity: 1, Amount: 0, Currency: 'RMB', ExChangerate: 1, Reason: '', Remark: '', Commissionrate: 0, Settlement: 0, Invoice: 0, OrderAmount: 0, OrderInvoice: 0, SubmitDate: null, Auditoperator: '', AuditDate: null, EnteroPerator: GetCookie_UserId(), EnterDate: Ext.getCmp("CREATEDATE").getRawValue(), DebitNo: '', IsDebit: "0", IsOpen: "0", IsAdvancedpay: "0", Sort: "0", IsInvoice: "0", FeeFrt: 'pp', IsCrmOrderFee: "0", AuditStatus: 0, InvoiceNum: '', ChequeNum: '', TAX: 0, TAXRATE: 0, NOTAXAMOUNT: 0, CHEQUENUM: "" }); ThisFee.fields.each(function (field) { if (field.persist) { name = field.name; //alert(name + ' -- ' + editp.get(name)); if (name = 'MBLNO' || name != 'CUSTNO') ThisFee.set(name, record.get(name)); } }, this); } } } }); ////////////////// //编辑form:formEdit this.formEdit = Ext.widget('form', { // layout: "border", region: 'north', frame: true, bodyPadding: 1, trackResetOnLoad: true, fieldDefaults: { margins: '1 1 1 1', labelAlign: 'right', flex: 1, labelWidth: 90, msgTarget: 'qtip' //,split:true }, bodyStyle: 'background:#FFF', items: [ {//fieldset 1 xtype: 'fieldset', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{//container_1 xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '报销单序列号', // allowBlank: false, //disabled: true, name: 'BXGID' }, { fieldLabel: '金额', //allowBlank: false, readOnly: true, id: "AMOUNT_ALL", name: 'AMOUNT', flex: 1, 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.comboxCreator, { fieldLabel: '制单时间', format: 'Y-m-d H:i:s', id: "CREATEDATE", xtype: 'datefield', renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s'), name: 'CREATEDATE' } //this.comboxFEENAME, /*{ fieldLabel: '时间戳', name: 'TimeMark', flex: 0, hidden: true, margins: '0' }*/ ] }, //container_1 end { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '报销单号', // allowBlank: false, //disabled: true, name: 'BXNO' }, { fieldLabel: '支票号', name: 'CHEQUENO', hidden: true, flex: 2 }, { fieldLabel: '支票额度', id: "CHEQUEAMOUNT", name: 'CHEQUEAMOUNT', hidden: true, flex: 1 }, this.comboxBXSTATUS, { fieldLabel: '备注', name: 'REMARK', flex: 2 }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: 'COMPANY', name: 'COMPANY', hidden: true, flex: 3 }, { fieldLabel: 'DEPTNAME', name: 'DEPTNAME', hidden: true, flex: 3 } ] } ] } ] }); ////////////////////////////////// //明细 <<<< 收支费用明细 >>>> // /* this.storeAccitems = Ext.create('DsExt.ux.RefTableStore', { model: 'Accitemsmb', proxy: { url: '/CommMng/BasicDataRef/GetAccitems' } }); this.storeAccitems.load({ params: { condition: ""} }); */ this.comboxAccitems = Ext.create('DsExt.ux.RefTableCombox', { forceSelection: true, store: this.storeAccitems, name: 'FEENAME', valueField: 'ACCID', displayField: 'ACCIDNAME' }); this.storeFeeNameRef = Ext.create('DsExt.ux.RefTableStore', { model: 'DsTruckMng.ux.FeeTypeRefModel', proxy: { url: '/CommMng/BasicDataRef/GetFeeTypeRefList' } }); this.storeFeeNameRef.load({ params: { condition: ""} }); this.comboxFeeNameRef = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeFeeNameRef, forceSelection: true, name: 'FeeName', valueField: 'Name', displayField: 'CodeAndName' }); this.storeCustomerNameRef = Ext.create('DsExt.ux.RefTableStore', { model: 'DsTruckMng.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeCustomerNameRef.load({ params: { condition: ""} }); this.comboxCustomerNameRef = Ext.create('DsExt.ux.RefTableCombox', { forceSelection: true, store: this.storeCustomerNameRef, name: 'CustomerName', valueField: 'CustName', displayField: 'CodeAndName' }); this.storecurr = Ext.create('DsExt.ux.RefTableStore', { model: 'currRef', proxy: { url: '/CommMng/BasicDataRef/GetcurrRefList' } }); this.storecurr.load({ params: { condition: ""} }); this.comboxcurr = Ext.create('DsExt.ux.RefTableCombox', { store: this.storecurr, name: 'currid', valueField: 'gid', displayField: 'codename' //币别 }); this.storeTAXRATE = Ext.create('DsExt.ux.RefEnumStore', {}); this.storeTAXRATE.load({ params: { enumTypeId: 25} }); this.comboxTAXRATE = Ext.create('DsExt.ux.RefEnumCombox', { //fieldLabel: '税率', store: this.storeTAXRATE, name: 'TAXRATE', valueField: 'EnumValueName', displayField: 'EnumValueName', id: "TAXRATE" }); this.storeCHEQUENUM = Ext.create('DsExt.ux.RefTableStore', { model: 'CHEQUENUMmb', proxy: { url: '/CommMng/BasicDataRef/GetUnusedCHEQUENUM' } }); //this.storeCHEQUENUM.load({ params: { DEPTID: DEPTGID, BXGID: bxgid} }); this.comboxCHEQUENUM = Ext.create('DsExt.ux.RefTableCombox', { //fieldLabel: '支票号',来自未使用的支票 forceSelection: true, store: this.storeCHEQUENUM, name: 'CHEQUENUM', valueField: 'CHEQUENUM', displayField: 'CHEQUENUM' //,id: "CHEQUENUM" }); //数据集 this.storeBodyChfee = Ext.create('Ext.data.Store', { model: 'MsChFee', remoteSort: false, pruneModifiedRecords: true, proxy: { type: 'ajax', url: '/OA/Baoxiao/GetFeeList', reader: { id: 'gid', root: 'data', totalProperty: 'totalCount' } } }); //表格 this.cellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.CheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); _this = this; this.formFeeBody = new Ext.grid.GridPanel({ store: this.storeBodyChfee, enableHdMenu: false, region: 'center', title: '费用明细', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.cellEditing], selModel: this.CheckBoxModel, selType: 'cellmodel', tbar: [{ text: '增加明细', id: "add1", tooltip: '增加明细', iconCls: "btnadddetail", handler: function (button, event) { this.onAddFeeClick(button, event); }, scope: this }, { text: '删除费用', id: "del1", tooltip: '删除费用', iconCls: "btndeletedetail", handler: function (button, event) { this.onDelFeeClick(button, event); }, scope: this }, '-', { text: '解除关联', id: "UnUnion1", tooltip: '解除该条费用与该报销单的关联,而不是删除费用', iconCls: "btndelete", handler: function (button, event) { this.onUnUnionClick(button, event); }, scope: this }, '-', { id: "S_HTH", fieldLabel: "合同号/提单号/箱号/报检号", labelWidth: 170, xtype: 'textfield', name: 'HTH', listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { var hth = Ext.getCmp("S_HTH").getValue(); if (hth != "") { Ext.getCmp("cxzt").setText(" 查询中... "); _this.storeBS.load({ params: { condition: " CUSTNO<>'' and( CUSTNO like '%" + hth + "%' or CUSTNO like '%" + hth + "%' or MBLNO like '%" + hth + "%' or HBLNO like '%" + hth + "%' or bsno in(select contractno from import_main where inspection_no like '%" + hth + "%'))" } , callback: function (options, success, response) { if (success) { Ext.getCmp("cxzt").setText(" "); } } }); } } } } }, { xtype: "label", id: "cxzt", text: "" } ], columns: [ { sortable: true, dataIndex: 'GId', header: '惟一编号', hidden: true, width: 160 }, { sortable: true, dataIndex: 'CustomerName', header: '结算对象', editor: this.comboxCustomerNameRef, width: 120 }, { sortable: true, dataIndex: 'CUSTNO', header: 'CUSTNO', hidden: true, width: 160 }, { sortable: true, dataIndex: 'BsNo', header: '业务编号(台账号)', //hidden: true, width: 150, renderer: function (value, p, record) { if (value == null || value == '') return ''; else return record.data.CUSTNO; }, editor: this.comboxCUSTNO }, { sortable: true, dataIndex: 'MBLNO', header: '业务编号(提单号)', //hidden: true, width: 150, renderer: function (value, p, record) { if (value == null || value == '') return ''; else return record.data.MBLNO; }, editor: this.comboxMBLNO }, { sortable: true, dataIndex: 'Reason', header: '支付种类', width: 60, editor: this.comboxPayType }, //comboxPayType { sortable: true, dataIndex: 'FeeName', header: '费用名称', editor: this.comboxFeeNameRef, width: 80 }, { sortable: true, dataIndex: 'BXGID', header: '报销单号', hidden: true, width: 200 }, { sortable: true, hidden: true, dataIndex: 'FeeStatus', header: '费用状态', renderer: function (value, p, record) { return record.data.FeeStatus_Ref; }, width: 66 }, { sortable: true, dataIndex: 'FeeDescription', header: '费用英文名称', hidden: true, width: 200 }, { sortable: true, dataIndex: 'CustomerType', header: '客户类别', hidden: true, width: 200 }, { sortable: true, dataIndex: 'Unit', header: '单位标准', hidden: true, width: 200 }, { sortable: true, hidden: true, dataIndex: 'UnitPrice', header: '单价', editor: { xtype: 'textfield', //numberfield selectOnFocus: true }, 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, hidden: true, dataIndex: 'Quantity', header: '数量', editor: { xtype: 'textfield', selectOnFocus: true }, width: 60 }, { sortable: true, dataIndex: 'NOTAXAMOUNT', header: '金额', width: 80, editor: { xtype: 'textfield', //numberfield selectOnFocus: true }, 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: '税率(%)', editor: this.comboxTAXRATE, renderer: function (value, p, record) { return record.data.TAXRATE; }, width: 66 }, { sortable: true, dataIndex: 'TAX', header: '税额', editor: { xtype: 'textfield', //numberfield selectOnFocus: true }, 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: 'Amount', header: '价税(票面)金额', renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { if (value == null || value == '') {return '';} 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; }, editor: //{ //xtype: 'textfield', //numberfield //selectOnFocus: true this.comboxAmount, //}, width: 80 }, { sortable: true, hidden: true, dataIndex: 'Currency', header: '币别', editor: this.comboxcurr, width: 50 }, { sortable: true, hidden: true, dataIndex: 'ExChangerate', header: '汇率', //hidden: true, editor: { xtype: 'textfield', selectOnFocus: true }, width: 60 }, { sortable: true, hidden: true, dataIndex: 'EnterDate', header: '时间', width: 80, renderer: Ext.util.Format.dateRenderer('Y-m-d'), editor: { format: 'Y-m-d', xtype: 'datefield', selectOnFocus: true } }, { sortable: true, dataIndex: 'CHEQUENUM', header: '支票号', editor: this.comboxCHEQUENUM, width: 140 }, { sortable: true, hidden: true, dataIndex: 'IsOpen', header: '是否抵扣销项税', editor: this.comboxIsOpen, renderer: function (value, p, record) { if (value == null || value == '') return ''; else return record.data.IsOpen_REF; }, width: 95 }, { sortable: true, dataIndex: 'Remark', header: '备注', editor: { xtype: 'textfield', selectOnFocus: true }, width: 250 }] }); //////////////////////////////////////////////明细<<<< 收支费用明细 >>>>结束 ///////////////////////支付情况。贷方明细 OA_Baoxiao_Pay this.storeSETTLEMENTTYPE = Ext.create('DsExt.ux.RefEnumStore', {}); this.storeSETTLEMENTTYPE.load({ params: { enumTypeId: 26} }); this.comboxSETTLEMENTTYPE = Ext.create('DsExt.ux.RefEnumCombox', { //支付方式 1支票 2网银电汇 3汇票 forceSelection: true, store: this.storeSETTLEMENTTYPE, name: 'SETTLEMENTTYPE' }); this.storeBank = Ext.create('DsExt.ux.RefTableStore', { model: 'Bankmb', proxy: { url: '/CommMng/BasicDataRef/GetBank' } }); this.storeBank.load({ params: { condition: " linkid='" + COMPANYID + "'"} }); this.comboxBank = Ext.create('DsExt.ux.RefTableCombox', { forceSelection: true, store: this.storeBank, name: 'Bank', //fieldLabel: '账户', valueField: 'FINANCESOFTCODE', displayField: 'codename' //币别 }); this.comboxCHEQUE = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeBodyChfee, name: 'TICKETNO', valueField: 'CHEQUENUM', displayField: 'CHEQUENUM' }); //数据集 this.storePayBody = Ext.create('Ext.data.Store', { model: 'BXPaymb', remoteSort: false, pruneModifiedRecords: true, proxy: { type: 'ajax', url: '/OA/Baoxiao/GetPayList', reader: { id: 'gid', root: 'data', totalProperty: 'totalCount' } } }); //表格 this.cellEditing_S = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.CheckBoxModel_S = Ext.create('Ext.selection.CheckboxModel'); this.formPayBody = new Ext.grid.GridPanel({ layout: 'border', store: this.storePayBody, enableHdMenu: false, region: 'center', bodyStyle: 'background:#FFF', trackResetOnLoad: true, //split:true, //height: 160, title: '支付明细', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.cellEditing_S], selModel: this.CheckBoxModel_S, selType: 'cellmodel', tbar: [{ text: '增加明细', tooltip: '增加明细', id: "add2", iconCls: "btnadddetail", handler: function (button, event) { this.onAddPayClick(button, event); }, scope: this }, '-', { text: '删除明细', tooltip: '删除明细', id: "del2", iconCls: "btndeletedetail", handler: function (button, event) { this.onDelPayClick(button, event); }, scope: this }], columns: [ { sortable: true, dataIndex: 'GID', header: 'GID', hidden: true, width: 60 }, { sortable: true, dataIndex: 'BXGID', header: 'BXGID', hidden: true, width: 60 }, { sortable: true, dataIndex: 'SETTLEMENTTYPE', header: '结算方式', renderer: function (value, p, record) { if (value == null || value == '') return ''; else return record.data.SETTLEMENTTYPE_REF; }, editor: this.comboxSETTLEMENTTYPE, width: 80 }, { sortable: true, dataIndex: 'TICKETNO', header: '票号', editor: this.comboxCHEQUE, width: 120 }, { sortable: true, dataIndex: 'AMOUNT', header: '报销金额', editor: { xtype: 'textfield', selectOnFocus: true }, 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: 'REMARK', header: '备注', editor: { xtype: 'textfield', selectOnFocus: true }, width: 80 }, { sortable: true, dataIndex: 'FINANCIALCODE', header: '贷方科目(银行户/其他应收等)', editor: this.comboxBank, width: 120 }] }); ////////////////////支付情况(贷方明细)//////////////////////end //公共按钮Toolbar:panelBtn this.panelBtn = new Ext.Panel({ region: "north", tbar: [ { // id: "saveandclose", text: "保存", handler: function (button, event) { this.Save('0'); }, scope: this }, { // id: "saveandclose", text: "保存并关闭", handler: function (button, event) { this.Save('1'); }, scope: this }, { // id: "saveandclose", text: "保存并新建", handler: function (button, event) { this.Save('2'); }, scope: this }, '-', { // id: "saveandclose", text: "关闭", handler: function (button, event) { window.close(); }, scope: this }, '-', { text: "导出Excel", id: "btnExportExcel", iconCls: 'btnexportexcel', handler: function (button, event) { this.onExportClick(button, event); }, scope: this }, '-', { // id: "saveandclose", text: "打印", handler: function (button, event) { this.DoPrint(); }, scope: this } ] }); //end 按钮Toolbar //布局 this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 30, items: [this.panelBtn] }); this.panelFee = new Ext.Panel({ layout: "border", region: 'north', margin: '1 1', height: 230, split: true, items: [this.panelTop, this.formFeeBody] }); this.panelPayBody = new Ext.Panel({ layout: "border", region: 'center', split: true, height: 300, margin: '1 1', items: [this.formEdit, this.formPayBody] }); /* this.panelBottom = new Ext.Panel({ layout: "border", region: 'south', items: [this.formEdit, this.panelPayBody ] });*/ Ext.apply(this, { items: [this.panelTop, this.panelFee, this.panelPayBody] }); parentWin = window.parent.opener; this.InitData(); //集中绑定事件 this.formFeeBody.on('edit', function (editor, e, eOpts) { this.FeeAfterEdit(editor, e, eOpts); }, this); this.formPayBody.on('edit', function (editor, e, eOpts) { this.PayAfterEdit(editor, e, eOpts); }, this); this.cellEditing.on('beforeedit', function (editor, e) { //Ext.getCmp("zongshu").setText("1234"); return this.FeeBeforeEdit(editor, e); }, this); this.cellEditing_S.on('beforeedit', function (editor, e) { //Ext.getCmp("zongshu").setText("1234"); return this.PayBeforeEdit(editor, e); }, this); }, //end initUIComponents parentfunction: function (button, event) { var ret1 = window.parent.opener.OprationSwap(); // alert(this.First); ret1[3](); }, onAddFeeClick: function (button, event, type) { //var allow = this.getAllowOperationDetail(); //if (allow == false) { // return; //} var store = null; store = this.storeBodyChfee; //var newSerialno = this.GetHandleSerialNo(store, type); var record = null; record = Ext.create('MsChFee', { GId: '', BsNo: '', MBLNO: '', BXGID: '', FeeStatus: 1, FeeStatus_Ref: '录入状态', FeeType: 2, FeeType_Ref: '', FeeName: '', FeeName_Ref: '', FeeDescription: '', CustomerType: '', CustomerName: '', CustomerName_Ref: '', Unit: '单票', UnitPrice: 0, Quantity: 1, Amount: 0, Currency: 'RMB', ExChangerate: 1, Reason: '', Remark: '', Commissionrate: 0, Settlement: 0, Invoice: 0, OrderAmount: 0, OrderInvoice: 0, SubmitDate: null, Auditoperator: '', AuditDate: null, EnteroPerator: GetCookie_UserId(), EnterDate: Ext.getCmp("CREATEDATE").getRawValue(), DebitNo: '', IsDebit: "0", IsOpen: "0", IsAdvancedpay: "0", Sort: "0", IsInvoice: "0", FeeFrt: 'pp', IsCrmOrderFee: "0", AuditStatus: 0, InvoiceNum: '', ChequeNum: '', TAX: 0, TAXRATE: 0, NOTAXAMOUNT: 0, CHEQUENUM: "" }); store.add(record); cellediting = this.cellEditing; var n = store.getCount(); cellediting.startEditByPosition({ row: n - 1, column: 2 }); }, onUnUnionClick: function (button, event) { var selectedRecords = this.formFeeBody.selModel.getSelection(); Ext.MessageBox.confirm('提示', '确定解除关联吗?', function (btn) { if (btn == 'yes') { for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (rec.BXGID != "" || rec.BXGID != "*") //如果是新增但没有保存的数据,没有必要提交到后台 { this.feeBodyUnUnion.push(rec); } this.storeBodyChfee.remove(selectedRecords[i]); } } }, this); //aftereditform(); var Amount_ALL = 0; for (var i = 0; i < this.storeBodyChfee.getCount(); i += 1) { Amount_ALL = Add(Amount_ALL, parseFloat(this.storeBodyChfee.getAt(i).get("Amount"))); } Ext.getCmp("AMOUNT_ALL").setValue(Amount_ALL + ""); }, onDelFeeClick: function (button, event) { var selectedRecords = this.formFeeBody.selModel.getSelection(); Ext.MessageBox.confirm('提示', '确定删除记录吗?', function (btn) { if (btn == 'yes') { for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (rec.BXGID != "" || rec.BXGID != "*") //如果是新增但没有保存的数据,没有必要提交到后台 { this.feeBodyDel.push(rec); } this.storeBodyChfee.remove(selectedRecords[i]); } } }, this); //aftereditform(); var Amount_ALL = 0; for (var i = 0; i < this.storeBodyChfee.getCount(); i += 1) { Amount_ALL = Add(Amount_ALL, parseFloat(this.storeBodyChfee.getAt(i).get("Amount"))); } Ext.getCmp("AMOUNT_ALL").setValue(Amount_ALL + ""); }, onAddPayClick: function (button, event, type) { var store = null; store = this.storePayBody; var record = null; record = Ext.create('BXPaymb', { GID: NewGuid(), BXGID: '', SETTLEMENTTYPE: "0", TICKETNO: "", AMOUNT: "0", REMARK: "", FINANCIALCODE: "", OPERATEDATE: "" }); store.add(record); cellediting = this.cellEditing_S; var n = store.getCount(); cellediting.startEditByPosition({ row: n - 1, column: 2 }); }, onDelPayClick: function (button, event) { var selectedRecords = this.formPayBody.selModel.getSelection(); Ext.MessageBox.confirm('提示', '确定删除记录吗?', function (btn) { if (btn == 'yes') { for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (rec.BXGID != "" || rec.BXGID != "*") //如果是新增但没有保存的数据,没有必要提交到后台 { this.PayBodyDel.push(rec); } this.storePayBody.remove(selectedRecords[i]); } } }, this); }, FeeAfterEdit: function (editor, e, eOpts) { //需要自己实现里面的事件 if (COMPANYID == "" || DEPTGID == "") { alert("登录信息不全,请退出重新登录"); returen; } if (e.field == 'BsNo') { var BSrecords = DsStoreQueryBy(this.storeBS, 'BSNO', e.value); if (BSrecords.getCount() > 0) { var BSdata = BSrecords.getAt(0).data; e.record.set('BsNo', BSdata.BSNO); e.record.set('MBLNO', BSdata.MBLNO); e.record.set('CUSTNO', BSdata.CUSTNO); } else { e.record.set('BsNo', ''); e.record.set('MBLNO', ''); e.record.set('CUSTNO', ''); } } if (e.field == 'MBLNO') { var BSrecords = DsStoreQueryBy(this.storeBS, 'MBLNO', e.value); if (BSrecords.getCount() > 0) { var BSdata = BSrecords.getAt(0).data; e.record.set('BsNo', BSdata.BSNO); e.record.set('MBLNO', BSdata.MBLNO); e.record.set('CUSTNO', BSdata.CUSTNO); } else { e.record.set('BsNo', ''); e.record.set('MBLNO', ''); e.record.set('CUSTNO', ''); } } if (e.field == 'IsOpen') { var IsOpenrecords = DsStoreQueryBy(this.storeIsOpenType, 'IsOpen', e.value); if (IsOpenrecords.getCount() > 0) { var IsOpendata = IsOpenrecords.getAt(0).data; e.record.set('IsOpen_REF', IsOpendata.IsOpen_REF); } else { e.record.set('IsOpen_REF', ''); } } if (e.field == 'FEENAME') { var czstaterecords = DsStoreQueryBy(this.storeAccitems, 'ACCID', e.value); if (czstaterecords.getCount() > 0) { var czstatedata = czstaterecords.getAt(0).data; e.record.set('FEENAMEREF', czstatedata.ACCNAME); } else { e.record.set('FEENAMEREF', ''); } } if (e.field == 'TAXRATE') { var TAXRATE = Div(parseFloat(e.record.data['TAXRATE']), 100); var Amount = parseFloat(e.record.data['Amount']); var NOTAXAMOUNT = parseFloat(e.record.data['NOTAXAMOUNT']); if (Amount == 0) { TAX = Mul(NOTAXAMOUNT, TAXRATE); //parseFloat((NOTAXAMOUNT * TAXRATE).toFixed(2)); e.record.set('TAX', (TAX).toFixed(2)); e.record.set('Amount', Add(NOTAXAMOUNT, TAX)); //(NOTAXAMOUNT + TAX).toFixed(2)); } else { var Amount = parseFloat(e.record.data['Amount']); var TAX = Mul(Div(Amount, Add(1, TAXRATE)), TAXRATE); //parseFloat((Amount / (1 + TAXRATE)).toFixed(2)) * TAXRATE; var NOTAXAMOUNT = Cut(Amount, TAX); //Amount - TAX; e.record.set('TAX', (TAX).toFixed(2)); e.record.set('NOTAXAMOUNT', (NOTAXAMOUNT).toFixed(2)); } e.record.set('Quantity', "1"); e.record.set('UnitPrice', NOTAXAMOUNT.toFixed(2)); } if (e.field == 'TAX') { //var NOTAXAMOUNT = parseFloat(e.record.data['NOTAXAMOUNT']); //var TAX = parseFloat(e.record.data['TAX']); //e.record.set('Amount', Add(NOTAXAMOUNT, TAX).toFixed(2)); //e.record.set('Quantity', "1"); //e.record.set('UnitPrice', NOTAXAMOUNT.toFixed(2)); } if (e.field == 'Amount') { var NOTAXAMOUNT = parseFloat(e.record.data['NOTAXAMOUNT']); if (NOTAXAMOUNT != 0) { var Amount = parseFloat(e.record.data['Amount']); //var TAXRATE = parseFloat(e.record.data['TAXRATE']); var TAX = Cut(Amount, NOTAXAMOUNT); // Amount - NOTAXAMOUNT; //e.record.set('NOTAXAMOUNT', (NOTAXAMOUNT).toFixed(2)); e.record.set('TAX', (TAX).toFixed(2)); } else { var TAXRATE = Div(parseFloat(e.record.data['TAXRATE']), 100); if (TAXRATE != 0) { var Amount = parseFloat(e.record.data['Amount']); var NOTAXAMOUNT = Div(Amount, Add(1, TAXRATE)); //Amount / (1 + TAXRATE); var TAX = Cut(Amount, NOTAXAMOUNT)//Amount - NOTAXAMOUNT; e.record.set('TAX', (TAX).toFixed(2)); e.record.set('NOTAXAMOUNT', (NOTAXAMOUNT).toFixed(2)); } else { var Amount = parseFloat(e.record.data['Amount']); var NOTAXAMOUNT = Amount; e.record.set('TAX', "0"); e.record.set('NOTAXAMOUNT', (NOTAXAMOUNT).toFixed(2)); } } e.record.set('Quantity', "1"); e.record.set('UnitPrice', NOTAXAMOUNT.toFixed(2)); } var Amount_ALL = 0; for (var i = 0; i < this.storeBodyChfee.getCount(); i += 1) { Amount_ALL = Add(Amount_ALL, parseFloat(this.storeBodyChfee.getAt(i).get("Amount"))); //Amount_ALL + parseFloat(this.storeBodyChfee.getAt(i).get("Amount")); } //this.editRecord.set('AMOUNT', Amount + ''); //this.formEdit.getForm().setValues(this.editRecord.data); Ext.getCmp("AMOUNT_ALL").setValue(Amount_ALL + ""); //getElementById("AMOUNT_ALL").value = Amount + ""; if (e.field == 'Reason') { var reasons = DsStoreQueryBy(this.storePayType, 'PayTypeID', e.value); if (reasons.getCount() > 0) { var reasondata = reasons.getAt(0).data; //alert(reasondata.PayTypeID); if (reasondata.PayTypeID == "退押箱") { e.record.set('Feetype', "1"); } } else { e.record.set('Feetype', "2"); } if (reasondata.PayTypeID == "退押箱" || reasondata.PayTypeID == "押箱" || reasondata.PayTypeID == "垫付") { e.record.set('IsAdvancedpay', "true"); } else { e.record.set('IsAdvancedpay', "false"); } } }, PayAfterEdit: function (editor, e, eOpts) { //需要自己实现里面的事件 if (COMPANYID == "" || DEPTGID == "") { alert("登录信息不全,请退出重新登录"); returen; } if (e.field == 'SETTLEMENTTYPE') { var BSrecords = DsStoreQueryBy(this.storeSETTLEMENTTYPE, 'EnumValueId', e.value); if (BSrecords.getCount() > 0) { var BSdata = BSrecords.getAt(0).data; e.record.set('SETTLEMENTTYPE_REF', BSdata.EnumValueName); } else { e.record.set('SETTLEMENTTYPE_REF', ''); } } if (e.field == 'TICKETNO') { var Amount_CHEQUE = 0; for (var i = 0; i < this.storeBodyChfee.getCount(); i += 1) { var _thisCHEQUENUM = this.storeBodyChfee.getAt(i).get("CHEQUENUM"); if (e.record.get('TICKETNO') == _thisCHEQUENUM) { Amount_CHEQUE = Add(Amount_CHEQUE, parseFloat(this.storeBodyChfee.getAt(i).get("Amount"))); } e.record.set('AMOUNT', Amount_CHEQUE.toFixed(2)); } } }, FeeBeforeEdit: function (editor, e) { if (this.OpStatus == "add") { var BXSTATUS = "1"; } else { var BXSTATUS = this.editRecord.get('BXSTATUS'); } /* this.VISIBLERANGE 可视 this.OPERATERANGE 可操作;*/ //可操作为0则全都可见,3为可提交/驳回,2为可审核/驳回,1为只能看 var canedit = true; if (this.OPERATERANGE == 0) { canedit = true; } else if (this.OPERATERANGE == 1) { canedit = false; } else //chfeefeeStatus == 1 || chfeefeeStatus == 2 || chfeefeeStatus == 6 if (this.OPERATERANGE == 2) { canedit = BXSTATUS == 0 || BXSTATUS == 2; } else if (this.OPERATERANGE == 3) { canedit = BXSTATUS == 1 || BXSTATUS == 6; } else { canedit = false; } //alert(canedit); var MBLNO = e.record.get('MBLNO'); if (canedit == true && e.field == 'Amount' && MBLNO != "") {//如果选项是amount,载入 //if (this.OpStatus == "add") { // alert("请先保存报销单"); // return canedit; //} else { this.storeAmount.load({ params: { MBLNO: MBLNO} }); //} //alert(this.storeAmount.getAt(0).get("GId")); } return canedit; }, PayBeforeEdit: function (editor, e) { if (this.OpStatus == "add") { var BXSTATUS = "1"; } else { var BXSTATUS = this.editRecord.get('BXSTATUS'); } /* this.VISIBLERANGE 可视 this.OPERATERANGE 可操作;*/ //可操作为0则全都可见,3为可提交/驳回,2为可审核/驳回,1为只能看 if (this.OPERATERANGE == 0) { canedit = true; } else if (this.OPERATERANGE == 1) { canedit = false; } else//chfeefeeStatus == 1 || chfeefeeStatus == 2 || chfeefeeStatus == 6 if (this.OPERATERANGE == 2) { canedit = true; } else if (this.OPERATERANGE == 3) { canedit = false; } else { canedit = false; } //alert(canedit); return canedit; }, InitData: function () { this.OpStatus = 'add'; var condition = ''; if (parentWin) { var ret = parentWin.OprationSwap(); this.OpStatus = ret[0]; this.StoreList = ret[1]; this.editRecord = ret[2]; // this.parentfunction = ret[3]; } if (this.OpStatus == 'edit') { condition = " BX.BXGID='" + this.editRecord.get('BXGID') + "'"; } else { Ext.getCmp("AMOUNT_ALL").setValue("0"); Ext.getCmp("CHEQUEAMOUNT").setValue("0"); } /* if (COMPANYID == "" || DEPTGID == "") { alert("登录信息不全,请退出重新登录") } else { this.LoadData(this.OpStatus, condition); }*/ this.LoadData(this.OpStatus, condition); var me = this; Ext.Ajax.request({ waitMsg: '正在查询用户权限...', url: '/CommMng/BasicDataRef/GetAuthorityRange', params: { modName: "mod_Baoxiao", USERID: USERID }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); rec = result.data; //alert(rec.VISIBLERANGE); //alert(rec.OPERATERANGE); //可操作为0则全都可见,3为可提交/驳回,2为可审核/驳回,1为只能看 /*0 审核通过 1 录入状态 2 提交审核 3 申请修改 4 申请删除 5 取消申请 6 驳回提交*/ this.VISIBLERANGE = rec.VISIBLERANGE; this.OPERATERANGE = rec.OPERATERANGE; if (this.OPERATERANGE == '0') { me.formPayBody.show(); } else if (this.OPERATERANGE == '1') { me.formPayBody.hide(); } else if (this.OPERATERANGE == '2') { Ext.getCmp("add2").enable(); Ext.getCmp("del2").enable(); } else {//3 Ext.getCmp("add2").disable(); Ext.getCmp("del2").disable(); } } else Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); }, scope: this }); //request over //var storeWorkFlowStep = GetWorkFlowStep('') }, //end InitData //载入数据 LoadData: function (OpStatus, condition) { if (COMPANYID == "" || DEPTGID == "") { alert("登录信息不全,请退出重新登录"); return; } this.OpStatus = OpStatus; Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/OA/Baoxiao/GetData', params: { handle: OpStatus, condition: condition }, 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; } var data = result.data; // this.formEdit.getForm().reset(); if (data.CREATEDATE == "") { data.CREATEDATE = currdate.format('yyyy-MM-dd hh:mm:ss') }; if (data.CREATEUSER == "") { data.CREATEUSER = SHOWNAME }; if (data.AMOUNT == "") { data.AMOUNT = 0 }; if (data.CHEQUEAMOUNT == "") { data.CHEQUEAMOUNT = 0 }; if (data.BXSTATUS_REF == "") { data.BXSTATUS_REF = "录入状态" }; if (data.BXSTATUS == "") { data.BXSTATUS = 1 }; if (this.OpStatus == 'add') { data.COMPANY = COMPANYID; data.DEPTNAME = DEPTGID; data.BXSTATUS = "1"; } var basicForm = this.formEdit.getForm(); //basicForm.findField('BXGID').setDisabled(false); //basicForm.findField('AMOUNT').setDisabled(false); //basicForm.findField('BXSTATUS').setDisabled(false); this.formEdit.getForm().setValues(data); //basicForm.findField('AMOUNT').setDisabled(true); //basicForm.findField('BXGID').setDisabled(true); //basicForm.findField('BXSTATUS').setDisabled(true); //alert(data.TimeMark); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); //request over if (this.OpStatus == 'edit') { //this.formEdit.getForm().findField('BXGID').setDisabled(false); var BXGID = this.editRecord.get('BXGID'); this.storeBodyChfee.load({ params: { BXGID: BXGID} }); this.storePayBody.load({ params: { BXGID: BXGID} }); this.storeCHEQUENUM.load({ params: { DEPTID: DEPTGID, BXGID: BXGID} }); } else this.storeCHEQUENUM.load({ params: { DEPTID: DEPTGID, BXGID: ""} }); }, // end LoadDate checkedit: function (status) { if (status != 1 && status != 2 && status != 6 && status != 0) { alert("注意 录入状态/提交审核/驳回提交 的费用可以全部保存,审核通过的业务只保存支付信息 "); return false; } else if (status == 0) { alert("注意审核通过的业务只保存支付信息 "); return true; } else if (this.storeBodyChfee.getCount() == 0) { return true; } else { for (var i = 0; i < this.storeBodyChfee.getCount(); i += 1) { var CHFEE = this.storeBodyChfee.getAt(i).data; if (Add(parseFloat(CHFEE.NOTAXAMOUNT), parseFloat(CHFEE.TAX)) != CHFEE.Amount) { alert("不含税金额与税额之和与含税金额不相等"); this.formFeeBody.selModel.select(i, true, false); return false; } } //end for return true; } //end if }, Save: function (type) { var Amount_ALL = 0; for (var i = 0; i < this.storeBodyChfee.getCount(); i += 1) { Amount_ALL = Add(Amount_ALL, parseFloat(this.storeBodyChfee.getAt(i).get("Amount"))); } Ext.getCmp("AMOUNT_ALL").setValue(Amount_ALL + ""); var basicForm = this.formEdit.getForm(); if (!basicForm.isValid()) { return; } //basicForm.findField('BXGID').setDisabled(false); //basicForm.findField('AMOUNT').setDisabled(false); //basicForm.findField('BXSTATUS').setDisabled(false); var data = this.formEdit.getForm().getValues(); var BXGID = data.BXGID; if (this.checkedit(data.BXSTATUS) != true) { return; } //basicForm.findField('BXGID').setDisabled(true); //basicForm.findField('AMOUNT').setDisabled(true); //basicForm.findField('BXSTATUS').setDisabled(true); if (COMPANYID == "" || DEPTGID == "") { alert("登录信息不全,请退出重新登录"); return; } var Feedatas = []; for (var i = 0; i < this.storeBodyChfee.getCount(); i += 1) { var member = this.storeBodyChfee.getAt(i); Feedatas.push(member); var Amount = member.data.Amount; var NOTAXAMOUNT = member.data.NOTAXAMOUNT; if (Amount == 0 || NOTAXAMOUNT == 0) { Ext.Msg.show({ title: '警告', msg: '不含税价格和价税合计金额均不允许为0,请修改后再保存', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } } //费用明细 var FeeBody = ConvertRecordsToJson(Feedatas); var FeeDelBody = ConvertRecordsToJsonAll(this.feeBodyDel); var Paydatas = []; for (var i = 0; i < this.storePayBody.getCount(); i += 1) { var member = this.storePayBody.getAt(i); Paydatas.push(member); } //支付明细 var PayBody = ConvertRecordsToJson(Paydatas); var PayDelBody = ConvertRecordsToJsonAll(this.PayBodyDel); var feeUnUnionBody = ConvertRecordsToJsonAll(this.feeBodyUnUnion); //如果已经审核通过,则只保存支付信息 if (data.BXSTATUS == 0) { FeeBody = ""; FeeDelBody = ""; feeUnUnionBody = ""; } var _this = this; Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/OA/Baoxiao/Save', scope: this, async: false, params: { OpStatus: this.OpStatus, data: Ext.JSON.encode(data), FeeBody: FeeBody, FeeDelBody: FeeDelBody, PayBody: PayBody, PayDelBody: PayDelBody, feeUnUnionBody: feeUnUnionBody }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var returnData = jsonresult.Data; this.formEdit.getForm().setValues(returnData); if (this.OpStatus == 'add') { var arrNewRecords = this.StoreList.add(returnData); this.editRecord = arrNewRecords[0]; // alert(editRecord.get('ContractNo')); } else if (this.OpStatus == 'edit') { var editp = Ext.create('Baoxiaomb', returnData); this.editRecord.fields.each(function (field) { if (field.persist) { name = field.name; //alert(name + ' -- ' + editp.get(name)); if (name != 'BXGID') this.editRecord.set(name, editp.get(name)); } }, this); this.editRecord.commit(); //this.onRefreshClick(button, event); } this.storeBodyChfee.commitChanges(); this.storePayBody.commitChanges(); if (type == '0') { this.OpStatus = 'edit'; //basicForm.findField('Feeid').setDisabled(false); //this.storeApp.load({ params: { condition: this.editRecord.get('ContractNo')} }); //this.storeCargo.load({ params: { condition: this.editRecord.get('ContractNo')} }); //basicForm.findField('Feeid').setDisabled(true); this.storeBodyChfee.load({ params: { BXGID: this.editRecord.get('BXGID'), Feetype: '2'} }); } else if (type == '1') {//保存并关闭 window.close(); } else if (type == '2') {//保存并全部新建 this.LoadData('add', ''); } } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } else { Ext.Msg.show({ title: '请重试', msg: '服务器响应出错', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } //alert('03'); } }); var me = this; if (this.editRecord.get('BXSTATUS') == "0") { //var recordList = []; //var BXGID = me.editRecord.get('BXGID'); Ext.Ajax.request({ waitMsg: "", url: '/OA/Baoxiao/SetGZ', scope: this, async: true, params: { BXGID: BXGID }, callback: function (_count) { //return _count; } }); } }, //end save onExportClick: function (button, event) { GridExportExcelPage(this.formFeeBody); } , DoPrint: function () { var basicForm = this.formEdit.getForm(); var BXGID = this.editRecord.get('BXGID') /* if (ContractNo == '*' || ContractNo == '') { Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; }*/ function GetDateStr(AddDayCount) { var dd = new Date(); dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期 var y = dd.getFullYear(); var m = dd.getMonth() + 1; //获取当前月份的日期 var d = dd.getDate(); return y + "-" + m + "-" + d; } //alert(GetDateStr(+5)); var needdate = GetDateStr(+5); var printdate = GetDateStr(0); var _date = Ext.getCmp("CREATEDATE").getRawValue(); var printType = 'Baoxiao'; // var sql1 = " select OA_Baoxiao.*,sd.deptname DN "; var sql1 = sql1 + " from OA_Baoxiao left join [user] U on U.showname=OA_Baoxiao.createuser "; var sql1 = sql1 + " left join [user_baseinfo] ub on ub.userid=u.gid "; var sql1 = sql1 + " left join sys_dept sd on sd.gid=OA_Baoxiao.DEPTNAME "; var sql1 = sql1 + " where BXGID='" + BXGID + "' "; var sql2 = " select vs.mblno,vs.CUSTNO, c.* from ch_fee c "; var sql2 = sql2 + " left join vw_settlement vs on vs.bsno=c.bsno "; var sql2 = sql2 + " where BXGID ='" + BXGID + "' order by c.CHEQUENUM,c.remark"; var sql3 = "select createuser from oa_baoxiao where bxgid ='" + BXGID + "' "; //var sql4 = "select dbo.GetRemain_ZWC ('" + DEPTGID + "','" + _date + "')"; //获取该部门剩余资金 var sql4 = "select '' "; //临时改为不计算部门剩余资金 /* var sql5 = " select * from vw_customerbalance where "; sql5 = sql5 + " deptgid=( select distinct deptname from oa_baoxiao where BXGID='" + BXGID + "') "; sql5 = sql5 + " and customername in( select distinct customername from ch_fee where BXGID='" + BXGID + "') "; */ var sql5 = ""; //临时改为不计算客户剩余资金 var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); } });