@diy-accounting-uk/diya-gl 1.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.
Files changed (157) hide show
  1. package/README.md +63 -0
  2. package/bin/diya-gl-mcp.js +10 -0
  3. package/bin/diya-gl-read-workbook.js +11 -0
  4. package/bin/diya-gl-recalc.js +10 -0
  5. package/bin/diya-gl-write-workbook.js +12 -0
  6. package/bin/diya-gl.js +24 -0
  7. package/bin/run-dist-bin.js +23 -0
  8. package/dist/app/bin/build-diya-gl-spec.js +680 -0
  9. package/dist/app/bin/build-packages.js +149 -0
  10. package/dist/app/bin/build-reconciliation-pages.js +1052 -0
  11. package/dist/app/bin/build-sitemaps.js +51 -0
  12. package/dist/app/bin/compliance-report.js +125 -0
  13. package/dist/app/bin/cross-package-reconciliation.js +92 -0
  14. package/dist/app/bin/diya-gl-mcp.js +27 -0
  15. package/dist/app/bin/export.js +318 -0
  16. package/dist/app/bin/extract-scenarios.js +1348 -0
  17. package/dist/app/bin/generate.js +353 -0
  18. package/dist/app/bin/judge-reconciliation.js +649 -0
  19. package/dist/app/bin/reconcile.js +247 -0
  20. package/dist/app/bin/report.js +291 -0
  21. package/dist/app/bin/verify-roundtrip.js +941 -0
  22. package/dist/app/bin/verify-stability.js +429 -0
  23. package/dist/app/bin/write-workbook.js +106 -0
  24. package/dist/app/data/filing/ct-computation-v1.1.toml +1033 -0
  25. package/dist/app/data/filing/ct600-v3.toml +2329 -0
  26. package/dist/app/data/filing/frs105-formats.toml +244 -0
  27. package/dist/app/data/fixture-master-gaps.json +247 -0
  28. package/dist/app/data/hmrc/SOURCE.md +14 -0
  29. package/dist/app/data/hmrc/form-layouts/bst.json +116 -0
  30. package/dist/app/data/hmrc/form-layouts/ltd.json +452 -0
  31. package/dist/app/data/hmrc/form-layouts/se.json +485 -0
  32. package/dist/app/data/hmrc/form-layouts/taxi.json +117 -0
  33. package/dist/app/data/hmrc/sa103-mtd-mapping.json +1078 -0
  34. package/dist/app/data/hmrc/sa103f_mapping_v3.csv +111 -0
  35. package/dist/app/data/judge-rubric.md +52 -0
  36. package/dist/app/data/ltd-2020.toml +49 -0
  37. package/dist/app/data/ltd-2021.toml +49 -0
  38. package/dist/app/data/ltd-2022.toml +49 -0
  39. package/dist/app/data/ltd-2023.toml +49 -0
  40. package/dist/app/data/ltd-2024.toml +49 -0
  41. package/dist/app/data/ltd-2025.toml +49 -0
  42. package/dist/app/data/ltd-2026.toml +53 -0
  43. package/dist/app/data/ltd-2027.toml +51 -0
  44. package/dist/app/data/render-unrepresentable/bst.json +24 -0
  45. package/dist/app/data/render-unrepresentable/ltd.json +863 -0
  46. package/dist/app/data/render-unrepresentable/se.json +455 -0
  47. package/dist/app/data/render-unrepresentable/taxi.json +16 -0
  48. package/dist/app/data/roundtrip-budget.json +38 -0
  49. package/dist/app/data/roundtrip-matrix-budget.json +26 -0
  50. package/dist/app/data/roundtrip-unrepresentable.json +401 -0
  51. package/dist/app/data/se-2020-2021.toml +52 -0
  52. package/dist/app/data/se-2021-2022.toml +52 -0
  53. package/dist/app/data/se-2022-2023.toml +55 -0
  54. package/dist/app/data/se-2023-2024.toml +54 -0
  55. package/dist/app/data/se-2024-2025.toml +51 -0
  56. package/dist/app/data/se-2025-2026.toml +51 -0
  57. package/dist/app/data/se-2026-2027.toml +51 -0
  58. package/dist/app/data/volatile-cells.json +16 -0
  59. package/dist/app/lib/anchors/bst.js +79 -0
  60. package/dist/app/lib/anchors/ltd.js +626 -0
  61. package/dist/app/lib/anchors/run.js +100 -0
  62. package/dist/app/lib/anchors/se.js +456 -0
  63. package/dist/app/lib/anchors/taxi.js +164 -0
  64. package/dist/app/lib/app-resources.js +80 -0
  65. package/dist/app/lib/book-checks/ltd.js +408 -0
  66. package/dist/app/lib/book-checks/se.js +687 -0
  67. package/dist/app/lib/book-checks/taxi.js +215 -0
  68. package/dist/app/lib/book-checks.js +872 -0
  69. package/dist/app/lib/books-engine.js +197 -0
  70. package/dist/app/lib/books-interchange.js +533 -0
  71. package/dist/app/lib/calculators/bst.js +381 -0
  72. package/dist/app/lib/calculators/ltd.js +1938 -0
  73. package/dist/app/lib/calculators/se.js +1239 -0
  74. package/dist/app/lib/calculators/shared.js +131 -0
  75. package/dist/app/lib/calculators/taxi.js +461 -0
  76. package/dist/app/lib/canonical-report-value.js +77 -0
  77. package/dist/app/lib/compliance-report.js +341 -0
  78. package/dist/app/lib/diya-gl-calculator.js +52 -0
  79. package/dist/app/lib/diya-gl-canonical.js +355 -0
  80. package/dist/app/lib/diya-gl-edits-ltd.js +144 -0
  81. package/dist/app/lib/diya-gl-edits.js +361 -0
  82. package/dist/app/lib/diya-gl-loader.js +774 -0
  83. package/dist/app/lib/diya-gl-schema.js +212 -0
  84. package/dist/app/lib/generator.js +1912 -0
  85. package/dist/app/lib/guide.js +33 -0
  86. package/dist/app/lib/headlines.js +293 -0
  87. package/dist/app/lib/link-caches.js +421 -0
  88. package/dist/app/lib/ltd-layout.js +139 -0
  89. package/dist/app/lib/mcp/diya-gl-tools.js +330 -0
  90. package/dist/app/lib/mcp/jsonrpc-stdio.js +66 -0
  91. package/dist/app/lib/mcp/server.js +65 -0
  92. package/dist/app/lib/overtype-sidecar.js +180 -0
  93. package/dist/app/lib/package-builder.js +202 -0
  94. package/dist/app/lib/payslips-date-chain.js +481 -0
  95. package/dist/app/lib/payslips-layout.js +235 -0
  96. package/dist/app/lib/period-shift.js +111 -0
  97. package/dist/app/lib/product-workbook.js +317 -0
  98. package/dist/app/lib/products.js +27 -0
  99. package/dist/app/lib/provenance-data.js +36 -0
  100. package/dist/app/lib/provenance.js +92 -0
  101. package/dist/app/lib/report-generator.js +374 -0
  102. package/dist/app/lib/report-indicators.js +468 -0
  103. package/dist/app/lib/report-serializer.js +392 -0
  104. package/dist/app/lib/scenario-extractor.js +1403 -0
  105. package/dist/app/lib/scenario-loader.js +84 -0
  106. package/dist/app/lib/sitemap-builder.js +59 -0
  107. package/dist/app/lib/spreadsheet-runner.js +566 -0
  108. package/dist/app/lib/tax/capital-allowances.js +77 -0
  109. package/dist/app/lib/tax/corporation-tax.js +144 -0
  110. package/dist/app/lib/tax/income-tax.js +122 -0
  111. package/dist/app/lib/tax/mileage.js +69 -0
  112. package/dist/app/lib/tax/national-insurance.js +31 -0
  113. package/dist/app/lib/tax/vat.js +188 -0
  114. package/dist/app/lib/tax-year.js +31 -0
  115. package/dist/app/lib/template-formula-map.js +253 -0
  116. package/dist/app/lib/workbook-set.js +153 -0
  117. package/dist/app/lib/xlsx-exporter.js +2815 -0
  118. package/dist/app/lib/xlsx-parts.js +111 -0
  119. package/dist/app/lib/xlsx-reader.js +84 -0
  120. package/dist/app/products/bst.js +727 -0
  121. package/dist/app/products/ltd.js +4270 -0
  122. package/dist/app/products/se.js +3403 -0
  123. package/dist/app/products/taxi.js +912 -0
  124. package/dist/app/templates/bst/bst-excel.xlsx +0 -0
  125. package/dist/app/templates/bst/meta.toml +27 -0
  126. package/dist/app/templates/ltd/Cashaccount.xlsx +0 -0
  127. package/dist/app/templates/ltd/Companysecretary.xlsx +0 -0
  128. package/dist/app/templates/ltd/Creditcardaccount.xlsx +0 -0
  129. package/dist/app/templates/ltd/Currentaccount.xlsx +0 -0
  130. package/dist/app/templates/ltd/Dividend Voucher.docx +0 -0
  131. package/dist/app/templates/ltd/Financialaccounts.xlsx +0 -0
  132. package/dist/app/templates/ltd/Fixedassets.xlsx +0 -0
  133. package/dist/app/templates/ltd/Payslips.xlsx +0 -0
  134. package/dist/app/templates/ltd/Purchases.xlsx +0 -0
  135. package/dist/app/templates/ltd/Sales.xlsx +0 -0
  136. package/dist/app/templates/ltd/Salesinvoice.xlsx +0 -0
  137. package/dist/app/templates/ltd/Savingaccount.xlsx +0 -0
  138. package/dist/app/templates/ltd/Vatreturns.xlsx +0 -0
  139. package/dist/app/templates/ltd/expensesform.xlsx +0 -0
  140. package/dist/app/templates/ltd/meta.toml +54 -0
  141. package/dist/app/templates/meta.toml +12 -0
  142. package/dist/app/templates/se/Bank.xlsx +0 -0
  143. package/dist/app/templates/se/Cash.xlsx +0 -0
  144. package/dist/app/templates/se/Financialaccounts.xlsx +0 -0
  145. package/dist/app/templates/se/Fixedassets.xlsx +0 -0
  146. package/dist/app/templates/se/Payslips.xlsx +0 -0
  147. package/dist/app/templates/se/Purchases.xlsx +0 -0
  148. package/dist/app/templates/se/Sales.xlsx +0 -0
  149. package/dist/app/templates/se/Salesinvoice.xlsx +0 -0
  150. package/dist/app/templates/se/Vat.xlsx +0 -0
  151. package/dist/app/templates/se/meta.toml +43 -0
  152. package/dist/app/templates/taxi/meta.toml +43 -0
  153. package/dist/app/templates/taxi/taxi-excel.xlsx +0 -0
  154. package/dist/web/spreadsheets.diyaccounting.co.uk/public/schema/diya-gl-book-v2.schema.json +713 -0
  155. package/dist/web/spreadsheets.diyaccounting.co.uk/public/schema/diya-gl-docs.md +930 -0
  156. package/dist/web/spreadsheets.diyaccounting.co.uk/public/schema/diya-gl-lines-v2.schema.json +220 -0
  157. package/package.json +37 -0
