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>
7 lines
No EOL
1 KiB
JSON
7 lines
No EOL
1 KiB
JSON
{
|
|
"_comment": "SINGLE SOURCE OF TRUTH for how insurance premium amounts are treated. Read by BOTH the Next.js app (lib/insurance.ts) and the CLI (scripts/seed.mjs) so the two can never drift apart.",
|
|
"_ruling": "Client note 2026-10-08: every rate on the client's 'Vehicle Monthly Insurance' sheet is INCL VAT. The figure quoted is what the insurer invoices and what Mega actually pays.",
|
|
"_consequence": "The premium is booked to the plant vehicle at the incl-VAT amount — it is the real cash cost, so it belongs in fixed expenses whole. Booked income is ALSO VAT-inclusive (see invoice-booking-policy.json), so nothing is distorted: both sides of the profit line are on the same basis. Do NOT add VAT to these rates again on the way in.",
|
|
"_notVATSplit": "No VAT rate is recorded here on purpose. A split is only shown when the client confirms the rate this policy covers their policy — short-term insurance can be treated differently from standard-rated cover, so assuming 15% would print a SARS figure nobody has confirmed.",
|
|
"ratesIncludeVat": true
|
|
} |