Overtime cost spread over the branches worked at
The rule
Someone works at two branches in one week: 30 hours at north from Monday to Wednesday, then 20 at south on Thursday and Friday. Overtime is worked out on the whole week, so the 10 hours past 40 are overtime, and they are the last 10 worked: all at south. The pay is right, but south’s labor cost carries the whole premium for a week north had most of.
Many employers spread the premium’s cost over the branches in proportion to the hours worked at each: north worked 30 of the 50 hours and is charged 60% of the premium, south 40%. The straight time for every hour stays with the branch it was worked at. The person’s pay does not change: only where its cost is charged.
Who uses it
Employers whose people work at several branches, stores, sites, cost centers or jobs in one week, and who report labor cost by them: retail and restaurant groups, staffing, healthcare systems with float pools, facilities and field service, and contractors costing labor to projects.
How the recipe does it
Configuration only: the package (package.toml) has one layer.
[[layer]]id = "overtime"[[layer.step]]id = "weekly"uses = "standard/threshold"params = { over = "40h", to = "overtime", window = "week" }
[[layer.step]]id = "straight-time"uses = "standard/earnings"params = { rate = "pay", measure = "wages", premiums = { work = 100, overtime = 100 }, window = "week" }
[[layer.step]]id = "overtime-premium"uses = "standard/regular_rate"params = { rate = "pay", measure = "wages", premiums = { overtime = 50 } }
[[layer.step]]id = "spread"uses = "standard/spread_overtime_premium"params = { by = "location", steps = ["overtime-premium"] }thresholdmakes the hours past 40 overtime, the latest first.earningspays every hour its straight time at the rate of the branch it was worked at.regular_ratepays each overtime hour half the week’s regular rate on top: the week’s straight time over its hours, so a week at two branches’ rates weighs each by its hours.spread_overtime_premiumtakes the moneyovertime-premiumpaid and spreads it over the locations in proportion to the hours worked at each. Each part names its location. The shares add up to the premium to the cent: each takes the whole cents of the running total not yet given, and what is left below a cent carries forward to the next.
by is any labor context dimension: cost_center, assignment, a job,
or an organization level that the setup implies from one (cost center
4410 implies the west division). Work with no value of it takes its share
too, with no value.
A week across two pay periods counts the earlier period’s days in the hours each branch worked, and spreads the money the later period pays. A late punch at one branch changes the hours each worked, and the closed week is worked out again with it: the adjustments in the open week move the premium between the branches, branch by branch.
Charging each branch its share of the overtime hours themselves, and the
straight time paid for them, is another rule,
standard/spread_overtime_hours: those hours then count in the hours of
the branch they are put at. Hours priced after it (by a later step, or by
payroll from an export) are priced at the rate of that branch, so run it
after the steps that pay the hours.
What your setup needs
Set up before you adopt the recipe; the recipe’s steps read them by name, and adopting it is refused, with a list of what is missing, until they exist.
- A measure called
wages: the amount the recipe adds up (money in a currency, or a count).
The scenarios show each as it was set up for them.
Parameters
| Parameter | Meaning |
|---|---|
by | The labor context dimension the premium is spread over. |
steps | The steps whose money is the premium spread. |
counts | The categories whose hours each value is weighed by (default: every worked category). |
What the scenarios show
the-premium-is-spread-by-the-hours-at-each-branch: 30 hours at north and 20 at south, the 10 overtime hours at south. The 112.00 premium is 67.20 at north and 44.80 at south; the straight time and the hours stay where they were worked.without-the-spread-the-branch-worked-last-carries-it: the same week with the step off: one premium of 112.00 with no location, beside south’s overtime hours.daily-overtime-and-double-time-are-spread-too: 14 hours at north with daily overtime and double time, 6 at south: each premium of 43.60 is spread 30.52 and 13.08, though every premium hour was at north.a-late-punch-at-one-branch-spreads-the-premium-again: Saturday’s 5 hours at north, punched after the week closed, adjust the open week by 138.66 at north (their 100.00 of straight time and 38.66 more premium) and 15.70 more premium at south.a-week-across-two-pay-periods-spreads-by-the-whole-weeks-hours: 40 hours at north in one pay period and 10 at south in the next; the 106.00 premium the second pays is 84.80 at north and 21.20 at south.the-overtime-hours-themselves-instead:spread_overtime_hoursputs 6 of the 10 overtime hours at north and 4 at south, with the money paid for them.
Legal note
This is a common way companies charge overtime’s cost to the places it
was worked for; check the rules where you operate. It changes only where
the cost is charged, never what the person is paid: overtime itself is
worked out on all of the week’s hours, as overtime laws generally count
the hours worked for one employer together. Some contracts and cost
accounting rules (government contracts, union agreements, grants) say
how overtime premium is charged; the policy follows them through by,
steps and counts.
Get the recipe
The recipe’s package and its scenarios are in the example packages repository: attendance/overtime_cost_spread. Test it, or your own copy of it, with hourctl attend test, and publish it with hourctl attend pkg publish.
The policy package
The package’s layers, with the standard steps each one runs and their settings:
name = "overtime_cost_spread"version = "1.0.0"description = "The overtime premium's cost spread over the branches a person worked at in the week, in proportion to the hours at each, instead of falling on the branch worked last."
# What the tenant must have set up for the recipe: the steps read these by name.[needs]measures = ["wages"]
# Everyone: past 40 hours a week is overtime. Every hour is paid its# straight time at its branch's rate, each overtime hour half the week's# regular rate on top; then the premium is spread over the locations in# proportion to the hours worked at each.[[layer]]id = "overtime"[[layer.step]]id = "weekly"uses = "standard/threshold"params = { over = "40h", to = "overtime", window = "week" }
[[layer.step]]id = "straight-time"uses = "standard/earnings"params = { rate = "pay", measure = "wages", premiums = { work = 100, overtime = 100 }, window = "week" }
[[layer.step]]id = "overtime-premium"uses = "standard/regular_rate"params = { rate = "pay", measure = "wages", premiums = { overtime = 50 } }
[[layer.step]]id = "spread"uses = "standard/spread_overtime_premium"params = { by = "location", steps = ["overtime-premium"] }Scenarios
Each scenario gives a person’s punches and setup and the timecard they must produce, worked out with this package adopted (the format).
The week of October 5 closed with 30 hours at north and 20 at south, its 112.00 premium spread 67.20 and 44.80. Saturday's 5 hours at north are punched the next Tuesday, after the close: the week is 55 hours, 35 at north, its last 15 overtime, and a regular rate of 1220.00 over 55 hours. Its premium is 166.36, spread 105.86 to north and 60.50 to south. The open week is adjusted by the differences, location by location: 138.66 at north, Saturday's 100.00 of straight time and 38.66 more premium, and 15.70 more premium at south. The closed week stays as it was paid
description = "The week of October 5 closed with 30 hours at north and 20 at south, its 112.00 premium spread 67.20 and 44.80. Saturday's 5 hours at north are punched the next Tuesday, after the close: the week is 55 hours, 35 at north, its last 15 overtime, and a regular rate of 1220.00 over 55 hours. Its premium is 166.36, spread 105.86 to north and 60.50 to south. The open week is adjusted by the differences, location by location: 138.66 at north, Saturday's 100.00 of straight time and 38.66 more premium, and 15.70 more premium at south. The closed week stays as it was paid"
punch = [ { at = "2026-10-05 07:00", kind = "in", values = { location = "north" } }, { at = "2026-10-05 17:00", kind = "out" }, { at = "2026-10-06 07:00", kind = "in", values = { location = "north" } }, { at = "2026-10-06 17:00", kind = "out" }, { at = "2026-10-07 07:00", kind = "in", values = { location = "north" } }, { at = "2026-10-07 17:00", kind = "out" }, { at = "2026-10-08 07:00", kind = "in", values = { location = "south" } }, { at = "2026-10-08 17:00", kind = "out" }, { at = "2026-10-09 07:00", kind = "in", values = { location = "south" } }, { at = "2026-10-09 17:00", kind = "out" }, { at = "2026-10-10 07:00", kind = "in", values = { location = "north" }, recorded = "2026-10-13 09:00" }, { at = "2026-10-10 12:00", kind = "out", recorded = "2026-10-13 09:00" },]
[policy]zone = "America/Chicago"pay_periods = { every_days = 7, from = "2026-10-05" }
[[measure]]id = "wages"kind = "money"currency = "USD"
[[rate]]kind = "pay"matches = { location = "north" }amount = 2000currency = "USD"
[[rate]]kind = "pay"matches = { location = "south" }amount = 2600currency = "USD"
[[close]]period = "2026-10-05"recorded = "2026-10-12 08:00"
[expect]week = "2026-10-12"quantities = [ "2026-10-13 wages 138.66 USD overtime location=north", "2026-10-13 wages 15.70 USD overtime location=south",]
[expect.period]day = "2026-10-05"quantities = [ "2026-10-07 wages 600.00 USD work location=north", "2026-10-08 wages 260.00 USD work location=south", "2026-10-09 wages 67.20 USD overtime location=north", "2026-10-09 wages 44.80 USD overtime location=south", "2026-10-09 wages 260.00 USD overtime location=south",]Paid on the 1st and 16th, the week of October 12 runs across two pay periods: Monday to Thursday's 40 hours at north are in the first, Friday's 10 at south in the second. The second period counts the whole week: its regular rate is 1060.00 for 50 hours, 21.20, and the 10 overtime hours, all Friday's, are owed 106.00 on top. North worked 40 of the week's 50 hours, the earlier period's days counted, and takes 84.80 of it; south 21.20
description = "Paid on the 1st and 16th, the week of October 12 runs across two pay periods: Monday to Thursday's 40 hours at north are in the first, Friday's 10 at south in the second. The second period counts the whole week: its regular rate is 1060.00 for 50 hours, 21.20, and the 10 overtime hours, all Friday's, are owed 106.00 on top. North worked 40 of the week's 50 hours, the earlier period's days counted, and takes 84.80 of it; south 21.20"
punch = [ { at = "2026-10-12 07:00", kind = "in", values = { location = "north" } }, { at = "2026-10-12 17:00", kind = "out" }, { at = "2026-10-13 07:00", kind = "in", values = { location = "north" } }, { at = "2026-10-13 17:00", kind = "out" }, { at = "2026-10-14 07:00", kind = "in", values = { location = "north" } }, { at = "2026-10-14 17:00", kind = "out" }, { at = "2026-10-15 07:00", kind = "in", values = { location = "north" } }, { at = "2026-10-15 17:00", kind = "out" }, { at = "2026-10-16 07:00", kind = "in", values = { location = "south" } }, { at = "2026-10-16 17:00", kind = "out" },]
[policy]zone = "America/Chicago"
[[layer]]id = "semi-monthly"settings = { pay_periods = { month_days = [1, 16] }, week_starts = "monday" }
[[measure]]id = "wages"kind = "money"currency = "USD"
[[rate]]kind = "pay"matches = { location = "north" }amount = 2000currency = "USD"
[[rate]]kind = "pay"matches = { location = "south" }amount = 2600currency = "USD"
[expect.period]day = "2026-10-16"first = "2026-10-16"quantities = [ "2026-10-16 wages 84.80 USD overtime location=north", "2026-10-16 wages 21.20 USD overtime location=south", "2026-10-16 wages 260.00 USD overtime location=south",]With daily overtime past 8 hours and double time past 12, Monday's 14 hours at north are 8 of work, 4 of overtime and 2 of double time; Tuesday's 6 at south are work. The regular rate is 280.00 and 156.00 for 20 hours, 21.80: the overtime premium is 43.60 and the double time premium 43.60. North worked 14 of the 20 hours and takes 30.52 of each, south 13.08, though all of the premium hours were worked at north
description = "With daily overtime past 8 hours and double time past 12, Monday's 14 hours at north are 8 of work, 4 of overtime and 2 of double time; Tuesday's 6 at south are work. The regular rate is 280.00 and 156.00 for 20 hours, 21.80: the overtime premium is 43.60 and the double time premium 43.60. North worked 14 of the 20 hours and takes 30.52 of each, south 13.08, though all of the premium hours were worked at north"
punch = [ { at = "2026-10-05 06:00", kind = "in", values = { location = "north" } }, { at = "2026-10-05 20:00", kind = "out" }, { at = "2026-10-06 08:00", kind = "in", values = { location = "south" } }, { at = "2026-10-06 14:00", kind = "out" },]
[policy]zone = "America/Chicago"pay_periods = { every_days = 7, from = "2026-10-05" }
# Overtime past 8 hours a day and double time past 12, before the weekly# 40; double time paid its straight time and the whole regular rate on top.[[layer]]id = "daily"[[layer.step]]id = "daily"uses = "standard/threshold"params = { tiers = [{ over = "8h", to = "overtime" }, { over = "12h", to = "double_time" }], window = "day" }before = "weekly"[[layer.step]]id = "straight-time"change = "params"params = { premiums = { work = 100, overtime = 100, double_time = 100 } }[[layer.step]]id = "overtime-premium"change = "params"params = { premiums = { overtime = 50, double_time = 100 } }
[[measure]]id = "wages"kind = "money"currency = "USD"
[[rate]]kind = "pay"matches = { location = "north" }amount = 2000currency = "USD"
[[rate]]kind = "pay"matches = { location = "south" }amount = 2600currency = "USD"
[expect]week = "2026-10-05"quantities = [ "2026-10-05 wages 40.00 USD double_time location=north", "2026-10-05 wages 80.00 USD overtime location=north", "2026-10-05 wages 160.00 USD work location=north", "2026-10-06 wages 30.52 USD double_time location=north", "2026-10-06 wages 13.08 USD double_time location=south", "2026-10-06 wages 30.52 USD overtime location=north", "2026-10-06 wages 13.08 USD overtime location=south", "2026-10-06 wages 156.00 USD work location=south",]A company that charges each branch for its share of the overtime hours themselves, not only the premium, replaces the step: the 10 overtime hours are put 6 at north and 4 at south, by the hours worked at each, and the money paid for them goes with them, the 260.00 of straight time and the 112.00 premium each 60 to 40. North is charged its 6 overtime hours at south's pay, as they were paid: the person's pay and hours by category are as before
description = "A company that charges each branch for its share of the overtime hours themselves, not only the premium, replaces the step: the 10 overtime hours are put 6 at north and 4 at south, by the hours worked at each, and the money paid for them goes with them, the 260.00 of straight time and the 112.00 premium each 60 to 40. North is charged its 6 overtime hours at south's pay, as they were paid: the person's pay and hours by category are as before"
punch = [ { at = "2026-10-05 07:00", kind = "in", values = { location = "north" } }, { at = "2026-10-05 17:00", kind = "out" }, { at = "2026-10-06 07:00", kind = "in", values = { location = "north" } }, { at = "2026-10-06 17:00", kind = "out" }, { at = "2026-10-07 07:00", kind = "in", values = { location = "north" } }, { at = "2026-10-07 17:00", kind = "out" }, { at = "2026-10-08 07:00", kind = "in", values = { location = "south" } }, { at = "2026-10-08 17:00", kind = "out" }, { at = "2026-10-09 07:00", kind = "in", values = { location = "south" } }, { at = "2026-10-09 17:00", kind = "out" },]
[policy]zone = "America/Chicago"pay_periods = { every_days = 7, from = "2026-10-05" }
[[layer]]id = "hours"[[layer.step]]id = "spread"change = "replace"uses = "standard/spread_overtime_hours"params = { by = "location" }
[[measure]]id = "wages"kind = "money"currency = "USD"
[[rate]]kind = "pay"matches = { location = "north" }amount = 2000currency = "USD"
[[rate]]kind = "pay"matches = { location = "south" }amount = 2600currency = "USD"
[expect]week = "2026-10-05"allocations = [ "2026-10-05 07:00-17:00 work 10.00 location=north", "2026-10-06 07:00-17:00 work 10.00 location=north", "2026-10-07 07:00-17:00 work 10.00 location=north", "2026-10-08 07:00-17:00 work 10.00 location=south", "2026-10-09 07:00-11:00 overtime 4.00 location=south", "2026-10-09 11:00-17:00 overtime 6.00 location=north",]quantities = [ "2026-10-07 wages 600.00 USD work location=north", "2026-10-08 wages 260.00 USD work location=south", "2026-10-09 wages 67.20 USD overtime location=north", "2026-10-09 wages 156.00 USD overtime location=north", "2026-10-09 wages 44.80 USD overtime location=south", "2026-10-09 wages 104.00 USD overtime location=south",]30 hours at north (20.00) Monday to Wednesday, then 20 at south (26.00) Thursday and Friday: the 10 overtime hours are Friday's, at south. The regular rate is 1120.00 for 50 hours, 22.40, and the premium 112.00. North worked 30 of the 50 hours and takes 67.20 of it; south 20 of 50, 44.80. The straight time stays where it was worked, south's overtime hours too, and the person is paid the same 1232.00
description = "30 hours at north (20.00) Monday to Wednesday, then 20 at south (26.00) Thursday and Friday: the 10 overtime hours are Friday's, at south. The regular rate is 1120.00 for 50 hours, 22.40, and the premium 112.00. North worked 30 of the 50 hours and takes 67.20 of it; south 20 of 50, 44.80. The straight time stays where it was worked, south's overtime hours too, and the person is paid the same 1232.00"
punch = [ { at = "2026-10-05 07:00", kind = "in", values = { location = "north" } }, { at = "2026-10-05 17:00", kind = "out" }, { at = "2026-10-06 07:00", kind = "in", values = { location = "north" } }, { at = "2026-10-06 17:00", kind = "out" }, { at = "2026-10-07 07:00", kind = "in", values = { location = "north" } }, { at = "2026-10-07 17:00", kind = "out" }, { at = "2026-10-08 07:00", kind = "in", values = { location = "south" } }, { at = "2026-10-08 17:00", kind = "out" }, { at = "2026-10-09 07:00", kind = "in", values = { location = "south" } }, { at = "2026-10-09 17:00", kind = "out" },]
[policy]zone = "America/Chicago"pay_periods = { every_days = 7, from = "2026-10-05" }
[[measure]]id = "wages"kind = "money"currency = "USD"
[[rate]]kind = "pay"matches = { location = "north" }amount = 2000currency = "USD"
[[rate]]kind = "pay"matches = { location = "south" }amount = 2600currency = "USD"
[expect]week = "2026-10-05"allocations = [ "2026-10-05 07:00-17:00 work 10.00 location=north", "2026-10-06 07:00-17:00 work 10.00 location=north", "2026-10-07 07:00-17:00 work 10.00 location=north", "2026-10-08 07:00-17:00 work 10.00 location=south", "2026-10-09 07:00-17:00 overtime 10.00 location=south",]quantities = [ "2026-10-07 wages 600.00 USD work location=north", "2026-10-08 wages 260.00 USD work location=south", "2026-10-09 wages 67.20 USD overtime location=north", "2026-10-09 wages 44.80 USD overtime location=south", "2026-10-09 wages 260.00 USD overtime location=south",]The same week with the spread turned off: the 112.00 premium is one amount with no location, and a cost report by location that follows the overtime hours puts it all on south, where the week ended
description = "The same week with the spread turned off: the 112.00 premium is one amount with no location, and a cost report by location that follows the overtime hours puts it all on south, where the week ended"
punch = [ { at = "2026-10-05 07:00", kind = "in", values = { location = "north" } }, { at = "2026-10-05 17:00", kind = "out" }, { at = "2026-10-06 07:00", kind = "in", values = { location = "north" } }, { at = "2026-10-06 17:00", kind = "out" }, { at = "2026-10-07 07:00", kind = "in", values = { location = "north" } }, { at = "2026-10-07 17:00", kind = "out" }, { at = "2026-10-08 07:00", kind = "in", values = { location = "south" } }, { at = "2026-10-08 17:00", kind = "out" }, { at = "2026-10-09 07:00", kind = "in", values = { location = "south" } }, { at = "2026-10-09 17:00", kind = "out" },]
[policy]zone = "America/Chicago"pay_periods = { every_days = 7, from = "2026-10-05" }
[[layer]]id = "no-spread"[[layer.step]]id = "spread"change = "disable"
[[measure]]id = "wages"kind = "money"currency = "USD"
[[rate]]kind = "pay"matches = { location = "north" }amount = 2000currency = "USD"
[[rate]]kind = "pay"matches = { location = "south" }amount = 2600currency = "USD"
[expect]week = "2026-10-05"quantities = [ "2026-10-07 wages 600.00 USD work location=north", "2026-10-08 wages 260.00 USD work location=south", "2026-10-09 wages 112.00 USD overtime", "2026-10-09 wages 260.00 USD overtime location=south",]