Tax: loss carry-forward (form 1344, 6111 line 480)
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
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- graphql, postgresql, typescript
Direzione di ricerca
Start with packages/server/src/modules/reports/helpers/tax.helper.ts and the existing R&D spreading calculation to understand how yearly tax amounts are computed. Review the corporate taxes provider and packages/server/src/__tests__/shaam6111.integration.test.ts for data and report patterns; the issue calls for a migration if storage is added. Done means loss balances roll forward from entered opening amounts, reduce later taxable income, appear in the tax report and 6111 line 480, and are covered by the described tests; deferred tax also needs a decision.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Follow-up to #5086 (out of scope there; epic #5085). Depends on #5104 (loss-offset order between preferred-rate and sort-991 income). Related: #5091 (other 6111 tax-adjustment lines that are never filled). Links point to main at 4d5ba86.
Background
Since #5096, a year with a taxable loss books current tax 0, and the loss is reported as TaxReportYear.taxableLoss:
- computed in
computeCurrentTax; - exposed in the schema and the resolver;
- shown in the "Taxable Loss" row of the client.
After that, the loss goes nowhere:
- No data: nothing stores losses carried forward. The tax inputs per year are only
corporate_tax_variables(tax_rate,original_tax_rate), read throughCorporateTaxesProvider. - Full tax on the next profit:
calculateTaxAmounts(L17-L171) looks at a single year. A profitable year after a loss year is taxed in full. - 6111 line 480 is never filled: the form computes 500 = 400 − 430 − 480 + 490 (formula), but
buildTaxAdjustmentEntriesnever sets 480. No form 1344 support exists either.
Proposed design (refine before building)
-
Data: where the opening balance comes from.
- Computed: roll forward from each year's
taxableLossand the amount used. This works only for years the app has full books for. - Entered: an opening balance per business (and per rate bucket, depending on #5104). This covers the years before the app's data.
Likely both: a computed roll-forward seeded by an entered opening balance. A small table such as
tax_loss_carry_forward (owner_id, year, opening_balance, source)and a provider in thecorporate-taxesmodule would fit the existing pattern (@Injectableprovider + DataLoader; SQL types fromyarn generate). - Computed: roll forward from each year's
-
Tax calculation. In
calculateTaxAmounts/computeCurrentTax:- offset the year's positive taxable income by the losses carried in, applying the #5104 order;
- expose
lossCarriedForwardUsedandlossCarriedForwardClosing.
R&D spreading already works across three years (
calculateCumulativeRnDExpenses, same file); follow its pattern if computing on the fly. -
Ledger. No new mechanism:
generateLedgerRecordsForTaxExpensesbookscurrentTaxExpense, which will already be reduced. -
Reports.
- Tax report: add rows for losses carried in, used and carried out.
- 6111: pass the amount used into
Shaam6111TaxAdjustmentInputsand set line 480 (call site). Check 500 against the tax report afterwards (the existing integration test does this: shaam6111.integration.test.ts L452).
-
Deferred tax (a deferred-tax asset for the loss) is a separate accounting decision: under Israeli GAAP it is booked only when using the loss is probable. Decide whether it belongs here or in its own issue.
Tests
- Unit: tax calculation for a loss year followed by a profit year (fully absorbed, partly absorbed), plus an entered opening balance.
- Integration: extend shaam6111.integration.test.ts with a loss year followed by a profit year. Assert that 480 is filled and that 500 matches the tax report.
How to run
yarn generate
yarn vitest run --project unit packages/server/src/modules/reports/helpers
yarn vitest run --project integration packages/server/src/__tests__/shaam6111.integration.test.ts
For a schema change, add a migration under packages/migrations/src/actions/ and register it in run-pg-migrations.ts, then run yarn migration:check-conflicts. Make sure POSTGRES_* points at a local DB.
Done when
- A loss year's taxable loss carries into the next year's balance; an opening balance can be entered for years before the app's data.
- A profit year after a loss year is taxed on income net of the losses carried forward, and tests cover it.
- The tax report shows the carry-forward, 6111 line 480 is filled, and 500 still matches the tax report.
- Deferred tax is decided: done here or tracked in its own issue.
- 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
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Urigo/accounter-fullstack
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
Urigo/accounter-fullstack#5302 ·
I maintainer di solito rispondono entro 2 giorni
-
1214 annual-audit-workflow
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
Urigo/accounter-fullstack#5257 ·
I maintainer di solito rispondono entro 2 giorni
-
1214 annual-audit-workflow
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
Urigo/accounter-fullstack#5256 ·
I maintainer di solito rispondono entro 2 giorni
-
annual-audit-workflow
Difficoltà 1/5 1-3 ore Idoneità per principianti 87/100
Urigo/accounter-fullstack#5252 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
Urigo/accounter-fullstack#4919 ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di Urigo/accounter-fullstack
Issue simili
-
area: integrations documentation priority: P2 size: XS
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
eddiejaoude/StackDash#798 ·
I maintainer di solito rispondono entro 1 giorno
-
bot:ai-assisted component:midnight-js status:untriaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
midnightntwrk/midnight-js#1790 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
area:vscode bug has repro platform:macos platform:vscode regression
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
anthropics/claude-code#113502 ·
-
Add: Rajdhani TV HDApertacheck:passed streams:add
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 77/100
I maintainer di solito rispondono entro 1 giorno