MonthAccount.js 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. Ext.define('erp.view.fa.gs.MonthAccount',{
  2. extend: 'Ext.Viewport',
  3. layout: 'anchor',
  4. hideBorders: true,
  5. initComponent : function(){
  6. var me = this;
  7. Ext.apply(me, {
  8. items: [{
  9. xtype: 'form',
  10. anchor: '100% 10%',
  11. bodyStyle: 'background:#f1f1f1',
  12. layout: 'column',
  13. defaults: {
  14. xtype: 'displayfield',
  15. columnWidth: .3,
  16. margin: '5 10'
  17. },
  18. items: [{
  19. fieldLabel: '期间',
  20. id: 'info_ym',
  21. value: Ext.Date.format(new Date(), 'Ym')
  22. },{
  23. xtype: 'checkbox',
  24. id: 'chkun',
  25. boxLabel: '包括未记账凭证'
  26. },{
  27. xtype: 'checkbox',
  28. id: 'chkbalance',
  29. boxLabel: '只显示有差额科目'
  30. }],
  31. buttonAlign: 'center',
  32. buttons: [{
  33. name: 'query',
  34. id: 'query',
  35. text: $I18N.common.button.erpQueryButton,
  36. iconCls: 'x-button-icon-query',
  37. cls: 'x-btn-gray',
  38. margin: '0 4 0 0'
  39. },{
  40. name: 'export',
  41. text: $I18N.common.button.erpExportButton,
  42. iconCls: 'x-button-icon-excel',
  43. cls: 'x-btn-gray',
  44. handler: function(btn){
  45. var grid = btn.ownerCt.ownerCt.ownerCt.down("grid");
  46. Ext.create('erp.util.BaseUtil').exportGrid(grid, '票据对账检查');
  47. }
  48. },{
  49. text: $I18N.common.button.erpCloseButton,
  50. iconCls: 'x-button-icon-close',
  51. cls: 'x-btn-gray',
  52. margin: '0 4 0 0',
  53. handler: function(){
  54. var main = parent.Ext.getCmp("content-panel");
  55. main.getActiveTab().close();
  56. }
  57. }]
  58. },{
  59. xtype: 'grid',
  60. anchor: '100% 90%',
  61. columnLines: true,
  62. columns: [{
  63. text: '类型',
  64. dataIndex: 'type',
  65. hidden: true,
  66. width: 0
  67. },{
  68. text: '期间',
  69. cls: 'x-grid-header-1',
  70. dataIndex: 'yearmonth',
  71. xtype: 'numbercolumn',
  72. format: '0',
  73. width: 65
  74. },{
  75. text: '币别',
  76. cls: 'x-grid-header-1',
  77. dataIndex: 'currency',
  78. width: 50
  79. },{
  80. text: '编号',
  81. cls: 'x-grid-header-1',
  82. dataIndex: 'code',
  83. width: 110
  84. },{
  85. text: '名称',
  86. cls: 'x-grid-header-1',
  87. dataIndex: 'name',
  88. width: 150
  89. },{
  90. text: '期初余额',
  91. cls: 'x-grid-header-1',
  92. columns: [{
  93. text: '银行',
  94. cls: 'x-grid-header-1',
  95. dataIndex: 'beginamount',
  96. xtype: 'numbercolumn',
  97. format: '0,000.000',
  98. align: 'right',
  99. width: 120
  100. },{
  101. text: '总账系统',
  102. cls: 'x-grid-header-1',
  103. dataIndex: 'cm_beginamount',
  104. xtype: 'numbercolumn',
  105. format: '0,000.000',
  106. align: 'right',
  107. width: 120
  108. },{
  109. text: '差额',
  110. cls: 'x-grid-header-1',
  111. dataIndex: 'begindiff',
  112. align: 'right',
  113. width: 120,
  114. renderer: function(val, meta, record) {
  115. val = Number((record.get('beginamount') - record.get('cm_beginamount')).toFixed(3));
  116. if(record.get('begindiff') != val) {
  117. record.set('begindiff', val);
  118. }
  119. return val == 0 ? '' : Ext.util.Format.number(val, '0,000.000');
  120. }
  121. }]
  122. },{
  123. text: '本期借方发生',
  124. cls: 'x-grid-header-1',
  125. columns: [{
  126. text: '银行',
  127. cls: 'x-grid-header-1',
  128. dataIndex: 'nowdebit',
  129. xtype: 'numbercolumn',
  130. format: '0,000.000',
  131. align: 'right',
  132. width: 120
  133. },{
  134. text: '总账系统',
  135. cls: 'x-grid-header-1',
  136. dataIndex: 'cm_nowdebit',
  137. xtype: 'numbercolumn',
  138. format: '0,000.000',
  139. align: 'right',
  140. width: 120
  141. },{
  142. text: '差额',
  143. cls: 'x-grid-header-1',
  144. dataIndex: 'debitdiff',
  145. align: 'right',
  146. width: 120,
  147. renderer: function(val, meta, record) {
  148. val = Number((record.get('nowdebit') - record.get('cm_nowdebit')).toFixed(3));
  149. if(record.get('debitdiff') != val) {
  150. record.set('debitdiff', val);
  151. }
  152. return val == 0 ? '' : Ext.util.Format.number(val, '0,000.000');
  153. }
  154. }]
  155. },{
  156. text: '本期贷方发生',
  157. cls: 'x-grid-header-1',
  158. columns: [{
  159. text: '银行',
  160. cls: 'x-grid-header-1',
  161. dataIndex: 'nowcredit',
  162. xtype: 'numbercolumn',
  163. format: '0,000.000',
  164. align: 'right',
  165. width: 120
  166. },{
  167. text: '总账系统',
  168. cls: 'x-grid-header-1',
  169. dataIndex: 'cm_nowcredit',
  170. xtype: 'numbercolumn',
  171. format: '0,000.000',
  172. align: 'right',
  173. width: 120
  174. },{
  175. text: '差额',
  176. cls: 'x-grid-header-1',
  177. dataIndex: 'creditdiff',
  178. align: 'right',
  179. width: 120,
  180. renderer: function(val, meta, record) {
  181. val = Number((record.get('nowcredit') - record.get('cm_nowcredit')).toFixed(3));
  182. if(record.get('creditdiff') != val) {
  183. record.set('creditdiff', val);
  184. }
  185. return val == 0 ? '' : Ext.util.Format.number(val, '0,000.000');
  186. }
  187. }]
  188. },{
  189. text: '期末余额',
  190. cls: 'x-grid-header-1',
  191. columns: [{
  192. text: '银行',
  193. cls: 'x-grid-header-1',
  194. dataIndex: 'endamount',
  195. xtype: 'numbercolumn',
  196. format: '0,000.000',
  197. align: 'right',
  198. width: 120
  199. },{
  200. text: '总账系统',
  201. cls: 'x-grid-header-1',
  202. dataIndex: 'cm_endamount',
  203. xtype: 'numbercolumn',
  204. format: '0,000.000',
  205. align: 'right',
  206. width: 120
  207. },{
  208. text: '差额',
  209. cls: 'x-grid-header-1',
  210. dataIndex: 'enddiff',
  211. align: 'right',
  212. width: 120,
  213. renderer: function(val, meta, record) {
  214. val = Number((record.get('endamount') - record.get('cm_endamount')).toFixed(3));
  215. if(record.get('enddiff') != val) {
  216. record.set('enddiff', val);
  217. }
  218. return val == 0 ? '' : Ext.util.Format.number(val, '0,000.000');
  219. }
  220. }]
  221. }],
  222. store: Ext.create('Ext.data.Store', {
  223. fields: [{
  224. name: 'type'
  225. },{
  226. name: 'isCount', type: 'bool'
  227. },{
  228. name: 'yearmonth', type: 'number'
  229. },{
  230. name: 'currency', type: 'string'
  231. },{
  232. name: 'code', type: 'string'
  233. },{
  234. name: 'name', type: 'string'
  235. },{
  236. name: 'beginamount', type: 'number'
  237. },{
  238. name: 'nowdebit', type: 'number'
  239. },{
  240. name: 'nowcredit', type: 'number'
  241. },{
  242. name: 'endamount', type: 'number'
  243. },{
  244. name: 'cm_beginamount', type: 'number'
  245. },{
  246. name: 'cm_nowdebit', type: 'number'
  247. },{
  248. name: 'cm_nowcredit', type: 'number'
  249. },{
  250. name: 'cm_endamount', type: 'number'
  251. },{
  252. name: 'begindiff', type: 'number'
  253. },{
  254. name: 'debitdiff', type: 'number'
  255. },{
  256. name: 'creditdiff', type: 'number'
  257. },{
  258. name: 'enddiff', type: 'number'
  259. }],
  260. groupField: 'type'
  261. }),
  262. viewConfig: {
  263. getRowClass: function(record) {
  264. return record.get('isCount') ? 'isCount' : null;
  265. }
  266. },
  267. features : [Ext.create('Ext.grid.feature.Grouping',{
  268. groupHeaderTpl: '{name}'
  269. })]
  270. }]
  271. });
  272. me.callParent(arguments);
  273. }
  274. });