MonthAccount.js 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  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. text: $I18N.common.button.erpCloseButton,
  41. iconCls: 'x-button-icon-close',
  42. cls: 'x-btn-gray',
  43. margin: '0 4 0 0',
  44. handler: function(){
  45. var main = parent.Ext.getCmp("content-panel");
  46. main.getActiveTab().close();
  47. }
  48. }]
  49. },{
  50. xtype: 'grid',
  51. anchor: '100% 90%',
  52. columnLines: true,
  53. columns: [{
  54. text: '期间',
  55. cls: 'x-grid-header-1',
  56. dataIndex: 'yearmonth',
  57. xtype: 'numbercolumn',
  58. format: '0',
  59. width: 65
  60. },{
  61. text: '币别',
  62. cls: 'x-grid-header-1',
  63. dataIndex: 'currency',
  64. width: 50
  65. },{
  66. text: '编号',
  67. cls: 'x-grid-header-1',
  68. dataIndex: 'code',
  69. width: 110
  70. },{
  71. text: '名称',
  72. cls: 'x-grid-header-1',
  73. dataIndex: 'name',
  74. width: 150
  75. },{
  76. text: '期初余额',
  77. cls: 'x-grid-header-1',
  78. columns: [{
  79. text: '银行',
  80. cls: 'x-grid-header-1',
  81. dataIndex: 'beginamount',
  82. xtype: 'numbercolumn',
  83. format: '0,000.000',
  84. align: 'right',
  85. width: 120
  86. },{
  87. text: '总账系统',
  88. cls: 'x-grid-header-1',
  89. dataIndex: 'cm_beginamount',
  90. xtype: 'numbercolumn',
  91. format: '0,000.000',
  92. align: 'right',
  93. width: 120
  94. },{
  95. text: '差额',
  96. cls: 'x-grid-header-1',
  97. dataIndex: 'begindiff',
  98. align: 'right',
  99. width: 120,
  100. renderer: function(val, meta, record) {
  101. val = record.get('beginamount') - record.get('cm_beginamount');
  102. if(record.get('begindiff') != val) {
  103. record.set('begindiff', val);
  104. }
  105. return val == 0 ? '' : Ext.util.Format.number(val, '0,000.000');
  106. }
  107. }]
  108. },{
  109. text: '本期借方发生',
  110. cls: 'x-grid-header-1',
  111. columns: [{
  112. text: '银行',
  113. cls: 'x-grid-header-1',
  114. dataIndex: 'nowdebit',
  115. xtype: 'numbercolumn',
  116. format: '0,000.000',
  117. align: 'right',
  118. width: 120
  119. },{
  120. text: '总账系统',
  121. cls: 'x-grid-header-1',
  122. dataIndex: 'cm_nowdebit',
  123. xtype: 'numbercolumn',
  124. format: '0,000.000',
  125. align: 'right',
  126. width: 120
  127. },{
  128. text: '差额',
  129. cls: 'x-grid-header-1',
  130. dataIndex: 'debitdiff',
  131. align: 'right',
  132. width: 120,
  133. renderer: function(val, meta, record) {
  134. val = record.get('nowdebit') - record.get('cm_nowdebit');
  135. if(record.get('debitdiff') != val) {
  136. record.set('debitdiff', val);
  137. }
  138. return val == 0 ? '' : Ext.util.Format.number(val, '0,000.000');
  139. }
  140. }]
  141. },{
  142. text: '本期贷方发生',
  143. cls: 'x-grid-header-1',
  144. columns: [{
  145. text: '银行',
  146. cls: 'x-grid-header-1',
  147. dataIndex: 'nowcredit',
  148. xtype: 'numbercolumn',
  149. format: '0,000.000',
  150. align: 'right',
  151. width: 120
  152. },{
  153. text: '总账系统',
  154. cls: 'x-grid-header-1',
  155. dataIndex: 'cm_nowcredit',
  156. xtype: 'numbercolumn',
  157. format: '0,000.000',
  158. align: 'right',
  159. width: 120
  160. },{
  161. text: '差额',
  162. cls: 'x-grid-header-1',
  163. dataIndex: 'creditdiff',
  164. align: 'right',
  165. width: 120,
  166. renderer: function(val, meta, record) {
  167. val = record.get('nowcredit') - record.get('cm_nowcredit');
  168. if(record.get('creditdiff') != val) {
  169. record.set('creditdiff', val);
  170. }
  171. return val == 0 ? '' : Ext.util.Format.number(val, '0,000.000');
  172. }
  173. }]
  174. },{
  175. text: '期末余额',
  176. cls: 'x-grid-header-1',
  177. columns: [{
  178. text: '银行',
  179. cls: 'x-grid-header-1',
  180. dataIndex: 'endamount',
  181. xtype: 'numbercolumn',
  182. format: '0,000.000',
  183. align: 'right',
  184. width: 120
  185. },{
  186. text: '总账系统',
  187. cls: 'x-grid-header-1',
  188. dataIndex: 'cm_endamount',
  189. xtype: 'numbercolumn',
  190. format: '0,000.000',
  191. align: 'right',
  192. width: 120
  193. },{
  194. text: '差额',
  195. cls: 'x-grid-header-1',
  196. dataIndex: 'enddiff',
  197. align: 'right',
  198. width: 120,
  199. renderer: function(val, meta, record) {
  200. val = record.get('endamount') - record.get('cm_endamount');
  201. if(record.get('enddiff') != val) {
  202. record.set('enddiff', val);
  203. }
  204. return val == 0 ? '' : Ext.util.Format.number(val, '0,000.000');
  205. }
  206. }]
  207. }],
  208. store: Ext.create('Ext.data.Store', {
  209. fields: [{
  210. name: 'type'
  211. },{
  212. name: 'isCount', type: 'bool'
  213. },{
  214. name: 'yearmonth', type: 'number'
  215. },{
  216. name: 'currency', type: 'string'
  217. },{
  218. name: 'code', type: 'string'
  219. },{
  220. name: 'name', 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. });