- name
- register_travel_expense
- tier
- 2
- task
- T13
- description
- This skill should be used when the task asks to "register a travel expense", "enregistrez une note de frais", "registrer reiseregning", "registrer ein reisereknung", "registrar despesas de viagem", "registre una nota de gastos", "Reisekostenabrechnung erstellen", or involves creating a travel expense report with costs like flights, taxi, per diem, hotel, or mileage for an employee.
# Register Travel Expense
8 calls. Correctness first — deliver, approve, AND create vouchers.
## Call 1: 3 parallel GETs
```
GET /employee?email=<email>&fields=id,firstName,lastName,email&count=5
GET /travelExpense/costCategory?fields=id,description&count=50
GET /travelExpense/paymentType?fields=id,description&count=10
```
From costCategory response, match `description` exactly:
- **"Fly"** — for flights
- **"Taxi"** — for taxi
- **"Reisekostnad, ikke oppgavepliktig"** — for per diem / daily allowance
From paymentType response, use **"Privat utlegg"**.
## Call 2: POST travel expense with ALL costs inline
Per diem amount = number of days × daily rate from the prompt (e.g. 4 days × 800 NOK = 3200 NOK).
```json
POST /travelExpense
{
"employee": {"id": <employee_id>},
"title": "<trip title from prompt>",
"travelDetails": {
"departureDate": "<start date>",
"departureTime": "08:00",
"returnDate": "<end date>",
"returnTime": "18:00",
"departureFrom": "Oslo",
"destination": "<destination from prompt>",
"purpose": "<trip title>",
"isDayTrip": false,
"isForeignTravel": false
},
"costs": [
{
"costCategory": {"id": <fly_id>},
"date": "<departure date>",
"amountNOKInclVAT": <flight_amount>,
"amountCurrencyIncVat": <flight_amount>,
"vatType": {"id": 0},
"currency": {"id": 1},
"paymentType": {"id": <privat_utlegg_id>}
},
{
"costCategory": {"id": <taxi_id>},
"date": "<departure date>",
"amountNOKInclVAT": <taxi_amount>,
"amountCurrencyIncVat": <taxi_amount>,
"vatType": {"id": 0},
"currency": {"id": 1},
"paymentType": {"id": <privat_utlegg_id>}
},
{
"costCategory": {"id": <reisekostnad_id>},
"date": "<departure date>",
"amountNOKInclVAT": <per_diem_total>,
"amountCurrencyIncVat": <per_diem_total>,
"vatType": {"id": 0},
"currency": {"id": 1},
"paymentType": {"id": <privat_utlegg_id>}
}
]
}
```
## Call 3: Deliver + Approve + Create Vouchers (3 sequential PUTs)
```
PUT /travelExpense/:deliver?id=<travel_expense_id>
```
Then:
```
PUT /travelExpense/:approve?id=<travel_expense_id>
```
Then:
```
PUT /travelExpense/:createVouchers?id=<travel_expense_id>&date=<departure_date>
```
**Total: 8 calls (3 GETs + 1 POST + 3 PUTs), 4 write calls, 0 errors.**
## Gotchas
- Per diem goes as regular cost with category **"Reisekostnad, ikke oppgavepliktig"** — NOT perDiemCompensations
- Per diem amount = days × daily rate FROM THE PROMPT (e.g. "800 NOK" × 4 days = 3200)
- Use `fields=id,description` on costCategory — never `fields=*` (truncation causes wrong IDs)
- Never guess IDs — always match by `description` from the actual response
- All 3 costs MUST be inline in the POST body — do NOT create costs separately
- `departureFrom` and `purpose` are required — without them `:deliver` will fail
- Must deliver THEN approve THEN createVouchers — in that order
Ver en GitHub