Contractor Portal · Business GuideReference sections by CON-XXX
CON-001

System Overview & Role

The Contractor portal is for subcontractors doing field work on engineering projects. A contractor user is linked to a Subcontractor record via user_id. All financial data (vouchers, ledger) is resolved through that Subcontractor record — not the user directly.

CapabilitySource
View workspaceSubcontractor record WHERE user_id = auth()->id()
Submit daily logsDailyLog; subcontractor_id auto-resolved
Submit expensesExpense; subcontractor_id auto-resolved
View materialsMaterialStock for the business (read-only)
View vouchersVoucher WHERE subcontractor_id = resolved sub.id
View ledgerLedgerEntry WHERE party_type=subcontractor AND party_id=sub.id
⚠ If no Subcontractor record is linked to the logged-in user, vouchers and ledger return empty arrays rather than errors. Admin must link the user_id to the Subcontractor record during onboarding.
CON-002

Subcontractor Onboarding Flow

1Admin creates POST /api/admin/subcontractors with company_name, trade_type, contact details
2If the subcontractor needs portal access: create a user account separately, note the user_id
3Admin updates the subcontractor record with user_id of the portal user
4Contractor logs in → GET /api/contractor/workspaces returns their company profile
5Contractor can now submit daily logs and expenses, and view vouchers/ledger
CON-003

Daily Log Workflow

Daily logs are the primary accountability record. They show the admin what work was done and how many workers were on site each day.

FieldRule
log_dateRequired; typically today or yesterday
work_summaryRequired; narrative of work done
workers_countOptional; defaults to 0
project_idOptional; links to a specific project
statusAuto-set to submitted; admin can change to approved/rejected
subcontractor_idAuto-resolved from auth user; cannot be overridden
CON-004

Expense Claims

Expenses represent costs incurred by the subcontractor on behalf of the project. All expenses start as pending and require admin approval.

Expense category examplesTypical usage
fuelDiesel for machinery, generator
materialsBinding wire, formwork timber, consumables
labourLabour-only costs not covered by weekly voucher
transportVehicle hire, delivery charges
otherMiscellaneous site costs
// Expense approval flow
contractor submits -> status: pending
admin reviews -> status: approved | rejected
// Approved expenses may generate a ledger debit entry
CON-005

Vouchers & Ledger (Read-Only)

Vouchers and ledger entries are read-only for the contractor. Admin creates vouchers for weekly work claims; once approved, a corresponding ledger entry records the payment.

Voucher statusContractor visible?Meaning
draftYesAdmin is preparing the voucher
submittedYesSubmitted for approval
approvedYesApproved; payment being processed
paidYesPayment made; matches ledger credit entry
rejectedYesDeclined; may require re-submission
// Running balance visible to contractor
credits = SUM(ledger_entries WHERE party_type=subcontractor AND party_id=sub.id AND entry_type=payment)
deductions = SUM(ledger_entries WHERE ... AND entry_type=deduction)
balance_due = credits - deductions - advance_paid
CON-006

Error Reference

CodeCause
401Token missing or expired
403user_type is not contractor
422Validation failed on daily log or expense submission