Using hour registration

Overview

The hour registration endpoint is used to send data to the hour registration service. This endpoint allows you to:

  • Track hours worked by employees or consultants.
  • Record hours that can be invoiced by contractors or consultants.
  • Bundle hour registrations using the masterRefId to include materials and other expenses.
  • Enable employees to invoice for their worked hours.

Links under the Hour Registration menu provide details about the required properties for creating various types of hour registrations.

Requirements

Duett requires the following for all time registrations:

  • At least one ArticleID.
  • At least one CustomerID.

For those using the service solely for payroll purposes, it is common to create an internal customer, e.g., "Electrician Andersen."

Additional Information

For a complete list of properties and their details, consult the documentation under the Hour Registration menu. This ensures you have all the required fields for your specific registration needs.

Example of a simple hour registration for salary:

{
    "customerId": "{{employer (internal customer)}}",
    "articleId": "{{It has to be an articleType of the following: normal, amount, or hour}}",
    "hourCount": 30,
    "hourDate": "2022-10-14T00:00:00Z",
    "invoiceStatus": "noInvoice",
    "salaryStatus": "pending",
    "internalReference": "12995",
    "carriers": [{
        "CarrierId": "{{carrierId of the employee}}"
    }, {
        "CarrierId": "{{carrierId for wageType}}"
    }]
}
                    
Example of a hour registration for invoice and project using startTime, endTime and pause:

{
    "customerId": "{{The customer to be invoiced}}",
    "articleId": "{{It has to be an articleType of the following: normal, amount, or hour}}",
    "hourDate": "2022-10-14T00:00:00Z",
    "hourPrice": 300,
    "hoursInvoiced": 30,
    "totalPrice": 6000,
    "invoiceStatus": "toBeInvoiced",
    "description": "Murte pipe i to etasjer",
    "startTime": "2023-08-22T08:00:00.881Z",
    "pause": 30,
    "endTime": "2023-08-22T16:00:00.881Z",
    "carriers": [{
        "CarrierId": "{{carrierId for project}}"
    }, {
        "CarrierId": "{{carrierId for employee}}"
    }]
}
                    
Example of a hour registration for travelling expenses:

{
    "customerId": "{{employer (internal customer)}}",
    "articleId": "{{e.g. 'Travel time by car' (Reisetid bil)}}",
    "hourDate": "2022-10-14T00:00:00Z",
    "totalPrice": 6000,
    "invoiceStatus": "noInvoice",
    "description": "Overnatting",
    "carriers": [{
        "CarrierId": "{{carrierId for employee}}"
    }]
}
                    
Property Description Default Create
articleId Required. The article this hour registration is tied to. It has to be an articleType of the following: "normal" or "hour" x
carriers List of carriers associated with this hour registration. If the company has activated the payroll module in Duett Økonomi, the wage type carrier must be included. See below for more details. x
customerId Required: The customer id goes here. Customers can be created or found at the customer endpoint here x
description Describe the nature of this hour registration x
externalId Your own unique identifier for this hour registration x
internalReference Internal reference x
hourCount The total number of hours worked from the hourDate. startTime and endTime can be used. x
hourDate Required: The date time of this hour registration x
hourPrice The price for each hour x
salaryHourPrice The price for each hour used in salary. This field is not required. Only used where the external system wants to control the hourly wage. x
hoursInvoiced The total number of hours to invoice x
startTime The start of the working day. Can be used to calculate hourCount instead of entering hourCount. x
endTime The end of the working day. Can be used to calculate hourCount instead of entering hourCount. x
pause The total number of minutes taken for breaks during the day, which will be taken away from the total hour count. x
invoiceStatus Enum: toBeInvoiced, noInvoice, later, dontKnow, transferred, prepared, approved, rejected x
masterRefId The reference to the master hourRegistration in a group. This can be used to bundle hour registration lines together into one hour registration. Be warned that deleting a master reference will delete all the lines associated with that hour registration. x
salaryStatus Enum: pending, approved, rejected. Other value when requesting this resource: transferred x
totalPrice The total amount for the hours in this hour registration. hourPrice * hourCount x

Notes on carriers

The carriers field is important in hour registration. The minimum carrier types you require in this field is "Employee"/"Ansatt" and if you have the wage module enabled in DuettWeb or DuettWin then also "WageType"/"Lønnsart". Usually you will have multiple carriers of types Project, Employee, Department, Task, Activity, WorkType, WageType. You can find out how to fetch a list of carrierTypes here and you can find out how to fetch a list of carriers here using the filters to fetch relevant data. You will ideally filter on carrierType.carrierTypeKind to fetch a list of relevant carriers for the user to select from. (usedInHour, wageType for example)



Tips on finding wage type for use in hour registration

                                        {
                                            "carrierType.carrierTypeKind": {
                                                "EQ": [
                                                    "wagetype"
                                                ]
                                            },
                                            "wageType.usedInHour": {
                                                "EQ": [
                                                    "true"
                                                ]
                                            }
                                        }
                                    
As url:
filter[carrierType.carrierTypeKind][EQ]=wagetype&filter[wageType.usedInHour][EQ]=true
Warning: Not all wage types are valid for use in hour registration.