Skip to content

Advanced Payroll

Jani Giannoudis edited this page Jul 9, 2023 · 12 revisions

Advanced Payroll Example

In diesem Beispiel wird demonstriert, wie die Payroll in mehrere Regulierungen aufgeteilt wird. Dazu wird das Beispiel Basic Payroll mit zwei Regulierungen erweitert:

  • Versicherungs-Regulierung mit einem einkommensabhängigen Beitrag
  • Company-Regulierung mit firmenspezifischen Benefits

Im letzten Schritt werden beide Regulierung automatisiert getestet.


Insurance Regulation

Ein Versicherung bietet ihre Dienste in Abhängigkeit von Monatslohn an:

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

Beispiel Insurance.json:

1 {
2   "$schema": "PayrollEngine.Exchange.schema.json",
3   "createdObjectDate": "2023-01-01T00:00:00.0Z",
4   "tenants": [
5     {
6       "identifier": "StartTenant",
7       "updateMode": "NoUpdate",
8       "regulations": [
9         {
10           "name": "InsuranceRegulation",
11           "baseRegulations": [
12             "StartRegulation"
13           ],
14           "sharedRegulation": true,
15           "lookups": [
16             {
17               "name": "InsuranceRate",
18               "values": [
20                 {
21                   "key": "A",
22                   "rangeValue": 1,
23                   "value": "30"
24                 },
25                 {
26                   "key": "B",
27                   "rangeValue": 3000,
28                   "value": "45"
29                 },
30                 {
31                   "key": "C",
32                   "rangeValue": 6000,
33                   "value": "60"
34                 }
35               ]
36             }
37           ],
38           "wageTypes": [
39             {
40               "wageTypeNumber": 200,
41               "name": "InsuranceRate",
42               "valueExpression": "GetRangeLookup<decimal>(\"InsuranceRate\", WageType[100])"
43             }
44           ]
45         }
46       ],
47       "payrolls": [
48         {
49           "name": "StartPayroll",
50           "updateMode": "NoUpdate",
51           "layers": [
52             {
53               "level": 2,
54               "regulationName": "InsuranceRegulation"
55             }
56           ]
57         }
58       ]
59     }
60   ]
61 }

Die Regulierung im Detail:

  • 2: Adjust the JSON schema path to your local environment
  • 7: Do not update the tenant (see Basic-Payroll Test)
  • 10: The regulation name
  • 11-13: The base regulation dependencies
  • 14: Activate Shared Regulation this regulation
  • 16-36: The insurance rate lookup
  • 22/27/32: The insurance rate salary step value
  • 23/28/33: The insurance rate value
  • 39-43: The insurance wage type
  • 40: The insurance rate wage type number 200, controls the payrun process order
  • 42: The benefit wage type value expression: calculated from the lookup value
  • 52-55: The insurance payroll layer
  • 53: The insurance regulation payroll level 2

Die JSON Datei wird mit der Payroll Konsole Kommando PayrollImport zum Backend übermittelt:

PayrollConsole PayrollImport Insurance.json

Company Regulation

Der Mitarbeiter kann einen Benefit/Bonus Betrag erhalten, diese kann mehrmals im Monat der Fall sein.

Beispiel Company.json:

1 {
2   "$schema": "PayrollEngine.Exchange.schema.json",
3   "createdObjectDate": "2023-01-01T00:00:00.0Z",
4   "tenants": [
5     {
6       "identifier": "StartTenant",
7       "updateMode": "NoUpdate",
8       "regulations": [
9         {
10           "name": "CompanyRegulation",
11           "baseRegulations": [
12             "InsuranceRegulation"
13           ],
14           "cases": [
15             {
16               "name": "Benefit",
17               "caseType": "Employee",
18               "fields": [
19                 {
20                   "name": "Benefit",
21                   "valueType": "Money",
22                   "timeType": "Moment"
23                 }
24               ]
25             }
26           ],
27           "wageTypes": [
28             {
29               "wageTypeNumber": 300,
30               "name": "Benefit",
31               "valueExpression": "CaseValue[\"Benefit\"]"
32             }
33           ]
34         }
35       ],
36       "payrolls": [
37         {
38           "name": "StartPayroll",
39           "updateMode": "NoUpdate",
40           "layers": [
41             {
42               "level": 3,
43               "regulationName": "CompanyRegulation"
44             }
45           ]
46         }
47       ]
48     }
49   ]
50 }

