# Post Calculation

Part of the [GeoDynamics API](/api/geodynamics/index.md). Host: `https://api.geodynamics.dev`.

## About Post Calculation

Post Calculation allows you to export your time registration enriched with post calculation information.

## Choosing the best export mode Activity or CostCenter

Generally there are 2 methods for exporting post calculation. Activity based will export every action of the user during the day, allowing you to have reliable from/to times per cost center. CostCenter based will group the visits by cost center, so if a user visits the same cost center twice in a day, there is only one visit hence the from/to times can no longer be used.

| Mode |  | Description |
| :-- | --- | --- |
| `Activity` | 0 | Every post calculation event is used for output |
| `CostCenter` | 1 | Post calculation events are grouped by cost center before being used for output |

## Grouping activity by cost center

When viewing the post calculation by cost center, the records are grouped by user/day/cost center. We also support second level grouping on 'activity code'. This option is only available when the mode is set to CostCenter. If the option is true we continue grouping on user/day/cost center. If the option is false the records are exported by user/day/cost center/activity code.

| GroupCostcenterByActivity | Description |
| :-- | --- |
| `True` | Every post calculation event is used for output |
| `False` | Post calculation events are grouped by cost center before being used for output |

## POST /intellitracer/v2/postcalculation/export?page={page}&search={search}

`https://api.geodynamics.dev/intellitracer/v2/postcalculation/export?page={page}&search={search}`

Privilege required: `Api: Postcalculation`

Export post calculation

Exports the time registration enriched with post calculation information if available. Results are grouped per day, per user.

In order to export time registration for all users, set _AllUsers_ to `true`.

In order to export time registration for the listed users, set _AllUsers_ to `false`.

### Path parameters

| Name | Type | Required | Example |
| --- | --- | --- | --- |
| `page` | number | required | `1` |
| `search` | string | required | `ABC` |

### Request body

Type: `object`

| Field | Type | Required |
| --- | --- | --- |
| `UserIds` (default = null) | array | optional |
| `AllUsers` (default = false) | boolean | optional |
| `Mode` (default = 0)  Calculate the postcalculation by activity or by costcenter. | number | optional |
| `GroupCostcenterByActivity` (default = false)  Group postcalculation by activity? | boolean | optional |
| `DateUtc` | string | required |
| `Filter` (default = null)  Filter on cost center. | string | optional |
| `IncludeTimesheet` (default = false) | boolean | optional |
| `IncludeTimesheetEvents` (default = false)  Include an overview of every event this day. This is similar to the bar graphs you can find on the 'Overview per user per day' screen in GeoDynamics. | boolean | optional |
| `IncludeTimeValidation` (default = false) | boolean | optional |
| `IncludePostCalculationLog` (default = false) | boolean | optional |
| `IncludeLossCostcenter` (default = false) | boolean | optional |

### Responses

#### 200: OK

