Ext.namespace('Shipping'); Shipping.RptCwGenlegAccitemsIndex = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.RptCwGenlegAccitemsIndex.superclass.constructor.call(this); }; Ext.extend(Shipping.RptCwGenlegAccitemsIndex, Ext.Panel, { PageSize: 1000, OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, sqlcontext: '', strCwSTARTGID: '', initUIComponents: function () { this.formname = "formRptCwGenlegAccitemsIndex"; //科目余额 Ext.Ajax.timeout = 120000; //#region formSearch 下拉框信息加载 //科目加载 this.storeCwAccitems = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CwAccitemsGlModel', proxy: { url: '/CommMng/BasicDataRef/GetCwAccitemsGl' } }); this.storeCwAccitems.load({ params: { condition: "ISENABLE=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, //输入值是否严格为待选列表中存在的值 id: 'ACCID', name: 'ACCID', valueField: 'ACCID', displayField: 'ACCIDNAME', enableKeyEvents: true, //激活键盘事件 listeners: { scope: this, 'keyup': { fn: function (_field, e) { if (e.getKey() == 13) { this.onRefreshClick(); } }, scope: this } } }); //币别 this.storeCodeCurrency = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeCurrencyModel', proxy: { url: '/MvcShipping/RptCwGL/GetCodeCurrencyList' } }); this.storeCodeCurrency.load(); this.comboxCodeCurrency = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '币别', store: this.storeCodeCurrency, forceSelection: true, id: 'CURRENCY', name: 'CURRENCY', valueField: 'CODENAME', displayField: 'CODENAME', value: '综合本位币', enableKeyEvents: true, //激活键盘事件 listeners: { scope: this, 'keyup': { fn: function (_field, e) { if (e.getKey() == 13) { this.onRefreshClick(); } }, scope: this } } }); //#endregion //#region 定义数据集 /* this.storeList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, model: 'RptCwGenlegAccitemsModel', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/RptCwGenlegAccitems/GetDataList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); */ this.storeList = null; //#endregion //#region 定义列 this.girdcolums = [{ sortable: false, dataIndex: 'GID', header: '唯一编码', width: 0 }, { sortable: false, dataIndex: 'LINKCODE', header: '科目代码', width: 80 }, { sortable: false, dataIndex: 'LINKNAME', header: '科目名称', width: 200 }, { text: '期初余额', sortable: false, columns: [{ sortable: false, dataIndex: 'AMTYEARDR', header: '借方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }, { sortable: false, dataIndex: 'AMTYEARCR', header: '贷方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }] }, { text: '本期发生额', sortable: false, columns: [{ sortable: false, dataIndex: 'AMTDR', header: '借方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }, { sortable: false, dataIndex: 'AMTCR', header: '贷方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }] }, { text: '累计发生额', sortable: false, columns: [{ sortable: false, dataIndex: 'AMTLASTDR', header: '借方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }, { sortable: false, dataIndex: 'AMTLASTCR', header: '贷方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }] }, { text: '期末余额', sortable: false, columns: [{ sortable: false, dataIndex: 'AMTCPDR', header: '借方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }, { sortable: false, dataIndex: 'AMTCPCR', header: '贷方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }] }, { text: '折合本位币期初余额', sortable: false, columns: [{ sortable: false, dataIndex: 'QTYYEARDR', header: '借方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }, { sortable: false, dataIndex: 'QTYYEARCR', header: '贷方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }] }, { text: '折合本位币本期发生额', sortable: false, columns: [{ sortable: false, dataIndex: 'QTYDR', header: '借方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }, { sortable: false, dataIndex: 'QTYCR', header: '贷方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }] }, { text: '折合本位币累计发生额', sortable: false, columns: [{ sortable: false, dataIndex: 'QTYLASTDR', header: '借方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }, { sortable: false, dataIndex: 'QTYLASTCR', header: '贷方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }] }, { text: '折合本位币期末余额', sortable: false, columns: [{ sortable: false, dataIndex: 'QTYCPDR', header: '借方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }, { sortable: false, dataIndex: 'QTYCPCR', header: '贷方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }] }]; //#endregion //#region 定义列2 this.girdcolums2 = [{ sortable: false, dataIndex: 'GID', header: '唯一编码', width: 0 }, { sortable: false, dataIndex: 'LINKCODE', header: '科目代码', width: 80 }, { sortable: false, dataIndex: 'LINKNAME', header: '科目', width: 200 }]; //#endregion //#region List列表显示信息 Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, { width: 30 }); this.ptoolbar = Ext.create('Ext.PagingToolbar', { store: this.storeList, displayInfo: true, displayMsg: "当前显示 {0} - {1}条记录 /共 {2}条记录", emptyMsg: "没有数据" }); //定义Grid this.gridList = new Ext.grid.GridPanel({ store: this.storeList, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, enableHdMenu: false, //是否显示表格列的菜单 stripeRows: true, //斑马线效果 rowLines: true, trackMouseOver: true, disableSelection: false, columnLines: true, columns: this.girdcolums2, viewConfig: { enableTextSelection: true, //允许复制数据 autoFill: true }, bbar: [this.ptoolbar] }); //#endregion //#region formSearch 查询面板 this.formSearch = Ext.widget('form', { frame: true, region: 'center', bodyPadding: 5, 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.comboxCodeCurrency, this.comboxACCNAME] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ xtype: "checkbox", //checkbox控件 id: "cbHSKM", name: "cbHSKM", boxLabel: "包括核算科目", fieldLabel: "", inputValue: "true", //选中的值 uncheckedValue: "false" //未选中的值 //checked: true //绘制时的选中状态 }, { xtype: "checkbox", //checkbox控件 id: "cbZKM", name: "cbZKM", boxLabel: "包括子科目", fieldLabel: "", inputValue: "true", //选中的值 uncheckedValue: "false" //未选中的值 //checked: true //绘制时的选中状态 }, { xtype: "checkbox", //checkbox控件 id: "cbJZFS", name: "cbJZFS", boxLabel: "包括余额和本期发生额均为零的科目", fieldLabel: "", inputValue: "true", //选中的值 uncheckedValue: "false" //未选中的值 //checked: true //绘制时的选中状态 }, { xtype: 'hiddenfield'}] }]//end items(fieldset 1) }]//end root items }); //#endregion formSearch //#region 按钮工具条 this.CheckSaveQuery = new Ext.form.Checkbox({ fieldLabel: '记忆查询条件', checked: true, width: 120 }); this.panelBtn = new Ext.Panel({ //region: "north", region: "center", border: false, tbar: [{ text: "执行查询", iconCls: "btnrefresh", handler: function (button, event) { this.onRefreshClick(button, event); var isvisible = false; var issavevalue = false; if (this.CheckSaveQuery.checked) { issavevalue = true } saveQuerySetting(this.formname, this.formSearch, isvisible, issavevalue); }, scope: this }, { text: "重置条件", iconCls: "btnreset", handler: function (button, event) { this.onClearSql(button, event); }, scope: this }, '-', { text: "导出Excel", id: "btnExportExcel", iconCls: 'btnexportexcel', handler: function (button, event) { this.onExportClick(button, event); }, scope: this }, { text: "打印", iconCls: 'btnprint', handler: function (button, event) { this.Print(); }, scope: this }, '-', this.CheckSaveQuery] }); //#endregion //#region 页面布局 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: 90, border: false, items: [this.panelTopF, this.formSearch] }); Ext.apply(this, { border: false, items: [this.panelTop, this.gridList] }); //this.onRefreshClick(); //#endregion //#region 页面加载 // this.storeList.on('beforeload', function (store) { // var sql = this.getCondition(); // var ACCDATEbgn = this.getACCDATEbgn(); // var ACCDATEend = this.getACCDATEend(); // var strCbHSKM = this.getCbHSKM(); // var strCURRENCY = this.getCURRENCY(); // var strCbJZFS = this.getCbJZFS(); // if (sql.toString() != "") { // Ext.apply(store.proxy.extraParams, { condition: sql, ACCDATEbgn: ACCDATEbgn, ACCDATEend: ACCDATEend, strCbHSKM: strCbHSKM, strCURRENCY: strCURRENCY, strCbJZFS: strCbJZFS }); // } // }, this); //加载事件 this.InitData(); LoadQueryData(this.formname, this.formSearch, this.CheckSaveQuery); //#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(); // var sZQ = "  当前登录账套:“" + strCwSTARTNAME + "”  当前财务账期:“" + sYear + "年第" + sMonth + "期”  "; Ext.getCmp("lbTitle2").setValue(sZQ); Ext.getCmp("ACCDATEbgn").setValue(strCwACCDATE); Ext.getCmp("ACCDATEend").setValue(strCwACCDATE); // //this.onRefreshClick(); } else { //Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, async: false, scope: this }); }, //end InitData //#endregion //#region 执行查询 onRefreshClick: function (button, event) { Ext.Msg.wait('正在查询数据, 请稍侯..'); //var girdcolums = this.gridList.getColumnMode(); var sql = this.getCondition(); var ACCDATEbgn = this.getACCDATEbgn(); var ACCDATEend = this.getACCDATEend(); var strCbHSKM = this.getCbHSKM(); var strCURRENCY = this.getCURRENCY(); var strCbJZFS = this.getCbJZFS(); // //#region 定义临时数据集_storeMonthData var zlcolumn = []; var myfield = []; var custfield = []; var storeMonthData = Ext.create('DsExt.ux.RefTableStore', { fields: [ { name: 'AMTYEARDR', type: 'decimal' }, { name: 'AMTYEARCR', type: 'decimal' }, { name: 'AMTYEARBLC', type: 'decimal' }, { name: 'AMTDR', type: 'decimal' }, { name: 'AMTCR', type: 'decimal' }, { name: 'AMTBLC', type: 'decimal' }, { name: 'AMTLASTDR', type: 'decimal' }, { name: 'AMTLASTCR', type: 'decimal' }, { name: 'AMTLASTBLC', type: 'decimal' }, { name: 'QTYYEARDR', type: 'decimal' }, { name: 'QTYYEARCR', type: 'decimal' }, { name: 'QTYYEARBLC', type: 'decimal' }, { name: 'QTYDR', type: 'decimal' }, { name: 'QTYCR', type: 'decimal' }, { name: 'QTYBLC', type: 'decimal' }, { name: 'QTYLASTDR', type: 'decimal' }, { name: 'QTYLASTCR', type: 'decimal' }, { name: 'QTYLASTBLC', type: 'decimal' } ], proxy: { url: '/MvcShipping/RptCwGenlegAccitems/GetDataList' } }); //#endregion // _this = this; if (sql.toString() != "") { Ext.Ajax.timeout = 60000000; this.sqlcontext = sql; //this.gridList.reconfigure(this.storeList, this.girdcolums2); //this.gridList.doLayout(); //storeMonthData.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql, ACCDATEbgn: ACCDATEbgn, ACCDATEend: ACCDATEend, strCbHSKM: strCbHSKM, strCURRENCY: strCURRENCY, strCbJZFS: strCbJZFS }, // waitMsg: "正在查询数据...", // callback: function (r, options, success) { // if (success) { //if (r.length != 0) { var zlcolumn = []; var sCURRENCY = this.formSearch.getForm().findField('CURRENCY').getValue(); if (sCURRENCY == "综合本位币") { //#region 列表zlcolumn myfield.push({ name: 'GID', type: 'string' }); myfield.push({ name: 'LINKCODE', type: 'string' }); myfield.push({ name: 'LINKNAME', type: 'string' }); myfield.push({ name: 'QTYYEARDR', type: 'decimal' }); myfield.push({ name: 'QTYYEARCR', type: 'decimal' }); myfield.push({ name: 'QTYYEARBLC', type: 'decimal' }); myfield.push({ name: 'QTYDR', type: 'decimal' }); myfield.push({ name: 'QTYCR', type: 'decimal' }); myfield.push({ name: 'QTYBLC', type: 'decimal' }); myfield.push({ name: 'QTYLASTDR', type: 'decimal' }); myfield.push({ name: 'QTYLASTCR', type: 'decimal' }); myfield.push({ name: 'QTYLASTBLC', type: 'decimal' }); myfield.push({ name: 'QTYCPDR', type: 'decimal' }); myfield.push({ name: 'QTYCPCR', type: 'decimal' }); // zlcolumn.push({ text: '期初余额', sortable: false, columns: [{ sortable: false, dataIndex: 'QTYYEARDR', header: '借方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }, { sortable: false, dataIndex: 'QTYYEARCR', header: '贷方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }] }, { text: '本期发生额', sortable: false, columns: [{ sortable: false, dataIndex: 'QTYDR', header: '借方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }, { sortable: false, dataIndex: 'QTYCR', header: '贷方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }] }, { text: '本年累计发生额', sortable: false, columns: [{ sortable: false, dataIndex: 'QTYLASTDR', header: '借方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }, { sortable: false, dataIndex: 'QTYLASTCR', header: '贷方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }] }, { text: '期末余额', sortable: false, columns: [{ sortable: false, dataIndex: 'QTYCPDR', header: '借方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }, { sortable: false, dataIndex: 'QTYCPCR', header: '贷方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }] }); //#endregion } else { //#region 列表zlcolumn myfield.push({ name: 'GID', type: 'string' }); myfield.push({ name: 'LINKCODE', type: 'string' }); myfield.push({ name: 'LINKNAME', type: 'string' }); myfield.push({ name: 'AMTYEARDR', type: 'decimal' }); myfield.push({ name: 'AMTYEARCR', type: 'decimal' }); myfield.push({ name: 'AMTYEARBLC', type: 'decimal' }); myfield.push({ name: 'AMTDR', type: 'decimal' }); myfield.push({ name: 'AMTCR', type: 'decimal' }); myfield.push({ name: 'AMTBLC', type: 'decimal' }); myfield.push({ name: 'AMTLASTDR', type: 'decimal' }); myfield.push({ name: 'AMTLASTCR', type: 'decimal' }); myfield.push({ name: 'AMTLASTBLC', type: 'decimal' }); myfield.push({ name: 'AMTCPDR', type: 'decimal' }); myfield.push({ name: 'AMTCPCR', type: 'decimal' }); myfield.push({ name: 'QTYYEARDR', type: 'decimal' }); myfield.push({ name: 'QTYYEARCR', type: 'decimal' }); myfield.push({ name: 'QTYYEARBLC', type: 'decimal' }); myfield.push({ name: 'QTYDR', type: 'decimal' }); myfield.push({ name: 'QTYCR', type: 'decimal' }); myfield.push({ name: 'QTYBLC', type: 'decimal' }); myfield.push({ name: 'QTYLASTDR', type: 'decimal' }); myfield.push({ name: 'QTYLASTCR', type: 'decimal' }); myfield.push({ name: 'QTYLASTBLC', type: 'decimal' }); myfield.push({ name: 'QTYCPDR', type: 'decimal' }); myfield.push({ name: 'QTYCPCR', type: 'decimal' }); // zlcolumn.push({ text: '期初余额', sortable: false, columns: [{ sortable: false, dataIndex: 'AMTYEARDR', header: '借方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }, { sortable: false, dataIndex: 'AMTYEARCR', header: '贷方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }] }, { text: '本期发生额', sortable: false, columns: [{ sortable: false, dataIndex: 'AMTDR', header: '借方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }, { sortable: false, dataIndex: 'AMTCR', header: '贷方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }] }, { text: '累计发生额', sortable: false, columns: [{ sortable: false, dataIndex: 'AMTLASTDR', header: '借方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }, { sortable: false, dataIndex: 'AMTLASTCR', header: '贷方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }] }, { text: '期末余额', sortable: false, columns: [{ sortable: false, dataIndex: 'AMTCPDR', header: '借方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }, { sortable: false, dataIndex: 'AMTCPCR', header: '贷方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }] }, { text: '折合本位币期初余额', sortable: false, columns: [{ sortable: false, dataIndex: 'QTYYEARDR', header: '借方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }, { sortable: false, dataIndex: 'QTYYEARCR', header: '贷方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }] }, { text: '折合本位币本期发生额', sortable: false, columns: [{ sortable: false, dataIndex: 'QTYDR', header: '借方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }, { sortable: false, dataIndex: 'QTYCR', header: '贷方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }] }, { text: '折合本位币累计发生额', sortable: false, columns: [{ sortable: false, dataIndex: 'QTYLASTDR', header: '借方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }, { sortable: false, dataIndex: 'QTYLASTCR', header: '贷方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }] }, { text: '折合本位币期末余额', sortable: false, columns: [{ sortable: false, dataIndex: 'QTYCPDR', header: '借方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }, { sortable: false, dataIndex: 'QTYCPCR', header: '贷方', align: 'right', summaryType: 'sum', //summaryRenderer: Ext.util.Format.numberRenderer('00.00'), width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }] }); //#endregion } //#region 定义 数据集 for (var k in myfield) { custfield.push(myfield[k]); } // Ext.define('RptCwGenlegAccitemsModel', { extend: 'Ext.data.Model', fields: custfield }); this.storeList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, model: 'RptCwGenlegAccitemsModel', remoteSort: true, proxy: { type: 'ajax', timeout: 60000000, //60秒 url: '/MvcShipping/RptCwGenlegAccitems/GetDataList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); //#endregion //#region 重载 数据集_列样式 this.girdcolums2 = [{ sortable: false, dataIndex: 'GID', header: '唯一编码', width: 0 }, { sortable: false, dataIndex: 'LINKCODE', header: '科目代码', width: 80 }, { sortable: false, dataIndex: 'LINKNAME', header: '科目', width: 200 }]; for (var k in zlcolumn) { this.girdcolums2.push(zlcolumn[k]); } // //this.gridList = new Ext.grid.GridPanel({ // store: this.storeList, // region: 'center', // loadMask: { msg: "数据加载中,请稍等..." }, // enableHdMenu: false, //是否显示表格列的菜单 // stripeRows: true, //斑马线效果 // rowLines: true, // trackMouseOver: true, // disableSelection: false, // columnLines: true, // columns: this.girdcolums2, // viewConfig: { // enableTextSelection: true, //允许复制数据 // autoFill: true // }, bbar: [Ext.create('Ext.PagingToolbar', { // store: this.storeList, // displayInfo: true, // displayMsg: "当前显示 {0} - {1}条记录 /共 {2}条记录", // emptyMsg: "没有数据" // })] //}); this.gridList.reconfigure(this.storeList, this.girdcolums2); //#endregion //#region 加载 数据集 this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql, ACCDATEbgn: ACCDATEbgn, ACCDATEend: ACCDATEend, strCbHSKM: strCbHSKM, strCURRENCY: strCURRENCY, strCbJZFS: strCbJZFS }, waitMsg: "正在查询数据...", timeout: 60000000, //60秒 scope: this }); this.storeList.on('beforeload', function (store) { var sql = this.sqlcontext; if (sql.toString() != "") { Ext.apply(store.proxy.extraParams, { condition: sql, ACCDATEbgn: ACCDATEbgn, ACCDATEend: ACCDATEend, strCbHSKM: strCbHSKM, strCURRENCY: strCURRENCY, strCbJZFS: strCbJZFS }); } }, this); this.ptoolbar.bindStore(this.storeList); // this.storeListtmp = this.storeList; // this.storeList.on('beforeload', function (store) { // Ext.apply(store.proxy.extraParams, { condition: sql, ACCDATEbgn: ACCDATEbgn, ACCDATEend: ACCDATEend, strCbHSKM: strCbHSKM, strCURRENCY: strCURRENCY, strCbJZFS: strCbJZFS }); // }, this); //#endregion Ext.Msg.hide(); //} // } // }, // timeout: 60000000, //60秒 // scope: this //}); } }, //#endregion //#region 查询 getCondition: function () { var form = this.formSearch.getForm(); if (!form.isValid()) { Ext.Msg.alert('提示', '查询条件赋值错误,请检查。'); return ''; } // this.gridList.reconfigure(this.storeList, this.girdcolums); // this.gridList.doLayout(); var sql = ''; //#region formSearch 查询面板 //会计期间 var ACCDATEbgn = form.findField('ACCDATEbgn').getRawValue(); var ACCDATEend = form.findField('ACCDATEend').getRawValue(); if (ACCDATEbgn.toString() == "" || ACCDATEend.toString() == "") { alert('请先选择会计期间!'); return ''; } sql = sql + getAndConSql(sql, ACCDATEbgn, "ACCDATE>='" + ACCDATEbgn + "'"); sql = sql + getAndConSql(sql, ACCDATEend, "ACCDATE<='" + ACCDATEend + "'"); var sACCID = this.formSearch.getForm().findField('ACCID').getValue(); if (sACCID != null) { if (sACCID != "") { sql = sql + getAndConSql(sql, sACCID, "LINKGID in (select GID from cw_accitems_gl where [YEAR]=SUBSTRING('" + ACCDATEbgn + "',1,4) and ACCID like '" + sACCID + "%')"); } } // var LINKCODE = form.findField('LINKCODE').getValue(); // sql = sql + getAndConSql(sql, LINKCODE, "LINKGID in (select GID from cw_accitems_gl where [YEAR]=SUBSTRING('" + ACCDATEbgn + "',1,4) and ACCID like '%" + LINKCODE + "%')"); // var LINKNAME = form.findField('LINKNAME').getValue(); // sql = sql + getAndConSql(sql, LINKNAME, "LINKGID in (select GID from cw_accitems_gl where [YEAR]=SUBSTRING('" + ACCDATEbgn + "',1,4) and ACCNAME like '%" + LINKNAME + "%')"); //#endregion formSearch return sql; }, getACCDATEbgn: function () { var form = this.formSearch.getForm(); //会计期间 var ACCDATEbgn = form.findField('ACCDATEbgn').getRawValue(); if (ACCDATEbgn.toString() == "") { alert('请先选择会计期间!'); return ''; } ACCDATEbgn = " and ACCDATE='" + ACCDATEbgn + "'"; return ACCDATEbgn; }, getACCDATEend: function () { var form = this.formSearch.getForm(); //会计期间 var ACCDATEend = form.findField('ACCDATEend').getRawValue(); if (ACCDATEend.toString() == "") { alert('请先选择会计期间!'); return ''; } ACCDATEend = " and ACCDATE='" + ACCDATEend + "'"; return ACCDATEend; }, getCbHSKM: function () { var form = this.formSearch.getForm(); var ACCDATEbgn = form.findField('ACCDATEbgn').getRawValue(); var strCbHSKM = form.findField('cbHSKM').getValue(); var strCbZKM = form.findField('cbZKM').getValue(); if (strCbHSKM) { if (strCbZKM) { strCbHSKM = " and (LINKGID in (select GID from [cw_accitems_gl] where [YEAR]=SUBSTRING('" + ACCDATEbgn + "',1,4)) or DEPTACC<>'' or EMPLACC<>'' or CORPACC<>'' or ITEMACC<>'')"; } else { strCbHSKM = " and (LINKGID in (select GID from [cw_accitems_gl] where [YEAR]=SUBSTRING('" + ACCDATEbgn + "',1,4) and (PACCGID='zc' or PACCGID='FZ' or PACCGID='QY' or PACCGID='CB' or PACCGID='SY')) or DEPTACC<>'' or EMPLACC<>'' or CORPACC<>'' or ITEMACC<>'')"; } } else { if (strCbZKM) { strCbHSKM = " and LINKGID in (select GID from [cw_accitems_gl] where [YEAR]=SUBSTRING('" + ACCDATEbgn + "',1,4))"; } else { strCbHSKM = " and LINKGID in (select GID from [cw_accitems_gl] where [YEAR]=SUBSTRING('" + ACCDATEbgn + "',1,4) and (PACCGID='zc' or PACCGID='FZ' or PACCGID='QY' or PACCGID='CB' or PACCGID='SY'))"; } } return strCbHSKM; }, getCURRENCY: function () { var form = this.formSearch.getForm(); var strCURRENCY = form.findField('CURRENCY').getValue(); return strCURRENCY; }, getCbJZFS: function () { var form = this.formSearch.getForm(); var strCbJZFS = form.findField('cbJZFS').getValue(); if (!strCbJZFS) { strCbJZFS = "(QTYLASTBLC<>0 OR QTYDR<>0 OR QTYCR<>0 or QTYLASTDR<>0 or QTYLASTCR<>0)"; } else { strCbJZFS = ""; } return strCbJZFS; }, //#endregion //#region 重置条件 onClearSql: function () { var form = this.formSearch.getForm(); form.reset(); this.InitData(); }, //onDeleteClick //#endregion //#region 导出Excel onExportClick: function (button, event) { var sql = escape(this.getCondition()); var ACCDATEbgn = escape(this.getACCDATEbgn()); var ACCDATEend = escape(this.getACCDATEend()); var strCbHSKM = escape(this.getCbHSKM()); var strCURRENCY = escape(this.getCURRENCY()); var strCbJZFS = escape(this.getCbJZFS()); if (sql.toString() != "") { 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=RptCwGenlegAccitemsIndex&formname=" + this.formname + "&condition1=" + sql + "&condition2=" + ACCDATEbgn + "&condition3=" + ACCDATEend + "&condition4=" + strCbHSKM + "&condition5=" + strCURRENCY + "&condition6=" + strCbJZFS; window.open(openUrl, openType, openSet); } }, //ExtJs 自带的导出当前页的excel导出函数 onExportClick2: function (button, event) { GridExportExcelPage(this.gridList); }, //#endregion //#region 打印 Print: function () { _this = this; if (this.storeList.getCount() == 0) { return; } var form = this.formSearch.getForm(); var ACCDATEbgn = _this.getACCDATEbgn(); var ACCDATEend = _this.getACCDATEend(); var strCbHSKM = this.getCbHSKM(); var strCURRENCY = this.getCURRENCY(); var strCbJZFS = this.getCbJZFS(); var rptACCDATEbgn = form.findField('ACCDATEbgn').getRawValue(); var rptACCDATEend = form.findField('ACCDATEend').getRawValue(); //Ext.Msg.wait('正在组织数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在组织数据, 请稍侯...', url: '/MvcShipping/RptCwGenlegAccitems/GetDataListStr', params: { condition: _this.sqlcontext, ACCDATEbgn: ACCDATEbgn, ACCDATEend: ACCDATEend, strCbHSKM: strCbHSKM, strCURRENCY: strCURRENCY, strCbJZFS: strCbJZFS, printstr: 'true' }, 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 = 'RptCwGenlegAccitemsList'; var sql1 = returnStr; var sql2 = ""; var sql3 = ""; var sql4 = "select '" + rptACCDATEbgn + "' as ACCDATEBGN,'" + rptACCDATEend +"' as ACCDATEEND "; 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 }); }, //#endregion OprationSwap: function () { var ret = new Array(); ret[0] = this.OprationStatus; ret[1] = this.storeList; ret[2] = this.SelectedRecord; return ret; } });