- name
- time_tracking_invoicing
- tier
- 2
- task
- T16
- description
- This skill should be used when the task asks to "register hours", "erfassen Sie Stunden", "registrer timer", "registrer timar", "enregistrer des heures", "registrar horas", log time on a project activity, or involves recording timesheet hours on a project and then creating a project invoice based on those hours.
# Time Tracking + Project Invoicing
Only write calls count. GETs are free. Target: 2 writes, 0 errors.
## Turn 1: Find Everything (4 parallel GETs — free)
```
GET /employee?email=<email>&fields=id,firstName,lastName&count=5
GET /project?name=<project_name>&fields=id,name,customer(id,name)&count=5
GET /activity?name=<activity_name>&fields=id,name&count=5
GET /ledger/account?number=1500,3000&fields=id,number,name
```
Extract: employee_id, project_id, customer_id (from project.customer.id), activity_id.
From accounts: account_1500_id (Kundefordringer) and account_3000_id (Salgsinntekt).
If account 3000 not found, use account 3100 or search for sales revenue account.
## Turn 2: Register Hours (1 write)
### WRITE 1: POST /timesheet/entry
```json
{
"employee": {"id": <employee_id>},
"project": {"id": <project_id>},
"activity": {"id": <activity_id>},
"date": "<today_date>",
"hours": <hours>
}
```
## Turn 3: Create Invoice Voucher (1 write)
Calculate: total_incl_vat = hours × hourly_rate × 1.25
### WRITE 2: POST /ledger/voucher
```json
{
"date": "<today_date>",
"description": "Prosjektfaktura - <project_name>",
"postings": [
{
"date": "<today_date>",
"account": {"id": <account_1500_id>},
"amountGross": <total_incl_vat>,
"amountGrossCurrency": <total_incl_vat>,
"description": "<activity_name> - <hours> timer",
"row": 1,
"customer": {"id": <customer_id>}
},
{
"date": "<today_date>",
"account": {"id": <account_3000_id>},
"amountGross": -<total_incl_vat>,
"amountGrossCurrency": -<total_incl_vat>,
"vatType": {"id": 3},
"description": "<activity_name> - <hours> timer",
"row": 2,
"customer": {"id": <customer_id>}
}
]
}
```
The vatType 3 on row 2 makes the system auto-generate an output VAT posting on account 2700. The postings balance automatically.
**Total: 2 writes, 0 errors. 6 API calls.**
## STRICT RULES
- **DO NOT** set up bank accounts — manual vouchers don't need bank
- **DO NOT** call POST /invoice — use POST /ledger/voucher instead
- **DO NOT** call POST /project/projectActivity — not needed
- **DO NOT** create customers, products, or suppliers — they pre-exist
- `vatType: {"id": 3}` on the revenue posting (row 2) — output VAT 25%
- `customer` reference MUST be on the 1500 posting (links receivable to customer)
- `total_incl_vat` = hours × hourly_rate × 1.25
- Use today's date for all date fields
Auf GitHub ansehen