Payroll

The payroll run is a process in 6 steps, ensuring that salaries are paid, tax filings are made, pensions are paid, etc.

Payroll Types

  • Monthly salary (paid in arrears) is used for employees who receive a monthly salary paid in arrears. This is selected on the employee's salary profile.
  • Monthly salary (paid in advance) is used for employees who receive a monthly salary paid in advance.
  • Biweekly pay is used for employees who are paid every 14 days.
  • B-income is used when a B-fee is required. B-income is used, for example, consultants on projects freelancers who give a concert or give a presentation. In the case of B-income, no A-tax and AM contribution to eIncome / Tax will be reported or settled.
  • Zero-filing is used to make a manual reporting to eIndkomst (Skat) in months where no salary has been reported.

Here are the payroll types enumeration used in our system.

Name ID Description
Days14 0 Biweekly pay is used for employees who are paid every 14 days
MountlyPayroll 1 Monthly salary (paid in advance)
None 2 Null Payroll - Zero-filing
MonthlyPayrollBackward 3 Monthly salary (paid in arrears)
Honorar 4 B-Income payroll
AutomaticNull 5 Null payrolls that are automaticly processed

Payroll Status

We use our payroll statuses as states for the payroll run and in each state of the payroll run endpoints for the appropriate state can be used. Here is an overview of the payroll statuses.

Name ID Description
DraftPreview 1 When payroll has initial draft state or after new payroll has been created
Processing 2 Payroll is in state where it is processing information to tax(SKAT)
Finished 4 Payroll has completed processing state and it is finished
DraftReview 16 When payroll has some error after processing state and it is returned to draft review
Reverted 32 Payroll has been reverted after finishing
ProcessingPayments 64 Payroll is in state where it is creating payments and accountings
ProcessingReports 128 Payroll is in state where it is upating reports,payslips and statistics
Failed 256 Null payroll has failed
FailedWithPayments 512 Payroll is in state where payments have been made, while SKAT failed
ControlProcessing 1024 Payroll is in state where control validation and calculation has been started
ControlFinished 2048 Payroll is in state where control validation and calculation has been finished
Creating 4096 Payroll is in state where employees are still being added into the payroll (over 1000 in the new payroll)

Payroll Stages

Name Description
Draft DraftPreview or DraftReview
Control ControlProcessing or ControlFinished
Processing ProcessingPayments or ProcessingReports
Active Payroll is created and is has status of Draft or Control or Processing or ProcessingPayments or ProcessingReports or Creating
Completed Finished or Reverted

Company can have only one active payroll per payroll type. Active payroll is considerd to be active until the payroll is finished, reverted or deleted.

If the user decides to delete the payroll then the payroll will no longer exists and the user can create new payroll. This action for deletition is only allowed while the payroll is in draft stage.

To see which payroll type you can run runnable payroll types

To check payroll status by type of the payroll active payroll

Creating
DraftPreview
ControlProcessing
ControlFinished
Processing
ProcessingPayments
ProcessingReports
Finished
FailedWithPayments
DraftReview

Payroll run

Create payroll run

To create new payroll use the endpoint for create

This endpoint will return payroll Uid for the created payroll wich will be required argument in the folowing endpoints and actions. It will set the status of the payroll to DraftPreview.

It is important in the request to fill all the required fields

Example:

Copy
Copied
    {
  "type": 3,
  "dispositionDate": "2019-08-24T14:15:22Z",
  "periodFrom": "2019-08-24T14:15:22Z",
  "periodTo": "2019-08-24T14:15:22Z",
  "selectedEmployeeUid": [
    "00000000-0000-0000-0000-000000000000"
  ]
}

type - payroll types

dispositionDate - is the date when the payments for the payroll will be executed

selectedEmployeeUid - Uid's of the employees which will be in the payroll run

note - there must be at least one employee in the request

Advanced (optional) options:

  • Absence registration period (Period from - Period to)
  • Mileage registration period (Period from - Period to)
  • Hour registration period (Period from - Period to)
  • Period for supplements and deductions (Period from - Period to)
  • Note to all employees
  • Extra payroll run (Toggle switch)
  • Pay out special holiday allowance (Toggle switch)
  • Transfer SH to holiday pay (Toggle switch)
  • Pay out the SH balance (Toggle switch)
  • Pay out free choice (Toggle switch)
  • Pay out savings (Toggle switch)
  • Pay out time in lieu (Toggle switch)
  • Do not notify the employee/s about payslip/s (for this payroll run) (Toggle switch)

Employees

Employees can be pull as list from the the payroll API here

In order to add employees to the payroll you need to provide array of employee uids in the selectedEmployeeUid attribute.

To change the settings of the payroll use the endpoint for update here

To delete the payroll use the endpoint for delete here

Draft Calculations

You can pull information about the payroll after it has been created here

It will return the settings for the payroll and basic information about all of the employees in the payroll including their Uid's which are required attributes for the following actions for a specific employee payroll.

