Ext.define('saas.view.money.report.PayDetail', { extend: 'saas.view.core.report.ReportPanel', xtype: 'monry-report-paydetail', controller: 'money-report-paydetail', viewModel: 'money-report-paydetail', viewName: 'money-report-paydetail', groupField:'pd_vendcode', groupHeaderTpl: '供应商名称: {[values.rows[0].data.pd_vendcode]}', listUrl: '/api/money/report/payDetail', defaultCondition: null, reportTitle: '应付账款明细表', QueryWidth:0.25, allowPaging: false, //筛选:供应商、日期(必填) searchItems: [ { xtype: 'vendorDbfindTrigger', name: 'pd_vendname', fieldLabel: '供应商名称', columnWidth: 0.25 }, { xtype: 'conmonthfield', name: 'pd_ym', fieldLabel: '期间', columnWidth: 0.5 }], reportColumns: [{ text: 'id', dataIndex: 'pd_id', hidden: true }, { text: '单据日期', xtype: 'datecolumn', dataIndex: 'pd_date', width: 110 }, { text: '单号', dataIndex: 'pd_code', width: 150 }, { text: '单据类型', dataIndex: 'pd_kind', width: 110 }, { text:'供应商编号', dataIndex:'pd_vendcode', width: 150, hidden: true },{ text:'供应商名称', width: 200, dataIndex:'pd_vendname', hidden: true },{ text: '采购员', dataIndex: 'pd_buyername', width: 110 },{ text: '增加应付', xtype: 'numbercolumn', dataIndex: 'pd_addpay', xtype: 'numbercolumn', width: 180, renderer : function(v) { var arr = (v + '.').split('.'); var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0'); var format = '0,000.' + xr.join(); return Ext.util.Format.number(v, format); }, summaryType: 'sum', summaryRenderer: function(v) { var arr = (v + '.').split('.'); var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0'); var format = '0,000.' + xr.join(); return Ext.util.Format.number(v, format); } }, { text: '增加预付', xtype: 'numbercolumn', dataIndex: 'pd_addpre', xtype: 'numbercolumn', width: 180, renderer : function(v) { var arr = (v + '.').split('.'); var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0'); var format = '0,000.' + xr.join(); return Ext.util.Format.number(v, format); }, summaryType: 'sum', summaryRenderer: function(v) { var arr = (v + '.').split('.'); var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0'); var format = '0,000.' + xr.join(); return Ext.util.Format.number(v, format); } }, { text: '应付余额', xtype: 'numbercolumn', dataIndex: 'pd_remain', xtype: 'numbercolumn', width: 110, renderer : function(v) { var arr = (v + '.').split('.'); var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0'); var format = '0,000.' + xr.join(); return Ext.util.Format.number(v, format); }, summaryType: 'last', summaryRenderer: function(v) { var arr = (v + '.').split('.'); var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0'); var format = '0,000.' + xr.join(); return Ext.util.Format.number(v, format); }, mySummaryRenderer: function(grid, column, datas) { var store = grid.store, dataIndex = column.dataIndex, groupField = store.getGroupField(), count = datas.length, data = datas, lasts = {}, keys = [], arr = []; for(var i = 0; i < count; i++) { var d = data[i]; var n = Number(d[dataIndex]); var v = isNaN(n) ? 0 : n; lasts[groupField] = v; } keys = Ext.Object.getAllKeys(lasts); arr = keys.map(function(key) { return lasts[key]; }); return Ext.Array.sum(arr); } }, { text: '供应商名称', dataIndex: 'pd_vendname', hidden:true }, { flex: 1 }] });