Ext.define('erp.view.scm.reserve.MonthAccount',{ extend: 'Ext.Viewport', layout: 'anchor', hideBorders: true, initComponent : function(){ var me = this; Ext.apply(me, { items: [{ xtype: 'form', anchor: '100% 10%', bodyStyle: 'background:#f1f1f1', layout: 'column', defaults: { xtype: 'displayfield', columnWidth: .2 }, items: [{ fieldLabel: '期间', margin: '0 0 0 8', id: 'info_ym', value: Ext.Date.format(new Date(), 'Ym') }/*,{ fieldLabel: '核算类别', value: '客户' },{ xtype: 'checkbox', id: 'chkdetail', boxLabel: '显示客户明细', checked: true },{ xtype: 'checkbox', id: 'chkun', boxLabel: '包括未记账凭证' },{ xtype: 'checkbox', id: 'chkbalance', boxLabel: '只显示有差额科目' }*/], buttonAlign: 'center', buttons: [{ name: 'query', id: 'query', text: $I18N.common.button.erpQueryButton, iconCls: 'x-button-icon-query', cls: 'x-btn-gray', margin: '0 4 0 0' },{ text: $I18N.common.button.erpCloseButton, iconCls: 'x-button-icon-close', cls: 'x-btn-gray', margin: '0 4 0 0', handler: function(){ var main = parent.Ext.getCmp("content-panel"); main.getActiveTab().close(); } }] },{ xtype: 'grid', anchor: '100% 90%', columnLines: true, columns: [{ text: '期间', cls: 'x-grid-header-1', dataIndex: 'cm_yearmonth', xtype: 'numbercolumn', format: '0', width: 80 },{ text: '科目', cls: 'x-grid-header-1', dataIndex: 'cm_catecode', width: 110 },{ text: '期初余额', cls: 'x-grid-header-1', columns: [{ text: '库存系统', cls: 'x-grid-header-1', dataIndex: 'pwm_beginamount', xtype: 'numbercolumn', format: '0,000.000', align: 'right', width: 120 },{ text: '总账系统', cls: 'x-grid-header-1', dataIndex: 'cm_beginbalance', xtype: 'numbercolumn', format: '0,000.000', align: 'right', width: 120 },{ text: '差额', cls: 'x-grid-header-1', dataIndex: 'beginbalance', align: 'right', width: 120, renderer: function(val, meta, record) { val = record.get('pwm_beginamount') - record.get('cm_beginbalance'); if(record.get('beginbalance') != val) { record.set('beginbalance', val); } return val == 0 ? '' : Ext.util.Format.number(val, '0,000.000'); } }] },{ text: '本期借方发生', cls: 'x-grid-header-1', columns: [{ text: '库存系统', cls: 'x-grid-header-1', dataIndex: 'pwm_nowinamount', xtype: 'numbercolumn', format: '0,000.000', align: 'right', width: 120 },{ text: '总账系统', cls: 'x-grid-header-1', dataIndex: 'cm_nowdebit', xtype: 'numbercolumn', format: '0,000.000', align: 'right', width: 120 },{ text: '差额', cls: 'x-grid-header-1', dataIndex: 'nowdebit', align: 'right', width: 120, renderer: function(val, meta, record) { val = record.get('pwm_nowinamount') - record.get('cm_nowdebit'); if(record.get('nowdebit') != val) { record.set('nowdebit', val); } return val == 0 ? '' : Ext.util.Format.number(val, '0,000.000'); } }] },{ text: '本期贷方发生', cls: 'x-grid-header-1', columns: [{ text: '库存系统', cls: 'x-grid-header-1', dataIndex: 'pwm_nowoutamount', xtype: 'numbercolumn', format: '0,000.000', align: 'right', width: 120 },{ text: '总账系统', cls: 'x-grid-header-1', dataIndex: 'cm_nowcredit', xtype: 'numbercolumn', format: '0,000.000', align: 'right', width: 120 },{ text: '差额', cls: 'x-grid-header-1', dataIndex: 'nowcredit', align: 'right', width: 120, renderer: function(val, meta, record) { val = record.get('pwm_nowoutamount') - record.get('cm_nowcredit'); if(record.get('nowcredit') != val) { record.set('nowcredit', val); } return val == 0 ? '' : Ext.util.Format.number(val, '0,000.000'); } }] },{ text: '期末余额', cls: 'x-grid-header-1', columns: [{ text: '库存系统', cls: 'x-grid-header-1', dataIndex: 'pwm_endamount', xtype: 'numbercolumn', format: '0,000.000', align: 'right', width: 120 },{ text: '总账系统', cls: 'x-grid-header-1', dataIndex: 'cm_endbalance', xtype: 'numbercolumn', format: '0,000.000', align: 'right', width: 120 },{ text: '差额', cls: 'x-grid-header-1', dataIndex: 'endbalance', align: 'right', width: 120, renderer: function(val, meta, record) { val = record.get('beginbalance') + record.get('nowdebit') - record.get('nowcredit'); if(record.get('endbalance') != val) { record.set('endbalance', val); } return val == 0 ? '' : Ext.util.Format.number(val, '0,000.000'); } }] }], store: Ext.create('Ext.data.Store', { fields: [{ name: 'isCount', type: 'bool' },{ name: 'cm_yearmonth', type: 'number' },{ name: 'cm_catecode', type: 'string' },{ name: 'pwm_beginamount', type: 'number' },{ name: 'pwm_nowinamount', type: 'number' },{ name: 'pwm_nowoutamount', type: 'number' },{ name: 'pwm_endamount', type: 'number' },{ name: 'cm_beginbalance', type: 'number' },{ name: 'cm_nowdebit', type: 'number' },{ name: 'cm_nowcredit', type: 'number' },{ name: 'cm_endbalance', type: 'number' },{ name: 'beginbalance', type: 'number' },{ name: 'nowdebit', type: 'number' },{ name: 'nowcredit', type: 'number' },{ name: 'endbalance', type: 'number' }], viewConfig: { getRowClass: function(record) { return record.get('isCount') ? 'isCount' : null; } } }) }] }); me.callParent(arguments); } });