mega-plant/lib
David d055c344de feat(running): drive the charts and the profit from the running-cost register
The machine charts plotted the workbook's monthly_income.fixed_expenses, which
is NOT the app's running cost. So the charts and the /running Overview
disagreed about the same machine in the same month — CT01 by R 40 640, DT01 by
R 121 115. The workbook's figure also carries depreciation/ownership and an
operator allocation, which are capital recovery and overhead rather than
running cost.

Every cost value now comes from the running-cost register: fixed = insurance
+ financing, running = purchases. Profit is income - fixed - running, and it
is ONE formula on every surface, so /charts, /income and the dashboard quote
the same figure for the same machine.

  R 8 456 243  fleet income, Jan-Oct
- R 4 705 292  fixed   (insurance + financing, from the register)
- R   306 387  running (purchases, from the register)
= R 3 444 564  profit   (was R 2 510 908 on the workbook's fixed)

The legacy repairs sheet comes out completely. It was the old workbook's
"Plant Monthly Running Cost" — read by no page, maintained by nobody — and a
repair is bought on a purchase order, so its money is already in Purchases.
The collection is still seeded, so the history is not lost, but it is no
longer in any total, any chart or any profit.

Also:
  - the profit badge wears the CHART's own green, and profit is green and
    loss red on every surface. It was hard-coded to the teal brand colour,
    so the label and the line it labelled were two different colours.
  - September and October now state a profit instead of a dash: the dash
    existed because the workbook had not posted those months' fixed costs,
    and the register has the premium and the instalment for every month.
  - the containers and the water trailers show profit equal to their income,
    because the running-cost model carries no cost for them.

Overheads roll-up — an audit found three things out of order, and the roll-up
total itself reconciles exactly (R 580 485,37, unexplained R 0,00):

  - the dashboard's Overhead mix legend named only five of the six sections,
    so the figures it listed added up to R 565 489 against a headline of
    R 580 485, and the donut drew a slice nobody could name.
  - the /overheads note claimed machine instalments were excluded, while the
    Bastion Finance block on the same page carried R 115 575,94 of them and
    R 11 204,76 of insurance for the same machines. The note now says so,
    with the figures read off the rows at render time.
  - two Subscriptions rows had VAT that did not balance — the sheet had the
    TOTAL in the VAT cell (115%), and annual excl/VAT against a monthly
    total. Both are corrected on the client's instruction; the roll-up total
    does not move, only the VAT breakdown does, and the seed's VAT gate now
    passes instead of exiting non-zero.

Verified: 161 tests pass (4 new ones pin the register join), the production
build is clean, the reconciliation script passes, and the charts, the profit
label and the overhead legend were checked on screen.
2026-11-05 21:24:30 +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 Cash float card, Office role + Slips tab, job card PDF, manual close/delete 2026-10-22 15:09:57 +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 Job cards oil path, Fuel tab diesel-only, Mechanic role, Plant Register QR column 2026-10-22 13:44:01 +02:00
auth.ts feat(clock): add standalone employee clock PWA 2026-10-21 06:39:15 +02:00
cash-float-server.ts Cash float card, Office role + Slips tab, job card PDF, manual close/delete 2026-10-22 15:09:57 +02:00
cash-float.test.ts Cash float card, Office role + Slips tab, job card PDF, manual close/delete 2026-10-22 15:09:57 +02:00
cash-float.ts Cash float card, Office role + Slips tab, job card PDF, manual close/delete 2026-10-22 15:09:57 +02:00
chart-profit.ts Income: hide stood-down machines, with an active/inactive filter 2026-10-03 18:40:32 +02:00
chart-running-cost.test.ts feat(running): drive the charts and the profit from the running-cost register 2026-11-05 21:24:30 +02:00
clock-access.test.ts Cash float card, Office role + Slips tab, job card PDF, manual close/delete 2026-10-22 15:09:57 +02:00
clock-access.ts Cash float card, Office role + Slips tab, job card PDF, manual close/delete 2026-10-22 15:09:57 +02:00
clock-api.ts Clock app: vehicle-QR diesel book-out with meter photo; user access levels 2026-10-22 12:25:15 +02:00
clock-badge.ts feat(clock): add standalone employee clock PWA 2026-10-21 06:39:15 +02:00
clock-display.ts feat(clock): add standalone employee clock PWA 2026-10-21 06:39:15 +02:00
clock-lock.test.ts feat(clock): add standalone employee clock PWA 2026-10-21 06:39:15 +02:00
clock-lock.ts feat(clock): add standalone employee clock PWA 2026-10-21 06:39:15 +02:00
clock-origin.ts feat(clock): add standalone employee clock PWA 2026-10-21 06:39:15 +02:00
clock-pwa.test.ts feat(clock): add standalone employee clock PWA 2026-10-21 06:39:15 +02:00
clock-pwa.ts feat(clock): add standalone employee clock PWA 2026-10-21 06:39:15 +02:00
clock-request.test.ts feat(clock): add standalone employee clock PWA 2026-10-21 06:39:15 +02:00
clock-request.ts feat(clock): add standalone employee clock PWA 2026-10-21 06:39:15 +02:00
clock-rules.ts Add Workforce pages, Plant Clock tab bar and oil & diesel book-out 2026-10-22 11:39:18 +02:00
clock-store.ts Add Workforce pages, Plant Clock tab bar and oil & diesel book-out 2026-10-22 11:39:18 +02:00
clock.test.ts Add Workforce pages, Plant Clock tab bar and oil & diesel book-out 2026-10-22 11:39:18 +02:00
clock.ts Add Workforce pages, Plant Clock tab bar and oil & diesel book-out 2026-10-22 11:39:18 +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 feat(plant): vehicle site history from Fuel Logs 2026-11-05 00:18:24 +02:00
expenses-sections.test.ts fix(expenses): remove Maintenance — the app runs on live data, not the sheet 2026-11-05 07:50:15 +02:00
expenses-sections.ts fix(expenses): remove Maintenance — the app runs on live data, not the sheet 2026-11-05 07:50:15 +02:00
financing.ts fix(running): charge TLB06 for the months it was live, and not for November 2026-11-05 01:56:26 +02:00
income-month.test.ts feat(income): posted income per site, and the LIVE month on the overview 2026-11-05 00:19:06 +02:00
income-month.ts feat(running): drive the charts and the profit from the running-cost register 2026-11-05 21:24:30 +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-route.test.ts feat(income): posted income per site, and the LIVE month on the overview 2026-11-05 00:19:06 +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-register.test.ts feat(income): posted income per site, and the LIVE month on the overview 2026-11-05 00:19:06 +02:00
invoice-register.ts feat(income): posted income per site, and the LIVE month on the overview 2026-11-05 00:19:06 +02:00
invoice-revalidate.ts feat(income): posted income per site, and the LIVE month on the overview 2026-11-05 00:19:06 +02:00
invoice-routes.ts Split the invoice register into Internal and External Invoices 2026-10-08 11:49:48 +02:00
job-card-pdf.ts Cash float card, Office role + Slips tab, job card PDF, manual close/delete 2026-10-22 15:09:57 +02:00
job-cards.ts Add Job Cards (vehicle-QR start/finish) and retire Operators/Mechanics pages 2026-10-22 12:54:59 +02:00
mechanics.ts Add Running Costs sub-pages: insurance, financing, purchases, oil, operators, mechanics 2026-10-09 01:06:27 +02:00
oil-log.ts Add Workforce pages, Plant Clock tab bar and oil & diesel book-out 2026-10-22 11:39:18 +02:00
oil.ts Add Workforce pages, Plant Clock tab bar and oil & diesel book-out 2026-10-22 11:39:18 +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(plant): vehicle site history from Fuel Logs 2026-11-05 00:18:24 +02:00
plant-site-history.test.ts feat(plant): vehicle site history from Fuel Logs 2026-11-05 00:18:24 +02:00
plant-site-history.ts feat(plant): vehicle site history from Fuel Logs 2026-11-05 00:18:24 +02:00
plant-site-import.test.ts feat(plant): vehicle site history from Fuel Logs 2026-11-05 00:18:24 +02:00
plant-site-import.ts feat(plant): vehicle site history from Fuel Logs 2026-11-05 00:18:24 +02:00
plant-site-policy.json feat(plant): vehicle site history from Fuel Logs 2026-11-05 00:18:24 +02:00
profit.test.ts feat(running): drive the charts and the profit from the running-cost register 2026-11-05 21:24:30 +02:00
profit.ts feat(running): drive the charts and the profit from the running-cost register 2026-11-05 21:24:30 +02:00
purchase-booking.ts feat(running): drive the charts and the profit from the running-cost register 2026-11-05 21:24:30 +02:00
purchase-invoice-amount.test.ts Purchase invoices: price an invoice that has no amount 2026-11-04 18:06:02 +02:00
purchase-invoice-amount.ts Purchase invoices: price an invoice that has no amount 2026-11-04 18:06:02 +02:00
purchase-invoice-status.ts Suppliers: replace the menu entry with the new page, flag over-invoiced POs, audited invoice amount corrections 2026-10-29 20:49:05 +02:00
purchase-parser.ts Purchase invoices, Suppliers 2 with payments, multi-page PO parsing 2026-10-29 20:29:08 +02:00
qr-pdf.ts Add Workforce pages, Plant Clock tab bar and oil & diesel book-out 2026-10-22 11:39:18 +02:00
qr.ts Add Running Costs sub-pages: insurance, financing, purchases, oil, operators, mechanics 2026-10-09 01:06:27 +02:00
require-full.ts Add Suppliers list; book purchase orders and petty-cash slips against it 2026-10-22 15:43:57 +02:00
rows.test.ts feat(running): drive the charts and the profit from the running-cost register 2026-11-05 21:24:30 +02:00
rows.ts feat(running): drive the charts and the profit from the running-cost register 2026-11-05 21:24:30 +02:00
running-costs.ts feat(running): drive the charts and the profit from the running-cost register 2026-11-05 21:24:30 +02:00
running-month.test.ts feat(running): drive the charts and the profit from the running-cost register 2026-11-05 21:24:30 +02:00
server-data.ts feat(running): drive the charts and the profit from the running-cost register 2026-11-05 21:24:30 +02:00
shrink-image.ts Cash float card, Office role + Slips tab, job card PDF, manual close/delete 2026-10-22 15:09:57 +02:00
site-income.test.ts feat(income): posted income per site, and the LIVE month on the overview 2026-11-05 00:19:06 +02:00
site-income.ts feat(income): posted income per site, and the LIVE month on the overview 2026-11-05 00:19:06 +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
stock-out.ts Job cards oil path, Fuel tab diesel-only, Mechanic role, Plant Register QR column 2026-10-22 13:44:01 +02:00
supplier-server.ts Add Suppliers list; book purchase orders and petty-cash slips against it 2026-10-22 15:43:57 +02:00
supplier-spend-data.ts feat(expenses): build the cards from the sheet, and make the total real 2026-11-05 07:26:58 +02:00
supplier-spend.ts Suppliers: replace the menu entry with the new page, flag over-invoiced POs, audited invoice amount corrections 2026-10-29 20:49:05 +02:00
supplier.test.ts Add Suppliers list; book purchase orders and petty-cash slips against it 2026-10-22 15:43:57 +02:00
supplier.ts Add Suppliers list; book purchase orders and petty-cash slips against it 2026-10-22 15:43:57 +02:00
utils.ts Mega Plant dashboard — fix & harden (Parts 0-5) 2026-09-12 09:35:48 +02:00
workforce-store.ts Add Workforce pages, Plant Clock tab bar and oil & diesel book-out 2026-10-22 11:39:18 +02:00
workforce.test.ts Add Workforce pages, Plant Clock tab bar and oil & diesel book-out 2026-10-22 11:39:18 +02:00
workforce.ts Add Workforce pages, Plant Clock tab bar and oil & diesel book-out 2026-10-22 11:39:18 +02:00