Tax: loss carry-forward (form 1344, 6111 line 480)
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- graphql, postgresql, typescript
Research direction
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.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- TypeScript
- Stars
- 30
- Forks
- 10
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 276
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Urigo/accounter-fullstack
-
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
Urigo/accounter-fullstack#5302 ·
Maintainers usually reply within 2 days
-
1214 annual-audit-workflow
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Urigo/accounter-fullstack#5257 ·
Maintainers usually reply within 2 days
-
1214 annual-audit-workflow
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Urigo/accounter-fullstack#5256 ·
Maintainers usually reply within 2 days
-
annual-audit-workflow
Difficulty 1/5 1-3 hours Newbie friendliness 87/100
Urigo/accounter-fullstack#5252 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Urigo/accounter-fullstack#4919 ·
Maintainers usually reply within 2 days
All issues in Urigo/accounter-fullstack
Similar issues
-
area: integrations documentation priority: P2 size: XS
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
eddiejaoude/StackDash#798 ·
Maintainers usually reply within 1 day
-
bot:ai-assisted component:midnight-js status:untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
midnightntwrk/midnight-js#1790 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
area:vscode bug has repro platform:macos platform:vscode regression
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
anthropics/claude-code#113502 ·
-
Add: Rajdhani TV HDOpencheck:passed streams:add
Difficulty 1/5 Under an hour Newbie friendliness 77/100
Maintainers usually reply within 1 day