MonthAccount.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.scm.reserve.MonthAccount', {
  3. extend: 'Ext.app.Controller',
  4. requires: ['erp.util.BaseUtil'],
  5. views: ['scm.reserve.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. 'grid': {
  16. itemclick: function(selModel, record) {
  17. me.loadDetail(selModel.ownerCt.store, record);
  18. }
  19. },
  20. '#info_ym': {
  21. afterrender: function(f) {
  22. this.getCurrentMonth(f);
  23. }
  24. }
  25. });
  26. },
  27. loadDetail:function(store, record){
  28. var ym = record.get('cm_yearmonth'),
  29. catecode = record.get('cm_catecode');
  30. this.BaseUtil.onAdd('MADetail_' + ym + '_' + catecode, '明细',
  31. 'jsps/scm/reserve/monthAccountDetail.jsp?y=' + ym + '&c=' + catecode);
  32. },
  33. getArAccount: function(form) {
  34. var me = this;
  35. Ext.Ajax.request({
  36. url: basePath + 'scm/reserve/monthAccount.action',
  37. params: {
  38. // condition: Ext.encode({chkun: form.down('#chkun').value})
  39. },
  40. callback: function(opt, s, r) {
  41. var rs = Ext.decode(r.responseText);
  42. if(rs.success) {
  43. var grid = form.ownerCt.down('gridpanel');
  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. console.log(chkbalance);
  60. var grid = chkbalance.ownerCt.ownerCt.down('gridpanel');
  61. grid.store.filterBy(function(item) {
  62. var bool = true;
  63. if(!chkdetail.value) {
  64. bool = item.get('isCount');
  65. }
  66. if(bool && chkbalance.value) {
  67. bool = item.get('endbalance') != 0;
  68. }
  69. return bool;
  70. });*/
  71. },
  72. getCurrentMonth: function(f) {
  73. var me = this;
  74. Ext.Ajax.request({
  75. url: basePath + 'fa/getMonth.action',
  76. params: {
  77. type: 'MONTH-P'
  78. },
  79. callback: function(opt, s, r) {
  80. var rs = Ext.decode(r.responseText);
  81. if(rs.data) {
  82. me.currentMonth = rs.data.PD_DETNO;
  83. f.setValue(rs.data.PD_DETNO);
  84. }
  85. }
  86. });
  87. }
  88. });