https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43290

--- Comment #1 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 203589
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=203589&action=edit
Bug 43290: Round cashup summary totals to avoid excess decimal precision

Koha::Cash::Register::Cashup->summary sums accountlines.amount, which
is decimal(28,6), via MySQL SUM() and Perl addition to build the
top-level 'total' and each entry in 'total_grouped'. This can return
more precision than the 2 decimal places these amounts are ever
displayed at, and the extra digits pass straight through the
/api/v1/cashups/:id JSON response since these fields are otherwise
unformatted.

sprintf the two derived sums ('total' and each total_grouped entry) to
2 decimal places, matching the payment amounts they represent. The
per-row income_grouped/payout_grouped entries are untouched - they're
a straight get_column() * -1 negation, not a Perl-side addition of two
separately-summed values, so they don't exhibit the same issue.

Test plan:
1) prove t/db_dependent/Koha/Cash/Register/Cashup.t
2) prove t/db_dependent/Koha/Cash/Register/Cashups.t
3) prove t/db_dependent/api/v1/cashups.t
4) Complete a cashup with multiple payment types and confirm the
   summary modal's Total and per-payment-type rows show a clean 2
   decimal place amount

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to