Files
accounted/app/api/suppliers
Jakob Wennberg e029376c08 fix(suppliers): per-currency stats and honest currency labels on the supplier page (#1177)
* fix(suppliers): per-currency stats and honest currency labels on the supplier page

Fixes #1169. The supplier detail page stamped "kr" on every invoice
amount although supplier_invoices carry their own currency, and the
stats endpoint summed remaining/paid amounts across currencies into
one number: a EUR + SEK supplier got a meaningless mixed total.

GET /api/suppliers/[id] now groups total_outstanding/total_paid per
invoice currency (öre-rounded per the money-math rule) and the page
renders one line per currency, "kr" only for SEK. Table cells and the
mobile Kvar line carry the invoice's currency the same way.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(suppliers): use roundOre from lib/money (antipattern ratchet)

The naive Math.round(x * 100) / 100 form is blocked by check:guards
(subtly wrong on exact-half values); lib/money.roundOre is canonical.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-25 12:58:38 +02:00
..
2026-07-21 23:00:15 +02:00