mega-plant/app/api
Dave 696c157e2e Purchase invoices: price an invoice that has no amount
An invoice saved with no amount landed as amount_incl = 0 (PocketBase
stores a number field as zero, not null), so the PO read "R 0,00 invoiced"
and the money never booked. There were two ways to give it an amount and
neither worked: the Upload-invoice modal let a blank amount save silently,
while the double-click correction form refused to save without a value AND
a written reason, and sat behind Edit mode.

- lib/purchase-invoice-amount.ts holds the rules, shared by the screen and
  the API so they cannot disagree. R0 is not an amount: a blank amount and
  a figure of zero are both refused, so an invoice can never land as zero.
- The API now separates PRICING an invoice that never had an amount (no
  reason owed, still logged) from CORRECTING one that was booked (Full user
  + a reason, as before).
- Double-clicking an amount on a PO opens the ordinary invoice modal on
  that invoice, with the amount field waiting. The inline correction form is
  gone — one window, one rule. There is no pencil button: a booked figure
  must take a deliberate second gesture, so a single stray tap never opens
  a form that can rewrite money.
- The PO-lines table freezes its Description column with an opaque
  background and fades its right edge, so it passes the mobile checklist.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-11-04 18:06:02 +02:00
..
assets/[id] Job cards oil path, Fuel tab diesel-only, Mechanic role, Plant Register QR column 2026-10-22 13:44:01 +02:00
auth/logout feat: add user access and improve plant dashboard 2026-10-06 04:02:08 +02:00
cash-float Add Suppliers list; book purchase orders and petty-cash slips against it 2026-10-22 15:43:57 +02:00
clock Add Suppliers list; book purchase orders and petty-cash slips against it 2026-10-22 15:43:57 +02:00
financing/[id] Add Running Costs sub-pages: insurance, financing, purchases, oil, operators, mechanics 2026-10-09 01:06:27 +02:00
health Round 4: regressions fixed + mobile standard 2026-09-12 12:05:43 +02:00
invoice-lines/[id] Split the invoice register into Internal and External Invoices 2026-10-08 11:49:48 +02:00
invoices Attach the uploaded PDF to the invoice it creates 2026-10-08 21:45:42 +02:00
job-cards/[id] Add Suppliers list; book purchase orders and petty-cash slips against it 2026-10-22 15:43:57 +02:00
mechanics Add Job Cards (vehicle-QR start/finish) and retire Operators/Mechanics pages 2026-10-22 12:54:59 +02:00
oils Clock app: vehicle-QR diesel book-out with meter photo; user access levels 2026-10-22 12:25:15 +02:00
operators Add Job Cards (vehicle-QR start/finish) and retire Operators/Mechanics pages 2026-10-22 12:54:59 +02:00
purchases Purchase invoices: price an invoice that has no amount 2026-11-04 18:06:02 +02:00
sites/[id] feat: add user access and improve plant dashboard 2026-10-06 04:02:08 +02:00
supplier-payments Purchase invoices, Suppliers 2 with payments, multi-page PO parsing 2026-10-29 20:29:08 +02:00
suppliers Suppliers: double-click name to set terms; Edit mode gates deletes and invoice corrections 2026-10-29 20:54:34 +02:00