Skip to content

Piece rate by job

The rule

Each unit produced (a box packed, a load moved, a garment sewn) pays a set amount, which depends on the work: packing pays one rate, forklift loads another. Rates change from a date; work is paid at the rate in force on its workday.

Who uses it

Agriculture, garment and food production, warehouses and installers: work where output is counted and paid by the unit, alone or on top of hourly pay.

How the recipe does it

Configuration only: a package (package.toml) of one layer running the standard piece_rate step. The rates are the tenant’s setup.

[[layer]]
id = "pieces"
[[layer.step]]
id = "pieces"
uses = "standard/piece_rate"
params = { measure = "boxes", rate = "piece", pay = "pay", category = "piece_pay" }
[[rate]] # one rate per job; the most specific wins
kind = "piece"
matches = { job = "pack" }
amount = 30 # minor units: 30 cents
currency = "USD"

Counts are labor entries of a count measure (boxes), each with its labor context. For each count of the day, piece_rate asks for the rate of the kind rate on that count’s context and workday (ctx:rate), and adds the count times the rate as money (ctx:add_quantity) in the measure pay. Of the rates whose values the work has, the one naming the most wins; a rate naming none is the default; two naming as many is an exception (rate_ambiguous), and nothing is paid until it is settled. With each instead of rate, every unit pays the same: a plant paying one rate replaces the step in a layer of its own with each = 20.

A corrected count replaces the first (replaces), and the money follows.

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 pay: 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

ParameterMeaning
measureThe count measure paid for.
rateThe rate kind to look up, matched on each count’s context.
eachInstead of rate: one amount per unit, in minor units.
payThe money measure the pay is added in.
categoryThe category of the pay.

What the scenarios show

  • each-job-at-its-rate: packing at 30 cents, forklift at 50, and a job without a rate of its own at the default 25.
  • a-raise-from-a-date: Tuesday at the old rate, Wednesday at the new.
  • one-rate-for-everything: each = 20, and a recount replacing a count.

This is a common way companies implement piece-rate pay; check the rules where you operate. Many places require piece-rate earners to make at least the minimum wage for all hours worked, and some require separate pay for rest and other non-productive time.

Get the recipe

The recipe’s package and its scenarios are in the example packages repository: attendance/piece_rate. 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:

piece_rate/package.toml
name = "piece_rate"
version = "1.0.0"
description = "Pay for each unit produced, at a rate matched on the work's context (the job, the line, the assignment), changing from a date."
# What the tenant must have set up for the recipe: the steps read these by name.
[needs]
measures = ["pay"]
# Each box counted is paid at the piece rate for its work: the rate that
# names the most of the work's context wins.
[[layer]]
id = "pieces"
[[layer.step]]
id = "pieces"
uses = "standard/piece_rate"
params = { measure = "boxes", rate = "piece", pay = "pay", category = "piece_pay" }

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 packing rate goes from 30 to 35 cents a box on Wednesday: Tuesday's boxes are paid at the old rate, Wednesday's at the new, each by the rate in force on its workday
scenarios/a-raise-from-a-date.toml
description = "The packing rate goes from 30 to 35 cents a box on Wednesday: Tuesday's boxes are paid at the old rate, Wednesday's at the new, each by the rate in force on its workday"
[policy]
zone = "America/Chicago"
[[measure]]
id = "boxes"
kind = "count"
[[measure]]
id = "pay"
kind = "money"
currency = "USD"
[[rate]]
kind = "piece"
matches = { job = "pack" }
amount = 30
currency = "USD"
to = "2026-10-06"
[[rate]]
kind = "piece"
matches = { job = "pack" }
amount = 35
currency = "USD"
from = "2026-10-07"
[[labor]]
workday = "2026-10-06"
measure = "boxes"
quantity = 100
category = "pieces"
values = { job = "pack" }
[[labor]]
workday = "2026-10-07"
measure = "boxes"
quantity = 100
category = "pieces"
values = { job = "pack" }
[expect]
week = "2026-10-05"
quantities = [
"2026-10-06 boxes 100 pieces job=pack",
"2026-10-06 pay 30.00 USD piece_pay job=pack",
"2026-10-07 boxes 100 pieces job=pack",
"2026-10-07 pay 35.00 USD piece_pay job=pack",
]
Boxes counted per job: packing pays 30 cents a box and forklift loads 50, matched on each count's job; a job with no rate of its own, labeling, is paid by the rate that names nothing, 25 cents
scenarios/each-job-at-its-rate.toml
description = "Boxes counted per job: packing pays 30 cents a box and forklift loads 50, matched on each count's job; a job with no rate of its own, labeling, is paid by the rate that names nothing, 25 cents"
[policy]
zone = "America/Chicago"
[[measure]]
id = "boxes"
kind = "count"
[[measure]]
id = "pay"
kind = "money"
currency = "USD"
[[rate]]
kind = "piece"
matches = { job = "pack" }
amount = 30
currency = "USD"
[[rate]]
kind = "piece"
matches = { job = "forklift" }
amount = 50
currency = "USD"
# The default: a rate that names no value matches any work, and loses to
# any rate that names one the work has.
[[rate]]
kind = "piece"
amount = 25
currency = "USD"
[[labor]]
workday = "2026-10-05"
measure = "boxes"
quantity = 100
category = "pieces"
values = { job = "pack" }
[[labor]]
workday = "2026-10-05"
measure = "boxes"
quantity = 12
category = "pieces"
values = { job = "forklift" }
[[labor]]
workday = "2026-10-05"
measure = "boxes"
quantity = 40
category = "pieces"
values = { job = "label" }
[expect]
week = "2026-10-05"
quantities = [
"2026-10-05 boxes 12 pieces job=forklift",
"2026-10-05 boxes 40 pieces job=label",
"2026-10-05 boxes 100 pieces job=pack",
"2026-10-05 pay 6.00 USD piece_pay job=forklift",
"2026-10-05 pay 10.00 USD piece_pay job=label",
"2026-10-05 pay 30.00 USD piece_pay job=pack",
]
A plant that pays one rate for every box needs no rate table: each = 20 pays 20 cents a box, whatever the job; a corrected count replaces the first
scenarios/one-rate-for-everything.toml
description = "A plant that pays one rate for every box needs no rate table: each = 20 pays 20 cents a box, whatever the job; a corrected count replaces the first"
[policy]
zone = "America/Chicago"
# A plant that pays one rate for every box: 20 cents each.
[[layer]]
id = "one-rate"
[[layer.step]]
id = "pieces"
change = "replace"
uses = "standard/piece_rate"
params = { measure = "boxes", each = 20, pay = "pay", category = "piece_pay" }
[[measure]]
id = "boxes"
kind = "count"
[[measure]]
id = "pay"
kind = "money"
currency = "USD"
[[labor]]
id = "l1"
workday = "2026-10-05"
measure = "boxes"
quantity = 90
category = "pieces"
values = { job = "pack" }
# The supervisor recounts: 95, not 90.
[[labor]]
id = "l2"
workday = "2026-10-05"
measure = "boxes"
quantity = 95
category = "pieces"
values = { job = "pack" }
replaces = "l1"
recorded = "2026-10-06 09:00"
[expect]
week = "2026-10-05"
quantities = [
"2026-10-05 boxes 95 pieces job=pack",
"2026-10-05 pay 19.00 USD piece_pay job=pack",
]