Ext.QuickTips.init(); Ext.define('erp.controller.fa.ars.MonthAccount', { extend: 'Ext.app.Controller', requires: ['erp.util.BaseUtil'], views: ['fa.ars.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); } }, 'checkbox[id=chkbalance]': { change: function(f) { me.filterBalance(); } }, 'checkbox[id=chkdetail]': { change: function(f) { me.filterBalance(); } }, '#info_ym': { afterrender: function(f) { this.getCurrentMonth(f); } } }); }, getArAccount: function(form) { var me = this, grid = form.ownerCt.down('gridpanel'); grid.setLoading(true); Ext.Ajax.request({ url: basePath + 'fa/ars/monthAccount.action', params: { condition: Ext.encode({chkun: form.down('#chkun').value}) }, callback: function(opt, s, r) { grid.setLoading(false); var rs = Ext.decode(r.responseText); if(rs.success) { 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'); 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-C' }, 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); } } }); } });