- name
- year_end_closing
- tier
- 3
- task
- T30
- description
- This skill handles simplified year-end closing tasks including depreciation, prepaid expense reversal, and tax calculation. Keywords include "year-end closing", "årsoppgjer", "årsoppgjør", "clôture annuelle", "cierre de ejercicio", "Jahresabschluss", "depreciation", "avskriving", "prepaid expense", "forskuddsbetalt", "tax expense", "skattekostnad".
# Year-End Closing
Depreciation + prepaid reversal + tax. ALL dates: 2025-12-31.
## Call 1: GET accounts + GET postings (parallel, 2 calls)
```
GET /ledger/account?number=<all_from_prompt>,1209,8700,2920,6300&fields=id,number,name
GET /ledger/posting?dateFrom=2025-01-01&dateTo=2025-12-31&fields=account(number),amount&count=500
```
ONE GET with ALL account numbers. Include 1209, 8700, 2920, 6300, the depreciation expense account (e.g. 6010), and all asset accounts from the prompt.
## Call 2 (if needed): POST missing accounts (batch)
If 1209 AND/OR 8700 not found, create in ONE batch call:
```json
POST /ledger/account/list
[
{"number": 1209, "name": "Akkumulert avskrivning"},
{"number": 8700, "name": "Skattekostnad"}
]
```
Only include accounts actually missing.
## MANDATORY CALCULATIONS
**A. Depreciation:** annual_depreciation = prompt_amount / useful_life_years (round to 2 decimals)
**B. Prepaid reversal:** Sum ALL postings on prepaid account (e.g. 1700) = remaining balance to reverse. Find the paired expense account (4000-8699) from posting data — typically 6300.
**C. Tax:** Revenue = abs(sum of postings on 3000-3999). Expenses = sum of positive postings on 4000-8699. Adjustments = total depreciation + prepaid remaining. Tax = max(0, (Revenue - Expenses - Adjustments) × 0.22), round to 2 decimals.
## Calls 3-7: POST 5 vouchers (ALL 5 MUST be posted)
### Voucher 1-3: Depreciation (one per asset, separate vouchers)
```json
POST /ledger/voucher
{
"date": "2025-12-31",
"description": "Avskriving <asset_name>",
"postings": [
{"date": "2025-12-31", "account": {"id": <depr_expense_id>}, "amountGross": <annual_depr>, "amountGrossCurrency": <annual_depr>, "row": 1},
{"date": "2025-12-31", "account": {"id": <1209_id>}, "amountGross": -<annual_depr>, "amountGrossCurrency": -<annual_depr>, "row": 2}
]
}
```
### Voucher 4: Prepaid reversal
```json
POST /ledger/voucher
{
"date": "2025-12-31",
"description": "Reversering forskuddsbetalt",
"postings": [
{"date": "2025-12-31", "account": {"id": <expense_acct_id>}, "amountGross": <remaining_balance>, "amountGrossCurrency": <remaining_balance>, "row": 1},
{"date": "2025-12-31", "account": {"id": <1700_id>}, "amountGross": -<remaining_balance>, "amountGrossCurrency": -<remaining_balance>, "row": 2}
]
}
```
### Voucher 5: Tax provision
```json
POST /ledger/voucher
{
"date": "2025-12-31",
"description": "Skattekostnad 2025",
"postings": [
{"date": "2025-12-31", "account": {"id": <8700_id>}, "amountGross": <tax>, "amountGrossCurrency": <tax>, "row": 1},
{"date": "2025-12-31", "account": {"id": <2920_id>}, "amountGross": -<tax>, "amountGrossCurrency": -<tax>, "row": 2}
]
}
```
**ALL 5 vouchers MUST be posted, even if tax = 0. Total: 7-8 calls, 0 errors.**
## STRICT RULES
- **Depreciation = prompt_amount / useful_life_years.** Use the amount stated in the prompt.
- **Prepaid = remaining balance** from posting data. NOT the full prompt amount.
- Always use `amountGross` AND `amountGrossCurrency`. Never `amount`.
- Use IDs from POST response directly. Never re-fetch.
- **ALL 5 vouchers MUST be posted.** Do NOT skip tax voucher even if tax = 0.
View on GitHub