Ext.define('erp.view.fa.ars.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' },{ name: 'export', text: $I18N.common.button.erpExportButton, iconCls: 'x-button-icon-excel', cls: 'x-btn-gray', handler: function(btn){ var grid = btn.ownerCt.ownerCt.ownerCt.down("#arMonthAccountGrid"); Ext.create('erp.util.BaseUtil').exportGrid(grid,'应收对账检查'); } },{ 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', id:'arMonthAccountGrid', anchor: '100% 90%', columnLines: true, columns: [{ text: '期间', cls: 'x-grid-header-1', dataIndex: 'am_yearmonth', xtype: 'numbercolumn', format: '0', width: 80 },{ text: '类型', cls: 'x-grid-header-1', dataIndex: 'am_catecode', width: 110 },{ text: '客户编号', cls: 'x-grid-header-1', dataIndex: 'am_asscode', width: 120 },{ text: '客户名称', cls: 'x-grid-header-1', dataIndex: 'am_assname', width: 180 },{ text: '币别', cls: 'x-grid-header-1', dataIndex: 'am_currency', width: 60, tdCls: 'cell-split' },{ text: '期初余额', cls: 'x-grid-header-1', columns: [{ 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: 'am_beginbalance', xtype: 'numbercolumn', format: '0,000.000', align: 'right', width: 120 },{ text: '差额', cls: 'x-grid-header-1', dataIndex: 'beginbalance', align: 'right', width: 120, tdCls: 'cell-split', renderer: function(val, meta, record) { val = record.get('cm_beginbalance') - record.get('am_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: 'cm_nowdebit', xtype: 'numbercolumn', format: '0,000.000', align: 'right', width: 120 },{ text: '总账系统', cls: 'x-grid-header-1', dataIndex: 'am_nowdebit', xtype: 'numbercolumn', format: '0,000.000', align: 'right', width: 120 },{ text: '差额', cls: 'x-grid-header-1', dataIndex: 'nowdebit', align: 'right', width: 120, tdCls: 'cell-split', renderer: function(val, meta, record) { val = record.get('cm_nowdebit') - record.get('am_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: 'cm_nowcredit', xtype: 'numbercolumn', format: '0,000.000', align: 'right', width: 120 },{ text: '总账系统', cls: 'x-grid-header-1', dataIndex: 'am_nowcredit', xtype: 'numbercolumn', format: '0,000.000', align: 'right', width: 120 },{ text: '差额', cls: 'x-grid-header-1', dataIndex: 'nowcredit', align: 'right', width: 120, tdCls: 'cell-split', renderer: function(val, meta, record) { val = record.get('cm_nowcredit') - record.get('am_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: 'cm_endbalance', xtype: 'numbercolumn', format: '0,000.000', align: 'right', width: 120 },{ text: '总账系统', cls: 'x-grid-header-1', dataIndex: 'am_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('cm_endbalance') - record.get('am_endbalance'); val = Math.abs(val) < 0.001 ? 0 : val; 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: 'am_yearmonth', type: 'number' },{ name: 'am_catecode', type: 'string' },{ name: 'am_asscode', type: 'string' },{ name: 'am_assname', type: 'string' },{ name: 'am_currency', type: 'string' },{ name: 'am_beginbalance', type: 'number' },{ name: 'cm_beginbalance', type: 'number' },{ name: 'beginbalance', type: 'number' },{ name: 'am_nowdebit', type: 'number' },{ name: 'cm_nowdebit', type: 'number' },{ name: 'nowdebit', type: 'number' },{ name: 'am_nowcredit', type: 'number' },{ name: 'cm_nowcredit', type: 'number' },{ name: 'nowcredit', type: 'number' },{ name: 'am_endbalance', type: 'number' },{ name: 'cm_endbalance', type: 'number' },{ name: 'endbalance', type: 'number' }], viewConfig: { getRowClass: function(record) { return record.get('isCount') ? 'isCount' : null; } } }) }] }); me.callParent(arguments); } });