Skip to content

The ledger

A ledger is one person’s pay period, worked out in full. Its lines are the only hours there are. A day, a week, a category total, a report or an export is a sum of them.

This page shows the fixed stages every ledger goes through. It also shows where your policy’s rules plug in. So you know what a rule can change and what it can’t.

The engine runs the same stages in the same order every time. The policy’s rules decide wherever the answer varies by place, contract or company. Two more policy stages run outside the ledger. They are late, on changes to closed periods, and approve, on approvals.

Facts punches, corrections, entries Setup context, categories, rates Policy the layers of each day 1 holiday and leave steps observance; whether leave can pass 2 pair steps which punches count, their direction 3 Effective punches, paired into segments 4 match and assign steps which shift, which assignment 5 Workday and labor context per segment 6 attribute steps which workday a shift's time belongs to 7 time steps each workday: effective start and end 8 Allocation segments, entries and leave into categories 9 rate and allocate steps rate ties; each day, week, period or 24h 10 accrue steps pay side: time off earned, forfeited 11 exceptions steps each workday: rules that raise exceptions 12 Adjustments for closed periods late steps: adjust or refuse 13 Carried decimal hours fixed: in the order time started Ledger days of lines, counts and money, exceptions, accruals, segments the policy's rules; checked after every one the engine, always the same
The stages always run in this order. A policy chooses which steps run in the highlighted stages, and with what parameters. It cannot add a stage, move one, or change what the engine's stages do.
StageWhat it doesDetail
1. holiday and leave stepsDecide which day each holiday is observed on. Decide whether each leave request can be approved, and who approves it.Schedules, leave
2. pair stepsDecide which punches count, and their direction. Examples: duplicates are ignored, an automatic clock-out is added, an out and an in a moment apart are joined. The punches stay as recorded.Step reference
3. Effective punches, pairingCorrections are applied to the punches, in the order they were made. The punches as marked are then paired into back-to-back work, lunch and break segments. What does not pair is an exception.Punches and segments
4. match and assign stepsDecide which scheduled shift each segment is of. When several assignments fit, decide which one the work goes to.Step reference
5. Workday and labor contextEach segment starts on the workday its raw start falls in. That is the day whose start is at or before the raw start, and whose next start is after it. The policy sets the day start, in the zone in force then. The segment’s labor context is resolved, with the source of every value.Labor context
6. attribute stepsDecide which workday a segment belongs to when it crosses a workday’s start. The choices are the day it starts in (the default), the day it ends in, or split at the day’s start.Step reference
7. time stepsSet effective start and end times beside the raw ones. Examples are rounding and snapping to the shift. Raw times are never changed.Step reference
8. AllocationEach segment, at its effective times, becomes a line in its kind’s category. Labor entries of hours, and approved leave, become untimed lines. Counts and money become quantity lines.Allocations
9. rate and allocate stepsRate ties are settled. Then each allocate step runs on each of its windows. A window is a day, a week, a period or 24 hours from when work starts. The step moves time between categories at exact instants. It also adds counts, money and time not worked.Step reference
10. accrue stepsOn the pay side, work out time off earned (and forfeited) in each window.Accruals
11. exceptions stepsRules look at each workday’s segments, lines and schedule. They raise exceptions.Step reference
12. AdjustmentsChanges recorded in an open period can affect closed periods. The exact differences are worked out. Each is adjusted or refused, as the late steps (or the policy’s setting) say.Period close
13. Carried decimal hoursLines are taken in the order their time started. Each line gets the whole hundredths (or the policy’s decimals) of its pay category’s running exact time not yet given out. The extra is carried to the next line of the same category. No policy changes this stage, beyond the number of decimals.Hours

A step decides and the engine acts. A step reads what it is given and asks for changes. The engine makes each change exactly, to the instant. It stamps what it changed with the step and the policy layers that gave it.

After every step, the engine checks that the step kept the rules no policy may break:

StageChecked after each step
timeNo segment ends before it starts, and none starts before the one before it ends.
allocateThe window’s time is the same as before the step, apart from time not worked that the step added. Worked time was moved, never made or lost.

Sometimes a step fails. Sometimes it asks for something that cannot be done, such as a category or measure that doesn’t exist, or a segment that doesn’t exist. Sometimes it runs past its time limit or breaks a check. In each case the whole ledger stops with an error. The error names the step (its id, and its package and name). No timecard is produced.

Part
PeriodIts first and last day.
DaysEvery day of the period. Each day holds its lines in the order paid, the time in categories that count as worked, its decimal hours, and its counts and money.
Worked, hoursThe period’s totals. They are sums of the days.
ExceptionsEverything that could not be worked out, about what falls in the period.
SegmentsEach segment with its raw and effective times, its context and what steps did to it.
CalendarIts days’ schedule: shifts, days off, holidays (schedules).
ClosedWhen it was closed, if it is. A closed ledger is as it was at that time.
Accruals, balancesTime off earned, used and adjusted in the period, and the balances at its end.
Sidepay, or another side such as bill. Each side is its own ledger.
ApprovalsWhere each approval stood when the ledger was worked out to be kept (approvals).
LeaveThe leave requests with a day in the period, each with where it stands (leave).
AttributesThe person’s employment details on the period’s last day, such as a payroll id. An export writes them out as they are here.

Every line records what made it. That is the segment or entry it came from, plus a stamp for each step that changed it. Here is an example stamp:

weekly [tenant rev 2, plant-7 rev 4]: moved 7h from work to overtime: over 38h in the week

So every line answers “why is this overtime?” step by step.

The decimal hours carry runs once over the whole period’s lines. It starts from the first line of the period. It runs for each pay category on its own. A category’s lines add up to the whole steps of its time. A leftover of one category never lands on a line of another.

Some time is still carried at the end of each category. It is less than one hundredth of an hour at two decimals. It is dropped. So a period’s total is under its exact time by less than one step for each category it has. A line can show 0.00 when the carry has not yet reached a step.

A week inside a two-week period takes its lines from the period’s ledger, carry and all. A week across two periods takes its days from both ledgers. Nothing is worked out per week or per report, so the numbers match.