fix(bookkeeping): settle öre differences to 3740 and improve supplier-invoice matching (#699)
Whole-krona Bankgiro/Swish payments of öre-bearing invoices were stranded as partially_paid forever (e.g. 11 231 paid on an 11 231,25 invoice left 0,25 kr open). Book the sub-krona residual to BAS 3740 (Öres- och kronutjämning) and settle the invoice in full, on both the supplier- and customer-invoice match flows. New shared pure helpers buildSupplierPaymentClearingLines + planSupplierPayment mirror the customer-side primitives; routing preview and commit through the same builder also fixes two pre-existing preview↔commit drifts (payment account + line descriptions). Öre absorption is accrual-only — cash entries book the full invoice, so absorbing there would hide a 1930 discrepancy. Also improves supplier-invoice ↔ bank matching: - Pass-3 date window now spans [invoice_date-5, due_date+5] instead of due_date ±5, so early payments auto-match; an ambiguity guard demotes non-unique amount matches to suggestions. - New retroactive matcher (on supplier_invoice.registered/.approved) surfaces the settling bank payment when the invoice is registered after the payment was imported. Matches are written as suggestions for one-click confirm-to-book, never silently auto-booked. Tests: new unit tests for both pure helpers; extended matching, handler, customer öre, and route suites. Full suite green (407 files / 5364 tests). Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
4dfd790de5
commit
b38b3d0230
@@ -1826,6 +1826,7 @@
|
||||
"amount_diff": "Difference: {amount}",
|
||||
"different_currencies": " (different currencies)",
|
||||
"partial_payment_note": " — the invoice will become partially paid.",
|
||||
"ore_rounding_note": "The {amount} difference is booked as rounding (account 3740). The invoice is marked as paid.",
|
||||
"fx_title": "Currency conversion",
|
||||
"fx_rate_description": "Riksbanken mid-rate {date}: 1 {invoiceCurrency} = {rate} SEK",
|
||||
"fx_paid_in_invoice_currency": "Payment equals: {amount}",
|
||||
|
||||
@@ -1826,6 +1826,7 @@
|
||||
"amount_diff": "Differens: {amount}",
|
||||
"different_currencies": " (olika valutor)",
|
||||
"partial_payment_note": " — fakturan blir delbetald.",
|
||||
"ore_rounding_note": "Differens {amount} bokförs som öresavrundning (konto 3740). Fakturan markeras som betald.",
|
||||
"fx_title": "Valutaomräkning",
|
||||
"fx_rate_description": "Riksbankens mittkurs {date}: 1 {invoiceCurrency} = {rate} SEK",
|
||||
"fx_paid_in_invoice_currency": "Inbetalning motsvarar: {amount}",
|
||||
|
||||
Reference in New Issue
Block a user