jaz-cli 2.0.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.
@@ -0,0 +1,501 @@
1
+ # File Type Catalog
2
+
3
+ Comprehensive catalog of all accounting file types encountered across real customer datasets. Use this to identify and classify files during conversion intake (Pipeline Step 1-2).
4
+
5
+ **Source data:** 76 files across 10 datasets — Sage 300/Accpac, Xero, QuickBooks, and generic Excel workpapers.
6
+
7
+ ---
8
+
9
+ ## Quick Reference
10
+
11
+ | # | Type | Conversion Relevance | Quick | Full |
12
+ |---|------|---------------------|-------|------|
13
+ | 1 | Trial Balance | HIGH | Required | Required |
14
+ | 2 | AR Aging Detail | HIGH | Required | Required |
15
+ | 3 | AR Aging Summary | MEDIUM | Fallback | Cross-check |
16
+ | 4 | AP Aging Detail | HIGH | Required | Required |
17
+ | 5 | AP Aging Summary | MEDIUM | Fallback | Cross-check |
18
+ | 6 | Chart of Accounts | HIGH | Required | Required |
19
+ | 7 | Contact List | MEDIUM | Supplement | Supplement |
20
+ | 8 | General Ledger Detail | HIGH | Not needed | Required |
21
+ | 9 | General Ledger Summary | MEDIUM | Cross-check | Cross-check |
22
+ | 10 | Account Transactions | MEDIUM | Not needed | Fallback for GL Detail |
23
+ | 11 | Balance Sheet | MEDIUM | Cross-check | Cross-check |
24
+ | 12 | Profit & Loss | MEDIUM | Cross-check | Cross-check |
25
+ | 13 | Journal Report | MEDIUM | Not needed | Validation |
26
+ | 14 | Bank Statement (CSV) | LOW | Not needed | Optional |
27
+ | 15 | Exchange Rates | MEDIUM | Required (if FX) | Required (if FX) |
28
+ | 16 | Fixed Asset Register | MEDIUM | Not needed | Required (if assets) |
29
+ | 17 | Sales & Purchases Schedule | LOW | Cross-check | Cross-check |
30
+ | 18 | Bank Reconciliation | LOW | Cross-check | Cross-check |
31
+ | 19 | GL Subledger (AR/AP/Interco) | HIGH | Context | Required |
32
+ | 20 | Import Template | LOW | Skip | Skip |
33
+ | 21 | Platform Export (Jaz) | SKIP | Skip | Skip |
34
+ | 22 | Multi-Report Workbook | Varies | Varies | Varies |
35
+
36
+ ### Minimum File Sets
37
+
38
+ **Quick Conversion:** Trial Balance + AR Aging Detail + AP Aging Detail + CoA (if not embedded in TB) + Exchange Rates (if FX currencies)
39
+
40
+ **Full Conversion:** All of Quick + General Ledger Detail + Contact List + Fixed Asset Register (if applicable)
41
+
42
+ ---
43
+
44
+ ## Type Details
45
+
46
+ ### 1. Trial Balance
47
+
48
+ The single most important file for any conversion. Contains every GL account with its balance at a point in time.
49
+
50
+ **Key indicators:**
51
+ - Title contains "Trial Balance" or "TB"
52
+ - Columns: Account Code + Account Name/Description + Debit + Credit (or single Balance column)
53
+ - No dates per row (point-in-time snapshot)
54
+ - Balancing totals at bottom (Total Debits = Total Credits)
55
+
56
+ **Source system patterns:**
57
+
58
+ | System | Account Codes | Typical Columns | Header Row | Quirks |
59
+ |--------|--------------|-----------------|-----------|--------|
60
+ | Sage 300/Accpac | 3-4 digit (e.g., `101`, `4730`) | Acc, Dept, Description, Group, Period Debit, Period Credit | Row 4 or 12 | `Dept` column (always `100`), `Group` = account classification (ASSETS/LIABILITY/REVENUE/EXPENSE). Rows 0-11 are report metadata. Merges in header rows. Report ID: GLTRLR1. |
61
+ | Xero | 3-digit (e.g., `200`, `400`) | Account Code, Account Name, Account Type, Debit YTD, Credit YTD, Prior Year | Row 4 | Clean flat table. May include prior year comparative column (often zeros for new companies). Account Type column useful for CoA classification. |
62
+ | QuickBooks | Variable | Account, Debit, Credit | Row 0-3 | May have grouped/indented sub-accounts. "Total" rows per category. |
63
+ | Generic Excel | Variable | No., Name, Debit, Credit | Row 7+ | Manual workpapers. May include classification column (e.g., "Fixed Assets", "Current Asset", "Bank"). Often embedded in multi-sheet workbooks. |
64
+
65
+ **Watch for:**
66
+ - Misleading filenames — "Chart of Accounts.xls" was actually a Trial Balance in one dataset
67
+ - TB embedded in a multi-sheet workbook alongside subledger detail
68
+ - Duplicate TBs at different dates (e.g., Nov 2023 FYE and Mar 2024 for same company)
69
+ - "Period Debit/Credit" in Sage = YTD cumulative balance, not period movement
70
+ - Some TBs include a "Net Income (Loss)" line after the total — this is informational, not a GL account
71
+
72
+ ---
73
+
74
+ ### 2. AR Aging Detail
75
+
76
+ Per-invoice outstanding receivables, grouped by customer. Essential for Quick Conversion (creates conversion invoices).
77
+
78
+ **Key indicators:**
79
+ - Title contains "Aged Receivables", "AR Aging", or "A/R Aged"
80
+ - Aging bucket columns: Current, 30 Days (or <1 Month), 60 Days, 90 Days, 90+ (or Older)
81
+ - Grouped by customer/contact name
82
+ - Individual invoice rows with: date, invoice number, reference, amount in bucket
83
+
84
+ **Source system patterns:**
85
+
86
+ | System | Grouping | Doc Type | Key Columns | Header Row |
87
+ |--------|----------|----------|------------|-----------|
88
+ | Sage 300/Accpac | Short code + full name as group header row | `T` column: I=Invoice, N=Credit Note | Doc. Date, Inv No, T, Description, Curr, Curr Amt, Total Amt, Rem Bal, aging buckets | Row 4 (data at row 6) |
89
+ | Xero | Contact name as group header row | No type column | Invoice Date, Due Date, Invoice Number, Invoice Reference, aging buckets, Total | Row 5 (data at row 8) |
90
+
91
+ **Sage-specific quirks:**
92
+ - Rows 0-17 are report metadata/filter parameters
93
+ - `Totals:` per supplier + `Grand Totals:` at bottom
94
+ - Separator rows use `-------` dash patterns
95
+ - Date format inconsistency within same column (`2025-11-10` mixed with `30/11/2025`)
96
+ - `Curr` and `Curr Amt` columns present but empty when all transactions are base currency
97
+
98
+ **Xero-specific quirks:**
99
+ - "Ageing by due date" stated on row 3
100
+ - Invoice Number is Xero's auto-number (INV-XXXX), Invoice Reference is customer's PO
101
+ - Percentage row at bottom (exclude from data)
102
+ - Credit notes appear as negative amounts
103
+
104
+ ---
105
+
106
+ ### 3. AR Aging Summary
107
+
108
+ One row per customer with total outstanding per aging bucket. No invoice detail.
109
+
110
+ **Key indicators:** Same title as Detail but with "Summary" suffix. Flat table (no grouping). One row per contact.
111
+
112
+ **When to use:** Only if Detail variant is unavailable. Creates a single lump conversion invoice per contact (loses invoice-level granularity and dates).
113
+
114
+ **Xero quirk:** Header row 5, data starts row 6 (no group header unlike Detail). Subtotal and percentage rows at bottom.
115
+
116
+ ---
117
+
118
+ ### 4. AP Aging Detail
119
+
120
+ Per-invoice outstanding payables, grouped by supplier. Essential for Quick Conversion (creates conversion bills).
121
+
122
+ **Key indicators:**
123
+ - Title contains "Aged Payables", "AP Aging", or "A/P Aged"
124
+ - Same aging bucket structure as AR
125
+ - Grouped by supplier/vendor name
126
+
127
+ **Source system patterns:** Mirrors AR Aging Detail. Same Sage metadata block (rows 0-17), same Xero structure.
128
+
129
+ **Sage-specific quirks:**
130
+ - Two-row header (row 18-19): Row 18 = primary labels (Doc. Date, Doc. Type/Doc. Number, Due Date, aging buckets), Row 19 = sub-labels (Appl. Date, Applied No., App. Type, Current, Days)
131
+ - Footer legend: AD = Adjustment, ED = Earned Discount Taken
132
+ - Vendor sections: "Vendor No.: OC-F02" as group header
133
+
134
+ **Xero-specific quirks:**
135
+ - No "Invoice Number" column (unlike AR Detail which has it) — only shows supplier's reference
136
+ - Row 3 says "Ageing by due date"
137
+
138
+ ---
139
+
140
+ ### 5. AP Aging Summary
141
+
142
+ One row per supplier with total outstanding per aging bucket. No invoice detail.
143
+
144
+ **Xero quirk:** May have two sections: "Aged Payables" and "Expense Claims" (Xero-specific — unpaid expense claims show as separate payables category). The Expense Claims section reveals liability that maps to "Unpaid Expense Claims" on the Balance Sheet.
145
+
146
+ ---
147
+
148
+ ### 6. Chart of Accounts
149
+
150
+ Account code + name + classification. No balances, no dates.
151
+
152
+ **Key indicators:**
153
+ - Title contains "Chart of Accounts" or "CoA"
154
+ - Columns: Account Code/Number + Description/Name + Type/Classification
155
+ - No debit/credit or balance columns
156
+ - Comprehensive list (typically 50-200+ accounts)
157
+
158
+ **Source system patterns:**
159
+
160
+ | System | Code Format | Type Codes | Key Columns |
161
+ |--------|-----------|-----------|------------|
162
+ | Sage 300/Accpac | `XXXX-100` (4 digits + dept suffix) | F=Fixed/Header, C=Control/Category, E=Detail/Postable | Acc No, Description, Type, D/C (normal balance direction) |
163
+ | Xero | 3-digit numeric | Full names (e.g., "Current Asset", "Revenue") | Account Code, Account Name, Account Type |
164
+ | QuickBooks | Variable | Varies by region | Account, Type, Detail Type |
165
+
166
+ **Sage-specific quirks:**
167
+ - Department suffix `-100` in account codes (strip for Jaz mapping)
168
+ - Type codes must be decoded: F = parent/header account (not postable), C = control account, E = detail account (postable)
169
+ - No classification grouping column — must infer Assets/Liabilities/Equity/Revenue/Expense from code ranges
170
+ - Column E may be entirely empty (unused field)
171
+
172
+ **Watch for:** Trial Balance sometimes doubles as a partial CoA (if it includes an account type/classification column). If no separate CoA file exists, extract account structure from the TB.
173
+
174
+ ---
175
+
176
+ ### 7. Contact List
177
+
178
+ Customer and/or supplier names with optional contact details.
179
+
180
+ **Key indicators:**
181
+ - Title contains "Customer", "Supplier", "Contact", "Vendor"
182
+ - Name column + optional: address, phone, email, tax ID (UEN/TIN/ABN)
183
+
184
+ **Quality varies dramatically:**
185
+ - **Best case (Xero/QB export):** Full contact details — company name, address lines, phone, email, tax registration
186
+ - **Worst case (manual Excel):** Single column with names only — no addresses, phones, emails, or tax IDs
187
+
188
+ **Watch for:**
189
+ - Separate sheets for customers vs suppliers in same workbook
190
+ - Names may be truncated or abbreviated (especially in Sage exports)
191
+ - May not exist at all — contacts must then be extracted from AR/AP aging group headers
192
+
193
+ ---
194
+
195
+ ### 8. General Ledger Detail
196
+
197
+ Every transaction posted to every GL account. The most comprehensive transactional report. Required for Full Conversion.
198
+
199
+ **Key indicators:**
200
+ - Title contains "General Ledger" or "G/L" + "Detail" or "Transactions Listing"
201
+ - Grouped by GL account (account header → transaction rows → subtotal/closing balance)
202
+ - Per-transaction: Date, Source module, Description, Reference, Debit, Credit
203
+ - Running balance per account
204
+ - Very large (hundreds to thousands of rows)
205
+
206
+ **Source system patterns:**
207
+
208
+ | System | Unique Features | Tax Info | Currency | Typical Size |
209
+ |--------|----------------|----------|----------|-------------|
210
+ | Sage 300/Accpac | Dual-currency columns (Source Currency + Functional Currency side by side), 3-row header (rows 19-21), Source module code (AP/AR/GL), Batch-Entry numbers | No tax column | Parallel Source + Functional amounts with exchange rate | 6,000+ rows, 64+ columns |
211
+ | Xero (GL Detail) | Tax Rate Name column, Tax Rate (%) column, Tax amount column | Yes — Tax Rate Name is critical for tax code mapping | Single currency | 400-500 rows, 10 columns |
212
+ | Xero (Account Transactions) | Gross + Tax columns (no rate name) | Partial — amount only, no code name | Single currency | 400-500 rows, 9 columns |
213
+
214
+ **Sage-specific quirks:**
215
+ - Rows 0-18 are report metadata/filter parameters (largest metadata block of any report type)
216
+ - 13,000+ merged cells in a typical GL file
217
+ - Source module codes: AP = payables, AR = receivables, GL = general journal
218
+ - Column A is entirely empty (data starts col B)
219
+ - Account sections: header row → period transactions → "Net Change" / "Ending Balance" subtotals
220
+
221
+ **Xero preference hierarchy:** GL Detail > Account Transactions. GL Detail includes Tax Rate Name (needed for mapping to Jaz tax profiles). Account Transactions only shows tax amount — would need to reverse-engineer the tax code from the rate.
222
+
223
+ ---
224
+
225
+ ### 9. General Ledger Summary
226
+
227
+ One row per account showing total debits, credits, and net movement for a period. No transaction detail.
228
+
229
+ **Key indicators:**
230
+ - Title contains "General Ledger" + "Summary"
231
+ - Flat table: Account Name, Account Code, Debit total, Credit total, Net Movement, Account Type
232
+ - Much smaller than GL Detail (30-100 rows vs hundreds/thousands)
233
+
234
+ **Use:** Validation tool. Net Movement should reconcile with TB changes between periods. Provides Account Type column useful for CoA classification. Redundant with TB for Quick Conversion.
235
+
236
+ ---
237
+
238
+ ### 10. Account Transactions (Xero-specific)
239
+
240
+ Nearly identical to GL Detail but with different tax columns.
241
+
242
+ **Key indicators:**
243
+ - Title contains "Account Transactions"
244
+ - Same grouped-by-account structure as GL Detail
245
+ - Columns: Date, Source, Description, Reference, Debit, Credit, Running Balance, Gross, Tax
246
+
247
+ **Difference from GL Detail:** Has `Gross` + `Tax` columns instead of `Tax` + `Tax Rate (%)` + `Tax Rate Name`. Missing Tax Rate Name means you cannot directly identify which tax code was applied.
248
+
249
+ **Use:** Fallback for GL Detail. Only use if GL Detail is unavailable.
250
+
251
+ ---
252
+
253
+ ### 11. Balance Sheet
254
+
255
+ Hierarchical financial statement showing Assets, Liabilities, and Equity at a point in time.
256
+
257
+ **Key indicators:**
258
+ - Title contains "Balance Sheet" or "Statement of Financial Position"
259
+ - Hierarchical: top-level sections (Assets/Liabilities/Equity) → sub-categories → accounts
260
+ - Total rows at each level
261
+ - One or more period columns
262
+
263
+ **Source system patterns:**
264
+
265
+ | System | Layout | Period Columns |
266
+ |--------|--------|---------------|
267
+ | Xero | Col A = section headers, Col B = account names, Col C = balance | Single date or comparative |
268
+ | Sage | Formatted report with merged section headers | May have multiple periods |
269
+
270
+ **Use:** Cross-check only. Confirms account classification hierarchy (which accounts are Bank vs Current Assets vs Fixed Assets etc.). Not directly used for conversion since TB already has account types.
271
+
272
+ ---
273
+
274
+ ### 12. Profit & Loss
275
+
276
+ Income statement showing Revenue and Expenses for a period.
277
+
278
+ **Key indicators:**
279
+ - Title contains "Profit and Loss", "P&L", or "Income Statement"
280
+ - Sections: Revenue/Trading Income, Cost of Sales, Gross Profit, Operating Expenses, Net Profit
281
+ - One or more period columns
282
+
283
+ **Use:** Cross-check only. Net Profit should equal Current Year Earnings on the Balance Sheet. Confirms revenue and expense account names. Redundant if TB is available.
284
+
285
+ ---
286
+
287
+ ### 13. Journal Report (Xero-specific)
288
+
289
+ Every double-entry journal in chronological order, grouped by journal ID.
290
+
291
+ **Key indicators:**
292
+ - Title contains "Journal Report"
293
+ - Grouped by journal: ID + date as group header, then debit/credit line items
294
+ - Columns: Date, Journal ID, Account Code, Account Name, Debit, Credit, Posted Date, Posted By
295
+ - Typically the largest file by row count (1000+ rows)
296
+
297
+ **Use:** Validation for Full Conversion. Every journal should balance (debits = credits). Can identify manual journals vs system-generated. Contains reversed journal entries (labeled "Reversed: ..."). Not the preferred conversion source — GL Detail is better because it groups by account rather than by journal.
298
+
299
+ ---
300
+
301
+ ### 14. Bank Statement (CSV)
302
+
303
+ Simple transaction list for a bank account.
304
+
305
+ **Key indicators:**
306
+ - CSV format
307
+ - Columns: Date, Description, Debit (or Withdrawal), Credit (or Deposit)
308
+ - No account codes — single account only
309
+ - May come from Jaz export or bank download
310
+
311
+ **Formats seen:**
312
+ - Jaz export: `Date,Description,Debit,Credit` (simple 4-column CSV)
313
+ - Bank download: varies by bank
314
+
315
+ **Use:** Optional for Full Conversion. Can be imported as bank records for reconciliation. Not needed for Quick Conversion.
316
+
317
+ ---
318
+
319
+ ### 15. Exchange Rates
320
+
321
+ Currency cross-rates, typically for FYE closing rates.
322
+
323
+ **Key indicators:**
324
+ - Title contains "Exchange Rates" or "Currency"
325
+ - Currency code + rate columns
326
+ - Short file (5-20 rows, or a matrix grid)
327
+
328
+ **Formats seen:**
329
+ - QuickBooks template: 18x18 currency matrix with cross-rates
330
+ - Simple list: Currency Code, Rate
331
+
332
+ **Use:** Required for any conversion involving foreign currencies. FYE closing rates are used for Quick Conversion transactions. Original transaction rates are used for Full Conversion.
333
+
334
+ ---
335
+
336
+ ### 16. Fixed Asset Register
337
+
338
+ List of fixed assets with cost, accumulated depreciation, and net book value.
339
+
340
+ **Key indicators:**
341
+ - Title contains "Fixed Asset", "Asset Register", or "Schedule of Fixed Assets"
342
+ - Columns: Asset Code/Name, Description, Cost/Original Value, Accumulated Depreciation, Net Book Value
343
+ - May include: Purchase Date, Category, Depreciation Rate/Method
344
+
345
+ **Use:** Required for Full Conversion if the company has fixed assets. Assets are imported via `POST /api/v1/transfer-fixed-assets` (dedicated endpoint that preserves accumulated depreciation).
346
+
347
+ **Watch for:** "Schedule 8" or similar numbered schedules may be auditor-prepared Sales & Purchases schedules (type 17), not Fixed Asset Registers — always check content.
348
+
349
+ ---
350
+
351
+ ### 17. Sales & Purchases Schedule (Auditor-prepared)
352
+
353
+ Supplementary audit schedule showing transaction detail with operational information (shipping, FX).
354
+
355
+ **Key indicators:**
356
+ - Title contains "Schedule" + number (e.g., "Schedule 8")
357
+ - Subtitle: "Schedules to the Accounts for the year ended..."
358
+ - Dual-frame layout: SALES columns + PURCHASES columns side by side
359
+ - Includes: Line numbers, dates, descriptions, invoice numbers, receipt/payment voucher numbers, FX rates, gross profit
360
+
361
+ **Distinguishing from Fixed Asset Register:** These schedules are NOT ERP exports — they are manually prepared by the accountant/auditor. Very few merged cells (4 vs hundreds in Sage exports). Contain operational detail (shipping routes, origin/destination countries) not found in standard accounting reports.
362
+
363
+ **Use:** Cross-check only. Useful for validating invoice/bill amounts and FX rates during Full Conversion. Contains operational context not available in other reports.
364
+
365
+ ---
366
+
367
+ ### 18. Bank Reconciliation
368
+
369
+ Narrative-format bank balance reconciliation, not a standard tabular report.
370
+
371
+ **Key indicators:**
372
+ - Title contains "Bank Reconciliation" or "Bank Recon"
373
+ - Narrative format: "Balance as per Bank Statement", "Less: Unpresented cheques", "Balance as per General Ledger"
374
+ - Very small (10-20 rows)
375
+ - May include FX conversion rate (for foreign currency bank accounts)
376
+
377
+ **Use:** Cross-check reference only. Confirms the GL bank account balance ties to the actual bank statement. Not directly importable.
378
+
379
+ ---
380
+
381
+ ### 19. GL Subledger (AR/AP/Intercompany Detail)
382
+
383
+ Detailed transaction history for a single GL control account, typically found as sheets within a multi-report workbook.
384
+
385
+ **Key indicators:**
386
+ - Sheet name indicates the account: "OTHER RECEIVABLES", "SUPPLIERS", "INTERCOMPANY", "RELATED PARTY AP"
387
+ - Single GL account (e.g., Account 133001, 310001, 330005)
388
+ - Contains: Description, Document No, Date, Currency, Amount (source), Exchange Rate, Amount (functional)
389
+ - Opening balance row, then chronological transactions, then closing balance
390
+
391
+ **Common sub-types:**
392
+ - **Other Receivables** — non-trade receivables (intercompany charges, rechargeable costs)
393
+ - **Suppliers** — grouped by supplier code (V0030, V0050, etc.) with invoices (negative) and payments (positive)
394
+ - **Intercompany** — multi-section: summary of all interco balances + detailed sections per related entity
395
+ - **Related Party AP** — related party payables with cash calls, management fees, charter hire
396
+
397
+ **Quirks:**
398
+ - Accounting-format negatives: `(8,812.50)` instead of `-8,812.50`
399
+ - Multi-currency within same subledger (e.g., mostly EUR transactions, some SGD at different FX rates)
400
+ - May include month-on-month reconciliation columns (sparsely populated)
401
+ - Date format mixing: ISO `YYYY-MM-DD` + `DD/MM/YY` in same column
402
+
403
+ **Use:** HIGH for Full Conversion — needed to reconstruct individual receivable/payable/intercompany balances. For Quick Conversion, provides context for understanding what makes up the AR/AP balances on the TB.
404
+
405
+ ---
406
+
407
+ ### 20. Import Template (QuickBooks)
408
+
409
+ Template file with instructions sheet + blank data template for data entry.
410
+
411
+ **Key indicators:**
412
+ - Title contains "Template" or "Import"
413
+ - First sheet is instructions/guidance
414
+ - Subsequent sheets have column headers but few/no data rows
415
+ - May include dropdown validation lists
416
+
417
+ **Use:** Skip. These are blank templates, not source data. May be useful to understand the source system's expected data structure.
418
+
419
+ ---
420
+
421
+ ### 21. Platform Export (Jaz/Internal)
422
+
423
+ Raw data exports from the Jaz platform itself. Contains UUIDs, internal field names, `jaz.ai` email addresses.
424
+
425
+ **Key indicators:**
426
+ - CSV format with Jaz-specific columns: `resource_id`, `organization_resource_id`, `business_transaction_type`, `value_date`
427
+ - UUID values (e.g., `550e8400-e29b-41d4-a716-446655440000`)
428
+ - References to `jaz.ai` email domains
429
+ - Column names use snake_case (Jaz API conventions)
430
+
431
+ **Sub-types:**
432
+ - **Org Usage Stats:** `org_resource_id`, `day`, `daily_imports` count
433
+ - **Transaction Line Items:** `resource_id`, `business_transaction_type` (PURCHASE/SALE/PAYMENT_PURCHASE), `account_resource_id`, `value_date`
434
+
435
+ **Use:** SKIP. These are NOT source accounting system data. They are Jaz platform exports that may be mixed in with conversion files. Exclude entirely from the conversion pipeline.
436
+
437
+ ---
438
+
439
+ ### 22. Multi-Report Workbook
440
+
441
+ A single Excel file containing multiple report types across different sheets.
442
+
443
+ **Key indicators:**
444
+ - Multiple sheets with different structures (different header rows, different column counts)
445
+ - Sheet names indicate different reports (e.g., "TB (YTD)", "BANK SGD (DBS)", "OTHER RECEIVABLES", "SUPPLIERS")
446
+ - May contain reports for the same entity at the same date, or related reports
447
+
448
+ **Examples seen:**
449
+ - `SY RoRo 3 - TB AP AR as at 30 Apr 2025.xlsx` — 6 sheets: TB, Bank Recon, Other Receivables subledger, Intercompany subledger, Suppliers subledger, Related Party AP subledger
450
+ - `Medical Net Schedule 8.xlsx` — multiple sheets with different schedule sections
451
+
452
+ **Handling:** Classify each sheet independently. Different sheets within the same workbook may be different file types with different header rows, data structures, and conversion relevance levels.
453
+
454
+ ---
455
+
456
+ ## Functional vs Source Currency Pairs (Sage 300/Accpac)
457
+
458
+ Sage 300 exports AP and AR aging in **matched pairs**: one file in Functional Currency (base currency, e.g., SGD) and one in Vendor/Customer Currency (original transaction currency).
459
+
460
+ | Pair | Functional Currency File | Source Currency File |
461
+ |------|------------------------|---------------------|
462
+ | AP at Date X | AP FUNCTIONAL CURRENCY.xls | AP VENDOR CURRENCY.xls |
463
+ | AR at Date X | AR FUNCTIONAL CURRENCY.xls | AR CUSTOMER CURRENCY.xls |
464
+
465
+ **Which to use:**
466
+ - **Quick Conversion (TTB journal):** Use Functional Currency version — amounts in base currency match the Trial Balance
467
+ - **Quick Conversion (FX conversion bills/invoices):** Use Source Currency version — original transaction amounts needed for FX-denominated conversion documents
468
+ - **Full Conversion:** Use both — Functional for TB verification, Source for reconstructing original transaction amounts
469
+
470
+ **Differences between the pair:**
471
+ - Source Currency version may have more rows (FX conversion creates additional applied detail lines)
472
+ - Source Currency version has an extra column for currency code indicator
473
+ - Source Currency version shows amounts in vendor's/customer's native currency
474
+ - Functional Currency version shows all amounts converted to base currency at transaction-date rates
475
+
476
+ ---
477
+
478
+ ## Source System Detection
479
+
480
+ When analyzing an unknown file, look for these system signatures:
481
+
482
+ | System | Signature |
483
+ |--------|-----------|
484
+ | **Sage 300/Accpac** | 17+ metadata rows before headers. Hundreds of merged cells. Account codes `XXXX-100` (with dept suffix). Report IDs like GLTRLR1. Filter parameters in header block. `T` column (I/N doc type). Dual-currency column sections. Two-row headers. |
485
+ | **Xero** | Clean flat exports. 4-5 metadata rows. Account codes 3-digit. Tax Rate Name column in GL Detail. "Ageing by due date" text. Auto-numbered invoices (INV-XXXX). "Demo Company (Global)" in demo data. |
486
+ | **QuickBooks** | Grouped/indented sub-accounts. "Total <category>" rows. Template files with instructions sheets. Exchange rate matrices. Account numbers optional. |
487
+ | **Generic Excel / Manual** | Very few merged cells (<10). No report metadata block. Custom layouts. May have been prepared by accountant/auditor for statutory purposes. Named schedules ("Schedule 8"). |
488
+ | **Jaz Platform** | CSV with snake_case columns. UUIDs. `jaz.ai` email references. `business_transaction_type` enum values. `resource_id` columns. |
489
+
490
+ ---
491
+
492
+ ## Common Pitfalls
493
+
494
+ 1. **Misleading filenames.** "Chart of Accounts.xls" was a Trial Balance. Always verify content, not filename.
495
+ 2. **Duplicate files.** Customers often include the same report multiple times (e.g., "AP AGING (1).xlsx" = exact copy). Deduplicate by comparing dimensions + cell counts.
496
+ 3. **Two entities in one dataset.** SY RoRo contained files for two separate companies (POH WAH SGD + SY RORO 3 EUR). Different base currencies, different source systems, different reporting dates. These need separate conversion workstreams.
497
+ 4. **Damaged/modified files.** A "-modified" suffix may indicate someone opened the file and broke merge metadata. Check for 0 merges in a file where you'd expect hundreds (Sage exports). Prefer the unmodified original.
498
+ 5. **Date format mixing.** Sage reports commonly mix `YYYY-MM-DD` and `DD/MM/YYYY` within the same column. The parser preserves the raw values — normalization happens during mapping.
499
+ 6. **Different cutoff dates.** Multiple TBs at different dates may exist (e.g., Nov 2023 FYE + Mar 2024). Confirm which is the conversion cutoff before proceeding.
500
+ 7. **Empty sheets.** Multi-sheet workbooks often have empty "Sheet1", "Sheet2", "Sheet3" sheets. These are noise — skip.
501
+ 8. **TB date ≠ Aging date.** Verify the TB date and AR/AP aging dates match. If they don't, the AR/AP totals on the aging won't reconcile with the TB receivables/payables balances.
@@ -0,0 +1,166 @@
1
+ # Mapping Rules — CoA, Contacts, Tax, Currencies
2
+
3
+ ## Chart of Accounts Mapping
4
+
5
+ ### Fresh Org Strategy (Replace)
6
+
7
+ When the Jaz org has only default system-generated accounts:
8
+
9
+ 1. **Discover system accounts:** `GET /api/v1/accounts` — system-generated accounts have `isSystemGenerated: true` or are marked as controlled. These cannot be deleted.
10
+ 2. **Delete non-system accounts** that aren't in the source CoA
11
+ 3. **Create source accounts** using `POST /api/v1/accounts` with bulk upsert (`accounts` wrapper)
12
+ 4. **Match by code first, then name** — if a system account has the same code as a source account, map to it
13
+
14
+ ### Existing Org Strategy (Match)
15
+
16
+ When the Jaz org has user-customized accounts:
17
+
18
+ 1. **GET all existing accounts** from Jaz
19
+ 2. **3-tier fuzzy matching** (reuse seeder's proven approach):
20
+ - **Tier 1 — Exact name match:** Case-insensitive exact match on account name
21
+ - **Tier 2 — Fuzzy match (Jaro-Winkler):** JW distance > 0.85 between names
22
+ - **Tier 3 — Token overlap:** Split names into tokens, overlap > 60%
23
+ 3. **Code as tiebreaker:** If multiple name matches, prefer the one with matching account code
24
+ 4. **Create missing accounts** for any unmatched source accounts
25
+
26
+ ### Account Type Mapping
27
+
28
+ Source systems use different classification names. Map to Jaz types:
29
+
30
+ | Source (common names) | Jaz `classificationType` |
31
+ |----------------------|-------------------------|
32
+ | Cash, Bank | Bank Accounts |
33
+ | Accounts Receivable, Trade Debtors | Current Assets |
34
+ | Inventory, Stock | Current Assets |
35
+ | Prepaid Expenses | Current Assets |
36
+ | Fixed Assets, Property/Equipment | Non-Current Assets |
37
+ | Accumulated Depreciation | Non-Current Assets |
38
+ | Accounts Payable, Trade Creditors | Current Liabilities |
39
+ | Accrued Liabilities | Current Liabilities |
40
+ | Loans (long-term) | Non-Current Liabilities |
41
+ | Owner's Equity, Share Capital | Equity |
42
+ | Retained Earnings | Equity |
43
+ | Sales, Revenue, Income | Revenue |
44
+ | Cost of Goods Sold, COGS | Cost of Sales |
45
+ | Operating Expenses | Expenses |
46
+ | Other Income | Other Revenue |
47
+ | Other Expenses | Other Expenses |
48
+
49
+ ### Clearing Account Creation
50
+
51
+ For Quick Conversion, create two clearing accounts:
52
+
53
+ ```json
54
+ {
55
+ "accounts": [
56
+ {
57
+ "accountName": "AR Conversion Clearing",
58
+ "accountCode": "1299",
59
+ "classificationType": "Current Assets",
60
+ "description": "Contra account for conversion AR balances — should net to zero"
61
+ },
62
+ {
63
+ "accountName": "AP Conversion Clearing",
64
+ "accountCode": "2199",
65
+ "classificationType": "Current Liabilities",
66
+ "description": "Contra account for conversion AP balances — should net to zero"
67
+ }
68
+ ]
69
+ }
70
+ ```
71
+
72
+ Choose codes that don't conflict with existing accounts. Adjust `1299`/`2199` if those codes are taken.
73
+
74
+ ## Contact Mapping
75
+
76
+ ### Matching Rules
77
+ 1. **Exact name match** (case-insensitive)
78
+ 2. **Fuzzy name match** (Jaro-Winkler > 0.85) — handles minor variations like "Pte Ltd" vs "Pte. Ltd."
79
+ 3. **If no match → create new contact**
80
+
81
+ ### Contact Types
82
+ - Source "Customer" → Jaz `type: "CUSTOMER"`
83
+ - Source "Supplier" / "Vendor" → Jaz `type: "SUPPLIER"`
84
+ - If both (customer AND supplier) → Jaz `type: "CUSTOMER_AND_SUPPLIER"`
85
+
86
+ ### Required Fields
87
+ - `companyName` — the contact's business name
88
+ - `displayName` — what shows on invoices/bills (often same as companyName)
89
+ - `type` — CUSTOMER, SUPPLIER, or CUSTOMER_AND_SUPPLIER
90
+
91
+ ### Optional but Recommended
92
+ - `email` — for payment reminders
93
+ - `phone` — **MUST be E.164** if provided (`+65XXXXXXXX` for SG, `+63XXXXXXXXXX` for PH)
94
+ - `currency` — default currency for this contact (for FX contacts)
95
+
96
+ ## Tax Profile Mapping
97
+
98
+ **Tax profiles are READ-ONLY in Jaz.** They are pre-provisioned per org. You can only discover and map.
99
+
100
+ ### Discovery
101
+ ```
102
+ GET /api/v1/tax-profiles
103
+ ```
104
+ Returns all available tax profiles with `taxTypeCode`, `taxPercentage`, and `description`.
105
+
106
+ ### Common Mappings
107
+
108
+ **Singapore (GST):**
109
+ | Source Tax Code | Jaz taxTypeCode | Rate |
110
+ |----------------|-----------------|------|
111
+ | GST 9%, Standard Rate | SR | 9% |
112
+ | GST on Purchases | TX | 9% |
113
+ | Zero Rated | ZR | 0% |
114
+ | Exempt | ES | 0% |
115
+ | Out of Scope | OS | 0% |
116
+ | No Tax | - | Skip tax on line item |
117
+
118
+ **Philippines (VAT):**
119
+ | Source Tax Code | Jaz taxTypeCode | Rate |
120
+ |----------------|-----------------|------|
121
+ | 12% VAT | S12 | 12% |
122
+ | VAT Exempt | VE | 0% |
123
+ | Zero Rated | VZ | 0% |
124
+
125
+ ### Handling "No Tax" / Tax-Free Items
126
+ If a source line item has no tax, omit `taxProfileResourceId` from the line item payload entirely — do NOT set it to a zero-rate profile unless the source explicitly used one.
127
+
128
+ ## Currency Mapping
129
+
130
+ ### Enable Currencies
131
+ Before creating any FX transactions or CoA entries with foreign currency:
132
+
133
+ ```
134
+ PUT /api/v1/organization/currencies
135
+ {
136
+ "currencies": ["USD", "EUR", "JPY"]
137
+ }
138
+ ```
139
+
140
+ ### Set FYE Exchange Rates
141
+ For Quick Conversion, all conversion transactions use the FYE closing rate:
142
+
143
+ ```
144
+ POST /api/v1/organization-currencies/<code>/rates
145
+ {
146
+ "rate": 1.35,
147
+ "effectiveDate": "2023-12-31"
148
+ }
149
+ ```
150
+
151
+ **Rate direction:** `functionalToSource` — how many units of functional (base) currency = 1 unit of source (foreign) currency. Example: If base is SGD and rate is 1 SGD = 0.74 USD, then rate = 0.74.
152
+
153
+ **Note:** Rate endpoints use `/organization-currencies` (hyphenated). Enable/disable uses `/organization/currencies` (nested path). These are DIFFERENT endpoints.
154
+
155
+ ## Confidence Scoring
156
+
157
+ For each mapping, assign a confidence level:
158
+
159
+ | Confidence | Criteria | Action |
160
+ |-----------|---------|--------|
161
+ | **High** | Exact match (name or code) | Auto-accept |
162
+ | **Medium** | Fuzzy match (JW > 0.85 or token > 60%) | Flag for review |
163
+ | **Low** | No match found, creating new | Flag for review |
164
+ | **Conflict** | Multiple possible matches | Must resolve manually |
165
+
166
+ Present all medium, low, and conflict mappings to the human reviewer before proceeding.