```json
[
  {
    "User": {
      "Id": "00000000-0000-0000-0000-000000000000",
      "Name": "John Doe",
      "Code": "012345",
      "EmployerCode": "ReplaceWithEncodedAuthentication",
      "FreeField1": null,
      "FreeField2": null,
      "FreeField3": null,
      "FreeField4": null,
      "FreeField5": null,
      "FreeField6": null
    },
    "DateUtc": "2019-01-18T00:00:00",
    "DateLocal": "2019-01-18T00:00:00",
    "TimeSheet": {
      "NormalHours": 7.6,
      "WorkedHours": 7.6,
      "NormalWorkedHours": 7.6,
      "Pause": 0.3,
      "LoadUnload": 7.6,
      "OvertimePositive": 7.6,
      "OvertimeNegative": 7.6,
      "OvertimeFirstHour": 7.6,
      "OvertimeExtraHours": 7.6,
      "OvertimeFirstHourCode": "`123'",
      "OvertimeExtraHoursCode": "`123'",
      "PoiCodeStart": "`012345'",
      "PoiNameStart": "`Poi 1'",
      "VehicleNameStart": "`Vehicle 1'",
      "PoiCodeStop": "`012345'",
      "PoiNameStop": "`Poi 1'",
      "VehicleNameStop": "`Vehicle 1'",
      "Mobility": {
        "KmDriver": 100.2,
        "KmPassenger": 100.2,
        "KmSingleDriver": 12.4,
        "KmHomeWork": 100.2,
        "KmHomeSite": 100.2,
        "KmHomeOther": 100.2,
        "EurDriver": 9.53,
        "EurPassenger": 9.53,
        "EurSingleDriver": 6.53,
        "EurHomeWork": 9.53,
        "EurHomeSite": 9.53,
        "EurHomeOther": 9.53,
        "EurMobility": 9.53
      },
      "Absence": {
        "Duration": 7.6,
        "Code": "SICKNESS"
      },
      "StartMovementUtc": "07:03:55",
      "StartMovementLocal": "07:03:55",
      "StartWorkUtc": "07:03:55",
      "StartWorkLocal": "07:03:55",
      "StopWorkUtc": "07:03:55",
      "StopWorkLocal": "07:03:55",
      "StopMovementUtc": "07:03:55",
      "StopMovementLocal": "07:03:55"
    },
    "TimesheetEvents": [
      {
        "Type": 0,
        "EventType": 0,
        "StartDateTimeLocal": "2019-03-12T11:01:51",
        "StartDateTimeUtc": "2019-03-12T11:00:51",
        "StopDateTimeLocal": "2019-03-12T11:01:51",
        "StopDateTimeUtc": "2019-03-12T11:00:51",
        "StartResource": {
          "Id": "00000000-0000-0000-0000-000000000000",
          "Code": "012345",
          "Name": "John Doe",
          "Type": 0
        },
        "StopResource": {
          "Id": "00000000-0000-0000-0000-000000000000",
          "Code": "012345",
          "Name": "John Doe",
          "Type": 0
        },
        "StartLocation": {
          "CountryName": "Belgium",
          "AddressLine": "Dumolinlaan 9, 8500 Kortrijk, BE",
          "PoiList": [
            "00000000-0000-0000-0000-000000000000",
            "00000000-0000-0000-0000-000000000000"
          ],
          "City": "Kortrijk",
          "CityLine": "8500 Kortrijk, BE",
          "CountryCode": 0,
          "HouseNumber": "9",
          "Latitude": 50.812939,
          "Longitude": 3.245304,
          "PostalCode": "8500",
          "ShortAddressLine": "Dumolinlaan 9, Kortrijk, BE",
          "Street": "Dumolinlaan",
          "StreetLine": "Dumolinlaan 9",
          "Submunicipality": "Kortrijk"
        },
        "StopLocation": {
          "CountryName": "Belgium",
          "AddressLine": "Dumolinlaan 9, 8500 Kortrijk, BE",
          "PoiList": [
            "00000000-0000-0000-0000-000000000000",
            "00000000-0000-0000-0000-000000000000"
          ],
          "City": "Kortrijk",
          "CityLine": "8500 Kortrijk, BE",
          "CountryCode": 0,
          "HouseNumber": "9",
          "Latitude": 50.812939,
          "Longitude": 3.245304,
          "PostalCode": "8500",
          "ShortAddressLine": "Dumolinlaan 9, Kortrijk, BE",
          "Street": "Dumolinlaan",
          "StreetLine": "Dumolinlaan 9",
          "Submunicipality": "Kortrijk"
        },
        "Duration": "00:37:54",
        "Mileage": 1245.4,
        "MileageBirdflight": 1100.5,
        "JobNumber": "12345"
      }
    ],
    "PostCalculationEvents": [
      {
        "CostCenter": "Workplace 1",
        "CostCenterFullCode": "Workplace 1",
        "ActivityCode": "001",
        "ActivityContext1": "Context 1",
        "ActivityContext2": "Context2",
        "ActivityContext3": "Context3",
        "Duration": 7.6,
        "TimeFromLocal": "2019-01-18T05:54:15",
        "TimeFromUtc": "2019-01-18T06:54:15",
        "TimeToLocal": "2019-01-18T05:58:16",
        "TimeToUtc": "2019-01-18T06:58:16",
        "Mobility": {
          "KmDriver": 100.2,
          "KmPassenger": 100.2,
          "KmSingleDriver": 12.4,
          "KmHomeWork": 100.2,
          "KmHomeSite": 100.2,
          "KmHomeOther": 100.2,
          "EurDriver": 9.53,
          "EurPassenger": 9.53,
          "EurSingleDriver": 6.53,
          "EurHomeWork": 9.53,
          "EurHomeSite": 9.53,
          "EurHomeOther": 9.53,
          "EurMobility": 9.53
        },
        "Resource": {
          "Id": "00000000-0000-0000-0000-000000000000",
          "Code": "012345",
          "Name": "John Doe",
          "Type": 0
        },
        "Details": {
          "DirectAssignedWorkTime": 7.6,
          "IndirectAssignedWorkTime": 7.6,
          "IndirectAssignedMobilityBeforeTime": 7.6,
          "IndirectAssignedMobilityAfterTime": 7.6,
          "IndirectAssignedMobilityTotalTime": 7.6,
          "IndirectAssignedLoadUnloadTime": 7.6,
          "IndirectAssignedTravelTime": 7.6,
          "IndirectAssignedAbsencePaidTime": 7.6,
          "IndirectAssignedAbsenceUnpaidTime": 7.6,
          "DirectAssignedWorkDistance": 7.6,
          "IndirectAssignedWorkDistance": 7.6,
          "IndirectAssignedMobilityBeforeDistance": 7.6,
          "IndirectAssignedMobilityAfterDistance": 7.6,
          "IndirectAssignedMobilityTotalDistance": 7.6,
          "IndirectAssignedLoadUnloadDistance": 7.6,
          "IndirectAssignedTravelDistance": 7.6,
          "TotalAssignedTime": 7.6,
          "TotalAssignedDistance": 7.6,
          "NormalWorkedHours": 7.6,
          "FirstOvertimeHour": 7.6,
          "ExtraOvertimeHours": 7.6,

...
```

_Example truncated._

#### 401: Unauthorized

#### 403: Forbidden

#### 417: ExpectationFailed

## POST /intellitracer/v2/postcalculation/vehiclepercostcenter

`https://api.geodynamics.dev/intellitracer/v2/postcalculation/vehiclepercostcenter`

Privilege required: `Api: Postcalculation`

Vehicle per costcenter

### Request body

Type: `object`

| Field | Type | Required |
| --- | --- | --- |
| `PoiIds` If no PoiIds are provided, the results will be for all Points of Interest. | array | optional |
| `ResourceIds` | array | required |
| `FromDate` | string | required |
| `ToDate` | string | required |
| `MinimumDuration` (default = 0.0)     Minimum duration in minutes. | number | optional |

### Responses

#### 200: OK

```json
[
  {
    "Poi": {
      "Id": "00000000-0000-0000-0000-000000000000",
      "Name": "Home",
      "Code": "012345"
    },
    "Date": "2019-01-18",
    "Vehicle": {
      "Id": "00000000-0000-0000-0000-000000000000",
      "Code": "012345",
      "Name": "John Doe",
      "Type": 0
    },
    "TimeFrom": "00:00:00",
    "TimeTo": "00:00:00",
    "TimeDuration": "00:00:00",
    "DrivingToMileage": "100",
    "DrivingToDuration": "00:00:00",
    "DrivingAtMileage": "100",
    "DrivingAtDuration": "00:00:00",
    "DurationContactOn": "00:00:00"
  }
]
```

#### 401: Unauthorized

#### 403: Forbidden

#### 417: ExpectationFailed
