@classytic/ledger-bd 0.1.1 → 0.2.1

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/CHANGELOG.md ADDED
@@ -0,0 +1,38 @@
1
+ # Changelog
2
+
3
+ Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
4
+ adhering to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
+
6
+ ## [0.2.1]
7
+
8
+ ### Added
9
+
10
+ - Chart of accounts: new expense code **`6423 — Courier COD Commission`**
11
+ under `SELLING_DISTRIBUTION`. Captures commission deductions from
12
+ cash-on-delivery collections by BD courier partners (Pathao, RedX,
13
+ Steadfast, Sundarban).
14
+
15
+ ### Fixed
16
+
17
+ - Packaging hygiene — added `README.md` and `CHANGELOG.md` to the `files`
18
+ array, added `repository` / `bugs` / `homepage` / `publishConfig.access`
19
+ to `package.json`, expanded `.gitignore` to cover `.env`, `.env.*`,
20
+ `/.claude`, `.mcp.json`, and the other standard safety patterns.
21
+
22
+ ## [0.2.0]
23
+
24
+ Initial public release. Bangladesh country pack for `@classytic/ledger`.
25
+
26
+ ### Ships
27
+
28
+ - **BFRS chart of accounts** — full post-0.8 tree (assets 1xxx, liabilities
29
+ 2xxx, equity 3xxx, revenue 4xxx, cost-of-sales 5xxx, expenses 6xxx).
30
+ - **NBR VAT / TDS tax codes** — standard 15% VAT + supplementary-duty
31
+ brackets + withholding rates per §52/§53 tables.
32
+ - **Mushak 9.1 monthly return** scaffolding.
33
+ - **Default journal templates** — sales, purchase, VDS, TDS, cash, bank.
34
+
35
+ ### Peer
36
+
37
+ - `@classytic/ledger >= 0.7.0` — ledger 0.7 introduced the
38
+ `journalTemplates` contract this pack relies on.
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import * as _classytic_ledger0 from "@classytic/ledger";
2
- import { AccountType, TaxCode, TaxCodesByRegion, TaxReportTemplate } from "@classytic/ledger";
1
+ import * as _$_classytic_ledger0 from "@classytic/ledger";
2
+ import { AccountType } from "@classytic/ledger";
3
3
 
4
4
  //#region src/accounts/assets.d.ts
5
5
  declare const CURRENT_ASSETS: AccountType[];
@@ -53,6 +53,59 @@ declare const ALL_TAX_ACCOUNTS: AccountType[];
53
53
  /** Complete flat array of all BD account types + tax sub-accounts + group labels */
54
54
  declare const BD_ACCOUNT_TYPES: readonly AccountType[];
55
55
  //#endregion
56
+ //#region src/tax/types.d.ts
57
+ /**
58
+ * Local tax type definitions for the BD pack's raw tax data exports.
59
+ *
60
+ * These were previously imported from `@classytic/ledger` but the ledger
61
+ * dropped tax interfaces in 0.7.0 (tax is intentionally separate — see
62
+ * `@classytic/bd-tax`). The pack still ships the BD VAT/TDS code table
63
+ * and Mushak 9.1 return template as raw data so the future `bd-tax`
64
+ * package (or any consumer wiring tax themselves) can pick them up.
65
+ *
66
+ * These types will eventually move to `@classytic/bd-tax` and be
67
+ * re-exported from there. Defined locally here in the meantime to keep
68
+ * the pack self-contained.
69
+ */
70
+ interface TaxRepartitionLine {
71
+ readonly factor: number;
72
+ readonly accountRole: string;
73
+ readonly gridCode?: string | number;
74
+ readonly label?: string;
75
+ readonly documentTypes?: readonly ('invoice' | 'refund' | 'payment')[];
76
+ }
77
+ type TaxExigibility = 'accrual' | 'cash';
78
+ interface TaxCode {
79
+ readonly code: string;
80
+ readonly name: string;
81
+ readonly taxType: string;
82
+ readonly rate: number;
83
+ readonly direction: 'collected' | 'recoverable' | 'paid';
84
+ readonly province?: string;
85
+ readonly reportLines?: readonly number[];
86
+ readonly description: string;
87
+ readonly active: boolean;
88
+ readonly repartition?: readonly TaxRepartitionLine[];
89
+ readonly exigibility?: TaxExigibility;
90
+ }
91
+ interface TaxCodesByRegion {
92
+ readonly [region: string]: readonly string[];
93
+ }
94
+ interface TaxReportLine {
95
+ readonly line: number | string;
96
+ readonly name: string;
97
+ readonly description: string;
98
+ readonly type: 'input' | 'calculated' | 'manual';
99
+ readonly calculate?: (data: Record<string | number, number>) => number;
100
+ readonly section: string;
101
+ }
102
+ interface TaxReportTemplate {
103
+ readonly name: string;
104
+ readonly lines: Readonly<Record<string | number, TaxReportLine>>;
105
+ calculate(inputData: Record<string | number, number>, manualData?: Record<string | number, number>): Record<string | number, number>;
106
+ summarize(calculated: Record<string | number, number>): Record<string, unknown>;
107
+ }
108
+ //#endregion
56
109
  //#region src/tax/codes.d.ts
