This commit is contained in:
Hillel Coren 2020-02-13 22:26:54 +02:00
parent d7a9adf39b
commit a4986a8e3d
2 changed files with 15 additions and 7 deletions

View File

@ -88,6 +88,7 @@ ReportResult clientReport(
ClientReportFields.name, ClientReportFields.name,
ClientReportFields.idNumber, ClientReportFields.idNumber,
ClientReportFields.balance, ClientReportFields.balance,
ClientReportFields.paidToDate,
ClientReportFields.country, ClientReportFields.country,
]); ]);
} }

View File

@ -522,14 +522,19 @@ class ReportResult {
final row = data[i]; final row = data[i];
for (var j = 0; j < row.length; j++) { for (var j = 0; j < row.length; j++) {
final cell = row[j]; final cell = row[j];
if (cell is ReportAmount) {
final column = columns[j]; final column = columns[j];
final value = row[columns.indexOf(groupBy)].sortString(); final value = row[columns.indexOf(groupBy)].sortString();
if (!totals.containsKey(value)) { if (!totals.containsKey(value)) {
totals[value] = {'count': 0, 'total': 0}; totals[value] = {'count': 0};
} }
if (column == groupBy) {
totals[value]['count'] += 1; totals[value]['count'] += 1;
totals[value]['total'] += cell.value; }
if (cell is ReportAmount) {
if (!totals[value].containsKey(column)) {
totals[value][column] = 0;
}
totals[value][column] += cell.value;
} }
} }
} }
@ -540,6 +545,8 @@ class ReportResult {
String value = ''; String value = '';
if (column == groupBy) { if (column == groupBy) {
value = group + ' (' + values['count'].floor().toString() + ')'; value = group + ' (' + values['count'].floor().toString() + ')';
} else if (getReportColumnType(column) == ReportColumnType.number) {
//value = values
} }
cells.add(DataCell(Text(value))); cells.add(DataCell(Text(value)));
} }