MonthAccount.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.fa.arp.MonthAccount', {
  3. extend: 'Ext.app.Controller',
  4. requires: ['erp.util.BaseUtil'],
  5. views: ['fa.arp.MonthAccount'],
  6. init:function(){
  7. var me = this;
  8. this.BaseUtil = Ext.create('erp.util.BaseUtil');
  9. this.control({
  10. 'button[id=query]': {
  11. click: function(btn) {
  12. me.getArAccount(btn.ownerCt.ownerCt);
  13. }
  14. },
  15. 'checkbox[id=chkbalance]': {
  16. change: function(f) {
  17. me.filterBalance();
  18. }
  19. },
  20. 'checkbox[id=chkdetail]': {
  21. change: function(f) {
  22. me.filterBalance();
  23. }
  24. },
  25. '#info_ym': {
  26. afterrender: function(f) {
  27. this.getCurrentMonth(f);
  28. }
  29. }
  30. });
  31. },
  32. getArAccount: function(form) {
  33. var me = this, grid = form.ownerCt.down('gridpanel');
  34. grid.setLoading(true);
  35. Ext.Ajax.request({
  36. url: basePath + 'fa/arp/monthAccount.action',
  37. params: {
  38. condition: Ext.encode({chkun: form.down('#chkun').value})
  39. },
  40. callback: function(opt, s, r) {
  41. grid.setLoading(false);
  42. var rs = Ext.decode(r.responseText);
  43. if(rs.success) {
  44. grid.store.loadData(rs.data);
  45. me.filterBalance();
  46. } else if(rs.exceptionInfo) {
  47. showError(rs.exceptionInfo);
  48. }
  49. }
  50. });
  51. },
  52. /**
  53. * 显示客户明细;
  54. * 只显示有差额科目
  55. */
  56. filterBalance: function() {
  57. var chkbalance = Ext.getCmp('chkbalance'),
  58. chkdetail = Ext.getCmp('chkdetail');
  59. var grid = chkbalance.ownerCt.ownerCt.down('gridpanel');
  60. grid.store.filterBy(function(item) {
  61. var bool = true;
  62. if(!chkdetail.value) {
  63. bool = item.get('isCount');
  64. }
  65. if(bool && chkbalance.value) {
  66. bool = item.get('endbalance') != 0;
  67. }
  68. return bool;
  69. });
  70. },
  71. getCurrentMonth: function(f) {
  72. var me = this;
  73. Ext.Ajax.request({
  74. url: basePath + 'fa/getMonth.action',
  75. params: {
  76. type: 'MONTH-V'
  77. },
  78. callback: function(opt, s, r) {
  79. var rs = Ext.decode(r.responseText);
  80. if(rs.data) {
  81. me.currentMonth = rs.data.PD_DETNO;
  82. f.setValue(rs.data.PD_DETNO);
  83. }
  84. }
  85. });
  86. }
  87. });