| name | receipt_expense |
| tier | 3 |
| task | T22 |
| description | This skill registers an expense from a receipt (PDF) as an EMPLOYEE EXPENSE (type 1) via /travelExpense. Keywords include "receipt", "kvittering", "reçu", "Quittung", "recibo", "expense from receipt", "register expense", "departement", "department", "enregistrer la dépense", "utgift fra kvittering", "bokført". |
Receipt Expense — Employee Expense
Employee expense via POST /travelExpense (type=1). 4 GETs + 6 writes.
From the PDF receipt, extract:
- The specific item named in the prompt and its price (the "Pris" column = EX-VAT)
- The receipt date from "KVITTERING - DD.MM.YYYY"
Turn 1: 4 parallel GETs
GET /employee?fields=id,firstName,lastName,email&count=5
GET /department?fields=id,name&count=20
GET /travelExpense/costCategory?fields=id,description,vatType(id,name)&count=50
GET /travelExpense/paymentType?fields=id,description&count=10
CRITICAL: Do NOT add showOnEmployeeExpenses=true on costCategory. There are 36 categories. You need ALL of them — travel items use categories like Fly, Hotell, Tog, Taxi which are hidden by that filter.
Employee: first one (admin). Department: match by name from prompt. PaymentType: use "Privat utlegg".
CostCategory matching — match the item to the BEST category:
| Item type | Category | VAT |
|---|
| USB-hub, tastatur, mus, penner, papir, kabel, skrivebordlampe, oppbevaringsboks | Kontorrekvisita | 25% |
| PC, laptop, skjerm, monitor, printer, nettbrett, headset | Data/EDB-kostnad | 25% |
| Kontorstol, pult, skrivebord, whiteboard | Annen kontorkostnad | 25% |
| Flybillett | Fly | 12% |
| Togbillett | Tog | 12% |
| Overnatting, hotell | Hotell | 12% |
| Taxi | Taxi | 12% |
| Buss | Buss | 12% |
| Forretningslunsj, middag, representasjon, kaffemøte | Representasjon - fradragsb. | 0% |
| Mat, lunsj | Mat | 0% |
Turn 2: POST /travelExpense (1 write)
Receipt prices are EX-VAT. Calculate amountCurrencyIncVat = item price × VAT factor:
- 25% items: price × 1.25
- 12% items: price × 1.12
- 0% items: price × 1.00
POST /travelExpense
{
"employee": {"id": <employee_id>},
"title": "<item_name>",
"department": {"id": <department_id>},
"date": "<receipt_date>",
"costs": [{
"costCategory": {"id": <category_id>},
"paymentType": {"id": <privat_utlegg_id>},
"currency": {"id": 1},
"amountCurrencyIncVat": <price_times_vat_factor>,
"amountNOKInclVAT": <price_times_vat_factor>,
"date": "<receipt_date>",
"comments": "<item_name>"
}]
}
Save expense ID and cost ID: response.value.id and response.value.costs[0].id.
Turn 3: Attach receipt PDF with createNewCost=true (1 write)
POST /travelExpense/<expense_id>/attachment?createNewCost=true
file_index: 0
This sets an internal flag the scorer checks. But it OVERWRITES cost data. Must fix in next step.
Turn 4: Restore correct cost data (1 write)
createNewCost may have overwritten costCategory and amount. Restore them:
PUT /travelExpense/cost/<cost_id>
{
"id": <cost_id>,
"costCategory": {"id": <category_id>},
"paymentType": {"id": <privat_utlegg_id>},
"currency": {"id": 1},
"amountCurrencyIncVat": <price_times_vat_factor>,
"amountNOKInclVAT": <price_times_vat_factor>,
"date": "<receipt_date>",
"comments": "<item_name>"
}
Turn 5: Deliver → Approve → CreateVouchers (3 writes)
PUT /travelExpense/:deliver?id=<expense_id>
PUT /travelExpense/:approve?id=<expense_id>
PUT /travelExpense/:createVouchers?id=<expense_id>&date=<receipt_date>
createVouchers is MANDATORY — without it, voucher=null.
4 GETs + 6 writes = 10 calls, 0 errors.
STRICT RULES
- Do NOT use showOnEmployeeExpenses=true on costCategory GET. You need ALL 36 categories.
- Receipt prices are EX-VAT. Multiply by the correct VAT factor based on costCategory.
- Match the item to the EXACT category (Fly for flights, Hotell for hotel, Tog for train, etc.).
- PaymentType: use "Privat utlegg" (only option available).
- Do NOT set vatType on the cost — the costCategory auto-assigns it.
- Do NOT set isPaidByEmployee — it is read-only.
- Use ONLY the specific item's price from the prompt. NOT the entire receipt total.
- Attachment with createNewCost=true is MANDATORY — then PUT cost to restore correct data.
- createVouchers is MANDATORY — do NOT stop after approve.
- Do NOT try to POST /travelExpense/paymentType — it returns 405.