# LEDGER — ISS-2026-9123: per-customer 3-level compound discounts

**Date:** 2026-07-17 · hazemdev2 both repos · scope frozen (client took all 5 recs, step 3990).

## Frozen decisions
- 3 FIXED discount levels, HEADER-level (on the invoice), COMPOUND on the running balance: discounted = base × (1−r1) × (1−r2) × (1−r3).
- Per-customer default rates (3) stored on the customer (business_partner), auto-seeded on customer-select in the invoice, overridable per invoice.
- Net revenue (no new GL / no contra account) — same posting as today; the compound discount reduces the amount.
- Tax treatment (implementer decision, accounting-correct): the 3 compound discounts reduce the PRE-TAX subtotal (taxable base); tax computed on the discounted base → net revenue. Document in delivery.
- Invoice-only for now (quotations/orders propagation = OUT / later).

## Current state (recon)
- Discount today = single per-line percent (sales_invoice_items.discount_percent/amount). Header discount_amount is a derived roll-up (SalesInvoice::recalculateTotals :229-244). SalesCalculationService::calculateLineItem :16-47 = one discount then tax per line.
- business_partners: NO discount fields (credit_limit, payment_terms_days only).
- Display/PDF: single discount line (invoice-view, print-templates.ts:458).

## WPs
| WP | Scope | Repo | Status |
|----|-------|------|--------|
| WP1 | ✅ impl d27b0cb5d (3 tests, 0 new fail, JE balanced); [FIN] review APPROVE (0 crit/high; 2 MEDIUM FIXED 84cec4df5: commission base nets header + print emits levels) · BE: business_partners 3 discount% cols + sales_invoices 3×(percent,amount) breakdown cols + models; header compound-discount calc in recalculateTotals (on pre-tax subtotal, tax on discounted base, net); StoreSalesInvoiceRequest accepts the 3 percents; PostSalesInvoice books net; tests. [FIN-adjacent] migration. | BE | ⬜ |
| WP2 | ✅ 2a33eb5ac (partner fields + invoice seed/totals) · FE: business-partner form 3 discount% fields; invoice form auto-seeds the 3 rates on customer-select (overridable) + 3 discount rows + live compound totals. | FE | ⬜ |
| WP3 | ✅ 2a33eb5ac (view + list + PDF 3 lines) · FE: invoice-view + print/PDF render the 3 successive discount lines (base/rate/amount per level). | FE | ⬜ |

## Notes
Update ISS-2026-9123 ticket when done. All hazemdev2, no main/deploy-to-client (owner /fullpush). Deploy to /app for testing.
