feat(billing): wire invoice tax and discount into the create and edit UI #200

Merged
vas2000-work merged 1 commit from feat/mapps-192-invoice-tax-discount-ui into main 2026-06-16 23:48:56 +02:00
Owner

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

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>
feat(billing): wire invoice tax and discount into the create and edit UI
All checks were successful
Check / clippy + fmt + tests (pull_request) Successful in 57s
Create release / Create release from merged PR (pull_request) Has been skipped
0791032dd4
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>
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/mokosh-apps!200
No description provided.