mega-plant/lib
David f85b9378a2 Add Running Costs sub-pages: insurance, financing, purchases, oil, operators, mechanics
Splits the Running Costs group into six purpose-built pages, each with its own
collection and its own source data, plus a coordinate parser for purchase orders.

Insurance (R503 330/yr, 20 vehicles)
  A premium can move every month or three, so it is stored as a RATE PERIOD in
  insurance_rates and each month's cost is resolved against the rate in force
  that month. cost_lines insurance rows are derived from those periods. An absent
  rate is null, never 0 — nobody has entered the date, which is not the same as
  being insured for free.

Financing (20 agreements, R428 585/mo)
  Instalment from the sheet; start date, paid-off date and the settled toggle are
  human-entered and preserved across re-seeds. Months-left and outstanding are
  null until a date is entered, never R0 on a live debt. The two paid-off
  agreements (WB02, DT01) show as settled and are excluded from the run-rate.

Purchases + Oil Stock
  Uploads PO PDFs the way /income/invoices does. The parser reads columns by
  x-position, because plain text extraction reorders them, and refuses any PO
  whose lines do not sum to the sub-total. A cost code either names a machine
  ("SS-02" -> SS02) or a stock store ("MPLANT, ENGOIL") — never both, never
  guessed. Oil POs move litres into oil_stock_movements instead of onto a machine;
  stock is the sum of movements so the first usage is a subtraction from history.

Operators (19) and Mechanics (2)
  Both are people with an employee number, separately reconcilable by the seed so
  someone added in the app survives. Mechanics get a badge QR; a mechanic with no
  employee number cannot be printed, because the code is what the QR encodes.

Cross-cutting
  - The seed no longer deletes operators, mechanics or oil items: people are added
    in the app, and those rows exist in no file.
  - Re-pointing allocations that PocketBase clears because `assets` is rebuilt
    with new ids each seed (operators, purchase lines).
  - One QR encoder for screen and PDF, so a printed code cannot drift from the one
    on screen. pdf-lib writes real vector PDFs; pdfjs-dist only reads them.
  - Every figure is null-safe: unknown is never rendered as zero.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-10-09 01:06:27 +02:00
..
auth-policy.test.ts feat: add user access and improve plant dashboard 2026-10-06 04:02:08 +02:00
auth-policy.ts feat: add user access and improve plant dashboard 2026-10-06 04:02:08 +02:00
auth-service.test.ts feat: add user access and improve plant dashboard 2026-10-06 04:02:08 +02:00
auth-service.ts feat: add user access and improve plant dashboard 2026-10-06 04:02:08 +02:00
auth.ts feat: add user access and improve plant dashboard 2026-10-06 04:02:08 +02:00
chart-profit.ts Income: hide stood-down machines, with an active/inactive filter 2026-10-03 18:40:32 +02:00
cost-code.ts Add Running Costs sub-pages: insurance, financing, purchases, oil, operators, mechanics 2026-10-09 01:06:27 +02:00
data.ts Add Running Costs sub-pages: insurance, financing, purchases, oil, operators, mechanics 2026-10-09 01:06:27 +02:00
financing.ts Add Running Costs sub-pages: insurance, financing, purchases, oil, operators, mechanics 2026-10-09 01:06:27 +02:00
insurance-rate-policy.json Add Running Costs sub-pages: insurance, financing, purchases, oil, operators, mechanics 2026-10-09 01:06:27 +02:00
insurance-rate-policy.ts Add Running Costs sub-pages: insurance, financing, purchases, oil, operators, mechanics 2026-10-09 01:06:27 +02:00
insurance.ts Add Running Costs sub-pages: insurance, financing, purchases, oil, operators, mechanics 2026-10-09 01:06:27 +02:00
intake-retry.test.ts feat: add user access and improve plant dashboard 2026-10-06 04:02:08 +02:00
intake-retry.ts feat: add user access and improve plant dashboard 2026-10-06 04:02:08 +02:00
invoice-booking-policy.json Invoices: line-item extraction, booking to plant items, VAT-inclusive income 2026-10-01 15:59:30 +02:00
invoice-booking.ts Invoices: line-item extraction, booking to plant items, VAT-inclusive income 2026-10-01 15:59:30 +02:00
invoice-parser.test.ts Test: a site typed without its space is deliberately NOT folded 2026-10-08 19:06:30 +02:00
invoice-parser.ts Invoices: one line per charge, and fold an abbreviated site 2026-10-06 11:25:10 +02:00
invoice-party-policy.json Split the invoice register into Internal and External Invoices 2026-10-08 11:49:48 +02:00
invoice-party.test.ts Split the invoice register into Internal and External Invoices 2026-10-08 11:49:48 +02:00
invoice-party.ts Split the invoice register into Internal and External Invoices 2026-10-08 11:49:48 +02:00
invoice-revalidate.ts Split the invoice register into Internal and External Invoices 2026-10-08 11:49:48 +02:00
invoice-routes.ts Split the invoice register into Internal and External Invoices 2026-10-08 11:49:48 +02:00
mechanics.ts Add Running Costs sub-pages: insurance, financing, purchases, oil, operators, mechanics 2026-10-09 01:06:27 +02:00
oil.ts Add Running Costs sub-pages: insurance, financing, purchases, oil, operators, mechanics 2026-10-09 01:06:27 +02:00
pb.ts Round 4: regressions fixed + mobile standard 2026-09-12 12:05:43 +02:00
plant-location-policy.json feat: add user access and improve plant dashboard 2026-10-06 04:02:08 +02:00
plant-map.test.ts feat: add user access and improve plant dashboard 2026-10-06 04:02:08 +02:00
plant-map.ts feat: add user access and improve plant dashboard 2026-10-06 04:02:08 +02:00
profit.test.ts Mega Plant dashboard — fix & harden (Parts 0-5) 2026-09-12 09:35:48 +02:00
profit.ts Mega Plant dashboard — fix & harden (Parts 0-5) 2026-09-12 09:35:48 +02:00
purchase-parser.ts Add Running Costs sub-pages: insurance, financing, purchases, oil, operators, mechanics 2026-10-09 01:06:27 +02:00
qr-pdf.ts Add Running Costs sub-pages: insurance, financing, purchases, oil, operators, mechanics 2026-10-09 01:06:27 +02:00
qr.ts Add Running Costs sub-pages: insurance, financing, purchases, oil, operators, mechanics 2026-10-09 01:06:27 +02:00
rows.test.ts Invoices: line-item extraction, booking to plant items, VAT-inclusive income 2026-10-01 15:59:30 +02:00
rows.ts Add Running Costs sub-pages: insurance, financing, purchases, oil, operators, mechanics 2026-10-09 01:06:27 +02:00
server-data.ts Add Running Costs sub-pages: insurance, financing, purchases, oil, operators, mechanics 2026-10-09 01:06:27 +02:00
sites.test.ts Give external invoices a supplier name; keep them off the sites page 2026-10-08 12:04:42 +02:00
sites.ts Give external invoices a supplier name; keep them off the sites page 2026-10-08 12:04:42 +02:00
utils.ts Mega Plant dashboard — fix & harden (Parts 0-5) 2026-09-12 09:35:48 +02:00