Fix rounding error on total value calculation

This commit is contained in:
Lauri Niskanen 2021-02-17 08:46:49 +02:00
parent 779ac31ffe
commit b12187b384
No known key found for this signature in database
GPG Key ID: 807DCEAC3AEB1848

View File

@ -229,7 +229,7 @@ function RefreshStatistics()
var valueSum = 0; var valueSum = 0;
result.forEach(element => result.forEach(element =>
{ {
valueSum += parseInt(element.value); valueSum += parseFloat(element.value);
}); });
$("#info-current-stock").text(__n(result.length, '%s Product', '%s Products') + ", " + __t('%s total value', valueSum.toLocaleString(undefined, { style: "currency", currency: Grocy.Currency }))); $("#info-current-stock").text(__n(result.length, '%s Product', '%s Products') + ", " + __t('%s total value', valueSum.toLocaleString(undefined, { style: "currency", currency: Grocy.Currency })));
} }