Die Regulierung im Detail:

  • 2: Adjust the JSON schema path to your local environment
  • 7: Do not update the tenant (see Basic-Payroll Test)
  • 10: The regulation name
  • 11-13: The base regulation dependencies
  • 21: The case field time type moment
  • 28-32: The benefit wage type
  • 29: The benefit wage type number 300, controls the payrun process order
  • 31: The benefit wage type value expression: calculated from case value
  • 41-44: The insurance payroll layer
  • 42: The company regulation payroll level 3

Die JSON Datei wird mit der Payroll Konsole Kommando PayrollImport zum Backend übermittelt:

PayrollConsole PayrollImport Company.json

Payroll Test

Der folgende Test Company.Test.et.json überpüft alle Regulierungen:

1  {
2    "$schema": "PayrollEngine.Exchange.schema.json",
3    "tenants": [
4      {
5        "identifier": "StartTenant",
6        "updateMode": "NoUpdate",
7        "payrolls": [
8          {
9            "name": "StartPayroll",
10            "updateMode": "NoUpdate",
11            "cases": [
12              {
13                "userIdentifier": "[email protected]",
14                "employeeIdentifier": "mario.nuñ[email protected]",
15                "divisionName": "StartDivision",
16                "case": {
17                  "caseName": "Salary",
18                  "values": [
19                    {
20                      "caseFieldName": "Salary",
21                      "value": "5000",
22                      "start": "2023-01-01T00:00:00.0Z",
23                      "created": "2022-11-04T00:00:00.0Z"
24                    }
25                  ]
26                }
27              },
28              {
29                "userIdentifier": "[email protected]",
30                "employeeIdentifier": "mario.nuñ[email protected]",
31                "divisionName": "StartDivision",
32                "reason": "Project A",
33                "case": {
34                  "caseName": "Benefit",
35                  "values": [
36                    {
37                      "caseFieldName": "Benefit",
38                      "value": "225",
39                      "start": "2023-01-14T00:00:00.0Z",
40                      "created": "2022-12-12T00:00:00.0Z"
41                    }
42                  ]
43                }
44              },
45              {
46                "userIdentifier": "[email protected]",
47                "employeeIdentifier": "mario.nuñ[email protected]",
48                "divisionName": "StartDivision",
49                "reason": "Project B",
50                "case": {
51                  "caseName": "Benefit",
52                  "values": [
53                    {
54                      "caseFieldName": "Benefit",
55                      "value": "250",
56                      "start": "2023-01-26T00:00:00.0Z",
57                      "created": "2022-01-14T00:00:00.0Z"
58                    }
59                  ]
60                }
61              }
62            ]
63          }
64        ],
65        "payrunJobInvocations": [
66          {
67            "name": "StartPayrunJob.Jan23",
68            "payrunName": "StartPayrun",
69            "userIdentifier": "[email protected]",
70            "employeeIdentifiers": [
71              "mario.nuñ[email protected]"
72            ],
73            "reason": "Test Payrun Jan 23",
74            "jobStatus": "Complete",
75            "periodStart": "2023-01-01T00:00:00.0Z",
76            "evaluationDate": "2023-02-01T00:00:00.0Z"
77          }
78        ],
79        "payrollResults": [
80          {
81            "payrunJobName": "StartPayrunJob.Jan23",
82            "employeeIdentifier": "mario.nuñ[email protected]",
83            "wageTypeResults": [
84              {
85                "wageTypeNumber": 100,
86                "value": 5000
87              },
88              {
89                "wageTypeNumber": 200,
90                "value": 45
91              },
92              {
93                "wageTypeNumber": 300,
94                "value": 475
95              }
96           ]
97          }
98        ]
99      }
100   ]
101 }

Die Regulierung im Detail:

  • 2: Adjust the JSON schema path to your local environment
  • 6: Do not update the tenant (see Basic-Payroll Test)
  • 10: Do not update the payroll (see Basic-Payroll Test)
  • 12-27: Salary case: 5'000 start 1st Jan. 23
  • 28-44: Benefit Project A: 225, 14th Jan. 23
  • 45-61: Benefit Project B: 250, 26th Jan. 23
  • 12-27: Salary case: 5'000 start at Jan. 23
  • 66-77: Start payrun job Jan. 23
  • 80-97: Test results payrun job Jan. 23
  • 86: The expected salary wage type (100) value 5'000
  • 90: The expected insurance wage type (200) value 45 (Class B)
  • 94: The expected benefit wage type (300) value 475 (225 + 250)

Der Payroll Konsole Kommando PayrunEmployeeTest erstellt für jeden Testlauf eine Kopie des Mitarbeiters.

PayrollConsole PayrunEmployeeTest Company.Test.et.json

Next steps

Clone this wiki locally