Fix for reports

This commit is contained in:
Hillel Coren 2023-06-16 16:33:42 +03:00
parent 8f33d9a3e4
commit 355f4f8a2c
1 changed files with 4 additions and 7 deletions

View File

@ -676,14 +676,11 @@ GroupTotals calculateReportTotals({
cell.currencyId != company.currencyId &&
shouldConverCurrencies) {
double cellValue = cell.value;
var rate = cell.exchangeRate;
if (rate == null || rate == 0 || rate == 1) {
rate = getExchangeRate(currencyMap,
fromCurrencyId: cell.currencyId,
toCurrencyId: company.currencyId);
}
final toCurrency = currencyMap[company.currencyId];
cellValue = round(cellValue / rate, toCurrency.precision);
final rate = getExchangeRate(currencyMap,
fromCurrencyId: cell.currencyId,
toCurrencyId: company.currencyId);
cellValue = round(cellValue * rate, toCurrency.precision);
totals[group][column] += cellValue;
} else {
totals[group][column] += cell.doubleValue;