jaz-cli 2.5.0 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/skills/api/SKILL.md +12 -2
- package/assets/skills/api/references/dependencies.md +3 -2
- package/assets/skills/api/references/endpoints.md +78 -0
- package/assets/skills/api/references/feature-glossary.md +5 -5
- package/assets/skills/api/references/field-map.md +17 -0
- package/assets/skills/api/references/full-api-surface.md +1 -1
- package/assets/skills/conversion/SKILL.md +1 -1
- package/assets/skills/transaction-recipes/SKILL.md +53 -19
- package/assets/skills/transaction-recipes/references/asset-disposal.md +174 -0
- package/assets/skills/transaction-recipes/references/fixed-deposit.md +164 -0
- package/assets/skills/transaction-recipes/references/hire-purchase.md +190 -0
- package/dist/__tests__/amortization.test.js +101 -0
- package/dist/__tests__/asset-disposal.test.js +249 -0
- package/dist/__tests__/blueprint.test.js +72 -0
- package/dist/__tests__/depreciation.test.js +125 -0
- package/dist/__tests__/ecl.test.js +134 -0
- package/dist/__tests__/fixed-deposit.test.js +214 -0
- package/dist/__tests__/fx-reval.test.js +115 -0
- package/dist/__tests__/lease.test.js +96 -0
- package/dist/__tests__/loan.test.js +80 -0
- package/dist/__tests__/provision.test.js +141 -0
- package/dist/__tests__/validate.test.js +81 -0
- package/dist/calc/amortization.js +21 -3
- package/dist/calc/asset-disposal.js +155 -0
- package/dist/calc/blueprint.js +26 -1
- package/dist/calc/depreciation.js +24 -1
- package/dist/calc/ecl.js +13 -1
- package/dist/calc/fixed-deposit.js +178 -0
- package/dist/calc/format.js +107 -2
- package/dist/calc/fx-reval.js +11 -1
- package/dist/calc/lease.js +42 -9
- package/dist/calc/loan.js +12 -2
- package/dist/calc/provision.js +17 -1
- package/dist/commands/calc.js +54 -2
- package/package.json +5 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: api
|
|
3
|
-
version: 2.
|
|
3
|
+
version: 2.7.0
|
|
4
4
|
description: Complete reference for the Jaz/Juan REST API — the accounting platform backend. Use this skill whenever building, modifying, debugging, or extending any code that calls the API — including API clients, integrations, data seeding, test data, or new endpoint work. Contains every field name, response shape, error, gotcha, and edge case discovered through live production testing.
|
|
5
5
|
license: MIT
|
|
6
6
|
compatibility: Requires Jaz/Juan API key (x-jk-api-key header). Works with Claude Code, Claude Cowork, Claude.ai, and any agent that reads markdown.
|
|
@@ -22,7 +22,7 @@ You are working with the **Jaz/Juan REST API** — the backend for Jaz (Singapor
|
|
|
22
22
|
|
|
23
23
|
**Base URL**: `https://api.getjaz.com`
|
|
24
24
|
**Auth**: `x-jk-api-key: <key>` header on every request — key has `jk-` prefix (e.g., `jk-a1b2c3...`). NOT `Authorization: Bearer` or `x-api-key`.
|
|
25
|
-
**Content-Type**: `application/json` for all POST/PUT/PATCH
|
|
25
|
+
**Content-Type**: `application/json` for all POST/PUT/PATCH (except multipart endpoints: `createBusinessTransactionFromAttachment` FILE mode, `importBankStatementFromAttachment`, and attachment uploads)
|
|
26
26
|
**All paths are prefixed**: `/api/v1/` (e.g., `https://api.getjaz.com/api/v1/invoices`)
|
|
27
27
|
|
|
28
28
|
## Critical Rules
|
|
@@ -129,6 +129,14 @@ You are working with the **Jaz/Juan REST API** — the backend for Jaz (Singapor
|
|
|
129
129
|
55. **Scheduled endpoints support date aliases** — `txnDateAliases` middleware (mapping `issueDate`/`date` → `valueDate`) now applies to all scheduled create/update endpoints: `POST/PUT /scheduled/invoices`, `POST/PUT /scheduled/bills`, `POST/PUT /scheduled/journals`, `POST/PUT /scheduled/subscriptions`.
|
|
130
130
|
56. **Kebab-case URL aliases** — `capsuleTypes` endpoints also accept kebab-case paths: `/capsule-types` (list, search, CRUD). `moveTransactionCapsules` also accepts `/move-transaction-capsules`. Both camelCase and kebab-case work identically.
|
|
131
131
|
|
|
132
|
+
### Jaz Magic — Extraction & Autofill
|
|
133
|
+
57. **When the user starts from an attachment, always use Jaz Magic** — if the input is a PDF, JPG, or any document image (invoice, bill, receipt), the correct path is `POST /magic/createBusinessTransactionFromAttachment`. Do NOT manually construct a `POST /invoices` or `POST /bills` payload from an attachment — Jaz Magic handles the entire extraction-and-autofill pipeline server-side: OCR, line item detection, contact matching, CoA auto-mapping via ML learning, and draft creation with all fields pre-filled. Only use `POST /invoices` or `POST /bills` when building transactions from structured data (JSON, CSV, database rows) where the fields are already known.
|
|
134
|
+
58. **Two upload modes with different content types** — `sourceType: "FILE"` requires **multipart/form-data** with `sourceFile` blob (JSON body fails with 400 "sourceFile is a required field"). `sourceType: "URL"` accepts **application/json** with `sourceURL` string. The OAS only documents URL mode — FILE mode (the common case) is undocumented.
|
|
135
|
+
59. **Three required fields**: `sourceFile` (multipart blob — NOT `file`), `businessTransactionType` (`"INVOICE"` or `"BILL"` only — `EXPENSE` rejected), `sourceType` (`"FILE"` or `"URL"`). All three are validated server-side.
|
|
136
|
+
60. **Response maps transaction types**: Request `BILL` → response `businessTransactionType: "PURCHASE"`. Request `INVOICE` → response `businessTransactionType: "SALE"`. S3 paths follow: `/purchases/` vs `/sales/`.
|
|
137
|
+
61. **Extraction is asynchronous** — the API response is immediate (file upload confirmation only). The actual Magic pipeline — OCR, line item extraction, contact matching, CoA learning, and autofill — runs asynchronously. The `subscriptionFBPath` in the response (e.g., `magic_transactions/{orgId}/purchase/{fileId}`) is a Firebase Realtime Database path for subscribing to extraction status updates.
|
|
138
|
+
62. **Accepts PDF and JPG/JPEG** — both file types confirmed working. Handwritten documents are accepted at upload stage (extraction quality varies). `fileType` in response reflects actual format: `"PDF"`, `"JPEG"`.
|
|
139
|
+
|
|
132
140
|
## Supporting Files
|
|
133
141
|
|
|
134
142
|
For detailed reference, read these files in this skill directory:
|
|
@@ -154,6 +162,8 @@ The backend DX overhaul is live. Key improvements now available:
|
|
|
154
162
|
|
|
155
163
|
## Recommended Client Patterns
|
|
156
164
|
|
|
165
|
+
- **Starting from an attachment?** → Use Jaz Magic (`POST /magic/createBusinessTransactionFromAttachment`). Never manually parse a PDF/JPG to construct `POST /invoices` or `POST /bills` — let the extraction & autofill pipeline handle it.
|
|
166
|
+
- **Starting from structured data?** → Use `POST /invoices` or `POST /bills` directly with the known field values.
|
|
157
167
|
- **Serialization (Python)**: `model_dump(mode="json", by_alias=True, exclude_unset=True, exclude_none=True)`
|
|
158
168
|
- **Field names**: All request bodies use camelCase
|
|
159
169
|
- **Date serialization**: Python `date` type → `YYYY-MM-DD` strings
|
|
@@ -54,8 +54,9 @@ Resources MUST be created in this order. Steps at the same level can run in para
|
|
|
54
54
|
- `POST /items` → create items (needs CoA + tax profile IDs from Levels 0-1)
|
|
55
55
|
|
|
56
56
|
### Level 3: Transactions (parallel)
|
|
57
|
-
- `POST /
|
|
58
|
-
- `POST /
|
|
57
|
+
- `POST /magic/createBusinessTransactionFromAttachment` → **starting from an attachment (PDF/JPG)?** Use Jaz Magic — extraction & autofill creates a draft invoice or bill with all fields pre-filled. See SKILL.md Rules 57-62.
|
|
58
|
+
- `POST /invoices` → create invoices from structured data (needs contacts + CoA + tax profiles)
|
|
59
|
+
- `POST /bills` → create bills from structured data (same deps, can embed payments)
|
|
59
60
|
- `POST /journals` → create journal entries (needs CoA)
|
|
60
61
|
- `POST /cash-in-journals` → cash receipts (needs bank account from CoA)
|
|
61
62
|
- `POST /cash-out-journals` → cash payments (needs bank account from CoA)
|
|
@@ -790,6 +790,84 @@ Valid `datatypeCode`: `TEXT`, `NUMBER`, `BOOLEAN`, `DATE`, `LINK`.
|
|
|
790
790
|
|
|
791
791
|
---
|
|
792
792
|
|
|
793
|
+
## 14g. Jaz Magic — Extraction & Autofill
|
|
794
|
+
|
|
795
|
+
### POST /api/v1/magic/createBusinessTransactionFromAttachment
|
|
796
|
+
|
|
797
|
+
**When the user starts from an attachment (PDF, JPG, document image), this is the endpoint to use.** Do not manually parse files to construct `POST /invoices` or `POST /bills` — Jaz Magic handles the full extraction-and-autofill pipeline server-side: OCR, line item detection, contact matching, and CoA auto-mapping via ML learning. Creates a complete draft transaction with all fields pre-filled. Use `POST /invoices` or `POST /bills` only when building from structured data where the fields are already known.
|
|
798
|
+
|
|
799
|
+
Processing is **asynchronous** — the API response confirms file upload immediately. The extraction pipeline runs server-side and pushes status updates via Firebase Realtime Database.
|
|
800
|
+
|
|
801
|
+
**Two modes** — content type depends on `sourceType`:
|
|
802
|
+
|
|
803
|
+
#### FILE mode (multipart/form-data) — most common
|
|
804
|
+
|
|
805
|
+
```
|
|
806
|
+
POST /api/v1/magic/createBusinessTransactionFromAttachment
|
|
807
|
+
Content-Type: multipart/form-data
|
|
808
|
+
|
|
809
|
+
Fields:
|
|
810
|
+
- sourceFile: PDF or JPG file blob (NOT "file")
|
|
811
|
+
- businessTransactionType: "INVOICE" or "BILL" (NOT "EXPENSE")
|
|
812
|
+
- sourceType: "FILE"
|
|
813
|
+
```
|
|
814
|
+
|
|
815
|
+
```json
|
|
816
|
+
/ Response (201):
|
|
817
|
+
{
|
|
818
|
+
"data": {
|
|
819
|
+
"businessTransactionType": "PURCHASE",
|
|
820
|
+
"filename": "NB64458.pdf",
|
|
821
|
+
"invalidFiles": [],
|
|
822
|
+
"validFiles": [{
|
|
823
|
+
"subscriptionFBPath": "magic_transactions/{orgId}/purchase/{fileId}",
|
|
824
|
+
"errorCode": null,
|
|
825
|
+
"errorMessage": null,
|
|
826
|
+
"fileDetails": {
|
|
827
|
+
"fileId": "6e999313b8b53ccef0757394ee6c7e6a",
|
|
828
|
+
"fileType": "PDF",
|
|
829
|
+
"fileURL": "https://s3.ap-southeast-1.amazonaws.com/.../{resourceId}.PDF",
|
|
830
|
+
"fileName": "NB64458.pdf"
|
|
831
|
+
}
|
|
832
|
+
}]
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
```
|
|
836
|
+
|
|
837
|
+
#### URL mode (application/json) — for remote files
|
|
838
|
+
|
|
839
|
+
```json
|
|
840
|
+
/ Request:
|
|
841
|
+
POST /api/v1/magic/createBusinessTransactionFromAttachment
|
|
842
|
+
Content-Type: application/json
|
|
843
|
+
|
|
844
|
+
{
|
|
845
|
+
"businessTransactionType": "BILL",
|
|
846
|
+
"sourceType": "URL",
|
|
847
|
+
"sourceURL": "https://example.com/invoice.pdf"
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
/ Response: same shape as FILE mode
|
|
851
|
+
```
|
|
852
|
+
|
|
853
|
+
**What Jaz Magic extracts and autofills:**
|
|
854
|
+
- Line items (description, quantity, unit price, amounts)
|
|
855
|
+
- Contact name and details (matched against existing contacts)
|
|
856
|
+
- Chart of Accounts mapping (ML-based learning from past transactions)
|
|
857
|
+
- Tax amounts and profiles
|
|
858
|
+
- Document reference numbers, dates, currency
|
|
859
|
+
|
|
860
|
+
**Key gotchas:**
|
|
861
|
+
- `sourceFile` is the field name (NOT `file`) — same pattern as bank statement endpoint
|
|
862
|
+
- Only `INVOICE` and `BILL` accepted — `EXPENSE` returns 422
|
|
863
|
+
- Response maps types: `INVOICE` → `SALE`, `BILL` → `PURCHASE`
|
|
864
|
+
- JSON body with `sourceType: "FILE"` always fails (400) — MUST use multipart
|
|
865
|
+
- `subscriptionFBPath` is the Firebase path for tracking extraction progress
|
|
866
|
+
- All three fields (`sourceFile`/`sourceURL`, `businessTransactionType`, `sourceType`) are required — omitting any returns 422
|
|
867
|
+
- File types confirmed: PDF, JPG/JPEG (handwritten documents accepted — extraction quality varies)
|
|
868
|
+
|
|
869
|
+
---
|
|
870
|
+
|
|
793
871
|
## 15. Bank Records
|
|
794
872
|
|
|
795
873
|
### POST /api/v1/magic/importBankStatementFromAttachment (multipart)
|
|
@@ -14,7 +14,7 @@ Key capabilities: draft/approval workflows, multi-currency (auto-fetch ECB rates
|
|
|
14
14
|
|
|
15
15
|
If payment date equals invoice date, it's recorded as a cash transaction (not AR). Transaction fees are deducted from cash received. RGL = `(Invoice payment / Transaction Rate) - (Cash received / Payment Rate)`.
|
|
16
16
|
|
|
17
|
-
**API**: CRUD `GET/POST/PUT/DELETE /invoices`, `POST /invoices/search`, `POST /invoices/:id/payments`, `GET /invoices/:id/payments`, `POST /invoices/:id/credits`, `GET /invoices/:id/download`, `POST/GET/DELETE /invoices/:id/attachments`, `PUT /invoices/:id/approve`, `POST /scheduled/invoices` (CRUD), `POST /scheduled/subscriptions` (recurring). Generic payment ops: `GET/PUT/DELETE /payments/:id`
|
|
17
|
+
**API**: CRUD `GET/POST/PUT/DELETE /invoices`, `POST /invoices/search`, `POST /invoices/:id/payments`, `GET /invoices/:id/payments`, `POST /invoices/:id/credits`, `GET /invoices/:id/download`, `POST/GET/DELETE /invoices/:id/attachments`, `PUT /invoices/:id/approve`, `POST /scheduled/invoices` (CRUD), `POST /scheduled/subscriptions` (recurring). Generic payment ops: `GET/PUT/DELETE /payments/:id`. **Starting from a PDF/JPG attachment?** Use `POST /magic/createBusinessTransactionFromAttachment` instead — Jaz Magic handles extraction & autofill (see AI Agents section).
|
|
18
18
|
|
|
19
19
|
---
|
|
20
20
|
|
|
@@ -26,7 +26,7 @@ Key capabilities: bill receipts (short-form template creating bill + payment tog
|
|
|
26
26
|
|
|
27
27
|
Transaction fees are added to cash spent (not deducted like invoices). RGL = `(Cash spent / Payment rate) - (Bill payment / Transaction rate)`.
|
|
28
28
|
|
|
29
|
-
**API**: CRUD `GET/POST/PUT/DELETE /bills`, `POST /bills/search`, `POST /bills/:id/payments`, `GET /bills/:id/payments`, `POST /bills/:id/credits`, `POST/GET/DELETE /bills/:id/attachments`, `PUT /bills/:id/approve`, `POST /scheduled/bills` (CRUD). Generic payment ops: `GET/PUT/DELETE /payments/:id`
|
|
29
|
+
**API**: CRUD `GET/POST/PUT/DELETE /bills`, `POST /bills/search`, `POST /bills/:id/payments`, `GET /bills/:id/payments`, `POST /bills/:id/credits`, `POST/GET/DELETE /bills/:id/attachments`, `PUT /bills/:id/approve`, `POST /scheduled/bills` (CRUD). Generic payment ops: `GET/PUT/DELETE /payments/:id`. **Starting from a PDF/JPG attachment?** Use `POST /magic/createBusinessTransactionFromAttachment` instead — Jaz Magic handles extraction & autofill (see AI Agents section).
|
|
30
30
|
|
|
31
31
|
---
|
|
32
32
|
|
|
@@ -66,7 +66,7 @@ There is no dedicated `/deposits` endpoint (returns 404). Deposits are managed t
|
|
|
66
66
|
|
|
67
67
|
Manual accounting entries for non-payment transactions. Three types: Manual Journals (multi-line debit/credit entries), Cash Journals (2-line cash transfers between bank accounts with cross-currency support), and Transfer Journals (year-end trial balance transfers, non-editable).
|
|
68
68
|
|
|
69
|
-
Manual journals support multi-currency —
|
|
69
|
+
Manual journals support multi-currency — the entire journal can be in the org's base currency or any enabled foreign currency. Foreign currency journal restrictions: (1) no controlled accounts (AR/AP — use invoices/bills instead), (2) no FX system accounts (Unrealized Gain/Loss/Rounding), (3) bank accounts must match the journal's currency (e.g., USD journal → USD bank only).
|
|
70
70
|
|
|
71
71
|
Minimum 2 balanced entries required. Cash journals are restricted to exactly 2 lines. Bank/cash/current asset/equity/liability accounts cannot have tax profiles applied. Supports scheduled/recurring journals with dynamic scheduler strings (`{{YEAR}}`, `{{MONTH}}`).
|
|
72
72
|
|
|
@@ -173,9 +173,9 @@ Fixed assets lock their linked line items — cannot edit account, amounts, or e
|
|
|
173
173
|
|
|
174
174
|
**Agent Builder**: Configure custom AI agents in Settings > Agent Builder with name, email (a-z, 0-9, + symbol), and workflow preferences.
|
|
175
175
|
|
|
176
|
-
**Jaz Magic**: Contact-level
|
|
176
|
+
**Jaz Magic**: The extraction & autofill engine. When users start from an attachment (PDF, JPG, document image), Jaz Magic is the correct path — it handles OCR, line item detection, contact matching, and CoA auto-mapping via ML learning, producing a complete draft transaction. Contact-level settings control extraction behavior: line items (detailed extraction), summary totals (single amount), or none. Up to 10 images can be merged into a single PDF. **Do not manually parse attachments to construct `POST /invoices` or `POST /bills` — always use Jaz Magic when the input is a file.**
|
|
177
177
|
|
|
178
|
-
**API**: `POST /magic/createBusinessTransactionFromAttachment` (
|
|
178
|
+
**API**: `POST /magic/createBusinessTransactionFromAttachment` (**attachment → draft transaction** — the primary endpoint for file-based creation), `POST /magic/importBankStatementFromAttachment` (bank statements), `PUT /invoices/magic-update`, `PUT /bills/magic-update`, `PUT /journals/magic-update`, `GET /invoices/magic-search`, `GET /bills/magic-search` (all magic endpoints use `x-magic-api-key`)
|
|
179
179
|
|
|
180
180
|
---
|
|
181
181
|
|
|
@@ -260,6 +260,23 @@ When POSTing, `classificationType` must be one of these exact strings (same as `
|
|
|
260
260
|
|
|
261
261
|
---
|
|
262
262
|
|
|
263
|
+
## Jaz Magic — Extraction & Autofill
|
|
264
|
+
|
|
265
|
+
| What You'd Guess | Actual API Field | Notes |
|
|
266
|
+
|------------------|-------------------|-------|
|
|
267
|
+
| `file` | `sourceFile` | Multipart blob — same pattern as bank statement |
|
|
268
|
+
| `type: "BILL"` | `businessTransactionType: "BILL"` | Request accepts `INVOICE` or `BILL` only |
|
|
269
|
+
| Response `"BILL"` | Response `"PURCHASE"` | Response maps: `BILL` → `PURCHASE`, `INVOICE` → `SALE` |
|
|
270
|
+
| JSON body | multipart/form-data | FILE mode requires multipart — JSON returns 400 |
|
|
271
|
+
| Sync response | Async extraction | Response = upload confirmation; extraction & autofill run async |
|
|
272
|
+
| `status` field | `subscriptionFBPath` | Firebase path for tracking extraction progress |
|
|
273
|
+
|
|
274
|
+
**Content-Type depends on sourceType:**
|
|
275
|
+
- `sourceType: "FILE"` → `Content-Type: multipart/form-data` (MUST use multipart)
|
|
276
|
+
- `sourceType: "URL"` → `Content-Type: application/json` (JSON body works)
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
263
280
|
## Bank Records
|
|
264
281
|
|
|
265
282
|
| What You'd Guess | Actual API Field | Notes |
|
|
@@ -386,7 +386,7 @@
|
|
|
386
386
|
|
|
387
387
|
| Method | Path | Description |
|
|
388
388
|
|--------|------|-------------|
|
|
389
|
-
| POST | `/magic/createBusinessTransactionFromAttachment` |
|
|
389
|
+
| POST | `/magic/createBusinessTransactionFromAttachment` | **Jaz Magic: Extraction & Autofill.** Upload PDF/JPG → full extraction pipeline (OCR, line items, contact matching, CoA ML learning) → draft invoice or bill with all fields autofilled. FILE mode = multipart (`sourceFile` blob), URL mode = JSON (`sourceURL`). Async — returns `subscriptionFBPath` for tracking extraction progress. Request `INVOICE` → response `SALE`, `BILL` → `PURCHASE`. |
|
|
390
390
|
| POST | `/magic/importBankStatementFromAttachment` | Convert bank statement → entries |
|
|
391
391
|
| PUT | `/invoices/magic-update` | AI-enhanced invoice update |
|
|
392
392
|
| PUT | `/bills/magic-update` | AI-enhanced bill update |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: conversion
|
|
3
|
-
version: 2.
|
|
3
|
+
version: 2.7.0
|
|
4
4
|
description: Accounting data conversion skill — migrates customer data from Xero, QuickBooks, Sage, MYOB, and Excel exports to Jaz. Covers config, quick, and full conversion workflows, Excel parsing, CoA/contact/tax/items mapping, clearing accounts, TTB, and TB verification.
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: transaction-recipes
|
|
3
|
-
version: 2.
|
|
4
|
-
description:
|
|
3
|
+
version: 2.7.0
|
|
4
|
+
description: 16 IFRS-compliant recipes for complex multi-step accounting in Jaz — prepaid amortization, deferred revenue, loan schedules, IFRS 16 leases, hire purchase, fixed deposits, asset disposal, FX revaluation, ECL provisioning, IAS 37 provisions, dividends, intercompany, and capital WIP. Each recipe includes journal entries, capsule structure, and verification steps. Paired with 10 financial calculators that produce execution-ready blueprints with workings.
|
|
5
5
|
license: MIT
|
|
6
6
|
compatibility: Works with Claude Code, Claude Cowork, Claude.ai, and any agent that reads markdown. For API payloads, load the jaz-api skill alongside this one.
|
|
7
7
|
---
|
|
@@ -17,7 +17,10 @@ You are modeling **complex multi-step accounting scenarios** in Jaz — transact
|
|
|
17
17
|
- Setting up prepaid expenses, deferred revenue, or accrued liabilities
|
|
18
18
|
- Modeling loan repayment schedules with amortization tables
|
|
19
19
|
- Implementing IFRS 16 lease accounting (right-of-use assets + lease liabilities)
|
|
20
|
+
- Recording hire purchase agreements (ownership transfers, depreciate over useful life)
|
|
20
21
|
- Recording depreciation using methods Jaz doesn't natively support (declining balance, 150DB)
|
|
22
|
+
- Managing fixed deposit placements with interest accrual schedules (IFRS 9)
|
|
23
|
+
- Disposing of fixed assets — sale, scrap, or write-off with gain/loss calculation (IAS 16)
|
|
21
24
|
- FX revaluation of non-AR/AP monetary items at period-end (IAS 21)
|
|
22
25
|
- Calculating expected credit loss provisions on aged receivables (IFRS 9)
|
|
23
26
|
- Accruing employee leave and bonus obligations (IAS 19)
|
|
@@ -61,7 +64,10 @@ Jaz schedulers generate **fixed-amount** recurring entries. This determines whic
|
|
|
61
64
|
| Declining Balance | Manual journals + capsule | Depreciation changes as book value reduces |
|
|
62
65
|
| FX Revaluation | Manual journals + capsule | Rates change each period |
|
|
63
66
|
| ECL Provision | Manual journals + capsule | Receivables and rates change each quarter |
|
|
64
|
-
|
|
|
67
|
+
| Fixed Deposit | Cash-out + manual journals + cash-in + capsule | Placement, monthly accruals, maturity |
|
|
68
|
+
| Hire Purchase | Manual journals + FA registration + capsule | Like IFRS 16 but depreciate over useful life |
|
|
69
|
+
| Asset Disposal | Manual journal + FA deregistration | One-off compound entry + FA update |
|
|
70
|
+
| Provisions (IAS 37) | Manual journals + cash-out + capsule | Unwinding amount changes each month |
|
|
65
71
|
| Bonus Accrual | Manual journals + capsule | Revenue/profit changes each quarter |
|
|
66
72
|
| Dividends | Manual journals + capsule | One-off: declaration + payment |
|
|
67
73
|
| Intercompany | Invoices/bills + capsule | Mirrored entries in two entities |
|
|
@@ -87,23 +93,29 @@ Each recipe includes: scenario description, accounts involved, journal entries,
|
|
|
87
93
|
|
|
88
94
|
6. **[Declining Balance Depreciation](references/declining-balance.md)** — DDB/150DB methods with switch-to-straight-line logic, for assets where Jaz's native SL isn't appropriate.
|
|
89
95
|
|
|
96
|
+
7. **[Fixed Deposit](references/fixed-deposit.md)** — Placement, monthly interest accrual (simple or compound), and maturity settlement. IFRS 9 amortized cost. *Paired calculator: `jaz calc fixed-deposit`*
|
|
97
|
+
|
|
98
|
+
8. **[Hire Purchase](references/hire-purchase.md)** — Like IFRS 16 lease but ownership transfers — ROU depreciation over useful life (not lease term). *Paired calculator: `jaz calc lease --useful-life <months>`*
|
|
99
|
+
|
|
100
|
+
9. **[Asset Disposal](references/asset-disposal.md)** — Sale at gain, sale at loss, or scrap/write-off. Computes accumulated depreciation to disposal date and gain/loss. *Paired calculator: `jaz calc asset-disposal`*
|
|
101
|
+
|
|
90
102
|
### Tier 3 — Month-End Close Recipes
|
|
91
103
|
|
|
92
|
-
|
|
104
|
+
10. **[FX Revaluation — Non-AR/AP Items](references/fx-revaluation.md)** — IAS 21 revaluation of non-AR/AP foreign currency monetary items (intercompany loans, term deposits, FX provisions) with Day 1 reversal. *Paired calculator: `jaz calc fx-reval`*
|
|
93
105
|
|
|
94
|
-
|
|
106
|
+
11. **[Bad Debt Provision / ECL](references/bad-debt-provision.md)** — IFRS 9 simplified approach provision matrix using aged receivables and historical loss rates. *Paired calculator: `jaz calc ecl`*
|
|
95
107
|
|
|
96
|
-
|
|
108
|
+
12. **[Employee Benefit Accruals](references/employee-accruals.md)** — IAS 19 leave accrual (scheduler, fixed monthly) and bonus accrual (manual journals, variable quarterly) with year-end true-up.
|
|
97
109
|
|
|
98
110
|
### Tier 4 — Corporate Events & Structures
|
|
99
111
|
|
|
100
|
-
|
|
112
|
+
13. **[Provisions with PV Unwinding](references/provisions.md)** — IAS 37 provision recognized at PV, with monthly discount unwinding schedule. For warranties, legal claims, decommissioning, restructuring. *Paired calculator: `jaz calc provision`*
|
|
101
113
|
|
|
102
|
-
|
|
114
|
+
14. **[Dividend Declaration & Payment](references/dividend.md)** — Board-declared dividend: two journals (declaration reducing retained earnings, then payment).
|
|
103
115
|
|
|
104
|
-
|
|
116
|
+
15. **[Intercompany Transactions](references/intercompany.md)** — Mirrored invoices/bills or journals across two Jaz entities with matching intercompany reference, quarterly settlement.
|
|
105
117
|
|
|
106
|
-
|
|
118
|
+
16. **[Capital WIP to Fixed Asset](references/capital-wip.md)** — Cost accumulation in CIP account during construction/development, transfer to FA on completion, auto-depreciation via Jaz FA module.
|
|
107
119
|
|
|
108
120
|
## How to Use These Recipes
|
|
109
121
|
|
|
@@ -118,19 +130,22 @@ Each recipe includes: scenario description, accounts involved, journal entries,
|
|
|
118
130
|
|
|
119
131
|
## Financial Calculators (CLI)
|
|
120
132
|
|
|
121
|
-
The `jaz-cli` includes
|
|
133
|
+
The `jaz-cli` includes 10 IFRS-compliant financial calculators. Each produces a formatted schedule + per-period journal entries + human-readable workings. Use `--json` for structured output with a complete **blueprint** — capsule type/name, tags, custom fields, workings (capsuleDescription), and every step with action type, date, accounts, and amounts.
|
|
122
134
|
|
|
123
|
-
All calculators support `--currency <code>`
|
|
135
|
+
All calculators support `--currency <code>` and `--json`.
|
|
124
136
|
|
|
125
137
|
```bash
|
|
126
138
|
# ── Tier 2 Calculators ──────────────────────────────────────────
|
|
127
139
|
|
|
128
|
-
# Loan amortization
|
|
140
|
+
# Loan amortization (PMT, interest/principal split)
|
|
129
141
|
jaz calc loan --principal 100000 --rate 6 --term 60 [--start-date 2025-01-01] [--currency SGD] [--json]
|
|
130
142
|
|
|
131
143
|
# IFRS 16 lease (PV, liability unwinding, ROU depreciation)
|
|
132
144
|
jaz calc lease --payment 5000 --term 36 --rate 5 [--start-date 2025-01-01] [--currency SGD] [--json]
|
|
133
145
|
|
|
146
|
+
# Hire purchase (lease + ownership transfer — depreciate over useful life)
|
|
147
|
+
jaz calc lease --payment 5000 --term 36 --rate 5 --useful-life 60 [--start-date 2025-01-01] [--currency SGD] [--json]
|
|
148
|
+
|
|
134
149
|
# Depreciation (DDB, 150DB, or straight-line)
|
|
135
150
|
jaz calc depreciation --cost 50000 --salvage 5000 --life 5 [--method ddb|150db|sl] [--frequency annual|monthly] [--currency SGD] [--json]
|
|
136
151
|
|
|
@@ -140,6 +155,12 @@ jaz calc prepaid-expense --amount 12000 --periods 12 [--frequency monthly|quarte
|
|
|
140
155
|
# Deferred revenue recognition
|
|
141
156
|
jaz calc deferred-revenue --amount 36000 --periods 12 [--frequency monthly|quarterly] [--start-date 2025-01-01] [--currency SGD] [--json]
|
|
142
157
|
|
|
158
|
+
# Fixed deposit — simple or compound interest accrual (IFRS 9)
|
|
159
|
+
jaz calc fixed-deposit --principal 100000 --rate 3.5 --term 12 [--compound monthly|quarterly|annually] [--start-date 2025-01-01] [--currency SGD] [--json]
|
|
160
|
+
|
|
161
|
+
# Asset disposal — gain/loss on sale or scrap (IAS 16)
|
|
162
|
+
jaz calc asset-disposal --cost 50000 --salvage 5000 --life 5 --acquired 2022-01-01 --disposed 2025-06-15 --proceeds 20000 [--method sl|ddb|150db] [--currency SGD] [--json]
|
|
163
|
+
|
|
143
164
|
# ── Tier 3 Calculators ──────────────────────────────────────────
|
|
144
165
|
|
|
145
166
|
# FX revaluation — unrealized gain/loss on non-AR/AP items (IAS 21)
|
|
@@ -156,7 +177,7 @@ jaz calc provision --amount 500000 --rate 4 --term 60 [--start-date 2025-01-01]
|
|
|
156
177
|
|
|
157
178
|
### Blueprint Output (`--json`)
|
|
158
179
|
|
|
159
|
-
Every calculator's `--json` output includes a `blueprint` object — a complete execution plan
|
|
180
|
+
Every calculator's `--json` output includes a `blueprint` object — a complete execution plan for creating the capsule and posting all transactions in Jaz:
|
|
160
181
|
|
|
161
182
|
```json
|
|
162
183
|
{
|
|
@@ -165,13 +186,14 @@ Every calculator's `--json` output includes a `blueprint` object — a complete
|
|
|
165
186
|
"blueprint": {
|
|
166
187
|
"capsuleType": "Loan Repayment",
|
|
167
188
|
"capsuleName": "Bank Loan — SGD 100,000 — 6% — 60 months",
|
|
189
|
+
"capsuleDescription": "Loan Amortization Workings\nPrincipal: SGD 100,000.00 | Rate: 6% p.a. ...",
|
|
168
190
|
"tags": ["Bank Loan"],
|
|
169
191
|
"customFields": { "Loan Reference": null },
|
|
170
192
|
"steps": [
|
|
171
193
|
{
|
|
172
194
|
"step": 1,
|
|
173
|
-
"action": "
|
|
174
|
-
"description": "
|
|
195
|
+
"action": "cash-in",
|
|
196
|
+
"description": "Record loan proceeds received from bank",
|
|
175
197
|
"date": "2025-01-01",
|
|
176
198
|
"lines": [
|
|
177
199
|
{ "account": "Cash / Bank Account", "debit": 100000, "credit": 0 },
|
|
@@ -183,12 +205,24 @@ Every calculator's `--json` output includes a `blueprint` object — a complete
|
|
|
183
205
|
}
|
|
184
206
|
```
|
|
185
207
|
|
|
208
|
+
**Blueprint action types** — each step tells you HOW to execute it in Jaz:
|
|
209
|
+
|
|
210
|
+
| Action | When used | Jaz module |
|
|
211
|
+
|---|---|---|
|
|
212
|
+
| `bill` | Supplier document (prepaid expense) | Bills |
|
|
213
|
+
| `invoice` | Customer document (deferred revenue) | Invoices |
|
|
214
|
+
| `cash-in` | Cash arrives in bank (loan disbursement, FD maturity) | Bank / Manual Journal |
|
|
215
|
+
| `cash-out` | Cash leaves bank (FD placement, provision settlement) | Bank / Manual Journal |
|
|
216
|
+
| `journal` | No cash movement (accrual, depreciation, unwinding, reval) | Manual Journals |
|
|
217
|
+
| `fixed-asset` | Register/update FA module (ROU asset, capital project) | Fixed Assets |
|
|
218
|
+
| `note` | Instruction only (deregister FA on disposal) | N/A |
|
|
219
|
+
|
|
186
220
|
**Math guarantees:**
|
|
187
|
-
-
|
|
188
|
-
-
|
|
221
|
+
- `financial` npm package (TypeScript port of numpy-financial) for PV, PMT — no hand-rolled TVM
|
|
222
|
+
- 2dp per period, final period closes balance to exactly $0.00
|
|
189
223
|
- Input validation with clear error messages (negative values, invalid dates, salvage > cost)
|
|
190
224
|
- DDB→SL switch when straight-line >= declining balance or when DDB would breach salvage floor
|
|
191
|
-
-
|
|
225
|
+
- All journal entries balanced (debits = credits in every step)
|
|
192
226
|
|
|
193
227
|
## Cross-References
|
|
194
228
|
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# Recipe: Asset Disposal
|
|
2
|
+
|
|
3
|
+
## Scenario
|
|
4
|
+
|
|
5
|
+
Your company disposes of a fixed asset — either selling it, trading it in, or scrapping it. IAS 16.67-72 requires derecognition on disposal or when no future economic benefits are expected. The gain or loss is the difference between net disposal proceeds and the carrying amount (IAS 16.68), and gains are NOT classified as revenue (IAS 16.71) — they appear separately in the P&L under Other Income.
|
|
6
|
+
|
|
7
|
+
**Pattern:** One-shot calculator (not a schedule) — computes accumulated depreciation to disposal date, net book value, and gain/loss, then produces a single disposal journal
|
|
8
|
+
|
|
9
|
+
**Why manual:** Jaz's fixed asset register tracks depreciation automatically, but the disposal journal (removing cost + accumulated depreciation + recognizing gain/loss) must be recorded manually. After the journal, the asset is marked as sold or discarded in the FA register.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Accounts Involved
|
|
14
|
+
|
|
15
|
+
| Account | Type | Subtype | Role |
|
|
16
|
+
|---|---|---|---|
|
|
17
|
+
| Fixed Asset (at cost) | Asset | Non-Current Asset | Original cost being removed |
|
|
18
|
+
| Accumulated Depreciation | Asset | Non-Current Asset (contra) | Contra-asset being cleared |
|
|
19
|
+
| Gain on Disposal | Revenue | Other Income | If proceeds > NBV |
|
|
20
|
+
| Loss on Disposal | Expense | Other Expense | If proceeds < NBV |
|
|
21
|
+
| Cash / Bank Account | Asset | Bank | Receives sale proceeds |
|
|
22
|
+
|
|
23
|
+
> **Note:** Gain on Disposal is NOT revenue — IAS 16.71 requires it to be classified separately. Use an "Other Income" account, not a sales revenue account.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Journal Entries
|
|
28
|
+
|
|
29
|
+
### Scenario A: Sale at a Gain (Proceeds > NBV)
|
|
30
|
+
|
|
31
|
+
Proceeds $12,000, NBV $10,000 — Gain of $2,000:
|
|
32
|
+
|
|
33
|
+
| Line | Account | Debit | Credit |
|
|
34
|
+
|---|---|---|---|
|
|
35
|
+
| 1 | Cash / Bank Account | $12,000 | |
|
|
36
|
+
| 2 | Accumulated Depreciation | $40,000 | |
|
|
37
|
+
| 3 | Fixed Asset (at cost) | | $50,000 |
|
|
38
|
+
| 4 | Gain on Disposal | | $2,000 |
|
|
39
|
+
|
|
40
|
+
### Scenario B: Sale at a Loss (Proceeds < NBV)
|
|
41
|
+
|
|
42
|
+
Proceeds $8,000, NBV $10,000 — Loss of $2,000:
|
|
43
|
+
|
|
44
|
+
| Line | Account | Debit | Credit |
|
|
45
|
+
|---|---|---|---|
|
|
46
|
+
| 1 | Cash / Bank Account | $8,000 | |
|
|
47
|
+
| 2 | Accumulated Depreciation | $40,000 | |
|
|
48
|
+
| 3 | Loss on Disposal | $2,000 | |
|
|
49
|
+
| 4 | Fixed Asset (at cost) | | $50,000 |
|
|
50
|
+
|
|
51
|
+
### Scenario C: Scrap / Write-Off (Zero Proceeds)
|
|
52
|
+
|
|
53
|
+
No proceeds, NBV $10,000 — Loss of $10,000:
|
|
54
|
+
|
|
55
|
+
| Line | Account | Debit | Credit |
|
|
56
|
+
|---|---|---|---|
|
|
57
|
+
| 1 | Accumulated Depreciation | $40,000 | |
|
|
58
|
+
| 2 | Loss on Disposal | $10,000 | |
|
|
59
|
+
| 3 | Fixed Asset (at cost) | | $50,000 |
|
|
60
|
+
|
|
61
|
+
**In all scenarios:** Debits = Credits = Original cost ($50,000).
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Capsule Structure
|
|
66
|
+
|
|
67
|
+
**Capsule:** "Asset Disposal — Delivery Van VH-1234"
|
|
68
|
+
**Capsule Type:** "Asset Disposal"
|
|
69
|
+
|
|
70
|
+
Contents:
|
|
71
|
+
- 1 disposal journal (removing cost, clearing accumulated depreciation, recognizing gain/loss)
|
|
72
|
+
- **Total entries:** 1
|
|
73
|
+
|
|
74
|
+
> **Note:** After recording the disposal journal, update the Jaz FA register to mark the asset as sold or discarded. This is a separate step — the register update does not create a journal entry but ensures the asset stops depreciating.
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Worked Example
|
|
79
|
+
|
|
80
|
+
**Asset details:**
|
|
81
|
+
- Asset: Delivery Van VH-1234
|
|
82
|
+
- Original cost: $50,000
|
|
83
|
+
- Salvage value: $5,000
|
|
84
|
+
- Useful life: 5 years (60 months)
|
|
85
|
+
- Depreciation method: Straight-line
|
|
86
|
+
- Acquired: January 1, 2022
|
|
87
|
+
- Disposed: June 15, 2025
|
|
88
|
+
- Sale proceeds: $12,000
|
|
89
|
+
|
|
90
|
+
**Step 1 — Calculate months held:**
|
|
91
|
+
```
|
|
92
|
+
Acquired: Jan 1, 2022
|
|
93
|
+
Disposed: Jun 15, 2025
|
|
94
|
+
Months held: 42 months (Jan 2022 through Jun 2025)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Step 2 — Calculate monthly depreciation (straight-line):**
|
|
98
|
+
```
|
|
99
|
+
Depreciable base = Cost − Salvage = $50,000 − $5,000 = $45,000
|
|
100
|
+
Monthly depreciation = $45,000 / 60 months = $750.00/month
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**Step 3 — Calculate accumulated depreciation to disposal date:**
|
|
104
|
+
```
|
|
105
|
+
Accumulated depreciation = $750.00 × 42 months = $31,500.00
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**Step 4 — Calculate net book value (NBV):**
|
|
109
|
+
```
|
|
110
|
+
NBV = Cost − Accumulated depreciation
|
|
111
|
+
NBV = $50,000 − $31,500 = $18,500.00
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**Step 5 — Calculate gain or loss:**
|
|
115
|
+
```
|
|
116
|
+
Gain/(Loss) = Proceeds − NBV
|
|
117
|
+
Gain/(Loss) = $12,000 − $18,500 = −$6,500.00 (Loss)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
**Disposal journal (Jun 15, 2025):**
|
|
121
|
+
- Dr Cash $12,000.00
|
|
122
|
+
- Dr Accumulated Depreciation $31,500.00
|
|
123
|
+
- Dr Loss on Disposal $6,500.00
|
|
124
|
+
- Cr Fixed Asset (at cost) $50,000.00
|
|
125
|
+
- Description: "Disposal of Delivery Van VH-1234 — sold at loss"
|
|
126
|
+
- Assign to capsule
|
|
127
|
+
|
|
128
|
+
**Verification of debits = credits:**
|
|
129
|
+
```
|
|
130
|
+
Debits: $12,000 + $31,500 + $6,500 = $50,000
|
|
131
|
+
Credits: $50,000
|
|
132
|
+
Balanced: Yes
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**Use the calculator:** `jaz calc asset-disposal --cost 50000 --salvage 5000 --life 5 --acquired 2022-01-01 --disposed 2025-06-15 --proceeds 12000`
|
|
136
|
+
|
|
137
|
+
The CLI generates a `capsuleDescription` with full workings (cost, accumulated depreciation, NBV, gain/loss breakdown) that can be attached to the capsule for audit trail.
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Enrichment Suggestions
|
|
142
|
+
|
|
143
|
+
| Enrichment | Value | Why |
|
|
144
|
+
|---|---|---|
|
|
145
|
+
| Tracking Tag | "Asset Disposal" | Filter all disposal transactions in reports |
|
|
146
|
+
| Nano Classifier | Disposal Type → "Sale" or "Scrap" | Distinguish sales from write-offs |
|
|
147
|
+
| Custom Field | "Asset Description" → "Delivery Van VH-1234" | Identify the specific asset disposed |
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Verification
|
|
152
|
+
|
|
153
|
+
1. **Fixed Asset account** → The original cost for this asset is fully removed (zeroed out).
|
|
154
|
+
2. **Accumulated Depreciation account** → The accumulated depreciation for this asset is fully cleared (zeroed out).
|
|
155
|
+
3. **P&L** → Gain or Loss on Disposal appears under "Other Income" or "Other Expense" (not revenue).
|
|
156
|
+
4. **FA register** → Asset is marked as sold or discarded. No further depreciation is posted.
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Variations
|
|
161
|
+
|
|
162
|
+
**DDB/150DB depreciation:** If the asset uses declining balance instead of straight-line, use `--method ddb` or `--method 150db` in the calculator. The accumulated depreciation will differ, changing the NBV and gain/loss.
|
|
163
|
+
|
|
164
|
+
**Partial-year depreciation:** The calculator pro-rates automatically based on the acquisition and disposal dates. No manual adjustment needed for mid-month or mid-year disposals.
|
|
165
|
+
|
|
166
|
+
**Fully depreciated asset:** If the asset is fully depreciated, NBV = salvage value. Gain = proceeds − salvage. If scrapped, loss = salvage value (the remaining book value written off).
|
|
167
|
+
|
|
168
|
+
**Trade-in:** Record as a disposal (this recipe) plus a new asset acquisition in the same capsule. The trade-in allowance is the "proceeds" for the old asset. The new asset is recorded at its full cost, with the trade-in reducing the cash paid.
|
|
169
|
+
|
|
170
|
+
**Insurance claim (involuntary disposal):** If the asset is destroyed (fire, theft, accident), the insurance payout is the "proceeds." Same journal structure — the only difference is the source of cash (insurer instead of buyer).
|
|
171
|
+
|
|
172
|
+
**Jaz FA register update:** After recording the disposal journal, update the FA register:
|
|
173
|
+
- Sold: `POST /mark-as-sold/fixed-assets` — marks the asset as sold with the disposal date
|
|
174
|
+
- Scrapped: `POST /discard-fixed-assets/:id` — marks the asset as discarded
|