MonthAccount.js 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. Ext.define('erp.view.scm.reserve.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: .2
  16. },
  17. items: [{
  18. fieldLabel: '期间',
  19. margin: '0 0 0 8',
  20. id: 'info_ym',
  21. value: Ext.Date.format(new Date(), 'Ym')
  22. }/*,{
  23. fieldLabel: '核算类别',
  24. value: '客户'
  25. },{
  26. xtype: 'checkbox',
  27. id: 'chkdetail',
  28. boxLabel: '显示客户明细',
  29. checked: true
  30. },{
  31. xtype: 'checkbox',
  32. id: 'chkun',
  33. boxLabel: '包括未记账凭证'
  34. },{
  35. xtype: 'checkbox',
  36. id: 'chkbalance',
  37. boxLabel: '只显示有差额科目'
  38. }*/],
  39. buttonAlign: 'center',
  40. buttons: [{
  41. name: 'query',
  42. id: 'query',
  43. text: $I18N.common.button.erpQueryButton,
  44. iconCls: 'x-button-icon-query',
  45. cls: 'x-btn-gray',
  46. margin: '0 4 0 0'
  47. },{
  48. text: $I18N.common.button.erpCloseButton,
  49. iconCls: 'x-button-icon-close',
  50. cls: 'x-btn-gray',
  51. margin: '0 4 0 0',
  52. handler: function(){
  53. var main = parent.Ext.getCmp("content-panel");
  54. main.getActiveTab().close();
  55. }
  56. }]
  57. },{
  58. xtype: 'grid',
  59. anchor: '100% 90%',
  60. columnLines: true,
  61. columns: [{
  62. text: '期间',
  63. cls: 'x-grid-header-1',
  64. dataIndex: 'cm_yearmonth',
  65. xtype: 'numbercolumn',
  66. format: '0',
  67. width: 80
  68. },{
  69. text: '科目',
  70. cls: 'x-grid-header-1',
  71. dataIndex: 'cm_catecode',
  72. width: 110
  73. },{
  74. text: '期初余额',
  75. cls: 'x-grid-header-1',
  76. columns: [{
  77. text: '库存系统',
  78. cls: 'x-grid-header-1',
  79. dataIndex: 'pwm_beginamount',
  80. xtype: 'numbercolumn',
  81. format: '0,000.000',
  82. align: 'right',
  83. width: 120
  84. },{
  85. text: '总账系统',
  86. cls: 'x-grid-header-1',
  87. dataIndex: 'cm_beginbalance',
  88. xtype: 'numbercolumn',
  89. format: '0,000.000',
  90. align: 'right',
  91. width: 120
  92. },{
  93. text: '差额',
  94. cls: 'x-grid-header-1',
  95. dataIndex: 'beginbalance',
  96. align: 'right',
  97. width: 120,
  98. renderer: function(val, meta, record) {
  99. val = record.get('pwm_beginamount') - record.get('cm_beginbalance');
  100. if(record.get('beginbalance') != val) {
  101. record.set('beginbalance', val);
  102. }
  103. return val == 0 ? '' : Ext.util.Format.number(val, '0,000.000');
  104. }
  105. }]
  106. },{
  107. text: '本期借方发生',
  108. cls: 'x-grid-header-1',
  109. columns: [{
  110. text: '库存系统',
  111. cls: 'x-grid-header-1',
  112. dataIndex: 'pwm_nowinamount',
  113. xtype: 'numbercolumn',
  114. format: '0,000.000',
  115. align: 'right',
  116. width: 120
  117. },{
  118. text: '总账系统',
  119. cls: 'x-grid-header-1',
  120. dataIndex: 'cm_nowdebit',
  121. xtype: 'numbercolumn',
  122. format: '0,000.000',
  123. align: 'right',
  124. width: 120
  125. },{
  126. text: '差额',
  127. cls: 'x-grid-header-1',
  128. dataIndex: 'nowdebit',
  129. align: 'right',
  130. width: 120,
  131. renderer: function(val, meta, record) {
  132. val = record.get('pwm_nowinamount') - record.get('cm_nowdebit');
  133. if(record.get('nowdebit') != val) {
  134. record.set('nowdebit', val);
  135. }
  136. return val == 0 ? '' : Ext.util.Format.number(val, '0,000.000');
  137. }
  138. }]
  139. },{
  140. text: '本期贷方发生',
  141. cls: 'x-grid-header-1',
  142. columns: [{
  143. text: '库存系统',
  144. cls: 'x-grid-header-1',
  145. dataIndex: 'pwm_nowoutamount',
  146. xtype: 'numbercolumn',
  147. format: '0,000.000',
  148. align: 'right',
  149. width: 120
  150. },{
  151. text: '总账系统',
  152. cls: 'x-grid-header-1',
  153. dataIndex: 'cm_nowcredit',
  154. xtype: 'numbercolumn',
  155. format: '0,000.000',
  156. align: 'right',
  157. width: 120
  158. },{
  159. text: '差额',
  160. cls: 'x-grid-header-1',
  161. dataIndex: 'nowcredit',
  162. align: 'right',
  163. width: 120,
  164. renderer: function(val, meta, record) {
  165. val = record.get('pwm_nowoutamount') - record.get('cm_nowcredit');
  166. if(record.get('nowcredit') != val) {
  167. record.set('nowcredit', val);
  168. }
  169. return val == 0 ? '' : Ext.util.Format.number(val, '0,000.000');
  170. }
  171. }]
  172. },{
  173. text: '期末余额',
  174. cls: 'x-grid-header-1',
  175. columns: [{
  176. text: '库存系统',
  177. cls: 'x-grid-header-1',
  178. dataIndex: 'pwm_endamount',
  179. xtype: 'numbercolumn',
  180. format: '0,000.000',
  181. align: 'right',
  182. width: 120
  183. },{
  184. text: '总账系统',
  185. cls: 'x-grid-header-1',
  186. dataIndex: 'cm_endbalance',
  187. xtype: 'numbercolumn',
  188. format: '0,000.000',
  189. align: 'right',
  190. width: 120
  191. },{
  192. text: '差额',
  193. cls: 'x-grid-header-1',
  194. dataIndex: 'endbalance',
  195. align: 'right',
  196. width: 120,
  197. renderer: function(val, meta, record) {
  198. val = record.get('beginbalance') + record.get('nowdebit') - record.get('nowcredit');
  199. if(record.get('endbalance') != val) {
  200. record.set('endbalance', val);
  201. }
  202. return val == 0 ? '' : Ext.util.Format.number(val, '0,000.000');
  203. }
  204. }]
  205. }],
  206. store: Ext.create('Ext.data.Store', {
  207. fields: [{
  208. name: 'isCount', type: 'bool'
  209. },{
  210. name: 'cm_yearmonth', type: 'number'
  211. },{
  212. name: 'cm_catecode', type: 'string'
  213. },{
  214. name: 'pwm_beginamount', type: 'number'
  215. },{
  216. name: 'pwm_nowinamount', type: 'number'
  217. },{
  218. name: 'pwm_nowoutamount', type: 'number'
  219. },{
  220. name: 'pwm_endamount', type: 'number'
  221. },{
  222. name: 'cm_beginbalance', type: 'number'
  223. },{
  224. name: 'cm_nowdebit', type: 'number'
  225. },{
  226. name: 'cm_nowcredit', type: 'number'
  227. },{
  228. name: 'cm_endbalance', type: 'number'
  229. },{
  230. name: 'beginbalance', type: 'number'
  231. },{
  232. name: 'nowdebit', type: 'number'
  233. },{
  234. name: 'nowcredit', type: 'number'
  235. },{
  236. name: 'endbalance', type: 'number'
  237. }],
  238. viewConfig: {
  239. getRowClass: function(record) {
  240. return record.get('isCount') ? 'isCount' : null;
  241. }
  242. }
  243. })
  244. }]
  245. });
  246. me.callParent(arguments);
  247. }
  248. });