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.
The stages
Section titled “The stages”| Stage | What it does | Detail |
|---|---|---|
1. holiday and leave steps | Decide which day each holiday is observed on. Decide whether each leave request can be approved, and who approves it. | Schedules, leave |
2. pair steps | Decide 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, pairing | Corrections 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 steps | Decide which scheduled shift each segment is of. When several assignments fit, decide which one the work goes to. | Step reference |
| 5. Workday and labor context | Each 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 steps | Decide 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 steps | Set 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. Allocation | Each 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 steps | Rate 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 steps | On the pay side, work out time off earned (and forfeited) in each window. | Accruals |
11. exceptions steps | Rules look at each workday’s segments, lines and schedule. They raise exceptions. | Step reference |
| 12. Adjustments | Changes 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 hours | Lines 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 |
What the engine checks
Section titled “What the engine checks”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:
| Stage | Checked after each step |
|---|---|
time | No segment ends before it starts, and none starts before the one before it ends. |
allocate | The 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.
What a ledger holds
Section titled “What a ledger holds”| Part | |
|---|---|
| Period | Its first and last day. |
| Days | Every 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, hours | The period’s totals. They are sums of the days. |
| Exceptions | Everything that could not be worked out, about what falls in the period. |
| Segments | Each segment with its raw and effective times, its context and what steps did to it. |
| Calendar | Its days’ schedule: shifts, days off, holidays (schedules). |
| Closed | When it was closed, if it is. A closed ledger is as it was at that time. |
| Accruals, balances | Time off earned, used and adjusted in the period, and the balances at its end. |
| Side | pay, or another side such as bill. Each side is its own ledger. |
| Approvals | Where each approval stood when the ledger was worked out to be kept (approvals). |
| Leave | The leave requests with a day in the period, each with where it stands (leave). |
| Attributes | The 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.
One period, one carry
Section titled “One period, one carry”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.