# Phase 14 — Procurement, Finance, Workforce and Privacy

## Implemented source workflows

### Procurement
- Purchase order creation with one or more validated line items in the request payload.
- Purchase order submission to `pending_approval`.
- Approval/rejection by an authorised facility/LCDA approver.
- Maker-checker rule: the purchase-order creator cannot approve their own order.
- Supplier bill capture, optionally linked to a matching approved purchase order.
- Supplier bill payment recording with transaction locking and overpayment prevention.

### Payroll
- Facility-scoped payroll periods and entries.
- Gross-to-net arithmetic from manually entered basic pay, allowances and deductions.
- Duplicate staff and cross-facility staff checks.
- Draft → approved → paid workflow.
- Maker-checker rule: payroll creator cannot approve their own period.
- Payroll does not calculate Nigerian statutory PAYE, pension, NHF, union or other statutory deductions.

### Leave management
- Staff leave request capture.
- Facility-scoped pending leave listing.
- Approve/reject workflow with reviewer and timestamp.

### Bank reconciliation
- Bank account metadata with application-level encryption of account numbers.
- Manual bank statement line entry.
- Receipt matching against equal bank credits.
- Supplier payment matching against equal bank debits.
- Facility checks and one-time matching of unmatched lines.

### Patient privacy and records governance
- Patient consent event log (grant/refusal/withdrawal) with scope, representative and evidence reference.
- Privacy request registration and resolution status.
- Retention policy register and documented retention reviews.
- No automatic erasure, anonymisation or destruction is triggered by a retention review.

## Important limitations
- Purchase orders currently accept structured line-item arrays, while the starter UI exposes one line item; a repeatable multi-line UI is future work.
- Procurement does not yet implement budget reservation, tender evaluation, goods-received note, three-way invoice matching, withholding tax or supplier performance.
- Supplier bills and payments are recorded but are not automatically posted to the general ledger.
- Payroll is a basic register; it does not implement statutory deductions, payslip generation, bank-file generation, payroll journal posting or tax submissions.
- Marking payroll as paid records a payment reference; it does not prove bank settlement.
- Bank statement lines are manually entered; there is no bank feed or statement CSV parser. Reconciliation currently matches receipts and supplier payments, not every journal/payment class.
- Consent records do not themselves establish the lawful basis for processing. A patient may have other lawful bases under applicable law; legal review is required.
- Retention policy records do not automatically delete data. Legal hold, record category, statutory retention, archiving and secure destruction procedures require formal approval.
- The module is not a completed NDPA/NDPC compliance solution or a substitute for a DPIA.

## Test evidence
`ProcurementPayrollAcceptanceTest.php` adds source tests for purchase-order maker-checker and payroll approval/net-pay calculation. Tests are included but not executed in this build environment.
