# Loan / Advance → Payroll Binding — v0.31.0

## Standard workflow
Employee Application → HR/Management Sanction → Accounts Disbursement → Active Installment Schedule → Payroll Calculation → Payroll Lock → Recovery Posted.

## Why recovery posts only at Payroll Lock
Payroll may be rebuilt many times while it is Draft/Reviewed/Approved. Reducing loan outstanding during every recalculation would create duplicate deductions and corrupt balances. Therefore:

- Payroll build **calculates** the scheduled recovery.
- Payroll lock **posts** the financial recovery to installments/outstanding balance.
- Controlled payroll unlock **reverses** that period's posting.
- Re-lock posts the corrected amount idempotently.

## Rounding
For a principal that does not divide evenly (for example 10,000 / 3), the final installment absorbs the rounding remainder. Example: 3,333.33 + 3,333.33 + 3,333.34 = 10,000.00.

## Arrears
Unpaid installments due on or before the payroll month are considered recoverable. This prevents a missed recovery from silently disappearing. Policy can later make this configurable if management wants a different arrears rule.

## Auditability
Sanction, disbursement, payroll posting, reversal and cancellation are all separate audit events. Recovery rows also carry an idempotency key to prevent duplicate posting.
