CarryGl.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.fa.gla.CarryGl', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. views: ['fa.gla.CarryGl', 'core.trigger.CateTreeDbfindTrigger', 'core.button.Close'],
  6. init: function(){
  7. this.control({
  8. 'displayfield[name=yearmonth]': {
  9. afterrender: function(f) {
  10. this.getCurrentMonth(f);
  11. }
  12. },
  13. 'cateTreeDbfindTrigger[name=ca_code]': {
  14. afterrender: function(f) {
  15. this.getDefaultCatecode(f);
  16. }
  17. },
  18. 'button[id=deal]': {
  19. click: function(btn) {
  20. var form = btn.ownerCt.ownerCt,
  21. ym = form.down('#yearmonth').value,
  22. cacode = form.down('#ca_code').value,
  23. account = form.down('#account').value;
  24. this.deal(form, ym, cacode, account);
  25. }
  26. }
  27. });
  28. },
  29. getCurrentMonth: function(f) {
  30. Ext.Ajax.request({
  31. url: basePath + 'fa/getMonth.action',
  32. params: {
  33. type: 'MONTH-A'
  34. },
  35. callback: function(opt, s, r) {
  36. var rs = Ext.decode(r.responseText);
  37. if(rs.data) {
  38. f.setValue(rs.data.PD_DETNO);
  39. }
  40. }
  41. });
  42. },
  43. getDefaultCatecode: function(f) {
  44. this.FormUtil.getFieldValue('Setting', 'nvl(se_value,\' \')', 'se_what=\'BroughtCatecode\'', f.id);
  45. },
  46. deal: function(form, ym ,ca_code, account) {
  47. var tab = this.FormUtil.getActiveTab();
  48. tab.setLoading(true);
  49. Ext.Ajax.request({
  50. url: basePath + 'fa/gla/carrygl.action',
  51. params: {
  52. yearmonth: ym,
  53. ca_code: ca_code,
  54. account: account
  55. },
  56. timeout: 4800000,
  57. callback: function(opt, s, r) {
  58. tab.setLoading(false);
  59. var rs = Ext.decode(r.responseText);
  60. if(rs.success) {
  61. if(rs.data) {
  62. showMessage('提示', rs.data);
  63. } else {
  64. alert('结转损益成功!');
  65. }
  66. }
  67. }
  68. });
  69. }
  70. });