Skip to content

AdvancedPayroll

Jani Giannoudis edited this page Feb 24, 2026 · 1 revision

Advanced Payroll Example

This example shows how payroll is divided into several regulations. For this purpose, the start example Examples\StartPayroll is extended by two regulations:

  • Insurance regulation with income-dependent contribution
  • Company regulation with company-specific benefits

In the last step, both regulations are tested automatically.

Insurance Regulation

An insurance company offers its services on the basis of the monthly wage:

Class Start End Rate
A 1 2999 30
B 3000 5999 45
C 6000 open 60

Example insurance regulation Insurance.yaml:

1   # yaml-language-server: $schema=../../Schemas/PayrollEngine.Exchange.schema.json
2   createdObjectDate: 2023-01-01T00:00:00Z
3   tenants:
4   - identifier: StartTenant
5     regulations:
6     - name: InsuranceRegulation
7       sharedRegulation: true
8       baseRegulations:
9       - StartRegulation
10      wageTypes:
11      - wageTypeNumber: 200
12        name: InsuranceRate
13        valueExpression: GetRangeLookup<decimal>("InsuranceRate", WageType[100])
14        collectors:
15        - Deduction
16      lookups:
17      - name: InsuranceRate
18        values:
19        - key: A
20          value: "30"
21          rangeValue: 1
22        - key: B
23          value: "45"
24          rangeValue: 3000
25        - key: C
26          value: "60"
27          rangeValue: 6000
28    payrolls:
29    - name: StartPayroll
30      layers:
31      - regulationName: InsuranceRegulation
32        level: 2
33      updateMode: NoUpdate
34    updateMode: NoUpdate

The insurance regulation in detail:

  • 1: Path to the JSON schema (adapt this to your local environment)
  • 6: The regulation name
  • 7: Activate Shared Regulation this regulation
  • 8-9: The base regulation dependencies
  • 10-15: The insurance wage type
  • 11: The insurance rate wage type number 200, controls the process order of the payrun
  • 13: The benefit wage type value expression: calculated from the lookup value
  • 15: The wage type collector Deduction
  • 16-27: The insurance rate lookup
  • 20/23/26: The insurance rate value
  • 21/24/27: The insurance rate salary range value
  • 30-32: The insurance payroll layer
  • 32: The insurance regulation payroll level 2
  • 34: Do not update the tenant (see Basic-Payroll Test)

With the command 2 Insurance.Setup.pecmd the Payroll Console sends the data of the YAML file to the backend.

Company Regulation

The employee may receive a benefit/bonus contribution several times a month.

Example company regulation Company.yaml:

1   # yaml-language-server: $schema=../../Schemas/PayrollEngine.Exchange.schema.json
2   createdObjectDate: 2023-01-01T00:00:00Z
3   tenants:
4   - identifier: StartTenant
5     regulations:
6     - name: CompanyRegulation
7       baseRegulations:
8       - InsuranceRegulation
9       cases:
10      - name: Benefit
11        caseType: Employee
12        fields:
13        - name: Benefit
14          valueType: Money
15          timeType: Moment
16      wageTypes:
17      - wageTypeNumber: 100.1
18        name: Benefit
19        valueExpression: CaseValue["Benefit"]
20        collectors:
21        - Income
22    payrolls:
23    - name: StartPayroll
24      layers:
25      - regulationName: CompanyRegulation
26        level: 3
27      updateMode: NoUpdate
28    updateMode: NoUpdate

Regulation in detail:

  • 1: Path to the JSON schema (adapt this to your local environment)
  • 6: The regulation name
  • 7-8: The base regulations
  • 10-15: The benefit case
  • 15: The benefit case field time type moment
  • 17-21: The benefit wage type
  • 17: The benefit wage type number 100.1, controls the process order of the payrun
  • 19: The benefit wage type value expression: calculated from case value
  • 21: The wage type collector Income
  • 24-26: The insurance payroll layer
  • 26: The company regulation payroll level 3
  • 28: Do not update the tenant (see Basic-Payroll Test)

With the command 3 Company.Setup.pecmd the Payroll Console sends the data of the YAML file to the backend.

Payroll Test

The following test Company.Test.et.yaml checks all regulations:

1   # yaml-language-server: $schema=../../Schemas/PayrollEngine.Exchange.schema.json
2   tenants:
3   - identifier: StartTenant
4     payrolls:
5     - name: StartPayroll
6       cases:
7       - userIdentifier: lucy.smith@foo.com
8         employeeIdentifier: mario.nuñez@foo.com
9         divisionName: StartDivision
10        case:
11          caseName: Salary
12          values:
13          - caseFieldName: Salary
14            value: "5000"
15            start: 2023-01-01T00:00:00Z
16            created: 2022-11-04T00:00:00Z
17      - userIdentifier: lucy.smith@foo.com
18        employeeIdentifier: mario.nuñez@foo.com
19        divisionName: StartDivision
20        reason: Project A
21        case:
22          caseName: Benefit
23          values:
24          - caseFieldName: Benefit
25            value: "225"
26            start: 2023-01-14T00:00:00Z
27            created: 2022-12-12T00:00:00Z
28      - userIdentifier: lucy.smith@foo.com
29        employeeIdentifier: mario.nuñez@foo.com
30        divisionName: StartDivision
31        reason: Project B
32        case:
33          caseName: Benefit
34          values:
35          - caseFieldName: Benefit
36            value: "250"
37            start: 2023-01-26T00:00:00Z
38            created: 2022-01-14T00:00:00Z
39      updateMode: NoUpdate
40    payrunJobInvocations:
41    - name: StartPayrunJob.Jan23
42      payrunName: StartPayrun
43      userIdentifier: lucy.smith@foo.com
44      jobStatus: Complete
45      periodStart: 2023-01-01T00:00:00Z
46      evaluationDate: 2023-02-01T00:00:00Z
47      reason: Test Payrun Jan 23
48      employeeIdentifiers:
49      - mario.nuñez@foo.com
50    payrollResults:
51    - payrunJobName: StartPayrunJob.Jan23
52      employeeIdentifier: mario.nuñez@foo.com
53      wageTypeResults:
54      - wageTypeNumber: 100
55        value: 5000
56      - wageTypeNumber: 100.1
57        value: 475
58      - wageTypeNumber: 200
59        value: 45
60      collectorResults:
61      - collectorName: Income
62        value: 5475
63      - collectorName: Deduction
64        value: -45
65    updateMode: NoUpdate

Regulation in detail:

  • 1: Path to the JSON schema (adapt this to your local environment)
  • 10-16: Salary case: 5'000 start 1st Jan. 23
  • 21-27: Benefit project A: 225, 14th Jan. 23
  • 32-38: Benefit project B: 250, 26th Jan. 23
  • 39: Do not update the payroll (see Basic-Payroll Test)
  • 40-49: Start payrun job Jan. 23
  • 50-65: Test results payrun job Jan. 23
  • 55: The expected salary wage type (100) value 5'000
  • 57: The expected benefit wage type (100.1) value 475 (225 + 250)
  • 59: The expected insurance wage type (200) value 45 (Class B)
  • 62: The expected colletor (Income) value 5'475 (5'000 + 475)
  • 64: The expected colletor (Deduction) value -45 (negated)
  • 66: Do not update the tenant (see Basic-Payroll Test)

The command 3 Company.Test.pecmd runs the test on a copy of the employee mario.nuñez@foo.com.

Next steps

Clone this wiki locally