Fix grouping in reports

This commit is contained in:
Hillel Coren 2022-07-24 13:02:08 +03:00
parent 5ba6f2f192
commit 6bb9f92c9d
2 changed files with 4 additions and 2 deletions

View File

@ -1338,11 +1338,13 @@ class ReportResult {
} }
value = value + ' (' + values['count'].floor().toString() + ')'; value = value + ' (' + values['count'].floor().toString() + ')';
} else if (columnType == ReportColumnType.number) { } else if (columnType == ReportColumnType.number) {
final currencyId = values['${column}_currency_id'];
value = formatNumber(values[column], context, value = formatNumber(values[column], context,
formatNumberType: column == 'quantity' formatNumberType: column == 'quantity'
? FormatNumberType.double ? FormatNumberType.double
: FormatNumberType.money, : FormatNumberType.money,
currencyId: values['${column}_currency_id'].round().toString()); currencyId:
currencyId == null ? null : currencyId.round().toString());
} else if (columnType == ReportColumnType.duration) { } else if (columnType == ReportColumnType.duration) {
value = formatDuration(Duration(seconds: values[column].toInt())); value = formatDuration(Duration(seconds: values[column].toInt()));
} }

View File

@ -617,7 +617,7 @@ GroupTotals calculateReportTotals({
totals[group][column] = 0; totals[group][column] = 0;
} }
if (cell is ReportNumberValue) { if (cell is ReportNumberValue && cell.currencyId != null) {
totals[group]['${column}_currency_id'] = parseDouble(cell.currencyId); totals[group]['${column}_currency_id'] = parseDouble(cell.currencyId);
} }