CASE 02
Payroll & Ledger Engine
Running the back office used to take a week of manual work across separate tools for payroll, invoicing, and chasing payments. Now one engine pulls the hours, runs payroll, drafts every invoice, chases what is overdue, and closes the books, all exact to the cent.
- Role
- Financial systems, payroll logic, and automation
- Year
- 2026
- Stack
- Web app · Database · Payments + accounting
- Status
- Live in production
01 The problem
Running a back office by hand is a stack of separate jobs. Pull everyone’s hours, compute the pay, pay the team, invoice every client, chase the ones who are late, then close the books. Each step lives in a different tool or a different person’s memory, each one is a chance to be wrong, and a single slip in a paycheck or an invoice costs trust and money. It took the better part of a week, every period, and it trusted a human to never miss a cent across hundreds of lines. Someone always had to check the numbers again by hand, because the cost of one mistake was too high to skip the second pass.
02 The system
One engine that runs the whole back office. It runs on its own each pay period, twice a month, with nobody starting it. It pulls and totals the team’s hours from their time-tracking, builds the pay period, and checks the figures before any of it posts. If something looks wrong, the run stops itself and says why, rather than pushing a bad number forward. It recomputes every amount in exact cents across two currencies and three pay structures, runs loan deductions across their lifecycle, and produces the payslips and a one-click batch payout for the whole team. It drafts every client invoice automatically, chases overdue clients with escalating reminders, and shows live receivables aging. It closes the books each month, profit and loss with year-to-date and month-over-month, in both currencies. It also tracks each person’s contract, loan, work anniversary for reviews and raises, and birthday. One system, from the first hour logged to the closed month.
03 How it holds up
Every money amount is held as integer cents behind a typed boundary. The tests cover the classic floating-point trap and half-cent cases. It is the first rule of handling money in code: a paycheck needs deterministic arithmetic. Two checks stand between a wrong number and close. The run reviews the period before posting and halts on flagged figures, while the database refuses to close an unbalanced period. Reversing a finalized pay run reverses its loan deductions with it. The month-end narrative is limited to figures supplied by the reporting data. The current source carries 496 tests and 117 schema migrations as of July 24, 2026.
04 The result
What took the better part of a week now runs in minutes, and the figures are exact, not approximately right. Payroll, payouts, invoicing, collections, the monthly close, and the people side all run from one system that checks its own math. The team stops stitching tools together, stops hunting for numbers, and stops checking the books by hand, because the engine already did. A related build: margin & payout tracker, hours in, exact pay and live margin out, with proof on every payout.
05 Frequently asked questions
What is a custom payroll engine?
One system that runs the whole back office on its own. Each pay period it pulls the team’s hours, computes every amount in exact cents, produces payslips and a batch payout, drafts every client invoice, chases overdue clients, and closes the month with profit and loss in both currencies.
How does payroll software keep money math exact?
The supported money path holds each amount as integer cents behind a typed boundary. Tests cover the classic floating-point trap and confirm that ten cents plus twenty cents produces thirty cents in the ledger calculation.
What stops an automated payroll run from posting a wrong number?
Two independent checks. The run reviews the period before anything posts and halts itself if a figure looks off, and an alert goes out the moment anything stops. The database refuses to close a pay period that does not balance. A wrong number has to get past both to reach the books.
What does a payroll and ledger engine replace?
Separate tools for payroll, invoicing, collections, and bookkeeping, plus the manual second pass that checked their numbers. Work that took the better part of a week each period now runs in minutes, from the first hour logged to the closed month, on one system that checks its own math.
· How it works
- 01
Hours in
It pulls and totals the team's hours from their time-tracking, builds the pay period on its own, and checks the figures before any of it posts. If a number looks wrong, the run stops itself and flags why.
- 02
Run payroll
Every amount recomputes in exact cents, across two currencies and three pay types, with loan deductions handled on their own.
- 03
Pay and invoice
One click exports a batch payout for the whole team. Every client invoice is generated, and a tailored email for each is written and queued as a draft for you to review and send.
- 04
Chase and age
Overdue clients get escalating reminders drafted for approval, and live receivables aging shows who owes what, by client, in 30, 60, and 90 day buckets.
- 05
Close the books
One click closes the month: profit and loss with year-to-date and month-over-month, aging, payroll, and balances in both currencies.
· Results
- Tests
- 496
- Money
- Exact to the cent
- Status
- Live in production
1. The supported money path holds amounts as integer cents behind a typed boundary. Tests cover the classic float trap, where a tenth plus two tenths must produce exactly thirty cents.
2. The database rejects an unbalanced pay-period close. Reversing a finalized period also reverses its linked loan deductions under the tested workflow.
3. It also tracks each person's loan to payoff, flags their 1- and 2-year anniversaries for review, keeps contract and birthday records, and produces payroll, profit, expense, per-client, and tax reports. The current source carries 496 tests and 117 schema migrations as of July 24, 2026.