MonthAccount.js 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. Ext.define('erp.view.fa.fix.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: 80
  74. },{
  75. text: '科目',
  76. cls: 'x-grid-header-1',
  77. dataIndex: 'catecode',
  78. width: 110
  79. },{
  80. text: '期初余额',
  81. cls: 'x-grid-header-1',
  82. columns: [{
  83. text: '固定资产',
  84. cls: 'x-grid-header-1',
  85. dataIndex: 'beginamount',
  86. xtype: 'numbercolumn',
  87. format: '0,000.000',
  88. align: 'right',
  89. width: 120
  90. },{
  91. text: '总账系统',
  92. cls: 'x-grid-header-1',
  93. dataIndex: 'cm_beginamount',
  94. xtype: 'numbercolumn',
  95. format: '0,000.000',
  96. align: 'right',
  97. width: 120
  98. },{
  99. text: '差额',
  100. cls: 'x-grid-header-1',
  101. dataIndex: 'begindiff',
  102. align: 'right',
  103. width: 120,
  104. renderer: function(val, meta, record) {
  105. val = record.get('beginamount') - record.get('cm_beginamount');
  106. if(record.get('begindiff') != val) {
  107. record.set('begindiff', val);
  108. }
  109. return val == 0 ? '' : Ext.util.Format.number(val, '0,000.000');
  110. }
  111. }]
  112. },{
  113. text: '本期借方发生',
  114. cls: 'x-grid-header-1',
  115. columns: [{
  116. text: '固定资产',
  117. cls: 'x-grid-header-1',
  118. dataIndex: 'nowdebit',
  119. xtype: 'numbercolumn',
  120. format: '0,000.000',
  121. align: 'right',
  122. width: 120
  123. },{
  124. text: '总账系统',
  125. cls: 'x-grid-header-1',
  126. dataIndex: 'cm_nowdebit',
  127. xtype: 'numbercolumn',
  128. format: '0,000.000',
  129. align: 'right',
  130. width: 120
  131. },{
  132. text: '差额',
  133. cls: 'x-grid-header-1',
  134. dataIndex: 'debitdiff',
  135. align: 'right',
  136. width: 120,
  137. renderer: function(val, meta, record) {
  138. val = record.get('nowdebit') - record.get('cm_nowdebit');
  139. if(record.get('debitdiff') != val) {
  140. record.set('debitdiff', val);
  141. }
  142. return val == 0 ? '' : Ext.util.Format.number(val, '0,000.000');
  143. }
  144. }]
  145. },{
  146. text: '本期贷方发生',
  147. cls: 'x-grid-header-1',
  148. columns: [{
  149. text: '固定资产',
  150. cls: 'x-grid-header-1',
  151. dataIndex: 'nowcredit',
  152. xtype: 'numbercolumn',
  153. format: '0,000.000',
  154. align: 'right',
  155. width: 120
  156. },{
  157. text: '总账系统',
  158. cls: 'x-grid-header-1',
  159. dataIndex: 'cm_nowcredit',
  160. xtype: 'numbercolumn',
  161. format: '0,000.000',
  162. align: 'right',
  163. width: 120
  164. },{
  165. text: '差额',
  166. cls: 'x-grid-header-1',
  167. dataIndex: 'creditdiff',
  168. align: 'right',
  169. width: 120,
  170. renderer: function(val, meta, record) {
  171. val = record.get('nowcredit') - record.get('cm_nowcredit');
  172. if(record.get('creditdiff') != val) {
  173. record.set('creditdiff', val);
  174. }
  175. return val == 0 ? '' : Ext.util.Format.number(val, '0,000.000');
  176. }
  177. }]
  178. },{
  179. text: '期末余额',
  180. cls: 'x-grid-header-1',
  181. columns: [{
  182. text: '固定资产',
  183. cls: 'x-grid-header-1',
  184. dataIndex: 'endamount',
  185. xtype: 'numbercolumn',
  186. format: '0,000.000',
  187. align: 'right',
  188. width: 120
  189. },{
  190. text: '总账系统',
  191. cls: 'x-grid-header-1',
  192. dataIndex: 'cm_endamount',
  193. xtype: 'numbercolumn',
  194. format: '0,000.000',
  195. align: 'right',
  196. width: 120
  197. },{
  198. text: '差额',
  199. cls: 'x-grid-header-1',
  200. dataIndex: 'enddiff',
  201. align: 'right',
  202. width: 120,
  203. renderer: function(val, meta, record) {
  204. val = record.get('endamount') - record.get('cm_endamount');
  205. if(record.get('enddiff') != val) {
  206. record.set('enddiff', val);
  207. }
  208. return val == 0 ? '' : Ext.util.Format.number(val, '0,000.000');
  209. }
  210. }]
  211. }],
  212. store: Ext.create('Ext.data.Store', {
  213. fields: [{
  214. name: 'type'
  215. },{
  216. name: 'isCount', type: 'bool'
  217. },{
  218. name: 'yearmonth', type: 'number'
  219. },{
  220. name: 'catecode', type: 'string'
  221. },{
  222. name: 'beginamount', type: 'number'
  223. },{
  224. name: 'nowdebit', type: 'number'
  225. },{
  226. name: 'nowcredit', type: 'number'
  227. },{
  228. name: 'endamount', type: 'number'
  229. },{
  230. name: 'cm_beginamount', type: 'number'
  231. },{
  232. name: 'cm_nowdebit', type: 'number'
  233. },{
  234. name: 'cm_nowcredit', type: 'number'
  235. },{
  236. name: 'cm_endamount', type: 'number'
  237. },{
  238. name: 'begindiff', type: 'number'
  239. },{
  240. name: 'debitdiff', type: 'number'
  241. },{
  242. name: 'creditdiff', type: 'number'
  243. },{
  244. name: 'enddiff', type: 'number'
  245. }],
  246. groupField: 'type'
  247. }),
  248. viewConfig: {
  249. getRowClass: function(record) {
  250. return record.get('isCount') ? 'isCount' : null;
  251. }
  252. },
  253. features : [Ext.create('Ext.grid.feature.Grouping',{
  254. groupHeaderTpl: '{name}'
  255. })]
  256. }]
  257. });
  258. me.callParent(arguments);
  259. }
  260. });