VmCopDetailQuery.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.fa.arp.VmCopDetailQuery', {
  3. extend: 'Ext.app.Controller',
  4. BaseUtil: Ext.create('erp.util.BaseUtil'),
  5. views: ['core.trigger.DbfindTrigger', 'fa.arp.VmCopDetailQuery', 'fa.arp.QueryGrid', 'core.form.MonthDateField',
  6. 'core.form.ConMonthDateField', 'core.form.YearDateField'],
  7. init:function(){
  8. var me = this;
  9. this.control({
  10. 'button[id=query]': {
  11. afterrender: function(btn) {
  12. setTimeout(function(){
  13. me.showFilterPanel(btn);
  14. }, 200);
  15. },
  16. click: function(btn) {
  17. me.showFilterPanel(btn);
  18. }
  19. },
  20. 'button[name=export]': {
  21. click: function() {
  22. var grid = Ext.getCmp('querygrid');
  23. me.BaseUtil.exportGrid(grid, '应付明细账');
  24. }
  25. }
  26. });
  27. },
  28. showFilterPanel: function(btn) {
  29. var filter = Ext.getCmp(btn.getId() + '-filter');
  30. if(!filter) {
  31. filter = this.createFilterPanel(btn);
  32. }
  33. filter.show();
  34. },
  35. getCurrentYearmonth: function(f) {
  36. Ext.Ajax.request({
  37. url: basePath + 'fa/arp/getCurrentYearmonth.action',
  38. method: 'GET',
  39. callback: function(opt, s, r) {
  40. var rs = Ext.decode(r.responseText);
  41. if(rs.exceptionInfo) {
  42. showError(rs.exceptionInfo);
  43. } else if(rs.data) {
  44. f.setValue(rs.data);
  45. }
  46. }
  47. });
  48. },
  49. hideFilterPanel: function(btn) {
  50. var filter = Ext.getCmp(btn.getId() + '-filter');
  51. if(filter) {
  52. filter.hide();
  53. }
  54. },
  55. query: function(cond) {
  56. var grid = Ext.getCmp('querygrid');
  57. grid.setLoading(true);
  58. Ext.Ajax.request({
  59. url: basePath + 'fa/arp/VmQueryController/getVmCopDetailQuery.action',
  60. params: {
  61. condition: Ext.encode(cond)
  62. },
  63. callback: function(opt, s, r) {
  64. var res = Ext.decode(r.responseText);
  65. if(grid && res.data) {
  66. grid.store.loadData(res.data);
  67. }
  68. grid.setLoading(false);
  69. }
  70. });
  71. },
  72. getCondition: function(pl) {
  73. var r = new Object(),v;
  74. Ext.each(pl.items.items, function(item){
  75. if(item.getValue !== undefined) {
  76. v = item.getValue();
  77. if(!Ext.isEmpty(v)) {
  78. r[item.id] = v;
  79. }
  80. }
  81. });
  82. var tb = Ext.getCmp('gl_info_ym');
  83. if(tb)
  84. tb.updateInfo(r);
  85. return r;
  86. },
  87. loadDetail: function(store, record) {
  88. },
  89. _getCaCode: function(store, record) {
  90. var c = record.get('ca_code');
  91. if(Ext.isEmpty(c)) {
  92. return this._getCaCode(store, store.getAt(store.indexOf(record) - 1));
  93. }
  94. return c;
  95. },
  96. createFilterPanel: function(btn) {
  97. var me = this;
  98. var filter = Ext.create('Ext.Window', {
  99. id: btn.getId() + '-filter',
  100. style: 'background:#f1f1f1',
  101. title: '筛选条件',
  102. width: 500,
  103. height: 385,
  104. layout: 'column',
  105. defaults: {
  106. margin: '2 2 2 10'
  107. },
  108. items: [{
  109. id: 'vm_yearmonth',
  110. name: 'vm_yearmonth',
  111. xtype: 'conmonthdatefield',
  112. fieldLabel: '期间',
  113. labelWidth: 80,
  114. margin: '10 2 2 10',
  115. columnWidth: .51,
  116. getValue: function() {
  117. if(!Ext.isEmpty(this.value)) {
  118. return {begin: this.firstVal, end: this.secondVal};
  119. }
  120. return null;
  121. },
  122. listeners:{
  123. afterrender:function(cmd){
  124. me.getCurrentYearmonth(cmd);
  125. }
  126. }
  127. },{
  128. xtype: 'dbfindtrigger',
  129. fieldLabel: '币别',
  130. height: 23,
  131. labelWidth: 80,
  132. id: 'vm_currency',
  133. name:'vm_currency',
  134. flex: 0.2,
  135. columnWidth: .51
  136. },{
  137. fieldLabel: '供应商号',
  138. labelWidth: 80,
  139. height: 23,
  140. layout: 'hbox',
  141. columnWidth: 1,
  142. xtype: 'fieldcontainer',
  143. id: 'vm_vendcode',
  144. defaults: {
  145. fieldStyle : "background:#FFFAFA;color:#515151;"
  146. },
  147. items: [{
  148. labelWidth: 35,
  149. xtype: 'dbfindtrigger',
  150. flex: 0.32,
  151. id: 'pu_vendcode',
  152. name: 'pu_vendcode'
  153. },{
  154. xtype: 'textfield',
  155. id: 'pu_vendname',
  156. name: 'pu_vendname',
  157. flex:0.32,
  158. readOnly: true,
  159. fieldStyle: 'background:#f1f1f1;'
  160. }],
  161. getValue: function() {
  162. var a = Ext.getCmp('pu_vendcode');
  163. if(!Ext.isEmpty(a.value)) {
  164. return a.value;
  165. }
  166. return null;
  167. }
  168. },{
  169. xtype: 'combo',
  170. editable: false,
  171. labelWidth: 80,
  172. name: 'asl_source',
  173. id: 'asl_source',
  174. fieldLabel: '单据类型',
  175. displayField: 'display',
  176. valueField: 'value',
  177. queryMode: 'local',
  178. value: "all",
  179. columnWidth: .51,
  180. store: Ext.create('Ext.data.Store', {
  181. fields: ['display', 'value'],
  182. data : [
  183. {"display": "全部", "value": "all"},
  184. {"display": "发票", "value": "arbill"},
  185. {"display": "其它应付单", "value": "other"},
  186. {"display": "验收单", "value": "inout"},
  187. {"display": "付款单", "value": "recb"},
  188. {"display": "退款单", "value": "recbr"},
  189. {"display": "冲账单", "value": "cmb"}
  190. ]
  191. })
  192. },{
  193. xtype: 'checkbox',
  194. id: 'chknoturn',
  195. name: 'chknoturn',
  196. columnWidth: .51,
  197. boxLabel: '包括已收货未开票信息'
  198. },{
  199. xtype: 'checkbox',
  200. id: 'chknopost',
  201. name: 'chknopost',
  202. columnWidth: .51,
  203. boxLabel: '包含未记账发票'
  204. },{
  205. xtype: 'checkbox',
  206. id: 'chkzerobalance',
  207. name: 'chkzerobalance',
  208. columnWidth: .51,
  209. boxLabel: '余额为零的不显示'
  210. },{
  211. xtype: 'checkbox',
  212. id: 'chknoamount',
  213. name: 'chknoamount',
  214. columnWidth: .51,
  215. boxLabel: '无发生额的不显示'
  216. }],
  217. buttonAlign: 'center',
  218. buttons: [{
  219. text: '确定',
  220. width: 60,
  221. cls: 'x-btn-blue',
  222. handler: function(btn) {
  223. var fl = btn.ownerCt.ownerCt,
  224. con = me.getCondition(fl);
  225. me.query(con);
  226. fl.hide();
  227. }
  228. },{
  229. text: '关闭',
  230. width: 60,
  231. cls: 'x-btn-blue',
  232. handler: function(btn) {
  233. var fl = btn.ownerCt.ownerCt;
  234. fl.hide();
  235. }
  236. }]
  237. });
  238. return filter;
  239. }
  240. });