Ext.namespace('Shipping'); String.prototype.trim = function () { return this.replace(/(^\s*)|(\s*$)/g, ""); } Shipping.MsCwVouchersGlIndex = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsCwVouchersGlIndex.superclass.constructor.call(this); }; Ext.extend(Shipping.MsCwVouchersGlIndex, Ext.Panel, { PageSize: 500, OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, sqlcontext: '', strCwSTARTGID: '', sortfield: '', sortdire: '', initUIComponents: function () { this.formname = "formMsCwVouchersGlIndex"; //总账凭证列表 Ext.Ajax.timeout = 1200000; this.SubStartGid = ""; //#region formSearch 下拉框信息加载 //键值维护表_凭证字 this.storeCrmKeyCodeCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CrmKeyCodeModel', proxy: { url: '/CommMng/BasicDataRef/GetCrmKeyCodeList' } }); this.storeCrmKeyCodeCode.load({ params: { condition: " and KEYTYPE='凭证字'"} }); this.comboxVKNO = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '凭证字', store: this.storeCrmKeyCodeCode, forceSelection: true, name: 'VKNO', width: 100, labelAlign: 'right', //labelWidth: 40, valueField: 'KEYVALUE', displayField: 'KEYVALUE', value: '记', enableKeyEvents: true, //激活键盘事件 listeners: { scope: this, 'keyup': { fn: function (_field, e) { if (e.getKey() == 13) { this.onRefreshClick(); } }, scope: this } } //allowBlank: false, }); //审核状态 Ext.define('ISCHECKEDModel', { extend: 'Ext.data.Model', fields: [ { name: 'Name', type: 'string' } ] }); var dataISCHECKED = [{ "Name": "未审核" }, { "Name": "审核" }, { "Name": ""}]; var storeISCHECKED = Ext.create('Ext.data.Store', { model: 'ISCHECKEDModel', data: dataISCHECKED }); this.comboxISCHECKED = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '审核', forceSelection: true, store: storeISCHECKED, id: 'ISCHECKED2', name: 'ISCHECKED2', width: 100, labelAlign: 'right', //labelWidth: 30, valueField: 'Name', displayField: 'Name', enableKeyEvents: true, //激活键盘事件 listeners: { scope: this, 'keyup': { fn: function (_field, e) { if (e.getKey() == 13) { this.onRefreshClick(); } }, scope: this } } }); //导出状态 Ext.define('ISEXPORTModel', { extend: 'Ext.data.Model', fields: [ { name: 'Name', type: 'string' } ] }); var dataISEXPORT = [{ "Name": "未导出" }, { "Name": "已导出" }, { "Name": ""}]; var storeISEXPORT = Ext.create('Ext.data.Store', { model: 'ISEXPORTModel', data: dataISEXPORT }); this.comboxISEXPORT = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '导出', forceSelection: true, store: storeISEXPORT, id: 'ISEXPORT', name: 'ISEXPORT', flex:0.5, labelAlign: 'right', //labelWidth: 30, valueField: 'Name', displayField: 'Name', enableKeyEvents: true, //激活键盘事件 listeners: { scope: this, 'keyup': { fn: function (_field, e) { if (e.getKey() == 13) { this.onRefreshClick(); } }, scope: this } } }); //复制状态 Ext.define('ISCOPYModel', { extend: 'Ext.data.Model', fields: [ { name: 'Name', type: 'string' } ] }); var dataISCOPY = [{ "Name": "未复制" }, { "Name": "已复制" }, { "Name": "" }]; var storeISCOPY = Ext.create('Ext.data.Store', { model: 'ISCOPYModel', data: dataISCOPY }); this.comboxISCOPY = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '复制', forceSelection: true, store: storeISCOPY, id: 'ISCOPY', name: 'ISCOPY', flex: 0.5, labelAlign: 'right', //labelWidth: 30, valueField: 'Name', displayField: 'Name', enableKeyEvents: true, //激活键盘事件 listeners: { scope: this, 'keyup': { fn: function (_field, e) { if (e.getKey() == 13) { this.onRefreshClick(); } }, scope: this } } }); //复制状态 Ext.define('ISAUTOModel', { extend: 'Ext.data.Model', fields: [ { name: 'Name', type: 'string' } ] }); var dataISAUTO = [{ "Name": "手工" }, { "Name": "自动" }, { "Name": "" }]; var storeISAUTO = Ext.create('Ext.data.Store', { model: 'ISAUTOModel', data: dataISAUTO }); this.comboxISAUTO = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '自动', forceSelection: true, labelWidth: 40, store: storeISAUTO, id: 'ISAUTO', name: 'ISAUTO', flex: 0.5, labelAlign: 'right', //labelWidth: 30, valueField: 'Name', displayField: 'Name', enableKeyEvents: true, //激活键盘事件 listeners: { scope: this, 'keyup': { fn: function (_field, e) { if (e.getKey() == 13) { this.onRefreshClick(); } }, scope: this } } }); //制单人 this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefListRm' } }); this.comboxZhiDanRen = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: "制单人", store: this.storeOpCode, // forceSelection: true, queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', name: 'PREPARED', flex: 1, valueField: 'UserName', displayField: 'CodeAndName', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.storeOpCode.load(); //#region formSearch 下拉框信息加载 //银行存款科目加载 this.storeCwAccitems = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CwAccitemsGlModel', proxy: { url: '/CommMng/BasicDataRef/GetCwAccitemsGl' } }); this.storeCwAccitems.load({ params: { condition: "DETAILED=1 and ISENABLE=1 " } }); this.comboxACCNAME = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '科目名称', store: this.storeCwAccitems, forceSelection: true, //输入值是否严格为待选列表中存在的值 name: 'ACCID', valueField: 'ACCID', displayField: 'ACCIDNAME' }); this.storeISVOUZERO = Ext.create('Ext.data.Store', { fields: ['ISVOUALLNO', 'NAME'] }); this.storeISVOUZERO.add({ "ISVOUALLNO": "", "NAME": "" }); this.storeISVOUZERO.add({ "ISVOUALLNO": "0", "NAME": "否" }); this.storeISVOUZERO.add({ "ISVOUALLNO": "1", "NAME": "是" }); this.comboxISVOUZERO = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '借贷为0', store: this.storeISVOUZERO, valueField: 'ISVOUALLNO', displayField: 'NAME', forceSelection: true, name: 'ISVOUZERO', value: '', enableKeyEvents: true, flex: 0.5, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); //#endregion //#region formSearch 查询面板 this.formSearch = Ext.widget('form', { frame: true, region: 'center', border: false, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 60, msgTarget: 'qtip' }, items: [{//fieldset 1 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '会计期间', xtype: 'monthfield', editable: false, allowBlank: false, //是否允许为空 id: 'ACCDATEbgn', name: 'ACCDATEbgn', enableKeyEvents: true, //激活键盘事件 listeners: { scope: this, 'keyup': { fn: function (_field, e) { if (e.getKey() == 13) { this.onRefreshClick(); } }, scope: this } } }, { fieldLabel: '至', //labelWidth: 20, xtype: 'monthfield', editable: false, allowBlank: false, //是否允许为空 id: 'ACCDATEend', name: 'ACCDATEend', enableKeyEvents: true, //激活键盘事件 listeners: { scope: this, 'keyup': { fn: function (_field, e) { if (e.getKey() == 13) { this.onRefreshClick(); } }, scope: this } } }, this.comboxVKNO, { id: 'EXPLAN2', fieldLabel: '摘要', labelAlign: 'right', //labelWidth: 30, name: 'EXPLAN2', enableKeyEvents: true, //激活键盘事件 listeners: { scope: this, 'keyup': { fn: function (_field, e) { if (e.getKey() == 13) { this.onRefreshClick(); } }, scope: this } } }, this.comboxISCHECKED, this.comboxACCNAME] }, { xtype: 'container', layout: 'hbox', flex:1, defaultType: 'textfield', items: [{ name: 'AMTDRCRbgn', fieldLabel: '金额范围', enableKeyEvents: true, //激活键盘事件 listeners: { scope: this, 'keyup': { fn: function (_field, e) { if (e.getKey() == 13) { this.onRefreshClick(); } }, scope: this } } }, { fieldLabel: '至', //labelWidth: 20, name: 'AMTDRCRend', flex: 1, enableKeyEvents: true, //激活键盘事件 listeners: { scope: this, 'keyup': { fn: function (_field, e) { if (e.getKey() == 13) { this.onRefreshClick(); } }, scope: this } } }, { id: 'VOUNO_NO', fieldLabel: '凭证号', labelAlign: 'right', //labelWidth: 40, name: 'VOUNO_NO', flex: 0.6, enableKeyEvents: true, //激活键盘事件 listeners: { scope: this, 'keyup': { fn: function (_field, e) { if (e.getKey() == 13) { this.onRefreshClick(); } }, scope: this } } }, { id: 'VOUNO_NOTO', fieldLabel: '-', labelAlign: 'right', labelWidth: 10, labelSeparator: '', name: 'VOUNO_NOTO', flex: 0.4, enableKeyEvents: true, //激活键盘事件 listeners: { scope: this, 'keyup': { fn: function (_field, e) { if (e.getKey() == 13) { this.onRefreshClick(); } }, scope: this } } }, this.comboxISEXPORT, this.comboxISVOUZERO, this.comboxZhiDanRen, this.comboxISCOPY, this.comboxISAUTO] }]//end items(fieldset 1) }]//end root items }); var _this = this; this.formSearch2 = Ext.widget('form', { frame: true, region: "west", border: false, width: 80, items: [{ xtype: 'radiogroup', id: 'rdLBYS', name: 'rdLBYS', //fieldLabel: '列表样式', //flex: 2, columns: 1, //vertical: true, horizontal: true, items: [ { id: 'rdoHJ', boxLabel: '合计列', name: 'OBJNUM', inputValue: '合计列' }, { id: 'rdoMX', boxLabel: '明细列', name: 'OBJNUM', inputValue: '明细列', checked: true}// ], listeners: { change: function (rd, newValue, oldValue, eOpts) { saveQuerySetting(_this.formname, _this.formSearch2, false, true); _this.onRefreshClick(); if (newValue.OBJNUM.toString() == "合计列") { _this.gridListHJ.show(); //显示按钮 _this.gridList.hide(); //隐藏按钮 } else { _this.gridList.show(); //显示按钮 _this.gridListHJ.hide(); //隐藏按钮 } } } }]//end root items }); //#endregion formSearch //#region 合计列 //#region 定义数据集 //列表加载 this.storeListHJ = Ext.create('Ext.data.Store', { pageSize: this.PageSize, model: 'MsCwVVModel', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsCwVouchersGl/GetDataListHJ', reader: { id: 'ORDNO', root: 'data', totalProperty: 'totalCount' } } }); //#endregion //#region 列定义 this.GridCheckBoxModelHJ = Ext.create('Ext.selection.CheckboxModel'); this.girdcolumsHJ = [{ sortable: false, dataIndex: 'ORDNO', header: '', //唯一编码 hidden: true, width: 0 }, { sortable: false, dataIndex: 'VOUALLNO', header: '', //凭证号 hidden: true, width: 0 }, { sortable: true, dataIndex: 'VOUDATE', header: '凭证日期', renderer: Ext.util.Format.dateRenderer('Y-m-d'), align: 'center', width: 100 }, { sortable: false, dataIndex: 'VKNO', header: '凭证字', align: 'center', width: 50 }, { sortable: true, dataIndex: 'VOUNO', header: '凭证号', align: 'center', width: 50 }, { sortable: false, dataIndex: 'AMTDR', header: '本位币借方', align: 'right', width: 120, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }, { sortable: false, dataIndex: 'AMTCR', header: '本位币贷方', align: 'right', width: 120, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }, { sortable: false, dataIndex: 'FCYDR', header: '外币借方', align: 'right', width: 120, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }, { sortable: false, dataIndex: 'FCYCR', header: '外币贷方', align: 'right', width: 120, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }, { sortable: false, dataIndex: 'QTYDR', header: '综合本位币借方', align: 'right', width: 120, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }, { sortable: false, dataIndex: 'QTYCR', header: '综合本位币贷方', align: 'right', width: 120, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }, { sortable: false, dataIndex: 'PREPARED', header: '制单人', align: 'center', width: 80 }, { sortable: false, dataIndex: 'MODIFIEDUSERNAME', header: '改单人', align: 'center', width: 80 }, { sortable: false, dataIndex: 'CHECKED', header: '审核人', align: 'center', width: 80 }, { sortable: false, dataIndex: 'ATTACHS', header: '附单据数', align: 'center', width: 60 }, { sortable: false, dataIndex: 'CREATETIME', header: '创建日期', align: 'center', width: 110 }, { sortable: false, dataIndex: 'ISEXPORT', header: '导出凭证', //是否 xtype: "booleancolumn", align: 'center', width: 60, trueText: "是", falseText: " " }, { sortable: false, dataIndex: 'ISCOPY', header: '复制到其他账套', //是否 xtype: "booleancolumn", align: 'center', width: 60, trueText: "是", falseText: " " }, { sortable: false, dataIndex: 'ISAUTO', header: '自动', //是否 xtype: "booleancolumn", align: 'center', width: 60, trueText: "是", falseText: " " }, { sortable: false, dataIndex: 'ISCHECKED', header: '', //是否审核 hidden: true, width: 0 }]; //#endregion this.Pagenum = Ext.create('Ext.form.field.Number', { name: 'bottles', fieldLabel: '每页记录数', labelAlign: 'right', value: this.PageSize, maxValue: 100000, width: 180, minValue: 0, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.PagenumHJ = Ext.create('Ext.form.field.Number', { name: 'bottles', fieldLabel: '每页记录数', labelAlign: 'right', value: this.PageSize, maxValue: 100000, width: 180, minValue: 0, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); //#region gridList列表显示信息 this.gridListHJ = new Ext.grid.GridPanel({ store: this.storeListHJ, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, columns: this.girdcolumsHJ, selModel: this.GridCheckBoxModelHJ, columnLines: true, //是否显示列分割线,默认为false iconCls: 'icon-grid', renderTo: Ext.getBody(), bbar: [Ext.create('Ext.PagingToolbar', { store: this.storeListHJ, displayInfo: true, displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录', emptyMsg: "没有数据" }), this.PagenumHJ] }); this.gridListHJ.addListener('itemdblclick', function (dataview, record, item, index, e, b) { this.SelectedRecord = record; this.OprationStatus = 'edit'; DsOpenEditWin('/MvcShipping/MsCwVouchersGl/Edit', "凭证录入", "", "940", "10", "10"); }, this); this.gridListHJ.addListener('sortchange', function (ct, column, direction, eOpts) { this.sortfield = column.dataIndex; this.sortdire = direction; }, this); //#endregion //#endregion //#region 明细列 //#region 定义数据集 //权限范围 this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', { model: 'MsOP', //proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' } proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang4' } }); this.StoreOpRange.load({ params: { optype: "MsCwVouchersGlCHECKED"} }); this.StoreOpRange2 = Ext.create('DsExt.ux.RefTableStore', { model: 'MsOP', //proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' } proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang4' } }); this.StoreOpRange2.load({ params: { optype: "MsCwVouchersGlNotCHECKED"} }); //列表加载 this.storeList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, model: 'MsCwVVModel', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsCwVouchersGl/GetDataCwVVList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } //,autoLoad: true //自动加载 }); //#endregion //#region 列定义 //Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, { width: 30 }); this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); this.girdcolums = [{ sortable: false, dataIndex: 'GID', header: '', //唯一编码 hidden: true, width: 0 }, { sortable: false, dataIndex: 'VOUALLNO', header: '', //凭证号 hidden: true, width: 0 }, { sortable: true, dataIndex: 'VOUDATE', header: '凭证日期', renderer: Ext.util.Format.dateRenderer('Y-m-d'), align: 'center', width: 100 }, { sortable: true, dataIndex: 'VKNO', header: '凭证字', align: 'center', width: 50 }, { sortable: true, dataIndex: 'VOUNO', header: '凭证号', align: 'center', width: 50 }, { sortable: false, dataIndex: 'EXPLAN', header: '摘要', //align: 'center', width: 300 }, { sortable: true, dataIndex: 'ACCALL', header: '会计科目', //align: 'center', width: 200 }, { sortable: true, dataIndex: 'AMTDR', header: '借方金额', align: 'right', width: 120, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { //return '' + value + ''; //return Ext.util.Format.number(value, '0,000.00'); //var fff = Ext.util.Format.number(value, '0,000.00') + ".00"; value = usMoney(value, 2, '', true); return value; } }, { sortable: true, dataIndex: 'AMTCR', header: '贷方金额', align: 'right', width: 120, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { //return Ext.util.Format.number(value, '0,000.00'); //var fff = Ext.util.Format.number(value, '0,000.00') + ".00"; value = usMoney(value, 2, '', true); return value; } }, { sortable: true, dataIndex: 'FCYDR', header: '外币借方', align: 'right', width: 120, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }, { sortable: true, dataIndex: 'FCYCR', header: '外币贷方', align: 'right', width: 120, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }, { sortable: true, dataIndex: 'PREPARED', header: '制单人', align: 'center', width: 80 }, { sortable: true, dataIndex: 'MODIFIEDUSERNAME', header: '改单人', align: 'center', width: 80 }, { sortable: true, dataIndex: 'CHECKED', header: '审核人', align: 'center', width: 80 }, { sortable: false, dataIndex: 'ATTACHS', header: '附单据数', align: 'center', width: 60 }, { sortable: false, dataIndex: 'ISEXPORT', header: '导出凭证', //是否 xtype: "booleancolumn", align: 'center', width: 60, trueText: "是", falseText: " " }, { sortable: true, dataIndex: 'CREATETIME', header: '创建日期', align: 'center', width: 110 }, { sortable: false, dataIndex: 'ISCOPY', header: '复制到其他账套', //是否 xtype: "booleancolumn", align: 'center', width: 60, trueText: "是", falseText: " " }, { sortable: false, dataIndex: 'ISAUTO', header: '自动', //是否 xtype: "booleancolumn", align: 'center', width: 60, trueText: "是", falseText: " " }, { sortable: false, dataIndex: 'ORDNO', header: '', //唯一编码 hidden: true, width: 0 }, { sortable: false, dataIndex: 'ISCHECKED', header: '', //是否审核 hidden: true, width: 0 }]; //#endregion //#region gridList列表显示信息 this.gridList = new Ext.grid.GridPanel({ store: this.storeList, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, columns: this.girdcolums, selModel: this.GridCheckBoxModel, columnLines: true, //是否显示列分割线,默认为false iconCls: 'icon-grid', renderTo: Ext.getBody(), viewConfig: { enableTextSelection: true, //允许复制数据 autoFill: true }, bbar: [Ext.create('Ext.PagingToolbar', { store: this.storeList, displayInfo: true, displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录', emptyMsg: "没有数据" }), this.Pagenum] }); /////////////以下部分为获取存储的gridpanel显示样式 //this.column = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id,表名,中间column数组,跳过一开始的几列 //this.gridList.reconfigure(this.storeList, this.girdcolums); //this.gridList.columns[1] = new Ext.grid.RowNumberer(); this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) { this.SelectedRecord = record; this.OprationStatus = 'edit'; DsOpenEditWin('/MvcShipping/MsCwVouchersGl/Edit', "凭证录入", "", "940", "10", "10"); }, this); this.gridList.addListener('sortchange', function (ct, column, direction, eOpts) { this.sortfield = column.dataIndex; this.sortdire = direction; }, this); //#endregion //#endregion //#region 按钮工具条/页面布局 this.panelBtn = new Ext.Panel({ layout: "border", region: "center", border: false, tbar: [{ text: "新建", iconCls: "btnadd", handler: function (button, event) { this.OprationStatus = 'add'; DsOpenEditWin('/MvcShipping/MsCwVouchersGl/Edit', "凭证录入", "", "940", "10", "10"); }, scope: this }, '-', { text: "查询", id: "btnRefresh", iconCls: "btnrefresh", handler: function (button, event) { this.onRefreshClick(); }, scope: this }, { text: "重置条件", iconCls: "btnreset", handler: function (button, event) { this.onClearSql(button, event); }, scope: this }, '-', { text: "删除", iconCls: "btndelete", handler: function (button, event) { this.onDeleteClick(button, event); }, scope: this }, { text: "导出", id: "btnExportExcel", iconCls: 'btnexportexcel', menu: [{ text: "合计列表", handler: function (menu, event) { _this.onExportClick(1); } }, { text: "明细列表", handler: function (menu, event) { _this.onExportClick(2); } }, { text: "财务软件", handler: function (menu, event) { _this.onExportClick3(); } }], scope: this }, { text: '打印', tooltip: '打印', id: "btnprint", iconCls: "btnprint", menu: [{ text: "合计列表", handler: function (menu, event) { _this.Print(1); } }, { text: "明细列表", handler: function (menu, event) { _this.Print(2); } }, { text: "合计列表(选择打印)", handler: function (menu, event) { _this.PrintSelect(1); } }], scope: this }, '-', { text: "审核", iconCls: "btislock", handler: function (button, event) { this.setISCHECKED(1); }, scope: this }, { text: "返审", iconCls: "btnotislock", handler: function (button, event) { this.setISCHECKED(0); }, scope: this }, { text: "凭证空号查看", // iconCls: "btnreset", handler: function (button, event) { this.onGetNoVkNo(); }, scope: this }, { text: "复制到其他账套", // iconCls: "btnreset", handler: function (button, event) { this.onCopyVouToOther(); }, scope: this }] }); this.panelZQ = new Ext.Panel({ layout: "border", region: "east", width: 500, style: 'text-align:right;', border: false, items: [{ xtype: 'displayfield', id: 'lbTitle2', name: 'lbTitle2', value: "  " }] }); this.panelTopF = new Ext.Panel({ layout: "border", region: "north", height: 26, //border: false, items: [this.panelBtn, this.panelZQ] }); this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 100, border: false, items: [this.panelTopF, this.formSearch2, this.formSearch] }); Ext.apply(this, { border: false, items: [this.panelTop, this.gridList, this.gridListHJ] }); //#endregion //#region 页面加载 this.gridList.show(); //显示按钮 this.gridListHJ.hide(); //隐藏按钮 this.InitData(); //#endregion //#region 下载窗体 this.formDownloadShow = Ext.widget('form', { frame: true, region: 'center', height: 100, bodyPadding: 5, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 90, msgTarget: 'qtip' }, items: [{ xtype: 'container', defaultType: 'textfield', layout: 'anchor', id: 'downloadfile', defaults: { anchor: '100%' }, items: [{ xtype: 'label', html: '', width: 120, text: '' }] }] }); me = this; this.winDownloadShow = Ext.create('Ext.window.Window', { title: "下载文件", width: 450, height: 120, //plain : true, iconCls: "addicon", resizable: false, // draggable:false,// 是否可以拖动 collapsible: true, // 允许缩放条 closeAction: 'close', closable: true, modal: 'true', buttonAlign: "center", bodyStyle: "padding:0 0 0 0", items: [this.formDownloadShow], buttons: [{ text: "关闭", minWidth: 70, handler: function () { me.winDownloadShow.close(); } }] }); //#endregion //#region 其他账套 this.storeCompany = Ext.create('Ext.data.Store', { fields: [ { name: 'GID', type: 'string' },//唯一编码 { name: 'STARTNAME', type: 'string' }, //账套名称 { name: 'STARTMONTH', type: 'date', dateFormat: 'Y-m' }, //启用年月 { name: 'ISENABLE', type: 'bool' }, //是否启用 { name: 'ISLOGIN', type: 'string' }, //是否登录 { name: 'CORPID', type: 'string' },//分公司代码 { name: 'MODIFIEDUSERNAME', type: 'string' },//最后一次更改操作人 { name: 'CORPNAME', type: 'string' } ], pageSize: 5000, remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsCwDesignStartusing/GetDataList', reader: { id: '', root: 'data', totalProperty: 'totalCount' } } }); this.storeCompany.load({ params: { condition: " ISENABLE=1 " } }); this.comboxCompany = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '账套', //'委托分公司', store: this.storeCompany, width: 80, name: 'STARTGID', valueField: 'GID', displayField: 'STARTNAME' }); this.storeUser = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' } }); //this.storeUser.load(); //this.comboxSeaeOp = Ext.create('Ext.ux.form.field.BoxSelect', { // fieldLabel: '制单', //'操作', // //renderTo: 'basicBoxselect', // //autoHeight:true, // autosize: true, // bodyPadding: 1, // flex: 2, // //height:60, // width: 80, // labelWidth: 90, // store: this.storeUser, // queryMode: 'local', // //stacked: true, // //pinList: false, // triggerOnClick: false, // valueField: 'GID', // displayField: 'CodeAndName' //}); this.formSubCompOrder = Ext.widget('form', { frame: true, region: 'center', bodyPadding: 5, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 90, msgTarget: 'qtip' }, items: [ {//fieldset 1 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxCompany ] } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); this.winSubCompOrder = Ext.create('Ext.window.Window', { title:'复制到其他账套', //"生成分部委托", width: 350, //height : 120, //plain : true, iconCls: "addicon", resizable: false, // 是否可以拖动 // draggable:false, collapsible: true, // 允许缩放条 closeAction: 'close', closable: true, modal: 'true', buttonAlign: "center", bodyStyle: "padding:0 0 0 0", items: [this.formSubCompOrder], buttons: [{ text:'确认', //"确认生成", minWidth: 70, handler: function () { var form = _this.formSubCompOrder.getForm(); var STARTGID = form.findField('STARTGID').getValue(); if (STARTGID == '' || STARTGID == null || STARTGID == undefined) { Ext.Msg.show({ title:'提示', msg:'账套不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //'委托分公司为必填!' return; }; _this.SubStartGid = STARTGID; _this.onCopyVouToOtherClick(); } }, { text: '关闭', //"关闭", minWidth: 70, handler: function () { _this.winSubCompOrder.close(); } }] }); //#endregion }, //end initUIComponents //#region 加载事件 InitData: function () { Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/MvcShipping/RptCwGenlegAccitems/GetData', callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { return; } data = result.data; var arrtmp = data.toString().split("&"); this.strCwSTARTGID = arrtmp[0].toString(); var strCwSTARTNAME = arrtmp[1].toString(); var strCwACCDATE = arrtmp[2].toString(); var sYear = arrtmp[3].toString(); var sMonth = arrtmp[4].toString(); // Ext.getCmp("ACCDATEbgn").setValue(strCwACCDATE); Ext.getCmp("ACCDATEend").setValue(strCwACCDATE); var sZQ = "  当前登录账套:“" + strCwSTARTNAME + "”  当前财务账期:“" + sYear + "年第" + sMonth + "期”  "; Ext.getCmp("lbTitle2").setValue(sZQ); LoadQueryData(this.formname, this.formSearch2, this.CheckSaveQuery); // this.storeListHJ.on('beforeload', function (store) { var sql = this.getCondition(); this.sqlcontext = sql; if (sql.toString() != "") { Ext.apply(store.proxy.extraParams, { condition: sql }); } }, this); this.storeList.on('beforeload', function (store) { var sql = this.getCondition(); this.sqlcontext = sql; if (sql.toString() != "") { Ext.apply(store.proxy.extraParams, { condition: sql }); } }, this); // this.storeList.on('refresh', function (store) { mergeCells(this.gridList, [2, 3, 4, 5, 10, 11, 12, 13, 14, 0]); // 加载完成后,执行函数 }, this) this.onRefreshClick(); } else { //Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, //end InitData //#endregion //#region 查询 onRefreshClick: function () { var sql = this.getCondition(); this.sqlcontext = sql; if (Ext.getCmp('rdLBYS').getValue().OBJNUM.toString() == "合计列") { this.PageSize = this.PagenumHJ.getValue(); this.storeListHJ.pageSize = this.PageSize; this.storeListHJ.currentPage = 1; this.storeListHJ.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在刷新数据...", timeout: 6000000, //30秒 scope: this }); } else { this.PageSize = this.Pagenum.getValue(); this.storeList.pageSize = this.PageSize; this.storeList.currentPage = 1; this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在刷新数据...", timeout: 6000000, //30秒 scope: this }); } }, getCondition: function () { var sql = ''; //凭证号 var VKNO = this.formSearch.getForm().findField('VKNO').getValue(); if (VKNO != null) { if (VKNO != "") { sql = sql + getAndConSql(sql, VKNO, "VKNO='" + VKNO.toString().trim() + "'"); } } //凭证号 var VOUNOTO = Ext.getCmp("VOUNO_NOTO").value; var VOUNO = Ext.getCmp("VOUNO_NO").value; if (VOUNO != null) { if (VOUNO != "") { if (VOUNOTO != null && VOUNOTO != "") { sql = sql + getAndConSql(sql, VOUNO, "VOUNO>='" + VOUNO.toString().trim() + "'"); //烟台爱德林要求2016-03-22改 sql = sql + getAndConSql(sql, VOUNOTO, "VOUNO<='" + VOUNOTO.toString().trim() + "'"); //烟台爱德林要求2016-03-22改 } else sql = sql + getAndConSql(sql, VOUNO, "VOUNO='" + VOUNO.toString().trim() + "'"); //烟台爱德林要求2016-03-22改 } } //摘要 var EXPLAN2 = Ext.getCmp("EXPLAN2").value; if (EXPLAN2 != null) { if (EXPLAN2 != "") { sql = sql + getAndConSql(sql, EXPLAN2, "EXPLAN like '%" + EXPLAN2.toString().trim() + "%'"); } } //审核状态 var ISCHECKED2 = this.formSearch.getForm().findField('ISCHECKED2').getValue(); if (ISCHECKED2 != null) { if (ISCHECKED2 == "审核") { sql = sql + getAndConSql(sql, ISCHECKED2, "ISCHECKED=1"); } else if (ISCHECKED2 == "未审核") { sql = sql + getAndConSql(sql, ISCHECKED2, "ISCHECKED=0"); } } //会计期间 //var ACCDATEbgn = Ext.getCmp("ACCDATEbgn").value; var ACCDATEbgn = this.formSearch.getForm().findField('ACCDATEbgn').getRawValue(); if (ACCDATEbgn != null) { if (ACCDATEbgn != "") { //sql = sql + getAndConSql(sql, ACCDATEbgn, "SUBSTRING(convert(char(10),VOUDATE,120),1,7) >='" + ACCDATEbgn.toString().trim() + "'"); sql = sql + getAndConSql(sql, ACCDATEbgn, "ACCDATE >='" + ACCDATEbgn.toString().trim() + "'"); } } //var ACCDATEend = Ext.getCmp("ACCDATEend").value; var ACCDATEend = this.formSearch.getForm().findField('ACCDATEend').getRawValue(); if (ACCDATEend != null) { if (ACCDATEend != "") { //sql = sql + getAndConSql(sql, ACCDATEend, "SUBSTRING(convert(char(10),VOUDATE,120),1,7) <='" + ACCDATEend.toString().trim() + "'"); sql = sql + getAndConSql(sql, ACCDATEend, "ACCDATE <='" + ACCDATEend.toString().trim() + "'"); } } //导出状态 var ISEXPORT2 = this.formSearch.getForm().findField('ISEXPORT').getValue(); if (ISEXPORT2 != null) { if (ISEXPORT2 == "已导出") { sql = sql + getAndConSql(sql, ISEXPORT2, "ISEXPORT=1"); } else if (ISEXPORT2 == "未导出") { sql = sql + getAndConSql(sql, ISEXPORT2, "ISEXPORT=0"); } } //是否复制 var ISCOPY = this.formSearch.getForm().findField('ISCOPY').getValue(); if (ISCOPY != null) { if (ISCOPY == "已复制") { sql = sql + getAndConSql(sql, ISCOPY, "ISCOPY=1 "); } else if (ISCOPY == "未复制") { sql = sql + getAndConSql(sql, ISCOPY, " ISNULL(ISCOPY,0)=0 "); } } var ISAUTO = this.formSearch.getForm().findField('ISAUTO').getValue(); if (ISAUTO != null) { if (ISAUTO == "自动") { sql = sql + getAndConSql(sql, ISAUTO, "ISAUTO=1 "); } else if (ISAUTO == "手工") { sql = sql + getAndConSql(sql, ISAUTO, " ISNULL(ISAUTO,0)=0 "); } } //金额范围 var AMTDRCRbgn = this.formSearch.getForm().findField('AMTDRCRbgn').getValue(); var AMTDRCRend = this.formSearch.getForm().findField('AMTDRCRend').getValue(); if (AMTDRCRbgn != null && AMTDRCRend != null) { if (AMTDRCRbgn != "" && AMTDRCRend != "") { if (Ext.getCmp('rdLBYS').getValue().OBJNUM.toString() == "合计列") { sql = sql + getAndConSql(sql, AMTDRCRbgn, "ORDNO in (select ORDNO from VW_cw_vouchers_vouitems_gl where ( (AMTDR>=" + AMTDRCRbgn.toString().trim() + " and AMTDR<=" + AMTDRCRend.toString().trim() + ") or (AMTCR>=" + AMTDRCRbgn.toString().trim() + " and AMTCR<=" + AMTDRCRend.toString().trim() + ") or (FCYDR>=" + AMTDRCRbgn.toString().trim() + " and FCYDR<=" + AMTDRCRend.toString().trim() + ") or (FCYCR>=" + AMTDRCRbgn.toString().trim() + " and FCYCR<=" + AMTDRCRend.toString().trim() + ") ))"); } else { sql = sql + getAndConSql(sql, AMTDRCRbgn, "( (AMTDR>=" + AMTDRCRbgn.toString().trim() + " and AMTDR<=" + AMTDRCRend.toString().trim() + ") or (AMTCR>=" + AMTDRCRbgn.toString().trim() + " and AMTCR<=" + AMTDRCRend.toString().trim() + ") or (FCYDR>=" + AMTDRCRbgn.toString().trim() + " and FCYDR<=" + AMTDRCRend.toString().trim() + ") or (FCYCR>=" + AMTDRCRbgn.toString().trim() + " and FCYCR<=" + AMTDRCRend.toString().trim() + ") )"); } } else { if (AMTDRCRbgn != "" || AMTDRCRend != "") { Ext.Msg.show({ title: '提示', msg: '金额范围查询,两个范围框都不允许为空!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); //Ext.Msg.hide(); return; } } } else { if (AMTDRCRbgn != null || AMTDRCRend != null) { Ext.Msg.show({ title: '提示', msg: '金额范围查询,两个范围框都不允许为空!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); //Ext.Msg.hide(); return; } } //制单人 var PREPARED = this.formSearch.getForm().findField('PREPARED').getValue(); if (PREPARED != null) { if (PREPARED != "") { sql = sql + getAndConSql(sql, PREPARED, "PREPARED like '%" + PREPARED.toString().trim() + "%'"); } } var ACCID = this.formSearch.getForm().findField('ACCID').getValue(); if (ACCID != null) { if (ACCID != "") { sql = sql + getAndConSql(sql, ACCID, "ACCID='" + ACCID.toString().trim() + "'"); } } var ISVOUZERO = this.formSearch.getForm().findField('ISVOUZERO').getValue(); if (ISVOUZERO != null) { if (ISVOUZERO != "") { if (ISVOUZERO=="1") sql = sql + getAndConSql(sql, ISVOUZERO, " EXISTS (SELECT 1 FROM cw_vouchers_gl WHERE cw_vouchers_gl.ORDNO=VW_cw_vouchers_vouitems_gl.ORDNO AND cw_vouchers_gl.AMTDR=0 AND cw_vouchers_gl.AMTCR=0) "); else sql = sql + getAndConSql(sql, ISVOUZERO, " NOT EXISTS (SELECT 1 FROM cw_vouchers_gl WHERE cw_vouchers_gl.ORDNO=VW_cw_vouchers_vouitems_gl.ORDNO AND cw_vouchers_gl.AMTDR=0 AND cw_vouchers_gl.AMTCR=0) "); } } return sql; }, onClearSql: function () { //this.formSearch.getForm().findField('VKNO').setValue("记"); //this.formSearch.getForm().findField('VOUNO_NO').setValue(""); //this.formSearch.getForm().findField('ACCDATEbgn').setValue(""); //this.formSearch.getForm().findField('ACCDATEend').setValue(""); var form = this.formSearch.getForm(); form.reset(); // this.InitData(); }, //#endregion //#region 删除 onDeleteClick: function (button, event) { var selections; if (Ext.getCmp('rdLBYS').getValue().OBJNUM.toString() == "合计列") { selections = this.gridListHJ.getSelectionModel().getSelection(); } else { selections = this.gridList.getSelectionModel().getSelection(); } if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return; } // var gids = ""; var sError = ""; for (var i = 0; i < selections.length; i++) { var record = selections[i]; if (record.get('ISCHECKED').toString() != "true") { if (i == 0) { gids = record.get('ORDNO'); } else { gids += "," + record.get('ORDNO'); } } else { sError = "(注:已经审核的业务不允许删除!)"; } } // if (gids.trim() == "") { Ext.Msg.show({ title: '提示', msg: '请选择未审核业务!' + sError, icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return; } else { Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) { if (btn == 'yes') { Ext.Msg.wait('正在删除数据...'); Ext.Ajax.request({ waitMsg: '正在删除数据...', url: '/MvcShipping/MsCwVouchersGl/Delete', params: { gids: gids }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { //this.storeList.remove(record); this.onRefreshClick(); Ext.Msg.show({ title: '提示', msg: jsonresult.Message + sError, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }, failure: function (response, options) { Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); }, success: function (response, options) { }, scope: this }); //end Ext.Ajax.request } }, this); } }, //#endregion //#region 审核/返审 setISCHECKED: function (iTYPE) { var selectedRecords; if (Ext.getCmp('rdLBYS').getValue().OBJNUM.toString() == "合计列") { selectedRecords = this.gridListHJ.getSelectionModel().getSelection(); } else { selectedRecords = this.gridList.getSelectionModel().getSelection(); } if (selectedRecords.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return; } // Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/MvcShipping/RptCwGenlegAccitems/GetData', callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { return; } data = result.data; var arrtmp = data.toString().split("&"); this.strCwSTARTGID = arrtmp[0].toString(); var strCwSTARTNAME = arrtmp[1].toString(); var strCwACCDATE = arrtmp[2].toString(); var sYear = arrtmp[3].toString(); var sMonth = arrtmp[4].toString(); // var iError = 0; for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; var kjqj = rec.get('VOUDATE').toString().substr(0, 7); if (kjqj < strCwACCDATE) { iError++; } } if (iError > 0) { Ext.Msg.show({ title: '警告', msg: '已经结转的期间凭证,不允许操作!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return; } // var sNAME = "审核"; if (iTYPE == 0) { sNAME = "返审"; if (this.StoreOpRange2.getCount() == 0) { Ext.Msg.show({ title: '警告', msg: '权限不足,不允许操作!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return; } } else {//审核 if (this.StoreOpRange.getCount() == 0) { Ext.Msg.show({ title: '警告', msg: '权限不足,不允许操作!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return; } } // var iOK = 0; var iSkip = 0; var strGIDs = ""; var strGIDs2 = ""; for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if ((!rec.get('ISCHECKED') && sNAME == "审核")) { if (strGIDs == "") { var records = DsStoreQueryBy(this.StoreOpRange, 'OPID', rec.get('PREPARED')); //制单人 if (records.getCount() > 0) { } else { iSkip++; continue; } // strGIDs = rec.get('ORDNO'); iOK++; } else { if (strGIDs.indexOf(rec.get('ORDNO')) < 0) { var records = DsStoreQueryBy(this.StoreOpRange, 'OPID', rec.get('PREPARED')); //制单人 if (records.getCount() > 0) { } else { iSkip++; continue; } // strGIDs = strGIDs + "," + rec.get('ORDNO'); iOK++; } } } else if ((rec.get('ISCHECKED') && sNAME == "返审")) { if (strGIDs == "") { var records = DsStoreQueryBy(this.StoreOpRange2, 'OPID', rec.get('PREPARED')); //制单人 if (records.getCount() > 0) { } else { iSkip++; continue; } // strGIDs = rec.get('ORDNO'); iOK++; } else { if (strGIDs.indexOf(rec.get('ORDNO')) < 0) { var records = DsStoreQueryBy(this.StoreOpRange2, 'OPID', rec.get('PREPARED')); //制单人 if (records.getCount() > 0) { } else { iSkip++; continue; } // strGIDs = strGIDs + "," + rec.get('ORDNO'); iOK++; } } } else { if (strGIDs2.indexOf(rec.get('ORDNO').toString()) < 0) { strGIDs2 += "," + rec.get('ORDNO'); iSkip++; } } } // if (strGIDs.toString().trim() == "") { //Ext.Msg.show({ title: '警告', msg: '权限不足,不允许操作!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); Ext.Msg.hide(); return; } else { Ext.MessageBox.confirm('提示', '确定' + sNAME + '吗?', function (btn) { if (btn == 'yes') { Ext.Msg.wait('正在' + sNAME + '...'); Ext.Ajax.request({ waitMsg: '正在' + sNAME + '...', url: '/MvcShipping/MsCwVouchersGl/setISCHECKED', params: { gids: strGIDs, iTYPE: iTYPE, iOK: iOK, iSkip: iSkip }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { //var msgs = '操作完成!成功:' + iOK + '条,跳过:' + iSkip + '条。'; this.onRefreshClick(); Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } else { this.onRefreshClick(); } }, failure: function (response, options) { Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); }, success: function (response, options) { }, scope: this }); } }, this); } } else { //Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, //#endregion //#region 导出Excel onExportClick: function (iType) { var strHandle = "MsCwVouchersGlIndex"; if (iType == 1) { if (this.storeListHJ.getCount() == 0) { return; } strHandle = "MsCwVouchersGlIndexHJ"; } else if (iType == 2) { if (this.storeList.getCount() == 0) { return; } } var strGIDs = ""; var sql = escape(this.getCondition()); var openSet = "height=1, width=400, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top=" + (screen.height - 200) / 2 + ",Left=" + (screen.width - 400) / 2; var openType = "_blank"; var openUrl = "../../Reports/RptExport.aspx?handle=" + strHandle + "&formname=" + this.formname + "&condition1=" + sql + "&gids=" + strGIDs; window.open(openUrl, openType, openSet); }, onGetNoVkNo: function () { var ACCDATEbgn = this.formSearch.getForm().findField('ACCDATEbgn').getRawValue(); //var ACCDATEend = Ext.getCmp("ACCDATEend").value; var ACCDATEend = this.formSearch.getForm().findField('ACCDATEend').getRawValue(); Ext.Msg.wait('正在查询, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在查询数据...', url: '/MvcShipping/MsCwVouchersGl/GetNoVKNO', scope: this, params: { accdatefr:ACCDATEbgn, accdateto: ACCDATEend }, 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.storeList.load({ params: { condition: "" }, waitMsg: "正在刷新数据...", scope: this }); } else { Ext.Msg.show({ title: '提示', msg:'没有空号!', icon: Ext.MessageBox.INFO, buttons: Ext.Msg.OK }); } } else { Ext.Msg.show({ title: '请重试', msg: '服务器响应出错', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }); }, //ExtJs 自带的导出当前页的excel导出函数 onExportClick2: function (iType) { if (iType == 1) { if (this.storeListHJ.getCount() == 0) { return; } GridExportExcelPage(this.gridListHJ); } else { if (this.storeList.getCount() == 0) { return; } GridExportExcelPage(this.gridList); } }, //导出财务接口 onExportClick3: function () { var selections; if (Ext.getCmp('rdLBYS').getValue().OBJNUM.toString() == "合计列") { selections = this.gridListHJ.getSelectionModel().getSelection(); } else { selections = this.gridList.getSelectionModel().getSelection(); } if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return; } // var gids = ""; if (selections.length > 0) { for (var i = 0; i < selections.length; i++) { var record = selections[i]; if (i == 0) { if (record.get('CHECKED').toString().trim() != "") { gids = record.get('ORDNO'); } } else { if (gids.indexOf(record.get('ORDNO')) < 0) { if (record.get('CHECKED').toString().trim() != "") { gids += "," + record.get('ORDNO'); } } } } } if (gids.toString().trim() == "") { Ext.Msg.show({ title: '警告', msg: '请选择已审核的凭证!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return; } // Ext.Msg.wait('正在导出数据...'); Ext.Ajax.request({ waitMsg: '正在导出数据...', url: '/MvcShipping/MsCwVouchersGl/getIsExport', params: { condition: this.getCondition(), gids: gids }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { //var sql = escape(this.getCondition()); //var openSet = "height=1, width=400, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top=" + (screen.height - 200) / 2 + ",Left=" + (screen.width - 400) / 2; //var openType = "_blank"; //var openUrl = "../../Reports/RptExport.aspx?handle=MsCwVouchersGlIndex3&formname=" + this.formname + "&condition1=" + sql + "&gids=" + gids; //window.open(openUrl, openType, openSet); //this.onRefreshClick(); //Ext.Msg.hide(); // Ext.Msg.wait('正在导出数据...'); Ext.Ajax.request({ waitMsg: '正在导出数据...', url: '/MvcShipping/MsCwVouchersGl/setExcelReportGl', params: { strCondition: this.getCondition(), gids: gids }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { if (jsonresult.Data == "") { Ext.Msg.show({ title: '提示', msg: '凭证导出成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //'委托分公司为必填!' this.onRefreshClick(); } else { var downloadfile = Ext.getCmp('downloadfile'); var children = downloadfile.items; if (children) { for (var i = 0, len = children.length; i < len; i++) { downloadfile.remove(children.items[i], true); } } var downloadfiles = '' + jsonresult.Message + ''; var htmla = Ext.widget('label', { html: downloadfiles, width: 120, text: '' }); downloadfile.items.add(htmla); this.winDownloadShow.show(); // Ext.Msg.hide(); this.onRefreshClick(); } } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }, failure: function (response, options) { Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); }, success: function (response, options) { }, scope: this }); } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }, failure: function (response, options) { Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); }, success: function (response, options) { }, scope: this }); }, //#endregion //复制到其他账套 onCopyVouToOther: function () { var selections; if (Ext.getCmp('rdLBYS').getValue().OBJNUM.toString() == "合计列") { selections = this.gridListHJ.getSelectionModel().getSelection(); } else { selections = this.gridList.getSelectionModel().getSelection(); } if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return; } // var gids = ""; if (selections.length > 0) { var record = selections[0]; gids = record.get('VKNO'); } if (gids.toString().trim() == "") { Ext.Msg.show({ title: '警告', msg: '没有要复制的凭证!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return; } // Ext.Msg.wait('正在导出数据...'); Ext.Ajax.request({ waitMsg: '正在导出数据...', url: '/MvcShipping/MsCwDesignGl/GetDataAll', params: { condition: " (TVW='" + gids + "' OR BPVW='" + gids + "' OR BRTW='" + gids +"') " }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { this.comboxCompany.setValue(jsonresult.data.STARTGID); this.winSubCompOrder.show(); Ext.Msg.hide(); } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }, failure: function (response, options) { Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); }, success: function (response, options) { }, scope: this }); }, onCopyVouToOtherClick: function () { var selections; if (Ext.getCmp('rdLBYS').getValue().OBJNUM.toString() == "合计列") { selections = this.gridListHJ.getSelectionModel().getSelection(); } else { selections = this.gridList.getSelectionModel().getSelection(); } if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return; } // var gids = ""; if (selections.length > 0) { for (var i = 0; i < selections.length; i++) { var record = selections[i]; if (i == 0) { gids = record.get('ORDNO'); } else { if (gids.indexOf(record.get('ORDNO')) < 0) { gids += "," + record.get('ORDNO'); } } } } if (gids.toString().trim() == "") { Ext.Msg.show({ title: '警告', msg: '没有要复制的凭证!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return; } // Ext.Msg.wait('正在导出数据...'); Ext.Ajax.request({ waitMsg: '正在导出数据...', url: '/MvcShipping/MsCwVouchersGl/CopyVouToOther', params: { STARTGID: this.SubStartGid, gids: gids }, callback: function (options, success, response) { if (success) { 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.winSubCompOrder.close(); } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }, failure: function (response, options) { Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); }, success: function (response, options) { }, scope: this }); }, //#endregion //#region 打印 Print: function (iType) { var sql = this.getCondition(); this.sqlcontext = sql; var sortstr = ''; if (this.sortfield != '' && this.sortdire != '') { sortstr = this.sortfield + ' ' + this.sortdire; } // if (iType == 1) { if (this.storeListHJ.getCount() == 0) { return; } // Ext.Ajax.request({ waitMsg: '正在组织数据, 请稍侯...', url: '/MvcShipping/MsCwVouchersGl/GetDataListStrHJ', params: { condition: sql, printstr: 'true', sort: sortstr }, callback: function (options, success, response) { if (success) { var ddd = Ext.MessageBox.isVisible(); if (Ext.MessageBox.isVisible()) { Ext.MessageBox.hide(); } var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var returnStr = jsonresult.data; var printType = 'MsCwVouchersGlIndexHJ'; var sql1 = returnStr; var sql2 = ""; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); } 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 }); } }, scope: this }); } else { if (this.storeList.getCount() == 0) { return; } // Ext.Ajax.request({ waitMsg: '正在组织数据, 请稍侯...', url: '/MvcShipping/MsCwVouchersGl/GetDataListStr', params: { condition: sql, printstr: 'true', sort: sortstr}, callback: function (options, success, response) { if (success) { var ddd = Ext.MessageBox.isVisible(); if (Ext.MessageBox.isVisible()) { Ext.MessageBox.hide(); } var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var returnStr = jsonresult.data; var printType = 'MsCwVouchersGlIndex'; var sql1 = returnStr; var sql2 = ""; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); } 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 }); } }, scope: this }); } }, PrintSelect: function (iType) { var sql = this.getCondition(); this.sqlcontext = sql; // if (this.storeListHJ.getCount() == 0) { return; } var selectedRecords = []; var storeadd = null; selectedRecords = this.GridCheckBoxModelHJ.selected.items; var feeGidSql = ''; for (var i = 0; i < selectedRecords.length; i++) { var record = selectedRecords[i]; var feeGId = "'" + record.get('ORDNO') + "'"; if (feeGidSql == '') { feeGidSql = feeGId; } else { feeGidSql = feeGidSql + "," + feeGId; } }; // var printType = 'MsCwVouchersGlIndexHJ'; var sql1 = "SELECT ORDNO,ORDNO as 唯一编码,VOUALLNO as 凭证字号,VOUNO as 凭证号,VKNO as 凭证字,VOUDATE as 凭证日期,ACCYEAR as 凭证年,ACCMONTH as 凭证月,ATTACHS as 附件数,ACCDATE as 会计期间,PREPARED as 制单人,ISCHECKED as 是否审核,CHECKED as 审核人,ENTERED as 记账人,MODIFIEDUSERNAME as 改单人,ISEXPORT as 是否导出凭证,SUM(case when FCYNO='RMB' THEN AMTDR ELSE 0 END) as 本位币借方,SUM(case when FCYNO='RMB' THEN AMTCR ELSE 0 END) as 本位币贷方,SUM(FCYDR) as 外币借方,SUM(FCYCR) as 外币贷方,SUM(AMTDR) as 综合本位币借方,SUM(AMTCR) as 综合本位币贷方 from VW_cw_vouchers_vouitems_gl WITH(NOLOCK) where ORDNO IN (" + feeGidSql + ") "; sql1 = sql1 + " GROUP BY ORDNO,VOUALLNO,VOUNO,VKNO,VOUDATE,ACCYEAR,ACCMONTH,ATTACHS,ACCDATE,PREPARED,ISCHECKED,CHECKED,ENTERED,ISEXPORT,MODIFIEDUSERNAME "; sql1 = sql1 + " order by VOUALLNO desc,VOUDATE desc "; var sql2 = ""; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); }, //#endregion //#region 获取 YYYY-mm-dd 格式的日期 GetDateStr: function (sdate, AddDayCount) { var dd = new Date(sdate); //获取选择的时期对象 dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期 sdate = dd.toISOString(); sdate = sdate.toString().substr(0, 10); return sdate; }, //#endregion OprationSwapJK: function () { var ret = new Array(); ret[0] = this.OprationStatus; ret[1] = this.storeList; ret[2] = this.SelectedRecord; ret[3] = this.sqlcontext; ret[4] = Ext.getCmp('btnRefresh'); ret[5] = null; ret[6] = null; ret[7] = null; ret[8] = null; ret[9] = null; ret[10] = null; return ret; } });