ModulesMaterialsOverview

Materials

The Materials Module adds a third agreement-type / docket-type dimension — materials — on top of Lacroo’s existing contract → docket → pricing → allocation → ERP stack. It’s deliberately a reuse exercise, not a green-field build: a Materials contract slots into the existing contract editor, materials dockets ride the existing workbench, the existing 8-stage pricing engine grows one new stage, and ERP push reuses the same erp_export_batches plumbing as labour and plant. The module is distinct from Plant Register and Labour Hire by intent — materials are reactive (a delivery happens, you record it) rather than scheduled, so there is no auto-generation primitive.

Who uses it

PersonaWhat they do
HC Project AdminAuthors a Materials contract per supplier — fills in the rate sheet, sets minimum quantities, confirms cost allocations. Bulk-imports CSV/XLSX from supplier price schedules.
HC Cost ControllerDrives the /admin/dockets workbench Materials toggle — reconciles supplier invoices against site receipts via delivery_docket_no, exports CSV, will eventually push GRNs to COINS.
Site SupervisorRecords each delivery as it lands on site. Picks materials from a typeahead, enters delivered quantity, signs off the docket. Sees minimum-qty top-up rows inline so they know what’s billed vs what arrived.
  • Contracts — authoring materials, bulk-import, surcharges-as-rows, cost allocation.
  • Dockets — per-delivery cardinality, the two-row top-up display, submit validation, the MAT- prefix, workbench toggle, diary 5th tab.
  • ERP Push — pushing confirmed materials dockets to COINS.
  • Material Dockets Export — every delivery in a date range as a CSV.
  • Spec: docs/superpowers/specs/2026-04-30-materials-module-design.md.

Architecture

Two new tables — contract_materials (per-contract rate sheet) and docket_materials (per-delivery line items, with immutable rate snapshots) — sit alongside contract_classifications/contract_equipment_rates and docket_workers/docket_equipment respectively. The pricing engine grows a new Stage 4c (PriceMaterialLine) that runs in parallel with worker and equipment pricing. The cost-allocation resolver gains 'material' as a root entity_type — top-up lines share their parent material’s allocation via the same source_entity_id. Display IDs reuse the existing dockets.docket_number sequence with a MAT- prefix prepended at creation — no schema work, no backfill. Mobile is read-only in v1; supplier portal is deferred. The module ships behind a per-org materials_module_enabled feature flag for staged rollout.