Epic: Annual audit — fix wrong numbers and broken controls (FY2025 close review, section A)

Aperta
#5,085 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
backend

Direzione di ricerca

Read docs/annual-audit-workflow/fy2025-close-review.md section 2.A and the listed entry points: packages/server/src/modules/reports/helpers/tax.helper.ts, the financial ledger generation resolvers, packages/server/src/modules/ledger/resolvers/ledger.resolver.ts, and the annual audit workflow step files. Work through sub-issues #5086–#5092 in the suggested order; use their tests and verify regenerated FY2025 charges leave no pending ledger changes. Done when all sub-issues are closed and the FY2025 review document is updated.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

annual-audit-workflow

Goal

Fix the calculations and controls in the annual-audit workflow (/workflows/annual-audit/:year) that put wrong numbers into the annual statements and the tax return, or let closed figures change after the close.

Background

These items come from the FY2025 close review: docs/annual-audit-workflow/fy2025-close-review.md, section 2.A, based on main at 85507ae.

This epic covers only the findings that affect the numbers or the close control. Other findings in the review are out of scope here:

  • missing filings;
  • reconciliations;
  • step-status issues.
How the pieces fit (read before picking up a sub-issue)
  • Year-end charges (workflow step 4).
    • packages/client/src/components/screens/operations/annual-audit/step-04-financial-charges/index.tsx calls the generate*Charge mutations in packages/server/src/modules/charges/resolvers/financial-charges.resolver.ts.
    • Each mutation creates a FINANCIAL charge tagged with a tax category (generateAndTagCharge). The charge's description carries the year, e.g. Tax expenses charge for 2025.
    • generateLedgerRecordsForFinancialCharge (packages/server/src/modules/ledger/resolvers/ledger-generation/financial-ledger-generation.resolver.ts) then dispatches on the charge's tax category to a per-type generator under .../financial-ledger-generation/.
    • The generators recompute their amounts every time the ledger is regenerated.
  • Ledger-drift detection (steps 2 and 7). chargesWithLedgerChanges (packages/server/src/modules/ledger/resolvers/ledger.resolver.ts) regenerates every charge of the year and diffs it against the stored ledger.
    • After a generator fix, existing year-end charges show up as "pending ledger changes" until they are regenerated.
    • That is the migration path for existing data. The calculation fixes need no SQL migration.
  • Tax computation. calculateTaxAmounts (packages/server/src/modules/reports/helpers/tax.helper.ts) is shared by the tax report (step 13), the tax-expense charge (step 4) and SHAAM 6111 (step 16). A change there affects all three.
  • Ledger lock (step 8). lockLedgerRecords sets admin_context.ledger_lock and marks ledger records locked.

Priority scale

Grade Meaning
P0 — Critical Puts wrong numbers into the FY2025 statements or tax return in the common case. Fix before closing 2025, or apply the workaround.
P1 — High Wrong in specific but realistic cases, or breaks a control the close relies on. Fix before filing.
P2 — Medium Misleading output with a simple workaround. Fix in the next cycle.
P3 — Low Polish.

Effort: S is about a day, M is 2–4 days, L is 1–2 weeks.

Sub-issues

Review item Issue Priority Effort FY2025 workaround
A2 #5087 Vacation reserve is overstated, and decreases are booked as increases P0 M Compute the reserve from the December payslips and book the correct change manually
A1 #5086 Tax-expense charge books a loss year's negative tax as an expense P1 (P0 if FY2025 is a tax-loss year) S–M In a loss year, don't generate the tax-expense charge (or delete it) and record tax 0
A3 #5088 Sort code 931 goes through both the R&D §20A adjustment and the reserves add-back P1 S Correct the 2025 taxable income by −⅔·X₂₀₂₅ + ⅓·X₂₀₂₄ + ⅓·X₂₀₂₃
A4 #5090 Ledger lock: year-end charges still post into a locked year; locked records can't be reopened P1 M–L Don't lock until the auditor's adjustments and the tax true-up are posted
A5 #5091 SHAAM 6111: hard-coded header; tax-adjustment lines never filled P1 (tasks P1–P3) L Use the app's file as a draft; finish it in the CPA's software or the Tax Authority's online form
A6 #5092 Step 10 exports the year's movements instead of a year-end trial balance P2 M Export the trial balance from inception to 31/12/2025

In the workaround for #5088, X is the sort-code-931 amount for each year.

Suggested order

  1. The numbers: #5087, #5086 and #5088.
    • #5086 and #5088 both change calculateTaxAmounts and the tax-expense generator. Land them in sequence, or in one PR.
    • Regenerate the tax expense after #5087, because the reserves change profit before tax.
  2. The lock: #5090, before anyone locks FY2025.
  3. 6111 content: #5091, after #5086 and #5088, which feed lines 5600, 9980, 150 and 400.
  4. Trial balance export: #5092.

Definition of done

  • All sub-issues closed.
  • FY2025 year-end charges regenerated (steps 2 and 7 show no pending ledger changes) and re-approved.
  • The FY2025 close review doc updated.

Related

  • #5083: the 1214 package in the workflow (steps 6 and 18).
  • #4544: dynamic report approvals in the annual audit flow.
  • #1981, #1883, #1844: earlier ledger-lock issues; see #5090.
  • #1147: partial-tax recognition. A tax-computation gap, not in this epic.
Lingua principale
TypeScript
Stelle
30
Fork
10
Merge medio
2g 12h
PR unite (30g)
276

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Urigo/accounter-fullstack

Tutte le issue di Urigo/accounter-fullstack

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.