web/website/docs/postbank-payroll.md

66 lines
4.7 KiB
Markdown

# P&O payroll
The central scheduler processes one monthly salary per verified staff identity.
The highest valid active rank sets the wage; departments do not stack. Official
accounts, deployment identities and duplicate linked Minecraft identities are
excluded. The default schedule is the 28th in Europe/Brussels and is disabled
until rollout. Big Four control identities manage settings in the bank dashboard's
P&O Payroll tab.
The P&O page also provides **Run Wage Cycle** for authorized Big Four identities.
It previews the Brussels calendar month, pending staff, exact net/contribution
totals and P&O issuer balance. An explicit confirmation and reason are required.
It uses saved, enabled payroll settings and may pay before the scheduled day;
it cannot select another month or pay a completed month again. P&O is the issuer,
so a negative issuer balance does not impose a bank-treasury funding requirement.
`POST /api/bank/admin/payroll/run` accepts only `requestId`, `period`,
`previewKey`, `reason` and `confirmed`. Preview changes require a fresh review.
The existing monthly freeze, recipient checks, payment references and item locks
protect manual/scheduler concurrency. A durable `payroll_cycle_run` audit saves
the actor, reason and reviewed totals before issuing wages, then records the
result. Repeating the same request returns its recorded outcome or in-progress
status. Failed items can be resumed after reloading and confirming; paid items
are never repaid. If a response is uncertain, reload the recorded status first.
Payroll reuses an active personal current account (102 or 108). If absent, the
payroll transaction creates a free personal Start package and current account
**108**, with zero opening funds. This does not create a staff/Public 979 account
or claim that the employee accepted terms. A blocked or closed personal current
account requires review rather than a replacement account.
Each period freezes rank, policy version, tax parameters and payslip amounts
before posting. An employee payment atomically moves employer cost from Website
bank treasury to P&O, net salary to the personal account, and social contributions
plus income tax to I.D. Taxes. P&O retains no generated money. All three legs
share the transaction with account provisioning and the paid marker. Insufficient
funds roll everything back. Unpaid recipients are rechecked against current
appointments and identity before posting.
The model is fictional DM payroll using selected Belgian-inspired 2026 parameters,
not a real Belgian payroll calculation. Defaults are net DM per month:
Officer 2,800; Branch Lead 3,360; Department Head 4,200; Executive 5,040;
Owner & CEO 5,600. The payroll policy can be changed centrally.
`scripts/rollout-postbank-payroll.mjs --actor=UUID` previews eligibility without
creating accounts. `--apply` enables the current policy and runs the initial
current-period payroll once. Repeating it cannot pay the same period/person
again. Use the physical release path when invoking the script.
The rollout first prepares a versioned public tariff register and its PDF. A
failed document render stops the rollout before payroll is enabled. The central
scheduler retries pending tariff documents. Anonymous clients read
`GET /api/bank/public/rates` and download the exact publication through
`GET /api/bank/public/rates.pdf?version=UUID`; pending PDFs never fall back to an
older document. Public snapshots contain tax parameters, not private rank wages
or individual payslips. The public Rates & Charges page uses this same register.
Validation includes concurrent-run idempotency, account 108 provisioning,
salary/tax conservation and rollback on insufficient funds. The same concurrent
rollout was verified in isolated MySQL tables without production payments.
## Additional owner-confirmed wage cycles
The monthly cycle remains one salary per eligible person per month. The separate Additional Wage Cycle control previews a full extra payment for the current eligible staff and saved wage/tax policy, even after the monthly cycle has completed. Big Four authority, same-origin JSON requests, fresh previews, reason and confirmation remain required.
Additional runs, items and payslips use additive `pb_payroll_additional_*` tables keyed by a distinct cycle UUID. The existing P&O issuer, account provisioning, tax legs and recipient eligibility checks perform the payments. No monthly records are reset. The intent audit precedes the cycle freeze and payment; duplicate requests replay their result. Concurrent confirmations of the same preview cannot create two cycles. Partial failures resume only unpaid items in that additional cycle. A further full payment requires a new preview and confirmation. Scheduled payroll never creates an additional cycle.