Ext.QuickTips.init(); Ext.define('erp.controller.scm.reserve.MonthAccount', { extend: 'Ext.app.Controller', requires: ['erp.util.BaseUtil'], views: ['scm.reserve.MonthAccount'], init:function(){ var me = this; this.BaseUtil = Ext.create('erp.util.BaseUtil'); this.control({ 'button[id=query]': { click: function(btn) { me.getArAccount(btn.ownerCt.ownerCt); } }, 'grid': { itemclick: function(selModel, record) { me.loadDetail(selModel.ownerCt.store, record); } }, '#info_ym': { afterrender: function(f) { this.getCurrentMonth(f); } } }); }, loadDetail:function(store, record){ var ym = record.get('cm_yearmonth'), catecode = record.get('cm_catecode'); this.BaseUtil.onAdd('MADetail_' + ym + '_' + catecode, '明细', 'jsps/scm/reserve/monthAccountDetail.jsp?y=' + ym + '&c=' + catecode); }, getArAccount: function(form) { var me = this; Ext.Ajax.request({ url: basePath + 'scm/reserve/monthAccount.action', params: { // condition: Ext.encode({chkun: form.down('#chkun').value}) }, callback: function(opt, s, r) { var rs = Ext.decode(r.responseText); if(rs.success) { var grid = form.ownerCt.down('gridpanel'); grid.store.loadData(rs.data); me.filterBalance(); } else if(rs.exceptionInfo) { showError(rs.exceptionInfo); } } }); }, /** * 显示客户明细; * 只显示有差额科目 */ filterBalance: function() {/* var chkbalance = Ext.getCmp('chkbalance'), chkdetail = Ext.getCmp('chkdetail'); console.log(chkbalance); var grid = chkbalance.ownerCt.ownerCt.down('gridpanel'); grid.store.filterBy(function(item) { var bool = true; if(!chkdetail.value) { bool = item.get('isCount'); } if(bool && chkbalance.value) { bool = item.get('endbalance') != 0; } return bool; });*/ }, getCurrentMonth: function(f) { var me = this; Ext.Ajax.request({ url: basePath + 'fa/getMonth.action', params: { type: 'MONTH-P' }, callback: function(opt, s, r) { var rs = Ext.decode(r.responseText); if(rs.data) { me.currentMonth = rs.data.PD_DETNO; f.setValue(rs.data.PD_DETNO); } } }); } });