57
110
  declare const ALL_TAX_CODES: Readonly<Record<string, TaxCode>>;
58
111
  /** Look up a tax code by its code string. e.g. getTaxCodeDetails('BD-VAT-15') */
@@ -90,8 +143,19 @@ declare const ALL_DIVISIONS: ("Dhaka" | "Chittagong" | "Rajshahi" | "Khulna" | "
90
143
  /**
91
144
  * @classytic/ledger-bd — Bangladesh Country Pack
92
145
  *
93
- * Provides BFRS-aligned chart of accounts (~500+ types), NBR VAT/TDS tax codes,
94
- * Mushak 9.1 return template, and coverage for every major BD industry.
146
+ * Provides the BFRS-aligned chart of accounts (~600+ types) and BD-specific
147
+ * accounting conventions for `@classytic/ledger`.
148
+ *
149
+ * **Scope of this package:** chart of accounts, journal templates, retained
150
+ * earnings + COGS conventions. **Tax (VAT, TDS, VDS, SD, Mushak returns,
151
+ * income-tax slabs, etc.) lives in a sister package: `@classytic/bd-tax`.**
152
+ *
153
+ * The BD VAT/TDS/SD code tables and the Mushak 9.1 return template that
154
+ * shipped pre-0.7 are still re-exported as raw data so the future
155
+ * `@classytic/bd-tax` package (or any consumer wiring tax themselves) can
156
+ * import them — but they are **not** wired into `defineCountryPack` because
157
+ * `@classytic/ledger@0.7+` no longer carries tax interfaces in its
158
+ * `CountryPack` contract.
95
159
  *
96
160
  * @example
97
161
  * ```typescript
@@ -99,14 +163,17 @@ declare const ALL_DIVISIONS: ("Dhaka" | "Chittagong" | "Rajshahi" | "Khulna" | "
99
163
  * import { bangladeshPack } from '@classytic/ledger-bd';
100
164
  *
101
165
  * const accounting = createAccountingEngine({
166
+ * mongoose,
102
167
  * country: bangladeshPack,
103
168
  * currency: 'BDT',
104
169
  * multiTenant: { orgField: 'business', orgRef: 'Business' },
105
170
  * });
171
+ *
172
+ * // Need NBR Mushak filing? Wire @classytic/bd-tax separately.
106
173
  * ```
107
174
  *
108
175
  * @module @classytic/ledger-bd
109
176
  */
110
- declare const bangladeshPack: _classytic_ledger0.CountryPack;
177
+ declare const bangladeshPack: _$_classytic_ledger0.CountryPack;
111
178
  //#endregion
112
179
  export { ADMIN_EXPENSES, ALL_DIVISIONS, ALL_TAX_ACCOUNTS, ASSETS, BANKING_REVENUE, BD_ACCOUNT_TYPES, BD_DIVISIONS, COGS, COST_OF_SERVICES, CURRENT_ASSETS, CURRENT_LIABILITIES, DEPRECIATION, DIRECT_LABOR, DIRECT_MATERIALS, DIVISIONS, EMPLOYEE_COSTS, EQUITY, EXPENSES, FINANCIAL_EXPENSES, INDUSTRY_REVENUE, LIABILITIES, MANUFACTURING_OVERHEAD, NGO_REVENUE, NON_CURRENT_ASSETS, NON_CURRENT_LIABILITIES, OTHER_INCOME, OTHER_OPERATING, PREMISES_COSTS, PROVISIONS, PURCHASES, REVENUE, SALES_REVENUE, SELLING_DISTRIBUTION, ALL_TAX_CODES as TAX_CODES, TAX_CODES_BY_DIVISION, TAX_EXPENSE, TDS_LIABILITY_ACCOUNTS, VAT_ASSET_ACCOUNTS, VAT_LIABILITY_ACCOUNTS, VDS_LIABILITY_ACCOUNTS, bangladeshPack, getTaxCodeDetails, mushakReturnTemplate };
package/dist/index.mjs CHANGED
@@ -317,6 +317,15 @@ const CURRENT_ASSETS = [
317
317
  isTotal: false,
318
318
  cashFlowCategory: null
319
319
  },
320
+ {
321
+ code: "1157",
322
+ name: "VAT Cash-Basis Transition",
323
+ category: A$2,
324
+ description: "Holding account for VAT recognized at invoice time but only payable to NBR after customer payment is received (cash-basis exigibility, Section 16 VAT & SD Act 2012). Cleared by ledger’s cashBasisRealize plugin on payment matching.",
325
+ parentCode: "Current Assets",
326
+ isTotal: false,
327
+ cashFlowCategory: null
328
+ },
320
329
  {
321
330
  code: "1161",
322
331
  name: "Raw Materials",
@@ -5027,6 +5036,15 @@ const SELLING_DISTRIBUTION = [
5027
5036
  parentCode: "Operating Expenses",
5028
5037
  isTotal: false,
5029
5038
  cashFlowCategory: null
5039
+ },
5040
+ {
5041
+ code: "6423",
5042
+ name: "Courier COD Commission",
5043
+ category: X$1,
5044
+ description: "Commission deducted by courier partners on cash-on-delivery collections (Pathao, RedX, Steadfast, Sundarban)",
5045
+ parentCode: "Operating Expenses",
5046
+ isTotal: false,
5047
+ cashFlowCategory: null
5030
5048
  }
5031
5049
  ];
5032
5050
  const FINANCIAL_EXPENSES = [
@@ -5912,7 +5930,14 @@ const VAT_CODES = {
5912
5930
  province: "National",
5913
5931
  reportLines: [1, 2],
5914
5932
  description: "Standard rate VAT at 15% with full input credit",
5915
- active: true
5933
+ active: true,
5934
+ repartition: [{
5935
+ factor: 1,
5936
+ accountRole: "collected",
5937
+ gridCode: 2,
5938
+ label: "VAT Output 15%"
5939
+ }],
5940
+ exigibility: "accrual"
5916
5941
  },
5917
5942
  "BD-VAT-10": {
5918
5943
  code: "BD-VAT-10",
@@ -6316,8 +6341,19 @@ const BD_DIVISIONS = ALL_DIVISIONS;
6316
6341
  /**
6317
6342
  * @classytic/ledger-bd — Bangladesh Country Pack
6318
6343
  *
6319
- * Provides BFRS-aligned chart of accounts (~500+ types), NBR VAT/TDS tax codes,
6320
- * Mushak 9.1 return template, and coverage for every major BD industry.
6344
+ * Provides the BFRS-aligned chart of accounts (~600+ types) and BD-specific
6345
+ * accounting conventions for `@classytic/ledger`.
6346
+ *
6347
+ * **Scope of this package:** chart of accounts, journal templates, retained
6348
+ * earnings + COGS conventions. **Tax (VAT, TDS, VDS, SD, Mushak returns,
6349
+ * income-tax slabs, etc.) lives in a sister package: `@classytic/bd-tax`.**
6350
+ *
6351
+ * The BD VAT/TDS/SD code tables and the Mushak 9.1 return template that
6352
+ * shipped pre-0.7 are still re-exported as raw data so the future
6353
+ * `@classytic/bd-tax` package (or any consumer wiring tax themselves) can
6354
+ * import them — but they are **not** wired into `defineCountryPack` because
6355
+ * `@classytic/ledger@0.7+` no longer carries tax interfaces in its
6356
+ * `CountryPack` contract.
6321
6357
  *
6322
6358
  * @example
6323
6359
  * ```typescript
@@ -6325,10 +6361,13 @@ const BD_DIVISIONS = ALL_DIVISIONS;
6325
6361
  * import { bangladeshPack } from '@classytic/ledger-bd';
6326
6362
  *
6327
6363
  * const accounting = createAccountingEngine({
6364
+ * mongoose,
6328
6365
  * country: bangladeshPack,
6329
6366
  * currency: 'BDT',
6330
6367
  * multiTenant: { orgField: 'business', orgRef: 'Business' },
6331
6368
  * });
6369
+ *
6370
+ * // Need NBR Mushak filing? Wire @classytic/bd-tax separately.
6332
6371
  * ```
6333
6372
  *
6334
6373
  * @module @classytic/ledger-bd
@@ -6338,13 +6377,60 @@ const bangladeshPack = defineCountryPack({
6338
6377
  name: "Bangladesh",
6339
6378
  defaultCurrency: "BDT",
6340
6379
  accountTypes: BD_ACCOUNT_TYPES,
6341
- taxCodes: ALL_TAX_CODES,
6342
- taxCodesByRegion: TAX_CODES_BY_DIVISION,
6343
- regions: BD_DIVISIONS,
6344
- taxReport: mushakReturnTemplate,
6345
6380
  retainedEarningsAccountCode: "3310",
6346
6381
  currentYearEarningsCode: "3311",
6347
- cogsGroupCode: "Cost of Sales"
6382
+ cogsGroupCode: "Cost of Sales",
6383
+ journalTemplates: [
6384
+ {
6385
+ code: "SALES",
6386
+ name: "Mushak Sales",
6387
+ journalType: "SALES",
6388
+ kind: "sale",
6389
+ sequencePrefix: "INV"
6390
+ },
6391
+ {
6392
+ code: "PURCHASE",
6393
+ name: "Purchase Mushak",
6394
+ journalType: "PURCHASES",
6395
+ kind: "purchase",
6396
+ sequencePrefix: "BILL"
6397
+ },
6398
+ {
6399
+ code: "BANK",
6400
+ name: "Bank",
6401
+ journalType: "CASH_RECEIPTS",
6402
+ kind: "bank",
6403
+ sequencePrefix: "BNK"
6404
+ },
6405
+ {
6406
+ code: "CASH",
6407
+ name: "Cash",
6408
+ journalType: "CASH_PAYMENTS",
6409
+ kind: "cash",
6410
+ sequencePrefix: "CSH"
6411
+ },
6412
+ {
6413
+ code: "VDS",
6414
+ name: "VDS Withholding",
6415
+ journalType: "TAX",
6416
+ kind: "general",
6417
+ sequencePrefix: "VDS"
6418
+ },
6419
+ {
6420
+ code: "TDS",
6421
+ name: "TDS Withholding",
6422
+ journalType: "TAX",
6423
+ kind: "general",
6424
+ sequencePrefix: "TDS"
6425
+ },
6426
+ {
6427
+ code: "MISC",
6428
+ name: "Miscellaneous",
6429
+ journalType: "MISC",
6430
+ kind: "general",
6431
+ sequencePrefix: "JE"
6432
+ }
6433
+ ]
6348
6434
  });
6349
6435
  //#endregion
6350
6436
  export { ADMIN_EXPENSES, ALL_DIVISIONS, ALL_TAX_ACCOUNTS, ASSETS, BANKING_REVENUE, BD_ACCOUNT_TYPES, BD_DIVISIONS, COGS, COST_OF_SERVICES, CURRENT_ASSETS, CURRENT_LIABILITIES, DEPRECIATION, DIRECT_LABOR, DIRECT_MATERIALS, DIVISIONS, EMPLOYEE_COSTS, EQUITY, EXPENSES, FINANCIAL_EXPENSES, INDUSTRY_REVENUE, LIABILITIES, MANUFACTURING_OVERHEAD, NGO_REVENUE, NON_CURRENT_ASSETS, NON_CURRENT_LIABILITIES, OTHER_INCOME, OTHER_OPERATING, PREMISES_COSTS, PROVISIONS, PURCHASES, REVENUE, SALES_REVENUE, SELLING_DISTRIBUTION, ALL_TAX_CODES as TAX_CODES, TAX_CODES_BY_DIVISION, TAX_EXPENSE, TDS_LIABILITY_ACCOUNTS, VAT_ASSET_ACCOUNTS, VAT_LIABILITY_ACCOUNTS, VDS_LIABILITY_ACCOUNTS, bangladeshPack, getTaxCodeDetails, mushakReturnTemplate };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@classytic/ledger-bd",
3
- "version": "0.1.1",
3
+ "version": "0.2.1",
4
4
  "description": "Bangladesh country pack for @classytic/ledger — BFRS chart of accounts, NBR VAT/TDS tax codes, Mushak 9.1 return",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -16,8 +16,21 @@
16
16
  },
17
17
  "files": [
18
18
  "dist",
19
+ "README.md",
20
+ "CHANGELOG.md",
19
21
  "LICENSE"
20
22
  ],
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/classytic/ledger-bd.git"
26
+ },
27
+ "bugs": {
28
+ "url": "https://github.com/classytic/ledger-bd/issues"
29
+ },
30
+ "homepage": "https://github.com/classytic/ledger-bd#readme",
31
+ "publishConfig": {
32
+ "access": "public"
33
+ },
21
34
  "keywords": [
22
35
  "accounting",
23
36
  "bangladesh",
@@ -33,7 +46,7 @@
33
46
  "author": "Classytic <classytic.dev@gmail.com> (https://github.com/classytic)",
34
47
  "license": "MIT",
35
48
  "peerDependencies": {
36
- "@classytic/ledger": ">=0.2.0"
49
+ "@classytic/ledger": ">=0.7.0"
37
50
  },
38
51
  "engines": {
39
52
  "node": ">=22"
@@ -48,7 +61,7 @@
48
61
  "release": "npm run build && npm run typecheck && npm publish --access public"
49
62
  },
50
63
  "devDependencies": {
51
- "@classytic/ledger": "^0.2.0",
64
+ "@classytic/ledger": "^0.7.0",
52
65
  "@types/node": "^22.0.0",
53
66
  "mongodb-memory-server": "^11.0.1",
54
67
  "mongoose": "^9.3.3",