Examples
Practical payroll examples covering typical real-world scenarios. Each example is self-contained — it includes regulation, case data, payrun jobs, and a test file that can be run independently on a clean tenant.
Examples
Tutorial
| Example | Description |
|---|---|
| StartPayroll | Step-by-step regulation build across three layers — JSON and YAML variants |
Business Scenarios
| Example | Description |
|---|---|
| GlobalPayroll | International payroll with age supplement, one-time bonus and progressive tax — LLM reference example |
| MultiCountryPayroll | Multi-country payroll (DE/FR/NL) with shared base regulation and split employee |
| MinWagePayroll | Minimum wage compliance with automatic top-up — fully No-Code |
| PartTimePayroll | Part-time with overtime guard and retroactive level correction — fully No-Code |
| ForecastPayroll | Parallel what-if scenarios alongside production — fully No-Code |
| MarchClausePayroll | German Märzklausel Q1 bonus routing via Low-Code extension methods |
Retro Corrections
| Example | Description |
|---|---|
| RetroPayroll | Three real-world retro events — positive deltas, late entry, cascading correction |
Data Import
| Example | Description |
|---|---|
| TaxTablePayroll | Bulk tax table import (~7 100 records) with range-based withholding tax |
Time Tracking
| Example | Description |
|---|---|
| TimesheetPayroll | Daily timesheet recording with permanent/casual worker wage calculation |
Foundation
| Example | Description |
|---|---|
| ActionPayroll | Custom case validate action with ISO 7064 check digit |
| CaseDefPayroll | All value types, all time types, slots, relations and No-Code actions |
| ExtendedPayroll | Composite function pattern with IDE support |
| ReportPayroll | 7 reports — pivot, XSLT, multi-section, dynamic query injection |
Setup
# Install all examples
Setup.All.pecmd
# Remove all examples
Delete.All.pecmd
# Install a single example
<Example>/Setup.pecmd
Web application login (all examples):
lucy.smith@foo.com / @ayroll3nginE (Supervisor rights across all examples)
Tutorial
StartPayroll
Step-by-step tutorial that builds a payroll regulation incrementally across three layers. Both variants are identical in content; the only difference is the exchange file format (JSON or YAML).
| Step | Regulation | What is added |
|---|---|---|
StartRegulation (Level 1) |
Salary case (CalendarPeriod) · WT 100 · Income + Deduction collectors · range guard 500–25 000 |
|
InsuranceRegulation (Level 2, shared) |
InsuranceRate range lookup · WT 200 (deduction from lookup) |
|
CompanyRegulation (Level 3) |
Benefit case (Moment) · WT 100.1 |
|
| — | Payslip report · EN + DE templates · Excel / PDF / XML output | |
| — | Salary range validation (499 → invalid, 500 → valid) |
See Basic Payroll (Steps 1–2) and Advanced Payroll (Step 3) for the walkthrough.
Business Scenarios
Regulation examples for common payroll requirements, each with a named company, employees, and verifiable test results.
GlobalPayroll
International payroll for fictitious GlobalTech. Demonstrates the three case scope levels and two common wage type patterns in a single regulation.
This example also serves as the LLM-assisted development reference.
Prompt.mdin the repository folder contains the natural language requirements used to generate this regulation, with human corrections documented alongside. See LLM-Assisted Development for the full workflow.
| Feature | Detail |
|---|---|
| Case scopes | National (SocialSecurity), Company (HealthInsurance), Employee (Salary, EmploymentLevel, BirthDate) |
| Part-time | Salary × EmploymentLevel |
| Conditional WT | Senior Supplement activates when employee age ≥ 50 |
| One-time bonus | Moment time type places bonus in exactly one pay period |
| Progressive tax | Range lookup maps gross income to a bracket rate |
| Test | Two-period employee payroll test — January (with bonus) and February (Moment validation) |
MultiCountryPayroll
Multi-country payroll for fictitious ACME International (DE, FR, NL). Demonstrates regulation layering and a split-country employee.
| Feature | Detail |
|---|---|
| Architecture | Shared base regulation (ACME.Global) + three country regulations (level 2) |
| Global scope | valueScope: Global on Salary — set once, read by all country payrolls |
| Split employee | Sophie Klein: 60 % in Germany, 40 % in France — two payrolls, one salary |
| Country WTs | WT 200–220 per country, all writing into the shared Deductions collector |
| Test | 5 employee result sets across 3 payrun jobs |
MinWagePayroll
Minimum wage compliance for fictitious FairPay GmbH. Automatic top-up for hourly workers whose agreed rate falls below the statutory minimum. Fully No-Code.
| Feature | Detail |
|---|---|
| Year-versioned lookup | ^#MinimumWage(PeriodStartYear) — add a new key annually, no regulation change |
| Intermediate WT | MinWageBase (WT 110) used as reference only — excluded from collectors |
| Compliance signal | ? ^$MinWageBase > ^$BasePay guard + storeEmptyResults: true → zero = compliant |
PartTimePayroll
Part-time payroll with overtime and retro correction for fictitious FlexWork AG.
Fully No-Code — GetWageTypeRetroResultSum() called directly from valueActions.
| Feature | Detail |
|---|---|
| Employment scaling | ^^Salary * ^^EmploymentLevel |
| Overtime guard | ? ^^EmploymentLevel >= 1.0 in WT + availableActions on case |
| Case build | Range clamps salary and employment level on input |
| Retro correction | Level reduction entered retroactively → negative deltas in March run |
| Cluster design | Legal + Retro for base WTs; Legal only for delta WTs |
ForecastPayroll
Two parallel what-if planning scenarios for fictitious PlanSoft GmbH — salary increase vs. monthly bonus — running alongside production without modifying any regulation. Fully No-Code.
| Feature | Detail |
|---|---|
| Forecast isolation | forecast: tag at case-change level; invisible to production |
| Parallel scenarios | SalaryIncrease2026 and BonusScenario2026 — same regulation, same payrun |
| Scenario resolution | ^^CaseField reads forecast-tagged value automatically inside forecast job |
| Optional WT | ? ^^PlannedBonus > 0 guard suppresses bonus in production and unrelated scenarios |
| Net comparison | Dedicated NetSalary WT (300) as single bottom-line figure per scenario |
MarchClausePayroll
German Märzklausel (§ 23a SGB IV) for fictitious ClearPay GmbH. Q1 bonus
is routed to the previous year for social insurance when it exceeds the BBG
remainder. Low-Code extension methods — valueExpression stays a single call.
| Feature | Detail |
|---|---|
| BBG check | NeedsMarchClauseRetro(bbgLimit) — pure extension method on WageTypeValueFunction |
| Period time type | AnnualBonus.timeType: Period — active in past retro period, invisible until created ≤ evaluationDate |
| Two employees | Anna: bonus below remainder → no retro. Ben: bonus exceeds remainder → retro Dec |
| Production pattern | ScheduleRetroPayrun() in valueExpression with !IsRetroPayrun guard (documented; omitted in Exchange import) |
Retro Corrections
RetroPayroll
Three real-world retro events across four monthly payruns for fictitious RetroPayroll AG. Covers positive deltas, late Moment entry, negative deltas, and cascading second corrections.
| Event | Trigger | Effect |
|---|---|---|
| A — Emma salary raise | Entered retroactively, effective Jan | Positive delta — two periods corrected in March run |
| B — Ben late bonus | Moment date 2024-01-15, entered in March |
Bonus attributed to January; retro in March run |
| C — Emma part-time reduction | Entered in April, effective Feb | Negative deltas — overpayment recovery across two periods |
Key design:
- Base WTs in
Legal+Retroclusters; delta WTs (GetWageTypeRetroResultSum()) inLegalonly storeEmptyResults: truerequired on all baseline jobs- Cascading correction: engine always diffs against the most recently stored value
Data Import
TaxTablePayroll
Large national tax table import and range-based withholding tax deduction. Country-neutral — works with any fixed-width authority file.
| Feature | Detail |
|---|---|
| Bulk import | LookupTextImport with /bulk — ~7 100 records, one API request |
| Sliced import | SliceSize splits oversized payloads; UpdateMode sequencing handled automatically |
| Composite key | "30 34" (period type + table number) disambiguates overlapping tables |
| Named columns | Col1–Col6 per bracket — column resolved at runtime from employee case value |
| Expression | GetRangeObjectLookup reads bracket + column; result negated for deduction semantics |
Time Tracking
TimesheetPayroll
Daily working hour recording with wage calculation for permanent and casual workers.
CaseObject scripting maps payroll case fields to typed C# model classes.
| Feature | Detail |
|---|---|
| Timesheet model | Timesheet base class + [TimesheetPeriod] attribute for early/regular/late hour phases |
| Customer scripts | Script/MyTimesheet.cs (3 period slots + WeekendRateFactor) · Script/MyTimesheet.WageTypeValue.cs (MyTimesheetCalculator + extensions) |
| Calendar integration | Payroll calendar drives period and working days; Workdays lookup holds holidays |
| Casual workers | Different base rate via CasualRateFactor; permanent vs. casual branch in MyTimesheetCalculator |
| Weekend override | MyTimesheetCalculator.CalcRegularWage multiplies wage by WeekendRateFactor on Sat/Sun |
| Excel import | Workdays.2025.xlsx via RegulationExcelImport /backend · WorkTimes.2025.Week8.xlsx via CaseChangeExcelImport |
| Reports | WorkTime report (employee + day) · Wage report (payrun job) · Excel/PDF/JSON output |
| Tests | Employee1 (permanent) + Employee2 (casual) — Week 2025/8 |
Foundation Examples
Compact examples covering engine fundamentals without a full business scenario.
| Example | Features |
|---|---|
| ActionPayroll | Custom CaseValidate action (CheckRegistrationNumber) · ISO 7064 check digit · input mask REG-000.000.000 · localized issues · No-Code call site · case test |
| CaseDefPayroll | All value types · all time types · inline lists with alias mapping · slot hierarchy · case relations · No-Code actions · hidden/inactive cases · custom scripts |
| ExtendedPayroll | Composite function pattern · partial WageTypeValueFunction registration · MyRegulation.GetSalary() call from valueExpression · IDE support · see Extended Functions |
| ReportPayroll | 7 reports on one dataset · scripted pivot (CumulativeJournal) · build/start/end scripts (EmployeeCaseValues) · XSLT+XSD (EmployeesXml) · multi-section relations (Regulation) · inline expression (RegulationsSimple) · attribute mode (TenantsSimple) · dynamic query injection (UsersSimple) |
See Also
- Basic Payroll — StartPayroll walkthrough: regulation setup and first payrun
- Advanced Payroll — StartPayroll walkthrough: derived regulations and testing
- Forecasts — forecast case data and payrun jobs
- No-Code/Low-Code Development — action syntax reference
- Extended Functions — composite and extension method scripting
- Payroll Testing — test types, commands, and load testing
- Best Practices — consolidated design guidelines from the examples above
- Time Data — time types and the temporal model
- LLM-Assisted Development — AI-generated regulations and tests with human review