Authentication & security
- Username/password login with
password_hash
- CSRF tokens on forms
- Session regeneration on login
require_login() + require_role() on protected pages
- Super User flag (
is_superuser) + legacy Jason fallback
Dashboard
- Received kg (current month)
- Recovery rate % (processing output ÷ input, current month)
- Active client count
- Recent intakes table (20 rows)
- Charts (30 days): intake, processing in/out, sales, recycling
Intake form
- Client + site selection (primary site auto-created on new client when address filled)
- Multiple commodity lines per submit
- Fields: commodity, qty, weight (kg), status, comments
- Collection note number (shared per submission or auto)
- Consignment number per line (auto C-YYYY-NNNNNN per company)
- Empty commodity list → message + link to Commodities settings
- PDF generation for selected intake IDs (
intake_pdf.php)
Inventory
- Filter: search, client, commodity, status, date range
- Pagination
- Bulk select → send to processing (machine queue)
Processing
- Per-machine: record runs (date, input/output kg, optional start/end runtime)
- Detail: commodity inputs and fraction outputs per run
- Processing queue: intakes in process; complete run → update intake status
- Optional “Use stock (from For sale)” per machine setting
- Run history, totals, date filters, pagination
For sale
- Stock fractions only (
fraction_types.type = stock)
- Available kg = produced (machine outputs) − prior sales
- Record sale to sales client with weight and pricing (wholesale/retail rates)
- Sales history
Recycling
- Recycling fractions only (
type = recycling)
- Available kg = produced − prior recycling deductions
- Record shipment/deduction to vendor
- History by vendor
Clients & sites
- Clients — intake customers (admin, manager, sales)
- Sales clients — for sale module
- Vendors — recycling module
- Edit: name, email, phone, address, SA province dropdown, notes, active
- Sites per client; primary site for intake dropdown
Settings (admin, manager)
- Build a machine: name, input commodities, output fractions, show-use-stock flag
- List/edit/delete machines (cascades runs, queue, config)
- Links to Commodities and Fraction types pages
- Backend support for adding intake statuses (per company; UI may be minimal; auto-seed “Received” etc.)
Commodities (admin, manager)
- Per-company list; starts empty (no global default list for new companies)
- Add commodity names for intake form and machine inputs
- Shows “Your company: …” when tenant-scoped
Fraction types (admin, manager)
- Add fractions; type Stock or Recycling
- Wholesale / retail rates on fractions
- Commodity wholesale/retail rates on same page
- Used when building machines and on for sale / recycling
Reports (all operational roles)
- Date range filter (default: current month)
- Mass balance (processing)
- Inputs by commodity / outputs by fraction
- Intake totals by commodity
- Stock deductions (sales) and recycling deductions
- Sales by client