The pay and bill engine prices shifts. For every shift it picks one rate card, interprets the paid time under the card's policy, finds the matching rate sheet and lines, applies line modifiers and shift overrides, and writes b3s__Pay_Bill_Staging__c rows per side:
| Side | Staging Type__c |
Who | Invoiced |
|---|---|---|---|
| Worker pay | Pay |
the worker (Payee_Contact__c) |
never |
| Supplier pay | Supplier |
the supplying vendor (Payee_Account__c = the shift's supplier) |
as a self-bill |
| Client bill | Bill |
the client | as a client invoice |
This is rating, not net pay. Every result explains itself through a trace (card, policy, sheet, priced segments with their lines and modifiers, warnings), which the Rate Card Studio and the Shift Rate Previewer render.
Run it in one of these ways:
PayBillEngine.run(shiftIds), the Interpret Now button on the Shift Rate Previewer, or a period batch from the Pay/Bill Runner. Writes staging lines, time segments, shift totals and the trace.PayBillEngine.estimate(shiftIds, rateCardId), PayBillEngine.simulate(shiftIds), the Shift Rate Previewer or Try a shift in the Rate Card Studio. Same pricing rules, zero DML.A shift whose lines are already on an issued invoice or exported to payroll is re-priced automatically when a billing-relevant field changes (see Locked lines and the staging ledger).
Rate_Card__c scope lookups, Status, Valid From/To, Priority, Currency, Pay_Bill_Setting
└─ Rate_Sheet__c Condition, Sort_Order, Is_Default ("ST Teacher 1 · PAYE")
└─ Rate_Line__c Unit, Pay_Code, Days, Start/End time, Condition, Sort_Order,
│ Worker_Pay, Supplier_Pay, Client_Bill ("Full Day", "Night")
│ Base_Rate, Margin, Formulas (optional: rates as formulas)
└─ Rate_Modifier__c Group, Condition, Sort_Order, per side Operation + Value, Base / Margin Operation + Value ("Inner London")
Shift__c ──< Pay_Bill_Staging__c Type = Pay | Supplier | Bill
──< Time_Segment__c interpreted time (Final only)
Custom Metadata (Setup, version controlled):
b3s__Pay_Bill_Setting__mdt: the interpretation policy (time source, rounding, breaks paid, week start, holiday calendar, accumulation rules and accumulate statuses, card hierarchy).b3s__Pay_Code__mdt: pay codes (Standard, OT_1_5, OT_2_0, Night, Weekend, Public_Holiday, Call_Out, Standby, Sleep_In, Session, Missed_Break, Holiday_Pay, Cancellation, VMS_Fee) with a category, whether the code counts toward overtime, and per side multipliers (blank means 1). The package ships only Missed_Break and VMS_Fee (the engine emits them). Create the other pay codes you use, and your Rate_Condition__mdt condition templates, before building rate cards: a rate line whose pay code has no record fails pricing with Unknown pay code.b3s__Holiday_Calendar__mdt + b3s__Holiday__mdt: public holiday calendars (Includes__c pulls in other calendars, Day_Start_Offset_Minutes__c moves the holiday window, for example -60 starts it at 23:00 the evening before).b3s__Rate_Condition__mdt: reusable condition templates for the Studio.b3s__Rate_Card_Item__c and the card's old base rate, overtime, rounding, time source and plugin fields no longer price anything. The item object stays in the package (released global types reference it) but is hidden.
Card. Candidates are Status__c = Active cards effective on the shift's site-local start date whose every populated scope lookup equals the shift's value: Contact, Job, Job Group (the job's group), Site, Cost Center, Account (level Account: the job's account or the site's account; level ParentAccount: the job account's parent or the site account's parent). The break engine resolves rulesets on the same accounts. A card with no scope lookups applies to every shift. The most specific card wins, ranked by the policy hierarchy (Hierarchy__c, default Contact,Job,JobGroup,Site,Account,ParentAccount,CostCenter; Job Group is inserted after Job when a configured list omits it). Then Priority__c (lower wins, blank last). Two cards still tied fail the shift with an error naming both. One card prices the whole shift.
Policy. The Pay_Bill_Setting__mdt named on the card (Pay_Bill_Setting__c), else the setting named Default, else the only setting. No settings at all means built-in defaults (scheduled time, no rounding, Monday weeks, unpaid breaks, no calendar, no accumulation). Several settings and none named fails the shift.
Paid window and breaks. Shift Billable_Start_Time__c / Billable_End_Time__c win when set (an input override written by a user, Flow or integration, e.g. client-adjusted times; each field wins on its own, timeSource = Billable). Otherwise the policy time source: Scheduled (label Prefer Scheduled, default) or Actual (label Prefer Actual, each actual falls back to scheduled). Approval does not gate the source: whoever approves (client, internal, other) sets the billable times or the actuals. The window is rounded by the Shift Rounding Engine with the policy's Rounding_Interval__c, Start_Rounding__c, End_Rounding__c. Breaks are carved per side: Pay honours Is_Paid__c, Bill and Supplier honour Is_Billable__c, and policy Breaks_Paid__c disables carving. When both carves agree the shift is priced once for all sides.
Calendar. Site__c.Holiday_Calendar__c, else the policy's Holiday_Calendar__c. An unknown calendar fails the shift. Runtime $dayType is Public Holiday or the weekday name.
Sheet. Sheets by Sort_Order__c, default sheets last; the first whose condition is true. None fails the shift ("No rate sheet matches"). There is no fall through to another sheet.
Lines (the sheet's lines by Sort_Order__c):
Lines whose pay code category is Allowance are additive: each matching one emits.
Otherwise the first matching Per Shift or Per Day line prices the whole shift (quantity 1). A line matches when its condition is true, Days__c contains the local start weekday (or Public Holiday on a holiday) and its window contains the local start time.
Otherwise Per Hour: every worked minute goes to the first Per Hour line whose days, window and condition match that minute. Time no line claims fails the shift ("No rate line for 2026-07-06 08:00–09:00 (Monday)").
Elastic bands (Band_Mode__c, Per Hour lines, Allowance lines included): Standard (default) matches each minute by its own time. Start Anchored matches every minute of the shift when the line matches (days, window, condition) at the first worked minute; End Anchored uses the last worked minute (a shift ending exactly at 06:00 counts as ending at 05:59, so inside a 20:00–06:00 night band). Sort order still decides: an earlier Standard line (for example Public Holiday) keeps its minutes. Anchor every band line on the sheet: an anchored Night line alone leaves the night part of a day-start shift unclaimed, which fails the shift. Accumulation re-codes on top, so overtime on a night-anchored shift is night rate times the overtime multiplier (unless the sheet has its own overtime line). Anchors are taken per side carve, so a break at the very edge of the shift can move them.
| Shift | Day 06–20, Night 20–06, both Start Anchored |
both End Anchored |
|---|---|---|
| 22:00–08:00 | 10h Night | 10h Day |
| 18:00–23:00 | 5h Day | 5h Night |
Lines coded with an Overtime category pay code or Missed_Break never claim worked time. They only price re-coded minutes and premiums.
Per Day charges once per worker per local date per card: the day's first shift carries it, later shifts that day show "charged on shift X". An earlier shift counts as charged when it has any effective staging line (Pay, Supplier or Bill; not a reversal and not reversed) priced by a Per Day line, the same in one batch as across runs.
Windows: both times blank is all day, End at or before Start runs overnight. Days__c and $dayType use the date of each minute.
Accumulation (Per Hour only). Policy Accumulation_Rules__c, for example [{"payCode":"OT_1_5","period":"week","thresholdHours":40},{"payCode":"OT_2_0","period":"day","thresholdHours":12}]. Periods: shift, day, week (policy Week_Start_Day__c). Minutes whose pay code counts toward overtime accrue; minutes above a threshold are re-coded from the end of the time backwards, and the first listed rule wins a minute claimed by several. Day and week counters are seeded from the worker's earlier shifts, the same whether they sit in the same run or were priced before, so the result does not depend on batch composition:
Rejected shifts never count. Policy Accumulate_Statuses__c narrows it further: a comma-separated list of Approval Status values, for example Submitted,Approved (use None for a shift with no approval status yet). Blank counts every earlier shift that is not rejected.Time_Segment__c) whose pay code counts toward overtime (Counts_Toward_Overtime__c), plus minutes already re-coded to an Overtime category code. Standby, sleep-in or travel hours on a non-counting code therefore do not push later shifts into overtime. An earlier shift with no segments counts all its worked minutes (actual, else scheduled, window minus unpaid breaks). A re-coded minute is priced by the first matching Per Hour line with that pay code, else by the line that claimed it times the pay code's side multipliers.Missed-break premiums. Detected against the shift's Break Ruleset (actual times only, see the break engine). Each violation emits quantity = premium hours on pay code Missed_Break, priced by a Per Hour Missed_Break line, else the claiming (or first Standard) Per Hour line times Missed_Break's multipliers. Pay only, plus Supplier and Bill when the ruleset marks premiums billable.
Modifiers (per line, by Sort_Order__c). Within a Group__c (blank = its own group) the first modifier whose condition is true wins; every group can apply. Each side (and, on formula lines, the base) applies its operation to the running value: Set, Add, Subtract, Multiply, Divide. A blank operation leaves the side unchanged; Set on a blank side creates it; other operations on a blank side leave it blank (warning).
Overrides. Worker_Pay_Override__c, Supplier_Pay_Override__c, Client_Bill_Override__c on the shift replace that side's unit rate on time and session lines only (lines that claim worked time or price the whole shift). Allowance-category lines and Missed_Break premiums keep their own line rates. Overtime-coded (re-coded) minutes on an overridden side are priced override x the pay code's side multiplier, whether or not the sheet has a line for that pay code (that line's own rate is ignored for the overridden side). Override_Reason__c shows in the trace.
Money. The unit rate is rounded once to the card currency's minor units (half up), then total = quantity x unit rate, rounded half up. A blank side emits no line for that side, never a zero line. A Supplier line also needs a supplier on the shift.
Output. Staging lines carry Type__c, Pay_Code__c, Rate_Card__c, Rate_Sheet__c, Rate_Line__c, Applied_Rule__c (sheet › line › modifiers › note), Time_Segment__c, quantity, unit (Hours or Each), rate, currency, total, plus the invoicing context: Client_Account__c (the shift's job account, else its site account) and Work_Date__c (the shift's Site_Scheduled_Start_Date__c), plus SBU__c (the shift's business unit, blank when SBU mode is off). Invoicing filters on these fields, not on the shift. When a VMS access fee applies, one negative VMS_Fee Supplier line is added (see VMS access fee). Shift rollups: Total_Pay__c, Total_Supplier__c, Total_Bill__c, Overtime_Hours__c / Double_Overtime_Hours__c (pay hours on Overtime-category codes, 2x and above counted as double), Currency__c, Pay_Bill_Status__c. Final also writes one Time_Segment__c per priced block and Pay_Bill_Trace__c. The engine never writes Billable_Start/End_Time__c (input only); the rounded window is on the result (billableStart / billableEnd), the segments and the trace. A change to either billable field re-interprets an invoiced shift like any other time change. Segments follow the ledger: a shift gets new segments only when new lines are inserted for it, and an old segment is deleted only when no surviving line (invoiced or manual) still points at it, so invoiced lines and their reversals keep the segment they were priced from.
Cancelled shifts and shifts with Approval Status Rejected produce no lines. Failures are per shift (Pay_Bill_Status__c = Failed, the error in the result and in Pay_Bill_Trace__c); the rest of the batch still prices.
The Supplier line's payee is Shift__c.Supplier_Account__c. VMS stamps it when a proposal is approved (the filled shift, the demand's child shift, and the shifts generated for a placement). For older shifts the engine falls back to the vendor of the converted Worker_Proposal__c (shift or its working pattern), then to the contact's account on VMS shifts.
Master vendor. Tick Account.Is_Master_Vendor__c on the one account that runs the VMS (the agency). When the resolved payee is that account, by any of the routes above, the shift has no supplier: its workers are internal, so the engine emits Pay and Bill lines only and no self-bill is ever raised to the master vendor. Only one account per org can carry the flag: a second one fails to save with a duplicate value error. Invoicing excludes Supplier lines payable to the master vendor as a safety net (see invoicing).
Sub-vendors can pay a percentage fee for taking part in the VMS. After a shift's Supplier lines are priced, the engine adds one more Supplier line per shift and payee:
| Field | Value |
|---|---|
Pay_Code__c |
VMS_Fee (pay code category Fee) |
Quantity__c / Unit__c |
1 / Each |
Rate__c = Total__c |
minus (supplier total x percentage), rounded to the currency |
Payee_Account__c |
the same vendor |
Applied_Rule__c |
VMS access fee 2 % |
The percentage is Account.VMS_Fee_Percent__c on the vendor when set (0 waives it), else Invoice_Configuration__c.VMS_Fee_Percent__c on the client's self-billing invoice configuration (its own active configurations, else the active defaults; new configurations default to 2). Configurations that disagree for one client fail the shift with an error naming the values: align them or set the vendor's percentage. No supplier (internal or master vendor workers) means no fee. Total_Supplier__c on the shift is net of the fee.
The fee is an ordinary staging line, so credits, Amend Existing and Delta as New carry it unchanged, and the self-bill always shows it as its own line (VMS access fee 2 %), whatever the group rules. The Vendor Portal Revenue tab shows it as a negative line. Tax options:
Client_Account__c is the vendor.One Shift field exists only for rate conditions; the engine does not set it:
Shift__c.Supplier_Account_Tier__c (Number): the supplying vendor's tier, stamped on approval from the winning invite's Tier__c (the vendor's tier from its VMS_Sharing_Group_Assignment__c at broadcast) onto the filled or child shift and the placement (Working_Pattern__c.Supplier_Account_Tier__c), and copied onto every shift generated for the placement. Blank means an internal (master vendor) worker. Example modifier condition: {"field":"b3s__Supplier_Account_Tier__c","operator":"equals","value":2}.A card is static (every rate typed, the default) or uses formulas, chosen per line: a line without Formulas__c prices exactly as above. Formulas suit cards built from pricing rules (mass updates, visible margins); static suits cards where every rate is negotiated. One line can mix both: a key without a formula uses its number field.
| Field | Holds |
|---|---|
Base_Rate__c |
Input base, for example the band's PAYE rate |
Margin__c |
Input margin, for example the commercial margin |
Formulas__c |
JSON, name → formula, for keys base, margin, pay, supplier, bill |
Modifier Base_Operation__c / Base_Value__c |
Set / Add / Subtract / Multiply / Divide on base (for example Inner London: Set 120) |
Modifier Margin_Operation__c / Margin_Value__c |
The same on margin (for example a supplier channel: Set 35 when Supplier_Account__c is the sub-supplier) |
Formula language: numbers, + - * /, parentheses, round(x, places), min(...), max(...), the names base, margin, pay, supplier, bill (case-insensitive) and line('Full Day').base for another line on the same sheet. Decimal arithmetic throughout (division to 10 places); the unit rate is still rounded once at the end.
Each value of a line resolves as: its formula if set, else its number field; then the matched modifiers' operation for it; then, for the three sides, the shift override. Formulas read final values, so bill = base * 1.2 + margin follows a Base modifier and a pay override flows into bill = pay + margin. line(...) evaluates that line under the same shift and minute. A loop (bill reads supplier reads bill), an unknown name, a blank input, bad JSON or a missing line fails the shift with the line and formula in the error.
The trace segment of a formula line adds formulas (name → formula) and inputs (base, margin).
Northwind Academy Trust (NAT) Teacher 1, with illustrative rules (Umbrella = PAYE x 1.2, Charge = base x 1.2 + margin, half day base and margin 50% of the full day):
Sheet Teacher 1 Rate Group = NAT_TEACHER_1 AND Engagement in (PAYE, Umbrella)
Line Full Day Per Shift Base 100 Margin 30
{"pay":"base","bill":"base * 1.2 + margin","supplier":"bill"}
Modifier [Engagement] Umbrella Pay Multiply 1.2
Modifier [Location] Inner London Base Set 120
Line Half Day Per Shift {"base":"line('Full Day').base * 0.5","margin":"line('Full Day').margin * 0.5",
"pay":"base","bill":"base * 1.2 + margin","supplier":"bill"}
Modifier [Engagement] Umbrella Pay Multiply 1.2
| Shift | Pay | Bill |
|---|---|---|
| PAYE, Full Day | 100.00 | 150.00 |
| Umbrella, Half Day, Inner London | 72.00 | 87.00 |
A rate the rules don't produce stays a hard number: a Set modifier for the case it covers, placed before the rule modifier in the same group (for example NAT TA 1: "Umbrella (Standard)", Pay Set 90.00, and "Charge (Standard)", Bill Set 115.00).
A different margin per channel (for example Direct vs Suppliers) is one Margin modifier on the Full Day line; a Half Day line whose margin is line('Full Day').margin * 0.5 follows it.
The Rate Card Studio edits all of this: Base rate, Margin and the five formulas in the line form, Base / Margin operations in the modifier form, and the grid shows calculated values (see The grid).
Overtime is set up in two places: the policy decides which hours are overtime, and the rate card decides how much each side gets for them.
Which hours. Accumulation_Rules__c on the card's Pay_Bill_Setting__mdt (see Pipeline, step 7). List the most expensive rule first: when two rules claim the same minute, the first listed wins. Daily, weekly and per shift rules can be combined:
[
{ "payCode": "OT_2_0", "period": "day", "thresholdHours": 10 },
{ "payCode": "OT_1_5", "period": "day", "thresholdHours": 8 },
{ "payCode": "OT_Weekly", "period": "week", "thresholdHours": 40 }
]
A weekly rule's counter includes hours already re-coded to overtime by a daily rule.
How much. A re-coded minute is priced from one of these, in this order:
| Source | Set up | Use when |
|---|---|---|
| Overtime line | A Per Hour line coded with the overtime pay code on the sheet, with its own rates or formulas (for example "pay":"line('Hourly').pay * 1.5","bill":"line('Hourly').bill * 1.5","supplier":"bill","margin":"bill - pay"). line('Hourly') includes that line's selected modifiers, so give the overtime line no modifiers of its own. It never claims worked time. |
A client agrees its own overtime rates, or bill and pay use different factors. |
| Pay code multipliers | Worker_Pay_Multiplier__c, Supplier_Pay_Multiplier__c and Client_Bill_Multiplier__c on Pay_Code__mdt, applied to the rate of the line that claimed the minute, after its modifiers. |
The factor is the same everywhere. |
| Shift override | An overridden side is the override times the pay code's multiplier for that side. | One-off cases. |
Overtime on night or public holiday time. The multiplier route stacks: a night minute over the threshold is the Night rate times the overtime multiplier. An overtime line replaces the claiming rate, so with Night or Public Holiday lines give each its own overtime line, with the same days, window or condition, or use multipliers.
Pay overtime, bill straight time (not back to back). Use a pay code whose Client_Bill_Multiplier__c is 1 (and Supplier_Pay_Multiplier__c 1 or 1.5, depending on whether the sub-vendor is paid the premium). Alternatively, give the overtime line a bill formula of line('Hourly').bill. Never leave the bill side of an overtime line blank: a blank side produces no Bill line, so those hours are not billed at all.
Shift totals and reporting. Overtime_Hours__c counts Pay hours on Overtime-category codes whose worker pay multiplier is below 2. Double_Overtime_Hours__c counts those at 2 or above. Both can be columns on the backing sheet. To print overtime as its own invoice lines, add b3s__Pay_Code__c as a group rule (template Group By Worker And Pay Code). The invoice shows the pay code's developer name, not Invoice_Label__c.
Rate Card Studio. Overtime lines are ordinary lines, so the Grid shows each as its own column group (Pay, Bill, Margin) next to Hourly. Multiplier-only overtime is not shown in the Grid; it shows in the estimate trace.
Sheets, lines and modifiers use the matcher JSON of app definitions:
{
"allOrSome": "all",
"selectors": [
{
"field": "b3s__Rate_Group__r.b3s__Code__c",
"operator": "equals",
"value": "ST_T1"
},
{
"field": "b3s__Contact__r.b3s__Engagement_Type__c",
"operator": "equals",
"value": "PAYE"
}
]
}
Paths start at the Shift (up to five lookups, with or without the b3s__ prefix). Runtime values: $dayType, $payCode, $durationHours (worked hours), $localDate, $localStartTime. A blank condition is true. A malformed condition or unknown path fails only the shifts priced by that card.
Card Riverside Learning Federation - ST Teacher (Job = ST Teacher, policy VMS_Default, GBP), with illustrative rates:
Sheet ST Teacher 1 · PAYE Rate Group = ST_T1 AND Engagement = PAYE
Line Full Day Per Shift Rate_Basis = Full Day Pay 100.00 Bill 135.00
Line Half Day Per Shift Rate_Basis = Half Day Pay 50.00 Bill 70.00
Sheet ST Teacher 1 · Umbrella Rate Group = ST_T1 AND Engagement = Umbrella
Line Full Day Per Shift Rate_Basis = Full Day Pay 120.00 Bill 135.00
Modifier [Tier] Tier 2 Supplier tier 2 Pay Set 122.00 Supplier Set 128.00 Bill Set 150.00
| Shift | Lines |
|---|---|
| PAYE, Full Day | Pay 100.00, Bill 135.00 (no Supplier line: blank side) |
| PAYE, Half Day | Pay 50.00, Bill 70.00 |
| Umbrella, Full Day | Pay 120.00, Bill 135.00 |
| Umbrella, Full Day, Tier 2 supplier | Pay 122.00, Supplier 128.00 (payee: the supplier), Bill 150.00 |
Rate basis lines match the shift's b3s__Rate_Basis__c value. Which values a job may use, and the times each value pre-sets, are set by Rate basis templates; templates never change pricing. Shifts generated from a working pattern take the pattern day's Rate Basis first, then the pattern's, then the booking request's, so one placement can mix Full Day and Half Day days. For a Rate Basis value you add to the value set yourself, add a line with a condition on that value (no condition template ships for it).
Two half days at two schools on the same day both pay (Per Shift). Location pricing is a Location modifier (in the formula example above, Inner London: Pay 100.00 → 120.00, Bill 150.00 → 174.00); a combined "Inner London AND Tier 1" row placed first in the Tier group handles typed combinations.
PayBillEngine.InterpretationResult (all @AuraEnabled): lines, errors (and error), trace, timeSource, timezoneName, billableStart, billableEnd, rounded, breaks, breakTrace, premiumHours, currencyCode. The trace:
{
"card": {
"id": "a0X...",
"name": "Riverside Learning Federation - ST Teacher",
"reason": "Most specific active card: matched on Job"
},
"policy": "VMS_Default",
"currency": "GBP",
"sheet": {
"id": "a0Y...",
"name": "ST Teacher 1 · Umbrella",
"condition": "Rate Group ▸ Code is ST_T1 and ..."
},
"segments": [
{
"start": "2026-07-09T07:00:00.000Z",
"end": "2026-07-09T14:00:00.000Z",
"quantity": 1,
"unit": "Each",
"payCode": "Standard",
"note": null,
"line": { "id": "a0Z...", "name": "Full Day" },
"modifiers": [
{ "id": "a10...", "name": "Tier 2", "group": "Tier" }
],
"rates": { "pay": 122.0, "supplier": 128.0, "bill": 150.0 }
}
],
"warnings": []
}
The Shift Rate Previewer and the Rate Card Studio's Try a shift render this trace. An estimate can force a specific card (Draft or out of scope allowed, with warnings) or price an unsaved, made-up shift; breaks are not part of a hypothetical shift.
ShiftRoundingEngine.run(shiftIds) / simulate(shiftIds) pick each shift's card the same way, apply the billable override / policy time source and rounding, and return the rounded window. Neither writes the shift (run is a deprecated alias of simulate). No card means no rounding. Rounding happens on the site's local wall clock, DST safe. compute(card, ...) rounds with the policy of the given card.
A staging row is locked once it sits on a numbered (issued) invoice or has been exported to payroll (Status__c = Processed, set by the payroll export). A locked row is never deleted or rewritten, only its Status__c may change. A shift edited after its pay was exported therefore keeps the exported line and gets a reversal plus the new line, and the next payroll export picks up the delta instead of the correction being lost.
Is_Manual__c) are always kept.Correction_Of__c) and the new rows are inserted.Reversals and reposts copy Client_Account__c, Work_Date__c and SBU__c from the original line, so a correction is invoiced by the same legal entity as the original. Lines written before those fields existed are stamped from their shift when the package is upgraded.
Lines created before this release carry the vendor on Pay lines; the first re-price of such an invoiced shift reverses them and writes Supplier lines.
When an Interpreted shift changes Status to Cancelled, Approval Status away from Approved or to Rejected, or any field in the Pay/Bill Setting's Invoice Affecting Fields (Invoice_Affecting_Fields__c, JSON array of Shift field API names), a background re-price is queued (auto breaks are regenerated first unless the shift is approval locked). This applies to every interpreted shift, invoiced or not. The package default list is scheduled, actual and billable start and end, contact, job, site, cost center, rate group, rate basis, supplier account and the three rate overrides. When several settings define the list they are combined; unknown names are ignored.
The re-price covers the shift's affected set, not only the edited shift:
| Included | Why |
|---|---|
| The edited shift | Its own lines change. |
| Other interpreted shifts of the same worker that start on a site-local date the shift covers | Day accumulation and the Per Day charge, which belongs to the first shift of the day. |
Later interpreted shifts of the same worker in the same policy week, when the policy has a week accumulation rule |
Weekly overtime is carved from the end of the week, so a change on Monday re-codes Friday. The week starts on the policy's Week_Start_Day__c (default Monday). |
The old values count too: moving a shift to another date or worker also re-prices the old day and week. Cancelled, rejected and never-interpreted shifts are never pulled in. Per shift in the set, unlocked lines are rewritten (a draft invoice they sat on is deleted, so the next generate rebuilds it from the new lines) and locked lines are corrected through the ledger (reversal plus new lines, or nothing when the result is unchanged).
Unprocess puts interpreted shifts back to Pending so they can be fixed and re-processed by the next run. It deletes the shifts' non-manual staging lines (with any draft invoice they sat on) and their time segments, and clears Total Pay, Total Supplier, Total Bill, overtime hours and the trace. The shifts' affected set (see above) is unprocessed too, so the next run re-prices the worker's week in order. The Shift Management Studio Unprocess bulk action shows the count first.
Interpreted; the confirmation says how many.An Interpreted shift is payrolled and locked on every save path. Only fields in the Pay/Bill Setting's Editable After Payroll Fields (Editable_After_Payroll_Fields__c; default comments, internal comments, rejection reason, query comment, PO number and the clock exception authorisation fields) change freely; any other change needs the Edit Payrolled Shifts custom permission (in WFM Admin), or Edit Invoiced Shifts / Edit Posted Shifts once the lines are on a draft or numbered invoice or exported. Portal users cannot override the lock. For an approved data fix, an administrator can turn on Bypass Ledger Locks on their own user-level WFM setting (see Invoicing). See Shift management studio for the full table.
Example Invoice_Affecting_Fields__c value (a shorter list than the default):
[
"b3s__Scheduled_Start_Time__c",
"b3s__Scheduled_End_Time__c",
"b3s__Actual_Start_Time__c",
"b3s__Actual_End_Time__c",
"b3s__Billable_Start_Time__c",
"b3s__Billable_End_Time__c",
"b3s__Contact__c",
"b3s__Work_Job__c"
]
Open Payroll in either the 3B WFM or 3B VMS app for a global run. The packaged app page hosts Pay/Bill Runner without an Account context. Select the period and Pay/Bill Setting, optionally select an SBU, review the preview, then click Run Interpretation. The WFM Admin permission set makes the tab visible. This creates pay/bill staging lines; it does not transfer wages or export payroll.
The Pay/Bill Runner component runs Final for a period in batches, stamping every staging line and time segment with the Pay_Bill_Run__c. Place it on:
Scope__c = Account). It takes the shifts whose job account or site account is that account. The rules are the account's single invoice configuration's Interpretation Rules, else the picked Pay/Bill Setting's, else every shift.Scope__c = Global, Context_Record_Id__c = GLOBAL). It takes every account's shifts. The rules are the picked Pay/Bill Setting's only: per-account invoice configuration rules are ignored in global mode. Use an account run for an account whose configuration has its own rules. The preview lists the shift count per account (job account, else site account).Selection, in both modes:
| Part | Rule |
|---|---|
| Period | Site_Work_Date__c (site-local scheduled start date, else actual start date) between period start and end. This is the same date the Studio and invoicing use. |
| Include earlier unprocessed shifts (default on) | Also takes shifts dated before the period start whose Pay_Bill_Status__c is Pending or Failed, so late entries and late approvals are not left behind. The preview shows how many came from earlier periods. |
| Re-price already interpreted shifts (default off) | Off: Interpreted shifts are skipped, so a re-run does not rebuild lines or draft invoices finance is reviewing. On: they are re-priced too. To re-price a single shift use Interpret Now or unprocess it. |
| SBU (SBU mode only, default All SBUs) | Only shifts whose b3s__SBU__c is the picked business unit. Stored on the run (Pay_Bill_Run__c.SBU__c, shown after the period in the run list); reversal and re-run keep it. One unit per run: start one run per unit for a multi-entity payroll. |
Both choices are stored on the run (Include_Earlier_Unprocessed__c, Reprice_Interpreted__c) with the rules (Shift_Filter__c). Reverse uses the stored scope, period and rules. For a run with the late sweep it also covers earlier shifts modified since the run started, and only lines stamped with that run are removed. Re-run uses the runner's current checkboxes. Runs can be reversed, re-run and deleted as before. Reverse deletes the run's unlocked lines and resets each affected shift to Pending with Total Pay, Total Supplier, Total Bill, overtime hours and the trace cleared; locked lines (invoiced or exported) are skipped and their shift is not reset.
Approved expenses (b3s__Expense__c) are paid and billed through the same staging ledger as shifts. The run interprets them after its shifts.
| Field | Use |
|---|---|
Account__c (Client Account) |
Client the expense is billed to. When blank it is stamped on save: placement job account, else placement site account, else the shift's job account, else its site account. It is re-derived when the placement or shift changes and the account is not changed in the same save. |
Shift__c |
Optional shift the expense belongs to. Supplies the account and the vendor when there is no placement. |
Treatment__c |
Payable and Billable (default), Payable (reimburse the worker only) or Billable (recharge the client only). |
Bill_Amount__c |
What the client is billed. Defaults to Total Value and follows Total Value while the two are equal; set it explicitly to bill a different amount. There is no markup: the bill amount is explicit. |
Net_Value__c, Tax_Value__c |
Receipt net and tax, informational. Interpretation uses Total Value and Bill Amount. |
Receipt_Required__c |
Checkbox for forms, Flows or validation rules that require a receipt before approval. |
Pay_Bill_Status__c |
Pending (default; blank counts as Pending), Interpreted or Failed. History tracked. |
| Treatment | Lines |
|---|---|
| Payable | Pay line to the worker for Total Value. A Supplier line to the vendor for the same amount when the worker is vendor-supplied. No VMS fee. |
| Billable | Bill line to the client for Bill Amount. |
| Payable and Billable | Both of the above. |
Every line has Expense__c set and no Shift__c, so re-pricing a shift never touches expense lines. Other values: Pay_Code__c = Expense_<Category> (for example Expense_Travel), quantity 1, unit Each, rate = total, Currency__c from the expense, Client_Account__c = the expense account, Work_Date__c = Date_of_Expense__c, and SBU__c from the expense in SBU mode.
The vendor follows the shift rules: the expense shift's Supplier_Account__c, else the vendor of the converted proposal for that shift or placement, else the worker's account when the shift is a VMS shift. The master vendor's own workers get no Supplier line.
An expense fails (status Failed, reason in the run log) when Total Value or the date is blank, a payable expense has no worker, or a billable expense has no client account. Fix it and the next run retries it.
After the shifts, the run takes the approved expenses with status Pending or Failed:
| Scope | Expense rule |
|---|---|
| Account run | Account__c = the run's account |
| Global run | every account |
| SBU run | SBU__c = the run's unit |
| Period | Date_of_Expense__c between period start and end |
| Include earlier unprocessed | also earlier Pending or Failed expenses |
Interpretation Rules are rooted at the shift and do not apply to expenses. Expense failures add to Failed and the error log. One run interprets up to 1,500 expenses; the log says when more remain, and the next run picks them up. Reverse deletes the run's unlocked expense lines and puts those expenses back to Pending; an expense with a locked line keeps its status.
| State | Rule |
|---|---|
| Approved, not interpreted | Only Approval Status, Rejection Reason and Query Comment change, unless the user holds Edit Payrolled Shifts. |
| Interpreted | Locked like a payrolled shift, approval status included: Edit Payrolled Shifts, Edit Invoiced Shifts when a line sits on a draft invoice, Edit Posted Shifts when a line is on a numbered invoice or exported. Reasons and comments stay editable. |
A permitted change to an interpreted expense (un-approving it, a new amount, another treatment) releases its lines: unlocked lines and the drafts they sit on are deleted, locked lines get reversal lines, and the expense goes back to Pending so the next run interprets it again. Interpreted expenses cannot be deleted; un-approve them first. Portal users cannot override the lock.
Off by default. When it is on, every shift is priced in the background as soon as it is created or changed, long before payroll. The estimated totals and the times they were based on are stored on the shift. Estimates create no staging lines, no time segments and never touch the final fields, so invoicing, the payroll export and the shift lock are unaffected.
| Setting | Where | Effect |
|---|---|---|
Pay/Bill Estimates Enabled (b3s__Pay_Bill_Estimates_Enabled__c) |
WFM settings custom setting (b3s__Scheduler__c) |
Global switch. It is a hierarchy setting: set it at org level, then uncheck it for an integration user or profile to skip estimates on large data loads. |
Disable Pay/Bill Estimates (b3s__Disable_Pay_Bill_Estimates__c) |
Strategic business unit (b3s__SBU__c) |
Opt-out per unit. Shifts stamped with this SBU are not estimated. Shifts with no SBU follow the global switch. |
Switching on does not estimate existing shifts. They are estimated the next time they are created or changed.
Shifts that are already Interpreted are never estimated: from that point the final totals are the truth and automatic re-pricing takes over. Rate card, rate sheet or policy changes do not re-estimate shifts (by design); the shift picks up the new rates on its next change and the final run always prices with the live cards.
Changed shifts are queued as Pay Bill Estimate platform events (b3s__Pay_Bill_Estimate__e, high volume), and a package subscriber prices them in batches of up to 200 with the same rules as the final run, skipping Interpreted shifts and shifts of an opted-out SBU. A shift edited several times in a burst is priced once. If an estimate cannot be saved, the shift keeps its previous estimate until its next change.
The subscriber runs as the platform event subscriber user: the Automated Process user unless a PlatformEventSubscriberConfig for PayBillEstimateTrigger names another user. That user must be able to see the rate cards and break rulesets. Example (deploy with the Metadata API, the user is org-specific):
<PlatformEventSubscriberConfig xmlns="http://soap.sforce.com/2006/04/metadata">
<platformEventConsumer>b3s__PayBillEstimateTrigger</platformEventConsumer>
<batchSize>200</batchSize>
<masterLabel>Pay Bill Estimate Subscriber</masterLabel>
<user>integration.user@example.com</user>
</PlatformEventSubscriberConfig>
All read-only for users (WFM Admin has read access), written only by the estimate subscriber.
| Field | Meaning |
|---|---|
Estimated Pay (b3s__Pay_Bill_Estimate_Pay__c) |
Sum of the estimate's Pay lines. |
Estimated Supplier (b3s__Pay_Bill_Estimate_Supplier__c) |
Sum of the Supplier lines (0 when the shift has no supplier payee). |
Estimated Bill (b3s__Pay_Bill_Estimate_Bill__c) |
Sum of the Bill lines. |
Estimate Currency (b3s__Pay_Bill_Estimate_Currency__c) |
The rate card's currency. |
Estimate Time Source (b3s__Pay_Bill_Estimate_Time_Source__c) |
Scheduled (rota times), Actual (policy Prefer Actual and clocked or timesheet times present) or Billable (Billable Start/End override). Blank when the shift was not priced (cancelled or rejected: totals are 0). Use it to tell a schedule-based estimate from a timesheet-based one. |
Estimated At (b3s__Pay_Bill_Estimate_At__c) |
When the estimate was computed. |
Estimate Error (b3s__Pay_Bill_Estimate_Error__c) |
Why the shift could not be priced (for example no matching rate card); the totals are blank. |
Once a shift is interpreted, the estimate fields keep their last value, so a report can compare estimated against final (Total_Pay__c, Total_Bill__c).
Once a run has interpreted a shift, its Total_Pay__c / Total_Bill__c (in Currency__c) are shown as estimates before payroll. With automatic estimates on, b3s__Pay_Bill_Estimate_Pay__c / b3s__Pay_Bill_Estimate_Bill__c (in b3s__Pay_Bill_Estimate_Currency__c) are available before any run, using the same title part shape. They are plain title parts with the currency formatter, so any definition can add them:
{
"label": "Pay",
"translationKey": "estimated_pay",
"fieldPath": "b3s__Total_Pay__c",
"formatter": "currency",
"currencyFieldPath": "b3s__Currency__c",
"hideIfNull": true
}
Example configuration:
| Surface | Shows | Where |
|---|---|---|
| Scheduler, every context provider (Account, Contact, Group, Job), every view | Pay and Bill | views[].shiftTitle; the fields are loaded through schedulables.shift.additionalFields with readOnly: true |
| Clock: My shifts, marketplace (open shifts) | Pay | shift.title, shift.openShiftTitle |
| Clock: invitations | Pay | invitation.title (b3s__Shift__r.b3s__Total_Pay__c) |
| Timesheet Submission | Pay | shift.title |
| Timesheet Approval (client) | Bill | shift.title |
Workers never see Bill. A shift with no run yet shows nothing (hideIfNull). Internal scheduler users need read access to the three fields (WFM Admin has it), since scheduler loads run in user mode. An interpreted shift is Payrolled for the shift lock, so running before timesheets are in means later time edits need Edit_Payrolled_Shifts or a field in Editable_After_Payroll_Fields__c.
Payee_Account__c is the vendor (sample definition: b3s__Type__c = 'Supplier', pay code column b3s__Pay_Code__c).PayBillPlugin, PayBillDefaultPlugin, PayBillEngine.TimeBlock / SegmentContext / InterpretedBlock remain as released global types, but the engine no longer calls plugins. The scheduler's rate card compliance rule reads the card's legacy items (see rate card compliance).
One card per shift (no mid-shift card split). Accumulation uses the same scope for every side. Per Day gating looks at earlier shifts of the day only; an edit re-prices the affected set (same-day shifts and the rest of the week). Not covered: per-side overtime scope, FLSA regular rate, cancellation charges, expense markup.