Time records pricing

Price definition

The Prices are defined via the price list. See price lists resource.

E.g.: The hourly price for one user is stored in the pricelist below:

{
    "user" : { "id" : "d2463429-0f35-4dfc-b8f9-697ea3a64ef8" },
    "price" : 100.0
}

Price calculation

The price is calculated based on the following priorities, where the higher number has the higher priority:

  1. One price for all
  2. Price per work type (activity)
  3. Price per user (employee)
  4. Price per user per work type
  5. Price per client
  6. Price per client per work type
  7. Price per client per user
  8. Price per client per user per work type
  9. Price per project
  10. Price per project per client
  11. Price per project per work type
  12. Price per project per user
  13. Price per project per user per work type
  14. Price per task
  15. Price per task per project
  16. Price per task per project per work type
  17. Price per task per project per user
  18. Price per task per project per work type

E.g.: In this example there are two types of price lists. The first one has a set price per user per work type. The second one has a set price per project. Therefore the price will then be calculated by the second one.

Automated calculation

It is used to calculate the price when saving the time record.

Syntax

The time record can be stored or updated with the following query parameter

    /time/timerecords?calculate_price=true

    /time/timerecords/{id}?calculate_price=true

Example

    POST http://{tenant}.api.primaerp.com/v1/time/timerecords?calculate_price=true

    PUT http://{tenant}.api.primaerp.com/v1/time/timerecords/{id}?calculate_price=true

The price will be calculated by the duration of the time record and its corresponding price list (according to the above priorities). At the end, the time record is saved with the calculated price.

Price update

It is used to update the price when the price list was changed.

Syntax

    /time/timerecords/{id}/$updateprice

Where {resource} is a resource ID.

Example

    PUT http://{tenant}.api.primaerp.com/v1/time/timerecords/{id}/$updateprice

The price will be calculated by the duration of the time record and its corresponding price list (according to the above priorities). At the end, the time record is saved with the calculated price.

Calculation on demand

It is used in case you want to know the price of the time record before saving.

Syntax

    /time/timerecords/$calculateprice

Example

You can post the time record

    POST http://{tenant}.api.primaerp.com/v1/time/timerecords/$calculateprice

This method returns the price which is calculated by the duration of the time record and its corresponding price list (according to the priorities).

Note that a time record is NOT stored neither updated!