Copy
Copied
result.employees[x].uid - Employee payroll Guid

If you want to view all the salary elements and calculations for specific employee inside the payroll use this endpoint here

To perform Draft calculations for specific employee for the payroll here

This endpoint calculates the employee payroll, if the calculations are not done yet and provides the draft calculations for review before processing.

Once the draft calculation for the employee payroll is finished user can manage:

  • View the payslip
  • Salary and tax details
  • Registrations
  • AM pension
  • Corrections
  • Errors
  • Log records

To update employee payroll use endpoint for update here.

Use this to edit all the salary data elements for the spesific employee of the current payroll run.

To delete or remove an employee from the current payroll use the endpoint for delete here

Controll

Once everything settled, the user can continue to the control stage where the draft calculations and validations for all employes are being processed.

To trigger the control stage use the endpoint for controll

note - triggering this stage requires the payroll to be in draft stage.

Once this endpoint is hit the payroll status will be set to ControlProcessing. The processing of the calculations and validations for all the employees in the payroll could take a while and when everything is finished the status will be changed to ControlFinished.

Use the endpoint for payroll status to check the payroll status

Once the status is ControlFinished you can see the validations here

If there is error in the validations the payroll can not proceed further and additional actions are required in order to fix the errors. You will need to go back to draft and fix the error.

Generating reports here

in the body of the request we send only “payrollReportType” which is for the category of the reports:

  • 1 – payslips
  • 4 – accounting
  • 7 – deviations
  • 2 – payroll report
  • 5 – tax report
  • 8 – payments

After receiving status 204 the generation of the report is started and it will take some time until they are ready for download

Downloading reports here

For payslips only zip format is supported. For All other reports are only in CSV except the deviation report which can be in PDF or CSV also.

Example Payslips

Copy
Copied
GET /api/companies/{companyUid}/payroll/{payrollUid}/control/report?reportType=1&format=3
Format Id
Csv 1
Pdf 2
Zip 3

If there is a need to chage something in the payroll, some calculation is missing or there is error in the validations, you can go back to the draft status and edit the employee payroll data. To do that use the endpoint to change the status of the payroll here and set the status to 1

Review and Run

The next phase is the payroll review

This will return detailed information regarding the payroll run.

And the last step is actual running the payroll. To initiate that step use the endpoint for payroll run here

note - to run the payroll it is required that the payroll is in ControlFinished state and in the request a valid verificationCode is provided*

To request an mobile Verification Code use the endpoint

Copy
Copied
https://{{env_url}}/api/verification

where the env_url will be API url of the environment here

This call will triger job for sending sms code on the logged in user and should recieve a sms on their phone when finished. The code send in the message is your verificationCode for the payroll run.

After successfull triggering the endpoint for payroll run the final stage of the payroll run will start. The status will be set to Processing and in this stage the payroll will start creating payments and accountings, upating reports,payslips, statistics and send to SKAT.

At the end when everything is finished it will set the payroll status to finished. If the payroll is failed it will be returned to DraftReview.

B-income and Null Payroll

B-income

To create a B-income type Use the endpoint for Payroll create with the appropriate body in the request.

Example

Copy
Copied
{"type":4,
"periodFrom":"2023-05-01T00:00:00.000Z",
"periodTo":"2023-05-31T00:00:00.000Z",
"dispositionDate":"2023-05-10T00:00:00.000Z",
"selectedEmployeeUid":["5865d0fd-c73f-48bc-a42c-6461daac243b"],
"isPaid":false,
"customRegistrationPeriods":[]}

note - this type of payroll is intended only for b-income type of employee

Then use the endpoint to get the data for the created payroll and employee payroll

Add payments to the payroll here

Example

Copy
Copied
{
  "rateUid": null,
  "name": "payment",
  "payCheckFor": "10",
  "unit": 1,
  "paymentPerUnit": 1233,
  "includeInPensionBase": false,
  "includeInAmPensionBase": false,
  "isIncludedInHolidayEntitlementSalary": false,
  "percentage": 0,
  "isIncludedInHolidayEntitlementSalaryReduction": false
}

Available payCheckFor types that can be used for payments are:

  • 10 - B-Income with contributions
  • 11 - B-Income without contributions
  • 13 - Reimbursement of Expenses

Or delete payment here

After that use the endpoint for control and the flow continues as regular payroll.

Null Payroll

To create a Null payroll Use the endpoint for Payroll create with the appropriate body in the request.

Example

Copy
Copied
customRegistrationPeriods: []
periodFrom: "2023-05-01T00:00:00.000Z"
periodTo: "2023-05-31T00:00:00.000Z"
selectedEmployeeUid: []
type: 2

Type of the payroll is 2 wich means null payroll, and PeriodFrom and PeriodTo - date range for the payroll

note - this type of payroll doesnt have any employee in it.

After it is created use the endpoint for runing the payroll with the valid verification code.