feat(billing): wire invoice tax and discount into the create and edit UI #200
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/mapps-192-invoice-tax-discount-ui"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Invoices showed Tax and Discount lines and the backend already accepted tax_amount / discount_amount on both create and PUT, but no UI path ever set them, so both were always 0 and the Tax Rates catalog was orphaned from invoicing.
This adds a Tax Rate picker, a Tax input, and a Discount input to both the manual invoice create form (InvoiceNewPage) and the edit modal (InvoiceEditModal), and includes tax_amount / discount_amount in their POST / PUT bodies. The picker is populated from GET /tax-rates (active rates only) and computes tax = subtotal * rate / 100 (rates are stored as a percentage per PMS-339); the Tax field stays editable as a manual override and re-follows the computed value whenever a rate is picked. On the create form the subtotal is the single line's qty * unit price; in the edit modal it is the invoice's stored subtotal. Empty Tax / Discount fields send null, so the server keeps its 0 default on create and the current amount on PUT, leaving existing zero-tax invoices unchanged unless edited.
Frontend-only change: the server DTOs and totals math (total = subtotal + tax - discount) already supported this.
#MAPPS-192
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com