@classytic/ledger-bd 0.1.1 → 0.2.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/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",
@@ -5912,7 +5921,14 @@ const VAT_CODES = {
5912
5921
  province: "National",
5913
5922
  reportLines: [1, 2],
5914
5923
  description: "Standard rate VAT at 15% with full input credit",
5915
- active: true
5924
+ active: true,
5925
+ repartition: [{
5926
+ factor: 1,
5927
+ accountRole: "collected",
5928
+ gridCode: 2,
5929
+ label: "VAT Output 15%"
5930
+ }],
5931
+ exigibility: "accrual"
5916
5932
  },
5917
5933
  "BD-VAT-10": {
5918
5934
  code: "BD-VAT-10",
@@ -6316,8 +6332,19 @@ const BD_DIVISIONS = ALL_DIVISIONS;
6316
6332
  /**
6317
6333
  * @classytic/ledger-bd — Bangladesh Country Pack
6318
6334
  *
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.
6335
+ * Provides the BFRS-aligned chart of accounts (~600+ types) and BD-specific
6336
+ * accounting conventions for `@classytic/ledger`.
6337
+ *
6338
+ * **Scope of this package:** chart of accounts, journal templates, retained
6339
+ * earnings + COGS conventions. **Tax (VAT, TDS, VDS, SD, Mushak returns,
6340
+ * income-tax slabs, etc.) lives in a sister package: `@classytic/bd-tax`.**
6341
+ *
6342
+ * The BD VAT/TDS/SD code tables and the Mushak 9.1 return template that
6343
+ * shipped pre-0.7 are still re-exported as raw data so the future
6344
+ * `@classytic/bd-tax` package (or any consumer wiring tax themselves) can
6345
+ * import them — but they are **not** wired into `defineCountryPack` because
6346
+ * `@classytic/ledger@0.7+` no longer carries tax interfaces in its
6347
+ * `CountryPack` contract.
6321
6348
  *
6322
6349
  * @example
6323
6350
  * ```typescript
@@ -6325,10 +6352,13 @@ const BD_DIVISIONS = ALL_DIVISIONS;
6325
6352
  * import { bangladeshPack } from '@classytic/ledger-bd';
6326
6353
  *
6327
6354
  * const accounting = createAccountingEngine({
6355
+ * mongoose,
6328
6356
  * country: bangladeshPack,
6329
6357
  * currency: 'BDT',
6330
6358
  * multiTenant: { orgField: 'business', orgRef: 'Business' },
6331
6359
  * });
6360
+ *
6361
+ * // Need NBR Mushak filing? Wire @classytic/bd-tax separately.
6332
6362
  * ```
6333
6363
  *
6334
6364
  * @module @classytic/ledger-bd
@@ -6338,13 +6368,60 @@ const bangladeshPack = defineCountryPack({
6338
6368
  name: "Bangladesh",
6339
6369
  defaultCurrency: "BDT",
6340
6370
  accountTypes: BD_ACCOUNT_TYPES,
6341
- taxCodes: ALL_TAX_CODES,
6342
- taxCodesByRegion: TAX_CODES_BY_DIVISION,
6343
- regions: BD_DIVISIONS,
6344
- taxReport: mushakReturnTemplate,
6345
6371
  retainedEarningsAccountCode: "3310",
6346
6372
  currentYearEarningsCode: "3311",
6347
- cogsGroupCode: "Cost of Sales"
6373
+ cogsGroupCode: "Cost of Sales",
6374
+ journalTemplates: [
6375
+ {
6376
+ code: "SALES",
6377
+ name: "Mushak Sales",
6378
+ journalType: "SALES",
6379
+ kind: "sale",
6380
+ sequencePrefix: "INV"
6381
+ },
6382
+ {
6383
+ code: "PURCHASE",
6384
+ name: "Purchase Mushak",
6385
+ journalType: "PURCHASES",
6386
+ kind: "purchase",
6387
+ sequencePrefix: "BILL"
6388
+ },
6389
+ {
6390
+ code: "BANK",
6391
+ name: "Bank",
6392
+ journalType: "CASH_RECEIPTS",
6393
+ kind: "bank",
6394
+ sequencePrefix: "BNK"
6395
+ },
6396
+ {
6397
+ code: "CASH",
6398
+ name: "Cash",
6399
+ journalType: "CASH_PAYMENTS",
6400
+ kind: "cash",
6401
+ sequencePrefix: "CSH"
6402
+ },
6403
+ {
6404
+ code: "VDS",
6405
+ name: "VDS Withholding",
6406
+ journalType: "TAX",
6407
+ kind: "general",
6408
+ sequencePrefix: "VDS"
6409
+ },
6410
+ {
6411
+ code: "TDS",
6412
+ name: "TDS Withholding",
6413
+ journalType: "TAX",
6414
+ kind: "general",
6415
+ sequencePrefix: "TDS"
6416
+ },
6417
+ {
6418
+ code: "MISC",
6419
+ name: "Miscellaneous",
6420
+ journalType: "MISC",
6421
+ kind: "general",
6422
+ sequencePrefix: "JE"
6423
+ }
6424
+ ]
6348
6425
  });
6349
6426
  //#endregion
6350
6427
  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.0",
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,
@@ -33,7 +33,7 @@
33
33
  "author": "Classytic <classytic.dev@gmail.com> (https://github.com/classytic)",
34
34
  "license": "MIT",
35
35
  "peerDependencies": {
36
- "@classytic/ledger": ">=0.2.0"
36
+ "@classytic/ledger": ">=0.7.0"
37
37
  },
38
38
  "engines": {
39
39
  "node": ">=22"
@@ -48,7 +48,7 @@
48
48
  "release": "npm run build && npm run typecheck && npm publish --access public"
49
49
  },
50
50
  "devDependencies": {
51
- "@classytic/ledger": "^0.2.0",
51
+ "@classytic/ledger": "^0.7.0",
52
52
  "@types/node": "^22.0.0",
53
53
  "mongodb-memory-server": "^11.0.1",
54
54
  "mongoose": "^9.3.3",