/// 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.storeBaoXiao2Body, panelEdit.storeBaoXiao2BodyDel); 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: "", isVOUALLNO: 0, initUIComponents: function () { this.feeSerialNo = 0; this.feeBodyDel = []; this.feeBodyUnUnion = []; this.PayBodyDel = []; this.formname = "BaoxiaoEdit2"; this.formname_结算方式 = "报销管理2_结算方式"; WorkFlowName = 'BaoxiaoMod'; //#region 枚举参照相关(编辑form) 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/GetBSNO' } }); 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', hidden: true, 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.storeSaleCompany = Ext.create('DsExt.ux.RefTableStore', { model: 'MsCompanysEntity', proxy: { url: '/MvcShipping/MsCompanys/GetNoPicDataList' } }); this.storeSaleCompany.load({ params: { condition: "" } }); this.comboxSaleCompany = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '所属分部', //'委托分公司', store: this.storeSaleCompany, forceSelection: true, name: 'SALECORPID', valueField: 'GID', displayField: 'NAME' }); //所属部门 this.storeDept = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.DeptModel', proxy: { url: '/CommMng/BasicDataRef/GetDeptList' } }); this.storeDept.load(); this.comboxDept = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '所属部门', //'所属部门', store: this.storeDept, //flex: 0.5, //labelWidth: 55, forceSelection: true, name: 'DEPTNAME', valueField: 'DeptName', displayField: 'DeptName' //,hidden: true }); //#endregion //编辑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", hidden: true, 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' }, { fieldLabel: '报销单号', // allowBlank: false, //disabled: true, name: 'BXNO' } ] } //container_1 end , { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '支票号', name: 'CHEQUENO', hidden: true, flex: 2 }, { fieldLabel: '支票额度', id: "CHEQUEAMOUNT", name: 'CHEQUEAMOUNT', hidden: true, flex: 1 }, this.comboxBXSTATUS, this.comboxDept, this.comboxSaleCompany , { fieldLabel: '总账凭证号', readOnly: true, xtype: 'textfield', name: 'VOUALLNO' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ { fieldLabel: '备注', name: 'REMARK', flex: 2 }] } ] }] }); this.formSum = Ext.widget('form', { // layout: "border", region: 'south', 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: [ ] } //container_1 end , { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [] } , { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '合计RMB', // allowBlank: false, readOnly: true, flex: 1, name: 'RMBAMOUNT', id: "RMBAMOUNT" }, { fieldLabel: '金额大写', // allowBlank: false, readOnly: true, flex: 2, name: 'HJRMBDX', id: "HJRMBDX" }, { xtype: 'hiddenfield', flex: 1}] } , { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '合计USD', // allowBlank: false, readOnly: true, flex: 1, name: 'USDAMOUNT', id: "USDAMOUNT" }, { fieldLabel: '金额大写', // allowBlank: false, readOnly: true, flex: 2, name: 'HJUSDDX', id: "HJUSDDX" }, { xtype: 'hiddenfield', flex: 1}] } , { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '合计其他币别', // allowBlank: false, readOnly: true, flex: 1, name: 'OTHERAMOUNT', id: "OTHERAMOUNT" }, { fieldLabel: '金额大写', // allowBlank: false, readOnly: true, flex: 2, name: 'HJOTHERDX', id: "HJOTHERDX" }, { xtype: 'hiddenfield', flex: 1}] } , { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '审核人', // allowBlank: false, readOnly: true, flex: 1, name: 'AUDITOR' }, { fieldLabel: '审核时间', // allowBlank: false, readOnly: true, flex: 1, name: 'AUDITTIME' }, { xtype: 'hiddenfield', flex: 2 } ] } ] }] }); ////////////////////////////////// //#region 明细 <<<< 收支费用明细 >>>> // //#region 参照 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: 'codename', 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.storeREASON = Ext.create('DsExt.ux.RefEnumStore', {}); this.storeREASON.load({ params: { enumTypeId: 36} }); this.comboxREASON = Ext.create('DsExt.ux.RefEnumCombox', { //fieldLabel: '借款方式', forceSelection: true, store: this.storeREASON, name: 'REASON', valueField: 'EnumValueName', displayField: 'EnumValueName' }); //#endregion //数据集 this.storeBaoXiao2Body = Ext.create('Ext.data.Store', { model: 'BaoXiao2Bodymb', remoteSort: false, pruneModifiedRecords: true, proxy: { type: 'ajax', url: '/OA/Baoxiao2/GetBaoXiao2Body', 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.girdcolums = [ //new Ext.grid.RowNumberer() //, { sortable: true, hidden: true, dataIndex: 'GID', header: 'GID', width: 80 }, { sortable: true, dataIndex: 'FEENAME', header: '费用名称', width: 80, editor: this.comboxFeeNameRef }, { sortable: true, dataIndex: 'CURRENCY', header: '币别', width: 80, editor: this.comboxcurr }, { sortable: true, dataIndex: 'Remark', header: '报销事由', width: 200, editor: { xtype: 'textfield', //numberfield selectOnFocus: true } }, { sortable: true, dataIndex: 'SETTLEMENT', header: '报销金额', width: 100, editor: { xtype: 'numberfield', //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: 'REASON', header: '支付方式', width: 80, editor: this.comboxREASON, renderer: function (value, p, record) { return record.data.JKTYPE_REF; } }, { sortable: true, hidden: true, dataIndex: 'JKTYPE_REF', header: 'JKTYPE_REF', width: 80 }, { sortable: true, dataIndex: 'INVOICENUM', header: '发票号', width: 100, editor: { xtype: 'textfield', //numberfield selectOnFocus: true } }, { sortable: true, //hidden: true, dataIndex: 'JKGID', header: '借款单号', width: 120 }, { sortable: true, dataIndex: 'AMOUNT', header: '金额(借款/报销)', width: 100, editor: { xtype: 'numberfield', //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, //hidden: true, dataIndex: 'SALESNO', header: '相关编号', width: 100, editor: { xtype: 'textfield', //numberfield selectOnFocus: true } }, { sortable: true, dataIndex: 'JKNAME', header: '借款人', width: 80 }, { sortable: true, dataIndex: 'JKDATE', header: '借款日期', width: 80 }, { sortable: true, hidden: true, dataIndex: 'FEETYPE', header: 'FEETYPE', width: 80 }, { sortable: true, hidden: true, dataIndex: 'FEETYPE_REF', header: '收付类型', width: 80 }, { sortable: true, hidden: true, dataIndex: 'FEESTATUS', header: 'FEESTATUS', width: 80 }, { sortable: true, dataIndex: 'FEESTATUS_REF', header: '费用状态', width: 80 }, { sortable: true, hidden: true, dataIndex: 'MODIFIEDUSER', header: 'MODIFIEDUSER', width: 80 }, { sortable: true, hidden: true, dataIndex: 'MODIFIEDTIME', header: 'MODIFIEDTIME', width: 80 }, { sortable: true, hidden: true, dataIndex: 'BXGID', header: '报销单号', width: 80 }]; this.formFeeBody = new Ext.grid.GridPanel({ store: this.storeBaoXiao2Body, 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.onDelClick(button, event); }, scope: this }, { text: "保存列表样式", id: "btnSaveTable", handler: function (button, event) { //this.column = DsTruck.SaveGridPanel(GID, this.formname, this.gridList.columns, this.column, 1, true); var tempcolumns = this.formFeeBody.columns; DsTruck.SaveGridPanel(USERID, this.formname, tempcolumns, this.girdcolums, 1, true); }, scope: this }], columns: this.girdcolums }); /////////////以下部分为获取存储的gridpanel显示样式 this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums); //使用者id,表名 ,中间column数组 this.girdcolums.unshift(new Ext.grid.RowNumberer()); this.formFeeBody.reconfigure(this.storeBaoXiao2Body, this.girdcolums); //////////////////////////// //#endregion 明细<<<< 收支费用明细 >>>>结束 //#region 明细 <<<< 待添加费用明细 >>>> this.storeUser = Ext.create('DsExt.ux.RefTableStore', { model: 'DsTruckMng.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' } }); this.storeUser.load({ params: { condition: ""} }); this.comboxUser = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '借款人', forceSelection: true, store: this.storeUser, name: 'S_Enter', id: "S_Enter", valueField: 'GID', displayField: 'CodeAndName', listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); //数据集 this.storeBaoXiaoAddBody = Ext.create('Ext.data.Store', { model: 'BaoXiao2Bodymb', remoteSort: false, pruneModifiedRecords: true, proxy: { type: 'ajax', url: '/OA/Baoxiao2/GetBaoXiao2Body', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); //表格 this.AddCBM = Ext.create('Ext.selection.CheckboxModel'); this.formAddBody = new Ext.grid.GridPanel({ store: this.storeBaoXiaoAddBody, enableHdMenu: false, region: 'center', //title: '待添加费用明细', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, //plugins: [this.cellEditing], selModel: this.AddCBM, selType: 'cellmodel', tbar: [ { text: '增加明细', id: "add3", tooltip: '增加明细', iconCls: "btnadddetail", handler: function (button, event) { this.onAddClick(button, event); }, scope: this }, '-', { text: "执行查询", iconCls: "btnrefresh", handler: function (button, event) { this.onRefreshClick(button, event); }, scope: this }, { text: "重置条件", iconCls: "btnreset", handler: function (button, event) { var form = this.formSearch.getForm(); form.reset(); }, scope: this }, '-', { id: "S_JKGID", fieldLabel: "借款单号", labelWidth: 65, xtype: 'textfield', name: 'S_JKGID', listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, this.comboxUser], columns: [ new Ext.grid.RowNumberer() , { sortable: true, hidden: true, dataIndex: 'GID', header: 'GID', width: 80 }, { sortable: true, dataIndex: 'FEENAME', header: '费用名称', width: 80, editor: this.comboxFeeNameRef }, { sortable: true, dataIndex: 'CURRENCY', header: '币别', width: 80, editor: this.comboxcurr }, { sortable: true, dataIndex: 'AMOUNT', header: '金额', width: 100, editor: { xtype: 'numberfield', //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: 'JKNAME', header: '借款人', width: 80 }, { sortable: true, dataIndex: 'JKDATE', header: '借款日期', width: 80 }, { sortable: true, dataIndex: 'JKTYPE_REF', header: '费用名称', width: 80 }, { sortable: true, //hidden: true, dataIndex: 'JKGID', header: '借款单号', width: 80 }, { sortable: true, dataIndex: 'Remark', header: '借款理由', width: 200 }, { sortable: true, hidden: true, dataIndex: 'FEETYPE', header: 'FEETYPE', width: 80 }, { sortable: true, hidden: true, dataIndex: 'FEETYPE_REF', header: '收付类型', width: 80 }, { sortable: true, hidden: true, dataIndex: 'FEESTATUS', header: 'FEESTATUS', width: 80 }, { sortable: true, dataIndex: 'FEESTATUS_REF', header: '费用状态', width: 80 }, { sortable: true, hidden: true, dataIndex: 'BSNO', header: 'BSNO', width: 80 }, { sortable: true, hidden: true, dataIndex: 'MODIFIEDUSER', header: 'MODIFIEDUSER', width: 80 }, { sortable: true, hidden: true, dataIndex: 'MODIFIEDTIME', header: 'MODIFIEDTIME', width: 80 }, { sortable: true, hidden: true, dataIndex: 'BXGID', header: '报销单号', width: 80 }] }); //#endregion 明细<<<< 收支费用明细 >>>>结束 //#region 支付情况 结算方式。贷方明细 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.storeBaoXiao2Body, name: 'TICKETNO', valueField: 'CHEQUENUM', displayField: 'CHEQUENUM' }); //总账科目加载 this.storeCwAccitems = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CwAccitemsGlModel', proxy: { url: '/CommMng/BasicDataRef/GetCwAccitemsGl' } }); this.storeCwAccitems.load({ params: { condition: "ISENABLE=1 and DETAILED=1" }, callback: function (options, success, response) { var data = { "GID": "", "ACCID": "", "ACCNAME": "", "ACCIDNAME": "", "DETAILED": "", "DC": "", "ISFCY": "", "ISDEPTACC": "", //核算部门,按规则设置生成 "ISEMPLACC": "", //核算人员,按规则设置生成 "ISCORPACC": "", //核算客户,按规则设置生成 "ISITEMACC": "", //核算项目,按规则设置生成 "REMARKS": "", "YEAR": "", "MONTH": "", "PACCGID": "", "ACCATTRIBUTE": "", //科目属性(资产、负债、共同、权益、成本、损益) //"ISENABLE": "", "id": "", "NAME": "", "ACCTYPE": "", //科目类别 "leaf": "", "expanded": "", "DR": "", "CR": "", "PACCNAME": "" }; this.storeCwAccitems.insert(0, data); }, scope: this }); this.comboxACCNAME = Ext.create('DsExt.ux.RefTableCombox', { //fieldLabel: '科目名称(总账)', store: this.storeCwAccitems, forceSelection: true, //输入值是否严格为待选列表中存在的值 name: 'OPERATORSIDE_gl', valueField: 'ACCID', displayField: 'ACCIDNAME', enableKeyEvents: true, //激活键盘事件 listeners: { scope: this, 'keyup': { fn: function (_field, e) { if (e.getKey() == 13) { this.onRefreshClick(); } }, scope: this } } }); //数据集 this.storePayBody = Ext.create('Ext.data.Store', { model: 'BXPaymb', remoteSort: false, pruneModifiedRecords: true, proxy: { type: 'ajax', url: '/OA/Baoxiao2/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.PayColumns = [ { 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 }, { sortable: true, dataIndex: 'OPERATORSIDE_gl', header: '借方科目(总账)', editor: this.comboxACCNAME, width: 120 }]; _this = this; 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 }, '-', { id: "btnSave", text: '保存更改', tooltip: '仅保存结算方式', iconCls: "btnsave", handler: function (button, event) { this.SaveSTL(); //alert(USERID); }, scope: this }, '-', { text: "保存列表样式", id: "btnsavelist", handler: function (button, event) { var tempcolumns = this.formPayBody.columns; DsTruck.SaveGridPanel(USERID, this.formname_结算方式, tempcolumns); }, scope: this }], columns: this.PayColumns }); this.PayColumns = DsTruck.GetGridPanel(USERID, this.formname_结算方式, this.PayColumns); //使用者id,表名 ,中间column数组,跳过一开始的几列 this.formPayBody.reconfigure(this.storePayBody, this.PayColumns); //#endregion 支付情况(贷方明细)//////////////////////end //公共按钮Toolbar:panelBtn this.panelBtn = new Ext.Panel({ region: "north", tbar: [ { id: "savebtn", text: "保存", handler: function (button, event) { this.Save('0'); }, scope: this }, { id: "saveandclosebtn", text: "保存并关闭", handler: function (button, event) { this.Save('1'); }, scope: this }, { id: "saveandnewbtn", 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 }, '-', { text: "生成总账凭证", id: "btnAddCwVouchers", iconCls: "btnadd", handler: function (button, event) { this.onAddCwVouchers(); }, 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: 450, split: true, items: [this.panelTop, this.formEdit, this.formFeeBody, this.formSum] }); this.panelPayBody = new Ext.Panel({ layout: "border", region: 'center', title: '结算方式', split: true, height: 220, margin: '1 1', items: [this.formPayBody] }); this.panelAddBody = new Ext.Panel({ layout: "border", region: 'center', title: '待添加费用明细', split: true, //height: 300, margin: '1 1', items: [this.formAddBody] }); this.MainTab = new Ext.tab.Panel({ layout: "border", region: "center", items: [this.panelAddBody, this.panelPayBody] }) Ext.apply(this, { items: [this.panelTop, this.panelFee, this.MainTab] }); 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); //#region 生成凭证_汇率列表 //#region 加载数据 //制单人 this.storePREPAREDCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' } }); this.storePREPAREDCode.load(); this.comboxPREPARED = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '制单人', store: this.storePREPAREDCode, forceSelection: true, id: 'PREPARED', name: 'PREPARED', valueField: 'UserName', displayField: 'CodeAndName', value: SHOWNAME }); //#endregion //#region 定义数据集 this.storeListCw = Ext.create('Ext.data.Store', { pageSize: this.PageSize, model: 'MsCodeCurrencyList', remoteSort: true, proxy: { type: 'ajax', url: '/OA/Baoxiao2/GetCodeCurrencyList', reader: { id: 'CURR', root: 'data', totalProperty: 'totalCount' } } }); //#endregion //#region 列定义 this.girdcolums = [{ sortable: false, text: '币别', dataIndex: 'CURR', width: 100, align: 'center' }, { sortable: false, text: '调整汇率', dataIndex: 'FCYEXRATE', width: 118, align: 'right', renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 5, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, editor: { xtype: 'numberfield', selectOnFocus: true, //得到焦点时自动选择文本 allowDecimals: true, //允许输入小数 decimalPrecision: 5, //允许保留的小数位数,并四舍五入 nanText: '请输入有效数值', hideTrigger: true //是否隐藏上下调节按钮 } }]; //#endregion //#region gridList列表显示信息 this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 //1单击,2双击 }); this.gridListCw = new Ext.grid.GridPanel({ region: 'center', width: 220, store: this.storeListCw, enableHdMenu: false, //是否显示表格列的菜单 hideHeaders: false, //是否隐藏表头 rowLines: true, columnLines: true, loadMask: { msg: "数据加载中,请稍等..." }, plugins: [this.gridListCellEditing], selType: 'cellmodel', columns: this.girdcolums }); //#endregion //#endregion }, //end initUIComponents parentfunction: function (button, event) { var ret1 = window.parent.opener.OprationSwap(); // alert(this.First); ret1[3](); }, onAddFeeClick: function (button, event, type) { var store = null; store = this.storeBaoXiao2Body; var record = null; record = Ext.create('BaoXiao2Bodymb', { GID: NewGuid(), //BsNo: '', JKGID: '', 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,*/ MODIFIEDUSER: GetCookie_UserId(), MODIFIEDTIME: Ext.getCmp("CREATEDATE").getRawValue(), JKTYPE_REF: '', INVOICENUM: '' /*, 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.storeBaoXiao2Body.remove(selectedRecords[i]); } } }, this); //aftereditform(); var Amount_ALL = 0; for (var i = 0; i < this.storeBaoXiao2Body.getCount(); i += 1) { Amount_ALL = Add(Amount_ALL, parseFloat(this.storeBaoXiao2Body.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.storeBaoXiao2Body.remove(selectedRecords[i]); } } }, this); //aftereditform(); var Amount_ALL = 0; for (var i = 0; i < this.storeBaoXiao2Body.getCount(); i += 1) { Amount_ALL = Add(Amount_ALL, parseFloat(this.storeBaoXiao2Body.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 (e.field == 'SETTLEMENT') { var AMOUNT = parseFloat(e.record.get('SETTLEMENT')); if (e.record.get('JKGID') == "" || typeof (e.record.get('JKGID')) == "undefined") { e.record.set('AMOUNT', AMOUNT); } } if (e.field == 'REASON') { var records = DsStoreQueryBy(this.storeREASON, 'EnumValueName', e.value); if (records.getCount() > 0) { var BSdata = records.getAt(0).data; e.record.set('JKTYPE_REF', BSdata.EnumValueName); } else { e.record.set('JKTYPE_REF', ''); } } this.SetAmount(); this.SetDX(); }, SetAmount: function () { var RMBAMOUNT = 0; var USDAMOUNT = 0; var OTHERAMOUNT = 0; for (var i = 0; i < this.storeBaoXiao2Body.getCount(); i += 1) { var Amount = this.storeBaoXiao2Body.getAt(i).get("SETTLEMENT"); if (typeof (Amount) == "undefined") { return; } var CURRENCY = this.storeBaoXiao2Body.getAt(i).get("CURRENCY"); if (CURRENCY == "RMB") { RMBAMOUNT = Add(RMBAMOUNT, Amount); } else if (CURRENCY == "USD") { USDAMOUNT = Add(USDAMOUNT, Amount); } else if (CURRENCY == "" || typeof (CURRENCY) == "undefined") { } else { OTHERAMOUNT = Add(OTHERAMOUNT, Amount); } } //this.editRecord.set('AMOUNT', Amount + ''); //this.formEdit.getForm().setValues(this.editRecord.data); Ext.getCmp("RMBAMOUNT").setValue(RMBAMOUNT + ""); Ext.getCmp("USDAMOUNT").setValue(USDAMOUNT + ""); Ext.getCmp("OTHERAMOUNT").setValue(OTHERAMOUNT + ""); }, SetDX: function () { var data = this.formSum.getForm().getValues(); Ext.getCmp("HJRMBDX").setValue(formatRMB(data.RMBAMOUNT)); Ext.getCmp("HJUSDDX").setValue(formatUSD(data.USDAMOUNT)); Ext.getCmp("HJOTHERDX").setValue(formatRMB(data.OTHERAMOUNT)); }, 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.storeBaoXiao2Body.getCount(); i += 1) { var _thisCHEQUENUM = this.storeBaoXiao2Body.getAt(i).get("CHEQUENUM"); if (e.record.get('TICKETNO') == _thisCHEQUENUM) { Amount_CHEQUE = Add(Amount_CHEQUE, parseFloat(this.storeBaoXiao2Body.getAt(i).get("Amount"))); } e.record.set('AMOUNT', Amount_CHEQUE.toFixed(2)); } } }, FeeBeforeEdit: function (editor, e) { var canedit = true; var BXSTATUS = this.BXSTATUS; var JKTYPE_REF = e.record.get('JKTYPE_REF'); var JKGID = e.record.get('JKGID'); if (BXSTATUS != "1" && BXSTATUS != "6") { canedit = false; alert("只有录入或驳回提交状态的报销单可以修改"); } if (e.field == 'AMOUNT') { if (JKTYPE_REF != "空白支票" && (JKGID != "" && typeof (JKGID) != "undefined")) { canedit = false; alert("只有[空白支票]的申请费用可以修改"); } } if (e.field == 'REASON' && JKGID != "") { canedit = false; alert("只有不来自借款的报销费用明细可以修改支付方式。"); } 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 //查询待添加的费用 onRefreshClick: function (button, event) { //if (this.editRecord != null) { // this.editRecord.get('BXGID'); // } var sql = " (isnull(c.BXGID,'')='' and isnull(c.JKGID,'')<>'') and c.jkgid in(select gid from oa_jiekuan where jkstatus=0) "; var JKGID = Ext.getCmp("S_JKGID").getValue(); sql = sql + getAndConSql(sql, JKGID, " c.JKGID like '%" + JKGID + "%' "); var EnterOperator = Ext.getCmp("S_Enter").getValue(); sql = sql + getAndConSql(sql, EnterOperator, " c.JKGID in(select GID from OA_JIEKUAN where EnterOperator ='" + EnterOperator + "') "); this.storeBaoXiaoAddBody.load({ params: { condition: sql }, waitMsg: "正在查询数据...", scope: this , callback: function (records, options, success) { //mergeCells(_this.gridList, [1]); //alert(records); } }); }, onAddClick: function (button, event) { //传递GID参数 //添加销售 var BXGID = ""; if (this.OpStatus == "add") { //先保存以获取业务编号 var data = this.formEdit.getForm().getValues(); var data2 = this.formSum.getForm().getValues(); //BXGID = data.BXGID; if (COMPANYID == "" || DEPTGID == "") { alert("登录信息不全,请退出重新登录"); return; } var Feedatas = []; for (var i = 0; i < this.storeBaoXiao2Body.getCount(); i += 1) { var member = this.storeBaoXiao2Body.getAt(i); Feedatas.push(member); } 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 _this = this; var returnData = ""; Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/OA/Baoxiao2/Save', scope: this, async: false, params: { OpStatus: this.OpStatus, data: Ext.JSON.encode(data), data2: Ext.JSON.encode(data2), FeeBody: FeeBody, FeeDelBody: FeeDelBody, PayBody: PayBody, PayDelBody: PayDelBody }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { returnData = jsonresult.Data; this.formEdit.getForm().setValues(returnData); this.OpStatus = "edit"; BXGID = returnData.BXGID; } 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'); } }); } else { //BXGID = data.BXGID; var formEdit = this.formEdit.getForm(); var selectedRecords = this.formAddBody.selModel.getSelection(); var data = formEdit.getValues(); BXGID = data.BXGID; } if (BXGID == "") { return; } var FeeList = ""; selectedRecords = this.formAddBody.selModel.getSelection(); for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (FeeList == "") { FeeList = "'" + rec.get('GID') + "'"; } else { FeeList = FeeList + ",'" + rec.get('GID') + "'"; } } if (FeeList == "") { return; } var _this = this; Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/OA/Baoxiao2/AddJKFee', scope: this, params: { BXGID: BXGID, FeeList: FeeList }, callback: function (options, success, response) { if (success) { var _this = this; var BXGID = formEdit.findField('BXGID').getValue(); this.storeBaoXiao2Body.load({ params: { condition: "BXGID='" + BXGID + "' " } , callback: function (options, success, response) { _this.SetAmount(); _this.SetDX(); _this.Save('0'); } }); this.onRefreshClick(); //this.Save('0'); } else { Ext.Msg.show({ title: '请重试', msg: '服务器响应出错', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }); }, onDelClick: function (button, event) { //传递GID参数 //添加销售 var formEdit = this.formEdit.getForm(); var selectedRecords = this.formFeeBody.selModel.getSelection(); this.SetAmount(); this.SetDX(); //this.Save('0'); var BXGID = formEdit.findField('BXGID').getValue(); var FeeList = ""; //selectedRecords = this.formAddBody.selModel.getSelection(); for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (FeeList == "") { FeeList = "'" + rec.get('GID') + "'"; } else { FeeList = FeeList + ",'" + rec.get('GID') + "'"; } } if (FeeList == "") { return; } Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/OA/Baoxiao2/DelJKFee', scope: this, params: { FeeList: FeeList }, callback: function (options, success, response) { if (success) { var _this = this; var BXGID = formEdit.findField('BXGID').getValue(); this.storeBaoXiao2Body.load( { params: { condition: "BXGID='" + BXGID + "' " } , callback: function (options, success, response) { _this.SetAmount(); _this.SetDX(); _this.Save('0'); } }); this.onRefreshClick(); } else { Ext.Msg.show({ title: '请重试', msg: '服务器响应出错', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }); }, //载入数据 LoadData: function (OpStatus, condition) { if (COMPANYID == "" || DEPTGID == "") { alert("登录信息不全,请退出重新登录"); return; } this.OpStatus = OpStatus; Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/OA/Baoxiao2/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(); this.formEdit.getForm().setValues(data); this.formSum.getForm().setValues(data); this.SetAmount(); this.SetDX(); if (data.BXSTATUS == "1" || data.BXSTATUS == "6" || this.OpStatus == "add") { //可以编辑 Ext.getCmp('savebtn').enable(); Ext.getCmp('saveandclosebtn').enable(); Ext.getCmp('saveandnewbtn').enable(); Ext.getCmp('add1').enable(); Ext.getCmp('del1').enable(); Ext.getCmp('add3').enable(); } else { Ext.getCmp('savebtn').disable(); Ext.getCmp('saveandclosebtn').disable(); Ext.getCmp('saveandnewbtn').disable(); Ext.getCmp('add1').disable(); Ext.getCmp('del1').disable(); Ext.getCmp('add3').disable(); } //storeBaoXiao2Body // if (this.isVOUALLNO == 1) { this.editRecord.fields.each(function (field) { if (field.persist) { name = field.name; if (name == 'VOUALLNO') { this.editRecord.set(name, data.VOUALLNO.toString()); } } }, this); this.editRecord.commit(); } // } 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'); var _this = this; this.storeBaoXiao2Body.load({ params: { condition: "BXGID='" + BXGID + "' " } , callback: function (options, success, response) { _this.SetAmount(); _this.SetDX(); } }); 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; } }, Save: function (type) { var basicForm = this.formEdit.getForm(); if (!basicForm.isValid()) { return; } var data = this.formEdit.getForm().getValues(); var data2 = this.formSum.getForm().getValues(); var BXGID = data.BXGID; if (COMPANYID == "" || DEPTGID == "") { alert("登录信息不全,请退出重新登录"); return; } var Feedatas = []; for (var i = 0; i < this.storeBaoXiao2Body.getCount(); i += 1) { var member = this.storeBaoXiao2Body.getAt(i); Feedatas.push(member); } //费用明细 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); //如果已经审核通过,则只保存支付信息 if (data.BXSTATUS == 0) { FeeBody = ""; FeeDelBody = ""; //feeUnUnionBody = ""; } var _this = this; Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/OA/Baoxiao2/Save', scope: this, async: false, params: { OpStatus: this.OpStatus, data: Ext.JSON.encode(data), data2: Ext.JSON.encode(data2), FeeBody: FeeBody, FeeDelBody: FeeDelBody, PayBody: PayBody, PayDelBody: PayDelBody }, 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')); BXGID = this.editRecord.get('BXGID'); } 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.storeBaoXiao2Body.commitChanges(); this.storePayBody.commitChanges(); if (type == '0') { this.OpStatus = 'edit'; this.storeBaoXiao2Body.load({ params: { condition: "BXGID='" + BXGID + "' " } , callback: function (options, success, response) { _this.SetAmount(); _this.SetDX(); } }); this.storePayBody.load({ params: { BXGID: BXGID} }); } else if (type == '1') {//保存并关闭 window.close(); } else if (type == '2') {//保存并全部新建 this.LoadData('add', ''); this.storeBaoXiao2Body.removeAll(); } } 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(); /* 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("ENTERDATE").getRawValue(); var printType = 'BaoXiao2'; //打印借款单 // var data = this.formEdit.getForm().getValues(); var JKUSERID = data.USERID; var GID = data.BXGID; var sql1 = " select bx.bxgid 报销单号,bx.CREATEUSER 报销人,dbo.trimtime(bx.createdate) 报销日期,bx.REMARK 备注 "; sql1 = sql1 + " ,BX.RMBAMOUNT RMB金额 ,'" + Ext.getCmp("HJRMBDX").getValue() + "' RMB大写 "; sql1 = sql1 + " ,BX.USDAMOUNT USD金额 ,'" + Ext.getCmp("HJUSDDX").getValue() + "' USD大写 "; sql1 = sql1 + " ,BX.OTHERAMOUNT 其他金额 ,'" + Ext.getCmp("HJOTHERDX").getValue() + "' 其他大写 "; sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=99024 and EnumValueID=BX.BXSTATUS) as 报销状态 "; sql1 = sql1 + " ,(select showname from vw_user where userid=(select top 1 auditor from workflow_do where billno=bx.BXGID order by AUDITTIME DESC )) 审核人"; sql1 = sql1 + " ,(select top 1 dbo.trimtime(AUDITTIME) from workflow_do where billno=bx.BXGID order by AUDITTIME DESC ) 审核时间 "; sql1 = sql1 + " ,isnull((select top 1 VOUALLNO from cw_vouno_bs_gl WITH(NOLOCK) where BSGID=BX.BXGID and BSTABLENAME='OA_Baoxiao' and STARTGID=(select top 1 GID from cw_design_startusing WITH(NOLOCK) where (ISDELETE=0 or ISDELETE is null) and ISENABLE=1 and GID=(select top 1 STARTGID from [cw_design_startusing_user] WITH(NOLOCK) where USERGID='" + USERID + "'))),'') 总账凭证号"; sql1 = sql1 + " FROM vw_BaoXiao BX "; sql1 = sql1 + " where BX.BXGID='" + GID + "' "; var sql2 = " select C.gid,C.feename 费用名称,C.SALESNO 相关编号,C.currency 币别,c.SETTLEMENT 核销金额,c.remark 报销事由 "; sql2 = sql2 + " ,case isnull(c.reason,'') when '' then (select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=36 and EnumValueID=J.JKTYPE) else c.Reason end 支付方式 "; sql2 = sql2 + " ,INVOICENUM 发票号,J.GID 借款单号, C.Amount 申请金额 "; sql2 = sql2 + " from ch_fee c left join OA_JIEKUAN j on j.GID=c.JKGID where c.BXGID='" + GID + "' "; var sql3 = ""; var sql4 = ""; //获取该部门剩余资金 var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); }, //#region 生成凭证 onAddCwVouchers: function (button, event) { var strGids = this.editRecord.get('BXGID'); if (strGids == "") { Ext.Msg.show({ title: '提示', msg: '请先保存单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } // if (strGids.trim() != "") { Ext.Ajax.request({ waitMsg: '正在预读数据,请稍候...', url: '/OA/Baoxiao2/GetIsVoucher', params: { strGids: strGids }, 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; } this.storeListCw.load({ params: { strGids: strGids }, waitMsg: "正在刷新数据...", scope: this }); this.showContactForm(false, strGids, this, 1); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); } // }, //#region 层_显示信息 showContactForm: function (win, strGids, _this, iGids) { var required = '*'; if (!win) { //#region 编辑formDiv 基本信息 var formDiv = Ext.widget('form', { border: false, bodyPadding: 10, fieldDefaults: { labelAlign: 'right', labelWidth: 60, labelStyle: 'font-weight:bold' }, items: [this.comboxPREPARED, { fieldLabel: '记账日期', format: 'Y-m-d', xtype: 'datefield', allowBlank: false, name: 'VOUDATE', value: Ext.util.Format.date(Ext.Date.add(new Date(), Ext.Date.MONTH - 1, 1), "Y-m-d") }, { xtype: "checkbox", //checkbox控件 name: "ISRATE", boxLabel: "是否按照系统录入汇率", width: 200, inputValue: "true", //选中的值 uncheckedValue: "false", //未选中的值 checked: true, //绘制时的选中状态, listeners: { 'change': function (field, newValue, oldValue, eOpts) { if (field.checked.toString() == "false") { this.gridListCw.show(); } else { this.gridListCw.hide(); } }, scope: this } }, this.gridListCw ], buttons: [{ text: '生成凭证', handler: function (options, success, response) { if (!this.up('form').getForm().isValid()) { return; } var dataDiv = this.up('form').getForm().getValues(false, false, false); // var j = 0; var bodydatas = []; for (var i = 0; i < _this.storeListCw.getCount(); i += 1) { var member = _this.storeListCw.getAt(i); bodydatas.push(member); } var jsonBody; if (bodydatas.length > 0) { jsonBody = ConvertRecordsToJsonAll(bodydatas); } // Ext.Msg.wait('正在生成' + iGids + '票结算单数据, 请稍侯...'); Ext.Ajax.request({ waitMsg: '正在生成' + iGids + '票结算单数据, 请稍侯...', url: '/OA/Baoxiao2/onAddCwVouchers', scope: this, params: { strGids: strGids, dataDiv: Ext.JSON.encode(dataDiv), jsonBody: jsonBody }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.MessageBox.INFO, buttons: Ext.Msg.OK }); _this.onRefreshClick(); // _this.isVOUALLNO = 1; _this.InitData(); return; } 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 }); } }, timeout: 3000000//30秒 }); // this.up('form').getForm().reset(); this.up('window').hide(); } }, { text: '取消', handler: function () { this.up('form').getForm().reset(); this.up('window').hide(); } }], listeners: { scope: this, 'render': function (thisDiv, thisExtend) { this.gridListCw.hide(); // Ext.Ajax.request({ waitMsg: '正在查询委托编号状态...', url: '/MvcShipping/MsBaseInfo/GetCwVOUNO', params: { VKNO: "记" }, 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.INFO, buttons: Ext.Msg.OK }); return; } // data = result.data; var arrayList = new Array(); arrayList = data.split("~"); var strY = arrayList[0].toString(); var strM = arrayList[1].toString(); var sVOUNO = arrayList[2].toString(); var strVOUNO = arrayList[3].toString(); var strVOUDATE = arrayList[4].toString(); var strACCDATE = arrayList[5].toString(); // thisDiv.form.findField('VOUDATE').setValue(strVOUDATE); thisDiv.form.findField('VOUDATE').setMinValue(strACCDATE + "-01"); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); } } }); //#endregion win = Ext.widget('window', { title: '辅助核算', closeAction: 'hide', width: 250, height: 250, layout: 'fit', resizable: true, modal: true, closable: false, items: formDiv }); } win.show(); } //#endregion //#endregion , SaveSTL: function () { var basicForm = this.formEdit.getForm(); //if (!basicForm.isValid()) { // return; //} var data = this.formEdit.getForm().getValues(); var BXGID = data.BXGID; 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); if (PayBody != "" || PayDelBody != "") { } else { return; } Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/OA/Baoxiao2/SaveSTL', scope: this, params: { BXGID: BXGID, PayBody: PayBody, PayDelBody: PayDelBody }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { //this.storePayBody.commitChanges(); this.storePayBody.load({ params: { BXGID: BXGID} }); } 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'); } }); } });