| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- Ext.QuickTips.init();
- Ext.define('erp.controller.fa.arp.MonthAccount', {
- extend: 'Ext.app.Controller',
- requires: ['erp.util.BaseUtil'],
- views: ['fa.arp.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/arp/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-V'
- },
- 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);
- }
- }
- });
- }
- });
|