MonthAccount.js.svn-base 6.4 KB

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