You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`applyLossCarryForward` enforces the 5-year window and 50%-per-year cap per loss entry — see Section 9.
481
+
480
482
#### Sections E & F — Crypto (placeholders, all zeros)
481
483
482
484
Not yet implemented. Fields poz36–poz45 are set to 0.
@@ -534,19 +536,34 @@ Results are sorted alphabetically by country code.
534
536
535
537
### 9. Prior Year Losses (Carry-Over)
536
538
537
-
**Legal basis:**[Art. 9 ust. 3 ustawy o PIT](https://lexlege.pl/ustawa-o-podatku-dochodowym-od-osob-fizycznych/art-9/) — losses from a given income source can be carried forward for up to 5 consecutive tax years, with two alternative methods:
**Legal basis:**[Art. 9 ust. 3 ustawy o PIT](https://lexlege.pl/ustawa-o-podatku-dochodowym-od-osob-fizycznych/art-9/) — losses from a given income source can be carried forward for up to **5 consecutive tax years** following the year in which they were incurred, with a cap of **50% of the original loss per year** (art. 9 ust. 3 pkt 1).
538
542
539
-
**Option 1 (gradual):** Deduct up to **50% of the loss per year** across 5 years ([art. 9 ust. 3 pkt 1](https://lexlege.pl/ustawa-o-podatku-dochodowym-od-osob-fizycznych/art-9/)).
543
+
> _Option 2_ (one-shot deduction up to 5,000,000 PLN, art. 9 ust. 3 pkt 2) is **not** supported by the calculator. Users who qualify can still enter an equivalent gradual deduction schedule manually.
540
544
541
-
**Option 2 (one-time):**Deduct the entire loss in a single year, up to **5,000,000 PLN** ([art. 9 ust. 3 pkt 2](https://lexlege.pl/ustawa-o-podatku-dochodowym-od-osob-fizycznych/art-9/)). Any remainder above 5M PLN follows the 50% rule for subsequent years.
545
+
**Data model:**Each loss is recorded as a `PriorYearLoss { year, totalLossPln, alreadyDeductedPln }` in the `priorLosses` Dexie table, scoped per session. The `/prior-losses` page provides CRUD for these rows; `alreadyDeductedPln` tracks the residual consumed across prior tax years.
542
546
543
-
**Implementation detail:** The user manually enters the deduction amount (`priorYearLoss`). The code caps it at the current year's gain:
547
+
**Algorithm (`applyLossCarryForward`):**
544
548
545
549
```
546
-
deductible = min(priorYearLoss, capitalGain)
550
+
For each priorLoss (oldest year first):
551
+
ageInYears = currentYear − loss.year
552
+
expired = ageInYears > 5 || ageInYears <= 0
553
+
cap = expired ? 0 : min(0.5 × loss.totalLossPln,
554
+
loss.totalLossPln − loss.alreadyDeductedPln)
555
+
deducted = min(cap, remainingGain)
556
+
remainingGain −= deducted
557
+
loss.alreadyDeductedPln += deducted // returned in updatedLosses
558
+
559
+
poz30 = sum of deducted across all priorLosses
547
560
```
548
561
549
-
The 50% limit and 5-year carry-forward tracking are **not enforced by the calculator** — the user is responsible for computing the correct deduction amount. This is by design for flexibility (supports both option 1 and option 2).
562
+
**Guarantees:**
563
+
564
+
- Losses older than 5 years or newer than the tax session are silently skipped (a warning is attached for residuals lost to expiration).
565
+
- The 50%-per-year cap is enforced per loss year — a user entering 100% of a loss as "already deducted" previously still has their residual constrained by `0.5 × totalLossPln`.
566
+
- The per-year breakdown (`perYear`) is persisted on the `taxSummary.lossDeduction` record and rendered in Section D of the PIT-38 form.
550
567
551
568
---
552
569
@@ -671,7 +688,7 @@ The app supports **three languages:**
671
688
- Compute raw (unrounded) tax amounts for dashboard display
672
689
6.**PIT-38** (`buildPit38`):
673
690
- Map summary values to form fields with proper rounding
674
-
- Apply prior-year loss deduction (capped at gain amount)
691
+
- Apply prior-year loss deduction via `applyLossCarryForward` (5-year window, 50%-per-year cap, FIFO across loss years)
675
692
- Round tax base and tax due to full PLN ([art. 63 § 1](https://lexlege.pl/ordynacja-podatkowa/art-63/))
676
693
- Round dividend tax to full groszy up ([art. 63 § 1a](https://lexlege.pl/ordynacja-podatkowa/art-63/))
"prior_losses_already_deducted_help": "Cumulative amount deducted in earlier tax years.",
207
+
"prior_losses_cap_explainer": "Each loss can be deducted across the next 5 tax years, with at most 50% of the original loss in any single year (art. 9 ust. 3 updof).",
208
+
"prior_losses_empty": "No prior-year losses recorded for this session.",
209
+
"prior_losses_intro": "Prior-year capital losses available to offset gains in {year}. Older than 5 years are excluded automatically.",
210
+
"prior_losses_no_session": "Select or create a session on the Data page first.",
"prior_losses_already_deducted_help": "Łączna kwota odliczona w poprzednich latach podatkowych.",
201
+
"prior_losses_cap_explainer": "Stratę można odliczać przez 5 kolejnych lat podatkowych, w jednym roku najwyżej 50% jej pierwotnej kwoty (art. 9 ust. 3 updof).",
202
+
"prior_losses_empty": "Brak strat z lat ubiegłych dla tej sesji.",
203
+
"prior_losses_intro": "Straty kapitałowe z poprzednich lat dostępne do odliczenia od dochodu w {year}. Straty starsze niż 5 lat są pomijane automatycznie.",
204
+
"prior_losses_no_session": "Najpierw wybierz lub utwórz sesję na stronie Dane.",
205
+
"prior_losses_remaining": "Pozostało (PLN)",
206
+
"prior_losses_title": "Straty z lat ubiegłych (PIT-38 poz. 30)",
"prior_losses_already_deducted_help": "Сума, відрахована в попередніх податкових роках.",
201
+
"prior_losses_cap_explainer": "Збиток можна відраховувати протягом 5 наступних податкових років, але не більше 50% початкової суми за один рік (ст. 9 п. 3 УПДОФ).",
202
+
"prior_losses_empty": "Для цієї сесії немає збитків минулих років.",
203
+
"prior_losses_intro": "Капітальні збитки минулих років, доступні для зменшення прибутку у {year}. Збитки старші за 5 років виключаються автоматично.",
204
+
"prior_losses_no_session": "Спочатку оберіть або створіть сесію на сторінці Дані.",
205
+
"prior_losses_remaining": "Залишилось (PLN)",
206
+
"prior_losses_title": "Збитки минулих років (PIT-38 поз. 30)",
0 commit comments