@@ -0,0 +1,55 @@
1
+ # UK self-employment tax rates and thresholds for the 2022-23 tax year
2
+ # Period: 6 April 2022 – 5 April 2023
3
+ # Source: HMRC
4
+ # Extracted from: packages/GB Accounts Basic Sole Trader 2023-04-05 (Apr23)
5
+ # Note: NI rates include the Health and Social Care Levy (1.25% addition)
6
+ # which was introduced in April 2022 and reversed in November 2022.
7
+ # The spreadsheet uses the blended rate for the full year: 9.73% and 2.73%.
8
+
9
+ [tax_year]
10
+ label = "2022-23"
11
+ next_label = "2023-24"
12
+ start = 2022-04-06
13
+ end = 2023-04-05
14
+
15
+ [income_tax]
16
+ personal_allowance = 12570
17
+ starting_rate = 0.00
18
+ basic_rate = 0.20
19
+ higher_rate = 0.40
20
+ starter_band_end = 0
21
+ basic_band_end = 37700
22
+ higher_band_start = 37701
23
+ higher_band_end = 150000
24
+ additional_rate = 0.45
25
+ personal_allowance_taper_threshold = 100000
26
+
27
+ [national_insurance]
28
+ class2_rate = 3.15
29
+ class4_lower_rate = 0.0973
30
+ class4_lower_limit = 11908
31
+ class4_upper_rate = 0.0273
32
+ class4_upper_limit = 50270
33
+ class2_weekly_rate = 3.15
34
+ class2_small_profits_threshold = 6725
35
+
36
+ [capital_allowances]
37
+ annual_investment_allowance = 1.00
38
+ writing_down_allowance = 0.18
39
+
40
+ [depreciation]
41
+ land_and_property = 0.00
42
+ plant_and_machinery = 0.10
43
+ fixtures_and_fittings = 0.20
44
+ computer_equipment = 0.33
45
+ motor_vehicles = 0.25
46
+
47
+ [mileage]
48
+ higher_rate_limit = 10000
49
+ higher_rate_pence = 0.45
50
+ lower_rate_start = 10001
51
+ lower_rate_pence = 0.25
52
+
53
+ [vat]
54
+ registration_threshold = 85000
55
+ standard_rate = 0.20
@@ -0,0 +1,54 @@
1
+ # UK self-employment tax rates and thresholds for the 2023-24 tax year
2
+ # Period: 6 April 2023 – 5 April 2024
3
+ # Source: HMRC
4
+ # Extracted from: packages/GB Accounts Basic Sole Trader 2024-04-05 (Apr24)
5
+ # Note: Class 2 NI remained payable at £3.45/week for 2023-24.
6
+ # Class 4 NI reverted to 9%/2% after the 2022-23 blended rates.
7
+
8
+ [tax_year]
9
+ label = "2023-24"
10
+ next_label = "2024-25"
11
+ start = 2023-04-06
12
+ end = 2024-04-05
13
+
14
+ [income_tax]
15
+ personal_allowance = 12570
16
+ starting_rate = 0.00
17
+ basic_rate = 0.20
18
+ higher_rate = 0.40
19
+ starter_band_end = 0
20
+ basic_band_end = 37700
21
+ higher_band_start = 37701
22
+ higher_band_end = 125140
23
+ additional_rate = 0.45
24
+ personal_allowance_taper_threshold = 100000
25
+
26
+ [national_insurance]
27
+ class2_rate = 3.45
28
+ class4_lower_rate = 0.09
29
+ class4_lower_limit = 12570
30
+ class4_upper_rate = 0.02
31
+ class4_upper_limit = 50270
32
+ class2_weekly_rate = 3.45
33
+ class2_small_profits_threshold = 6725
34
+
35
+ [capital_allowances]
36
+ annual_investment_allowance = 1.00
37
+ writing_down_allowance = 0.18
38
+
39
+ [depreciation]
40
+ land_and_property = 0.00
41
+ plant_and_machinery = 0.10
42
+ fixtures_and_fittings = 0.20
43
+ computer_equipment = 0.33
44
+ motor_vehicles = 0.25
45
+
46
+ [mileage]
47
+ higher_rate_limit = 10000
48
+ higher_rate_pence = 0.45
49
+ lower_rate_start = 10001
50
+ lower_rate_pence = 0.25
51
+
52
+ [vat]
53
+ registration_threshold = 85000
54
+ standard_rate = 0.20
@@ -0,0 +1,51 @@
1
+ # UK self-employment tax rates and thresholds for the 2024-25 tax year
2
+ # Period: 6 April 2024 – 5 April 2025
3
+ # Source: HMRC
4
+
5
+ [tax_year]
6
+ label = "2024-25"
7
+ next_label = "2025-26"
8
+ start = 2024-04-06
9
+ end = 2025-04-05
10
+
11
+ [income_tax]
12
+ personal_allowance = 12570
13
+ starting_rate = 0.00
14
+ basic_rate = 0.20
15
+ higher_rate = 0.40
16
+ starter_band_end = 0
17
+ basic_band_end = 37700
18
+ higher_band_start = 37701
19
+ higher_band_end = 125140
20
+ additional_rate = 0.45
21
+ personal_allowance_taper_threshold = 100000
22
+
23
+ [national_insurance]
24
+ class2_rate = 0
25
+ class4_lower_rate = 0.06
26
+ class4_lower_limit = 12570
27
+ class4_upper_rate = 0.02
28
+ class4_upper_limit = 50270
29
+ class2_weekly_rate = 0
30
+ class2_small_profits_threshold = 6725
31
+
32
+ [capital_allowances]
33
+ annual_investment_allowance = 1.00
34
+ writing_down_allowance = 0.18
35
+
36
+ [depreciation]
37
+ land_and_property = 0.00
38
+ plant_and_machinery = 0.10
39
+ fixtures_and_fittings = 0.20
40
+ computer_equipment = 0.33
41
+ motor_vehicles = 0.25
42
+
43
+ [mileage]
44
+ higher_rate_limit = 10000
45
+ higher_rate_pence = 0.45
46
+ lower_rate_start = 10001
47
+ lower_rate_pence = 0.25
48
+
49
+ [vat]
50
+ registration_threshold = 90000
51
+ standard_rate = 0.20
@@ -0,0 +1,51 @@
1
+ # UK self-employment tax rates and thresholds for the 2025-26 tax year
2
+ # Period: 6 April 2025 – 5 April 2026
3
+ # Source: HMRC
4
+
5
+ [tax_year]
6
+ label = "2025-26"
7
+ next_label = "2026-27"
8
+ start = 2025-04-06
9
+ end = 2026-04-05
10
+
11
+ [income_tax]
12
+ personal_allowance = 12570
13
+ starting_rate = 0.00
14
+ basic_rate = 0.20
15
+ higher_rate = 0.40
16
+ starter_band_end = 0
17
+ basic_band_end = 37700
18
+ higher_band_start = 37701
19
+ higher_band_end = 125140
20
+ additional_rate = 0.45
21
+ personal_allowance_taper_threshold = 100000
22
+
23
+ [national_insurance]
24
+ class2_rate = 3.50
25
+ class4_lower_rate = 0.06
26
+ class4_lower_limit = 12570
27
+ class4_upper_rate = 0.02
28
+ class4_upper_limit = 50270
29
+ class2_weekly_rate = 3.50
30
+ class2_small_profits_threshold = 6845
31
+
32
+ [capital_allowances]
33
+ annual_investment_allowance = 1.00
34
+ writing_down_allowance = 0.18
35
+
36
+ [depreciation]
37
+ land_and_property = 0.00
38
+ plant_and_machinery = 0.10
39
+ fixtures_and_fittings = 0.20
40
+ computer_equipment = 0.33
41
+ motor_vehicles = 0.25
42
+
43
+ [mileage]
44
+ higher_rate_limit = 10000
45
+ higher_rate_pence = 0.45
46
+ lower_rate_start = 10001
47
+ lower_rate_pence = 0.25
48
+
49
+ [vat]
50
+ registration_threshold = 90000
51
+ standard_rate = 0.20
@@ -0,0 +1,51 @@
1
+ # UK self-employment tax rates and thresholds for the 2026-27 tax year
2
+ # Period: 6 April 2026 – 5 April 2027
3
+ # Source: HMRC
4
+
5
+ [tax_year]
6
+ label = "2026-27"
7
+ next_label = "2027-28"
8
+ start = 2026-04-06
9
+ end = 2027-04-05
10
+
11
+ [income_tax]
12
+ personal_allowance = 12570
13
+ starting_rate = 0.00
14
+ basic_rate = 0.20
15
+ higher_rate = 0.40
16
+ starter_band_end = 0
17
+ basic_band_end = 37700
18
+ higher_band_start = 37701
19
+ higher_band_end = 125140
20
+ additional_rate = 0.45
21
+ personal_allowance_taper_threshold = 100000
22
+
23
+ [national_insurance]
24
+ class2_rate = 3.65
25
+ class4_lower_rate = 0.06
26
+ class4_lower_limit = 12570
27
+ class4_upper_rate = 0.02
28
+ class4_upper_limit = 50270
29
+ class2_weekly_rate = 3.65
30
+ class2_small_profits_threshold = 7105
31
+
32
+ [capital_allowances]
33
+ annual_investment_allowance = 1.00
34
+ writing_down_allowance = 0.14
35
+
36
+ [depreciation]
37
+ land_and_property = 0.00
38
+ plant_and_machinery = 0.10
39
+ fixtures_and_fittings = 0.20
40
+ computer_equipment = 0.33
41
+ motor_vehicles = 0.25
42
+
43
+ [mileage]
44
+ higher_rate_limit = 10000
45
+ higher_rate_pence = 0.45
46
+ lower_rate_start = 10001
47
+ lower_rate_pence = 0.25
48
+
49
+ [vat]
50
+ registration_threshold = 90000
51
+ standard_rate = 0.20
@@ -0,0 +1,16 @@
1
+ {
2
+ "description": "Cells that are expected to move between saved and recalculated runs (EQ3 stability).",
3
+ "notes": "Volatile formulas: Excel's own ca=\"1\" always-recalculate flag, here on the print sheet's INDIRECT(ADDRESS(...)) reads. The generator rolls the Payslips.xlsx Admin sheet's daily date chain (B3:B381, seeded at B2) and every plain =Admin!B<n> cached copy the workbook's other sheets keep of it, so those agree without a recalculation. A dynamic INDIRECT/ADDRESS lookup into the same chain resolves its target only at recalculation time, so its cache still moves.",
4
+ "cells": [
5
+ {
6
+ "key": "cell/Payslips.xlsx!Payslips!I9",
7
+ "type": "volatile formula",
8
+ "reason": "Formula INDIRECT(ADDRESS($H$4+1,13,1,TRUE,$H$3)), marked ca=\"1\" (Excel's always-recalculate flag). It resolves dynamically into a month tab's own date column, itself part of the Admin daily chain seeded at Admin!B2, so its cached value is only as fresh as the last full recalculation."
9
+ },
10
+ {
11
+ "key": "cell/Payslips.xlsx!Payslips!I10",
12
+ "type": "volatile formula",
13
+ "reason": "Formula INDIRECT(ADDRESS($H$4+1,5,1,TRUE,$H$3)), marked ca=\"1\", the same dynamic always-recalculate lookup as I9 into a different column."
14
+ }
15
+ ]
16
+ }
@@ -0,0 +1,79 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (C) 2026 DIY Accounting Ltd
3
+ //
4
+ // anchors/bst.js — the Basic Sole Trader anchor table.
5
+ //
6
+ // The BST extractors (xlsx-exporter.js) read fixed cell addresses on the
7
+ // strength of the sheet names and header labels the current template ships
8
+ // with, and never check the labels are still there. A customer's own file
9
+ // (the --file mode in app/bin/export.js, and any upload the page reads) is
10
+ // not a fixture this repo controls, so before any of those reads run,
11
+ // validateBstAnchors confirms every sheet the extractors open still exists
12
+ // and every header cell they key their column reads on still carries the
13
+ // text the template ships.
14
+ //
15
+ // Kept to what the BST path actually reads: extractBstTransactions() and
16
+ // extractBook()'s entity/tax blocks. A later phase's row-mapping exposure
17
+ // builds on this list, so keep additions here rather than duplicating them.
18
+
19
+ import { validateAnchors } from "./run.js";
20
+ import { workbookSetFromWorkbook } from "../workbook-set.js";
21
+ import { BST_SALES_SHEETS, BST_PURCHASE_SHEETS, BST_LEDGER_SHEET } from "../xlsx-exporter.js";
22
+
23
+ // Every sheet extractBstTransactions() and extractBook() open by name.
24
+ const BST_REQUIRED_SHEETS = [
25
+ "Business Details",
26
+ "Admin",
27
+ "PurchasesStock",
28
+ BST_LEDGER_SHEET,
29
+ "Fixed Assets",
30
+ ...BST_SALES_SHEETS,
31
+ ...BST_PURCHASE_SHEETS,
32
+ ];
33
+
34
+ // The header cell each extractor reads a column by position from, and the
35
+ // text the current template prints there. SalesApr/PurchasesApr stand for
36
+ // all twelve month tabs of each kind — the template repeats the same header
37
+ // row on every one, so checking the sheets exist (BST_REQUIRED_SHEETS above)
38
+ // plus one representative header block is what catches both a renamed sheet
39
+ // and a reshuffled column, without reading the same header text 24 times.
40
+ const BST_HEADER_ANCHORS = [
41
+ { sheet: "Business Details", cell: "C3", label: "Your name" },
42
+ { sheet: "SalesApr", cell: "A1", label: "Sales Date" },
43
+ { sheet: "SalesApr", cell: "B1", label: "Customer Name" },
44
+ { sheet: "SalesApr", cell: "C2", label: "Sales Invoice or reference" },
45
+ { sheet: "SalesApr", cell: "F2", label: "Gross Sales Value" },
46
+ { sheet: "PurchasesApr", cell: "A2", label: "Purchase Date" },
47
+ { sheet: "PurchasesApr", cell: "B2", label: "Supplier" },
48
+ { sheet: "PurchasesApr", cell: "C2", label: "Purchase Reference / Invoice Number" },
49
+ { sheet: "PurchasesApr", cell: "E2", label: "Enter Expense Code Letter" },
50
+ { sheet: "PurchasesApr", cell: "F2", label: "Enter Mileage on purchases" },
51
+ { sheet: "PurchasesApr", cell: "G2", label: "Total Purchase Value incl Vat" },
52
+ { sheet: "Admin", cell: "D21", label: "Higher rate allowance up to" },
53
+ { sheet: "Admin", cell: "D22", label: "Lower rate allowance over" },
54
+ { sheet: "PurchasesStock", cell: "B4", label: "Opening Stock" },
55
+ { sheet: "PurchasesStock", cell: "D2", label: "Physical Stock Value" },
56
+ { sheet: BST_LEDGER_SHEET, cell: "C1", label: "Sales not yet received" },
57
+ { sheet: BST_LEDGER_SHEET, cell: "F1", label: "Purchases still to be paid" },
58
+ { sheet: BST_LEDGER_SHEET, cell: "B3", label: "Owed start year" },
59
+ { sheet: BST_LEDGER_SHEET, cell: "E3", label: "Owed start year" },
60
+ { sheet: BST_LEDGER_SHEET, cell: "B29", label: "Amount owed by customers" },
61
+ { sheet: BST_LEDGER_SHEET, cell: "E29", label: "Amount owed to suppliers" },
62
+ { sheet: "Fixed Assets", cell: "C2", label: "Asset Description" },
63
+ { sheet: "Fixed Assets", cell: "E2", label: "Original Cost" },
64
+ { sheet: "Fixed Assets", cell: "B66", label: "Plant & Machinery" },
65
+ ];
66
+
67
+ /** The Basic Sole Trader anchor table: one workbook, keyed "*". */
68
+ export const BST_ANCHORS = { "*": { sheets: BST_REQUIRED_SHEETS, headers: BST_HEADER_ANCHORS } };
69
+
70
+ /**
71
+ * Confirm every sheet and header label the BST extractors key on is present
72
+ * before any of them run. Throws AnchorError naming every anchor that
73
+ * failed; returns nothing on success.
74
+ * @param {Buffer} xlsxBuffer
75
+ */
76
+ export async function validateBstAnchors(xlsxBuffer) {
77
+ const set = await workbookSetFromWorkbook("workbook.xlsx", xlsxBuffer);
78
+ await validateAnchors(set, BST_ANCHORS, "Basic Sole Trader");
79
+ }