diff --git a/CLAUDE.md b/CLAUDE.md index 79b2649c..f8476380 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -268,10 +268,10 @@ When adding a new section (like 721), follow this checklist: - Optional toggle in fiscal profile (`monodivisa: boolean`) + CLI `--monodivisa` flag - When active: skips the FX FIFO engine entirely (`skipFx: true` in `ReportOptions`) - `skipFx` ALSO sets `FifoEngine({traditionalCostBasis:true})` → a same-fiat FCY security's cost converts at the ACQUISITION-date rate (Art. 35.1), embedding the buy→sale FX drift in the stock line (the FX engine being off). Drift counted exactly once (stock line here, FX engine in default); capital gains deliberately DIFFER from the FX-on case — don't "fix" back to sale-date cost. Also affects option-exercise delivery + same-stablecoin permutas, and short closes, option expirations and option exercises/assignments (the open leg — short-sale proceeds, premium paid or received — converts at its own date's `lot.ecbRate`; on an exercise the strike leg uses the exercise date and `exerciseRate()` blends the two). -- Matches behavior of Autodeclaro/Taxdown (competitors don't calculate Art. 37.1.l FX gains) +- Matches Autodeclaro/Taxdown ONLY in how shares are valued (buy at the buy-date rate, sale at the sale-date rate — the DGT fund method of V2324-10 / V0775-21 applied to shares). It is NOT full parity: it computes no currency result at all (Art. 33.1, timing Art. 14.2.e LIRPF), not even for the taxpayer's own USD→EUR conversions or broker AFx/FXCONV ones, while Autodeclaro documents a «Cash (Forex)» section for currency sales. UI text must say exactly that and send users who convert currency to the default mode (#230). When monodivisa drops conversions in the report year, the info message `report.monodivisa_conversions_skipped` says how many. - Warning text must say "distorsionar" not "infraestimar" — monodivisa can both understate (miss FX gains) and overstate (miss FX losses) - Art. 80 double taxation deduction is subtly affected (lower `totalSavingsBase` when FX gains are skipped) — accepted known limitation matching competitors -- DGT V2324-10 is the specific consulta vinculante confirming FIFO for currency — cite specifically, not generic "consultas vinculantes" +- Cite DGT consultas specifically AND for what they actually say. V2324-10 is about investment funds in foreign currency (cost at the subscription-date rate, proceeds at the reimbursement-date rate, FX on the dollars deferred to their conversion); it is NOT a rule on FIFO for currency. No consulta applies FIFO to fiat currency (see the parking/ordering bullet below). The default mode's share treatment follows V1740-17 / V0282-22 / V2422-20; the official rate is the ECB's by Ley 46/1998 art. 36. ### FX Engine Simplification (Hard Trace — v0.39.2) - `detectAutoConvert()` was REMOVED — it produced false positives on hybrid accounts (mix of manual + AFx trades), causing ALL operations to disappear @@ -289,7 +289,7 @@ When adding a new section (like 721), follow this checklist: ### FX dividend/interest withholding = pago a cuenta, NOT a disposal (Hard Trace — issue #225) - **Symptom**: a FCY dividend with withholding created a GROSS acquisition lot AND a separate WITHHOLDING disposal that FIFO-consumed the OLDEST FCY lot (often a prior conversion at a different rate), fabricating a phantom Art. 33 FX gain into casillas 1633/1637 on currency the taxpayer never converted to EUR. -- **Why wrong**: withholding (retención en origen) is a **pago a cuenta** — deducted at source, the withheld FCY never enters the taxpayer's spendable balance, and it is **not a conversión a euros**. The DGT FX-timing doctrine (V2422-20, V1613-25, V0463-21) crystallizes an FX gain ONLY on the effective conversion to euros (cobro/pago, Art. 14.2.e). No competitor/tool (Taxdown/Autodeclaro run monodivisa; IBKR's Forex worksheet covers only completed conversions) books an FX gain on withholding. No binding consulta is squarely on point — this is a reasoned, conservative position (removes a phantom disposal of money never received). +- **Why wrong**: withholding (retención en origen) is a **pago a cuenta** — deducted at source, the withheld FCY never enters the taxpayer's spendable balance, and it is **not a conversión a euros**. The DGT FX-timing doctrine (V2422-20, V1613-25, V0463-21) crystallizes an FX gain ONLY on the effective conversion to euros (cobro/pago, Art. 14.2.e). No tool we know of books an FX gain on withholding (IBKR's Forex worksheet covers only completed conversions). No binding consulta is squarely on point — this is a reasoned, conservative position (removes a phantom disposal of money never received). - **Fix** (`extractCashFxEvents`): a pre-pass sums withholding per `(currency, date)`; each `Dividends`/`Payment In Lieu`/`Interest Received` inflow is emitted as a lot for the **NET** (gross − matched withholding) FCY actually received; the `Withholding Tax` row emits **no disposal**. FX lots are fungible per currency, so (currency,date) netting equals exact issuer pairing. Guards: a **positive** withholding (refund) is FCY *received* (acquire, not dispose); an **orphan** withholding (no same-(currency,date) income — cross-date reclaim) is dropped, never a disposal; interest withholding nets too. - **Income path is untouched**: gross dividend → 0029 and withholding → 0588 are computed in `dividends.ts`/`double-taxation.ts` from the raw cashTransactions, never from FX events. Only 1633/1637 (and marginally `totalSavingsBase`'s positive-FX term) change. - **Citation correction**: the FX engine tracks divisa under **Art. 33.1** (transmisión − adquisición), NOT Art. 37.1.l (which is "incorporaciones que no derivan de transmisión" — unrelated). Header comment + this section corrected. This closes the Art.37.1.l→Art.33/V2466-08 follow-up deferred in #220. @@ -303,8 +303,8 @@ When adding a new section (like 721), follow this checklist: - **Loss-sell carried-principal: un-converted dollars correctly produce ZERO in the casillas (NOT a residual that ever reaches a declared box — confirmed with issue #230's reporter)**: any SELL that realizes a LOSS discards the carried principal it pulls back from the parked FIFO (the leg re-adds principal at its CARRIED basis only up to `min(cost, proceeds)`; the rest is drained from the parked queue and pushed to NO pool lot). A loss-sell emits **no `FxDisposal`** and books **nothing** into casillas 1633/1637 — only a real FCY→EUR conversion (`consumeLots`) ever emits a disposal, and the casillas sum only those (`report.ts`: `fxDisposals` filtered by conversion `disposeDate`). This is **fiscally correct and is exactly the reporter's principle** (issue #230, 2026-06-17): the dollars spent inside a losing position never reached a EUR conversión, so under **Art. 14.2.e** ("se imputará en el momento del cobro o del pago") there is no divisa gain/loss to compute — *"como si te hubieras comprado una hamburguesa en dólares"*. The €-loss lands entirely in the stock line at the sale-date rate (V2422-20). Pinned by `tests/integration/fx-carry-basis-e2e.test.ts` ("FCY stock loss-sell with NO EUR conversion → divisa 1633/1637 = 0"). - **The so-called "residual" is a gap-vs-raw-economic, never a casilla error**: `residual = Σ over loss-sells of [ discardedPrincipalQty × (saleRate − carriedBasisRate) ]` is the difference between the engine's (correct) casilla figure and a *raw-economic reconciliation* — a benchmark the engine deliberately does NOT compute, because forcing it would **DOUBLE-COUNT** the FX drift against the already-recognized stock loss. That gap is unbounded in magnitude and rate-path-dependent in sign (under-states the raw-economic FX when the rate rose between buy and sale, over-states when it fell), but it lives only in the V2422-20 "two-element" seam — it **never lands in 1633/1637**. The discard is also *clean*: it mutates only the per-position parked FIFO, never the spendable pool, so it cannot shift the FIFO frontier for a later conversion. The earlier framing of this as an "unbounded residual / NOT a bug" was anxious about the wrong benchmark; the casilla output is simply the only-real-conversions figure, which is the right one. - **Re-added principal keeps its ORIGINAL acquisition date for FIFO ordering (issue #230, comment 4729376344 — wrong-YEAR attribution fix)**: the spendable pool is consumed oldest-first BY ARRAY POSITION (`consumeLots` takes `lots[0]`/`shift`). A SELL re-adds its carried principal to that pool. The first cut stamped the re-add with the SALE date and APPENDED it at the tail (`pushPoolLot` with `event.date`) — so a funding lot acquired BETWEEN the buy and the sale sat AHEAD of the (genuinely-older) re-added principal, and a PARTIAL conversion consumed that NEWER funding first → mis-rated the conversion and shifted an FX gain into the WRONG TAX YEAR. Numerical proof (reproduced by the maintainer): fund $1000@0.80 (Jan) → buy → fund $1000@1.10 (Mar) → sell USD-flat (re-adds @0.80) → convert $1000 in year N, $1000 in N+1 gave **€100 / €500** when correct origin-FIFO is **€400 / €200** — same €600 lifetime, but €300 in the wrong year. **Fix**: each parked slice now carries its consumed pool lot's ORIGINAL `acquireDate` (`null` for an uncovered slice), and the SELL re-adds the principal stamped with THAT date (uncovered → sale date); `pushPoolLot` SPLICES the lot into date-sorted pool position (not the tail), so the pool stays FIFO-ordered by genuine age and `consumeLots` is untouched. Only the carried PRINCIPAL keeps its original date — the trading PROFIT and uncovered/unmatched re-adds correctly stay at the sale date (DGT V0282-22: returned principal keeps its acquisition; profit is newly-acquired). Lifetime total is unchanged; only the per-year split (and the trace's `acquireDate`/`lotId`) moves. Pinned by `tests/integration/fx-carry-basis-e2e.test.ts` ("re-added principal keeps its original acquisition date (FIFO order across years)"), which fails €100/€500 on the pre-fix engine. The dominant funding-absent/uncovered case is unaffected (no tracked origin → sale-date re-add, as before). -- **Doctrine — V2324-10 "symmetric" achieved via DEFERRAL, not realize-at-buy**: this delivers the DGT V2324-10 carry/symmetric result (currency FX captured across the full holding period) WITHOUT realizing any FX at the buy — Art. 14.2.e. The buy CONSUMES (parks) but does NOT realize, so it does NOT re-arm the missing-prior-year-lots phantom GAIN bug that PR #143 / PR #171 removed (a buy emits no disposal, and an uncovered buy is a safe no-op against an empty pool). The genuinely-unsettled V0282-22 "realize-at-buy" variant (older symmetric V2324-10 vs newer defer V0282-22 / V0152-26 on the BUY axis) is explicitly NOT what this implements — that variant needs buy-side disposal emission and would re-introduce the phantom; it remains a documented FUTURE follow-up only. -- **Legal-citation (corrected, retained)**: divisa is **Art. 33.1** (transmisión − adquisición), timing **Art. 14.2.e** ("se imputará en el momento del cobro o del pago"), FIFO-for-currency rationale **DGT V2324-10**; NOT Art. 37.1.l (which governs "incorporaciones que no derivan de transmisión"). The stale "Art. 37.1.l" comment in `report.ts`'s FX block was corrected alongside this work (see the #225 citation correction above). +- **Doctrine — FX captured across the full holding period via DEFERRAL, not realize-at-buy**: carry-basis is an engine design choice backed by V0282-22 (returned principal keeps its acquisition rate, profit dollars take the sale-date rate), V2422-20 (worked example: no gain on the shares, none on converting the dollars) and Art. 14.2.e (FX imputed "en el momento del cobro o del pago"). Do NOT cite V2324-10 for it: that consulta is about investment funds, not a currency rule (see the citation bullet above). The buy CONSUMES (parks) but does NOT realize, so it does NOT re-arm the missing-prior-year-lots phantom GAIN bug that PR #143 / PR #171 removed (a buy emits no disposal, and an uncovered buy is a safe no-op against an empty pool). A "realize-at-buy" variant (spending dollars on a stock realizes their FX) is explicitly NOT what this implements: newer doctrine (V0282-22 / V0152-26) defers to the conversion, and the variant needs buy-side disposal emission that would re-introduce the phantom; it remains a documented FUTURE follow-up only. +- **Legal-citation (corrected, retained)**: divisa is **Art. 33.1** (transmisión − adquisición), timing **Art. 14.2.e** ("se imputará en el momento del cobro o del pago"), FIFO-for-currency is an inference, not a consulta (no DGT answer applies FIFO to fiat currency; see the parking/ordering bullet); NOT Art. 37.1.l (which governs "incorporaciones que no derivan de transmisión"). The stale "Art. 37.1.l" comment in `report.ts`'s FX block was corrected alongside this work (see the #225 citation correction above). - **Scope/filter (unchanged)**: only `assetCategory` STK/FUND/BOND, `currency ≠ EUR`, ecb-resolvable; crypto permutas (proceeds in a coin, not fiat — crypto valuation path), options/FOP/FSFOP, and the CASH conversions already handled by `extractFxEvents` are excluded; SHORT legs are skipped (inflow at open, outflow at close — the long-side carry model can't represent them). Gated by monodivisa (`skipFx`), like the rest of the FX engine. - **The parking/ordering is a REASONED GAP-FILL, not a statutory mandate (issue #230 follow-up, contributor elmasvital)**: the law does NOT prescribe how to FIFO-order a currency when some of it is locked inside an open securities position — it is genuinely SILENT. Art. 37.2 LIRPF's "se considerará… los adquiridos en primer lugar" FIFO is scoped *expressly* "a efectos de las letras a), b) y c)" of 37.1 — i.e. **valores** — and DGT **V1613-25** holds verbatim that *"las divisas no son valores ni participaciones"*, so 37.2 does NOT literally reach currency; FIFO-on-divisa is itself an inference (the base for the divisa GAIN is Art. 33.1 + 35 + timing 14.2.e). So a contributor's "pure global FIFO on the currency (consume the literally-oldest dollars, even those spent on a still-held stock)" is a *defensible reading of a silent gap* — but it is NOT more legally faithful: the only on-point consulta, **V0282-22**, values each dollar tranche by ORIGIN and defers the divisa gain to the actual EUR conversion, which is closer to carry-basis than to pure-FIFO. And mechanically, pure-FIFO ("a stock buy does not remove the FCY it spent from the queue") is byte-identical to the v0.49.0 **full-proceeds model already killed** — it re-opens the €450-vs-€320 drift and un-anchors the wrong-year fix (#240). Verdict: keep carry-basis (most-defensible reading + no regression); the contributor's pure-FIFO is offered only as the discrepancy-CHECK below, never as the engine. - **FX conservation self-check (`checkConservation`, issue #230 — the contributor's "pool para comprobación de descuadres… que no se silencien operaciones sin respaldo económico")**: an ALWAYS-ON, zero-tax-impact diagnostic run at the end of `processEvents`. Per-currency accumulators (`accAcquired`/`accDisposed`/`accParked`/`accUnparked`/`accDiscarded`/`accProfit`/`accPhantom`, incremented next to each `record()` site) assert the quantity identity `(acquired + profit + phantom) − disposed − discarded == poolBalance + Σ parkedBalance`, within `CONSERVATION_EPS = 0.01` FCY units. It is the regression tripwire for the "pool diverged from the real spendable balance" bug class (the €450/€320 drift). **The `phantom` term is load-bearing**: three documented-legitimate paths put untracked FCY into the books with no real acquire behind them — (1) missing-lot floored disposals (`consumeLots` "sin lotes"/"insuficientes", which floor gain to 0 and never decrement the pool), (2) uncovered park (`parkPrincipal` shortfall, `rate=null`), (3) unmatched-sell re-add (`unparkAndReadd` top-up at the sale rate) — so each increments `accPhantom` by exactly its quantity, making the identity hold EXACTLY (silent) on every legitimate scenario and fire ONLY on a genuine internal descuadre. Emits `fx.conservation_mismatch` (severity `warning`, developer-facing). Runs on ALL-YEAR engine state (before report.ts year-filters), so the identity is scoped to the full `processEvents` run, never the year-filtered casillas. Pinned by `tests/engine/fx-conservation.test.ts` (19 tests incl. a BreakableEngine that proves it fires on a real desync and is silent on sub-EPS dust). @@ -328,7 +328,7 @@ When adding a new section (like 721), follow this checklist: ### Rigorous by default, with an opt-out checkbox when warranted (product posture) - **Default = maximum fiscal rigor.** When Spanish law/DGT doctrine supports computing something (e.g. the divisa/FX element under Art. 33.1), DeclaRenta computes it by default — even when it is legally soft (inferred from general norms, no binding consulta) and even when no competitor does it. Being the most correct tool is the point. -- **BUT** when a computation is (a) not strictly needed for a correct return, (b) rests on genuinely-unsettled doctrine, or (c) is something other tools (Taxdown/Autodeclaro/etc.) deliberately omit — provide a **profile checkbox** to turn it off, exactly like the **monodivisa toggle** does for the FX engine (`profile.monodivisa` → `skipFx`). Rigorous on, but one click to match the simpler/market-standard treatment and reconcile with other tools. +- **BUT** when a computation is (a) not strictly needed for a correct return, (b) rests on genuinely-unsettled doctrine, or (c) is something other tools commonly omit — provide a **profile checkbox** to turn it off, exactly like the **monodivisa toggle** does for the FX engine (`profile.monodivisa` → `skipFx`). Rigorous on, but one click to match the simpler/market-standard treatment and reconcile with other tools. - Pattern to follow for any future "should we compute this aggressive/contested thing?" question: ship it ON by default, expose an OFF checkbox in the fiscal profile (persisted in localStorage, threaded as a `ReportOptions` flag), and add a Competitor-Reconciliation-style note explaining when to use it. Never silently drop rigor; never force a contested computation with no escape hatch. ### Correctness with User Comfort @@ -352,9 +352,9 @@ When adding a new section (like 721), follow this checklist: ### Competitor Reconciliation Hint - When the final results page is shown, include a subtle note (not a warning) explaining: - - If other tools (Autodeclaro, Taxdown, etc.) show a different amount, it's likely because they use "monodivisa" mode (they don't calculate FX gains per Art. 37.1.l LIRPF) - - Point the user to the monodivisa toggle in their fiscal profile to compare - - Wording: "Si otra herramienta muestra un importe distinto, puede deberse a que no calcula las ganancias por tipo de cambio. Puedes activar el modo monodivisa en tu perfil fiscal para comparar." + - If other tools (Autodeclaro, Taxdown, etc.) show a different amount, it may be because they value foreign-currency shares at each operation's own-date rate instead of separating the currency result (Art. 33.1, timing Art. 14.2.e LIRPF) + - Point the user to the monodivisa toggle in their fiscal profile to compare, and say plainly that monodivisa values shares like those tools but computes no currency result at all, not even on USD→EUR conversions; if they convert currency, the default mode is the one that computes it + - Wording: the `report.competitor_reconciliation` message and its `.hint` key in the locales - This hint should appear near the capital gains total, rendered as a collapsible "info" note (not a warning) - It validates the user's concern ("your numbers are correct, here's why they differ") rather than creating doubt diff --git a/docs/casillas.md b/docs/casillas.md index 95e3dc09..c5d79f2c 100644 --- a/docs/casillas.md +++ b/docs/casillas.md @@ -25,7 +25,7 @@ **Notas:** - La divisa es un elemento patrimonial: la ganancia/pérdida es valor de transmisión − valor de adquisición (Art. **33.1** LIRPF), imputada en la conversión efectiva a euros (Art. 14.2.e). La divisa comparte el bloque «otros elementos patrimoniales» (casillas 1633/1637) con opciones, cripto y fondos no cotizados. La casilla 1626 es «Tipo de elemento patrimonial. Clave», y 1631 es la «Fecha de transmisión» — no son importes. -- Cada conversión EUR→FCY crea un lote en la cola FIFO de esa divisa (DGT V2324-10). +- Cada conversión EUR→FCY crea un lote en la cola FIFO de esa divisa, valorado por lo que realmente costó (Art. 35.1 LIRPF): el importe en euros que aplicó el bróker cuando el extracto lo da, y si no, el tipo BCE del día de la conversión. La transmisión se valora igual. La ley no fija en qué orden sale la divisa: aplicar FIFO es una inferencia por analogía con el Art. 37.2, que solo habla de valores. - Cada conversión de la divisa (por ejemplo, USD→EUR) consume lotes por FIFO y realiza una ganancia o pérdida de divisa. Lo mismo ocurre con los intereses y comisiones que pagas en esa divisa. - Comprar valores en divisa no realiza nada. La divisa gastada queda apartada con su coste de origen y vuelve a la cola cuando vendes los valores. - Las conversiones automáticas del broker (AFx/FXCONV de IBKR) se procesan por defecto como cualquier otra conversión, porque IBKR no convierte a euros al vender y la divisa que tienes es real. Si tu broker sí la convierte en el acto, puedes excluirlas desmarcando «Procesar autoconversiones del bróker» en el perfil fiscal, o con `--skip-auto-convert` en la CLI. @@ -47,7 +47,7 @@ **Notas:** - Los dividendos incluyen tanto dividendos ordinarios como "Payment In Lieu of Dividends" (dividendos sustitutivos en operaciones de préstamo de valores). - Las retenciones extranjeras NO se deducen aquí — se declaran en la casilla 0588. -- La conversión a EUR usa el tipo de cambio ECB oficial del día de pago (DGT V0583-16, PGC NRV 11a). +- El informe convierte a EUR con el tipo oficial del BCE (Ley 46/1998 art. 36) del día de pago que da el extracto. La regla de la DGT es el tipo vigente el día en que el cobro es exigible (V1024-11 para dividendos, V0463-21 para intereses). Normalmente coincide con el día de pago; si el bróker paga más tarde, los dos tipos pueden diferir. - Los gastos genuinos de administración y depósito de valores negociables (cuando el bróker los detalla) sí son deducibles en la **Casilla 0037** (Art. 26.1.a LIRPF); la casilla 0027 recoge ingresos íntegros, nunca gastos. - Las cuotas de suscripción del bróker (p. ej. planes de trading de tarifa plana) NO son «gastos de administración y depósito de valores negociables», por lo que no son deducibles. @@ -121,7 +121,7 @@ El motor de anti-churning recorre todas las operaciones en orden cronológico y, DeclaRenta usa exclusivamente los **tipos de cambio diarios del BCE** (European Central Bank), publicados a las 16:00 CET cada día TARGET. Para fines de semana y festivos, se utiliza el último tipo disponible (día hábil anterior). -**Base legal:** PGC NRV 11a (partidas monetarias en moneda extranjera) y consultas vinculantes de la DGT (V2324-10, V0583-16). No existe ningún artículo en la LGT que prescriba una fuente concreta de tipos de cambio; el BCE constituye un safe harbor por su carácter institucional. +**Base legal:** el art. 36 de la Ley 46/1998 fija como cambio oficial del euro frente a otras divisas el que publica el Banco Central Europeo. La DGT valora las rentas en divisa al tipo vigente en la fecha de la operación o del cobro (V1024-11, V0463-21, V2422-20). ## Método FIFO (Art. 37.2 LIRPF) diff --git a/docs/modelos-fiscales.md b/docs/modelos-fiscales.md index cf9f289d..56beab1c 100644 --- a/docs/modelos-fiscales.md +++ b/docs/modelos-fiscales.md @@ -181,7 +181,7 @@ DeclaRenta implementa las siguientes normas de la legislación fiscal española: | Art. 46 LIRPF | Base del ahorro: ganancias y pérdidas patrimoniales derivadas de transmisión de elementos patrimoniales. | | Art. 49 LIRPF | Compensación de pérdidas patrimoniales: arrastre 4 años, compensación cruzada con límite del 25%. | | Art. 80 LIRPF | Deducción por doble imposición internacional: menor entre impuesto pagado en origen y cuota española. | -| PGC NRV 11a / DGT V0583-16 | Tipos de cambio: el BCE constituye la referencia oficial para la conversión de moneda extranjera (safe harbor). | +| Ley 46/1998 art. 36 | Tipos de cambio: el cambio oficial del euro frente a otras divisas es el que publica el Banco Central Europeo. | | Ley 7/2024 | Introduce el tramo del 30% en la base del ahorro para rentas superiores a 300.000 EUR. | | RD 1065/2007 | Reglamento general de gestión e inspección tributaria. Regula la obligación de informar sobre bienes en el extranjero (Modelo 720). | | Orden EHA/3290/2008 | Regula la declaración de inversiones españolas en el exterior (Modelo D-6). | diff --git a/src/cli/index.ts b/src/cli/index.ts index ef101e0f..269792f5 100644 --- a/src/cli/index.ts +++ b/src/cli/index.ts @@ -201,7 +201,7 @@ program .option("--prior-losses ", "JSON file with prior year losses for carryforward (Art. 49 LIRPF)") .option( "--monodivisa", - "Modo tradicional (como Autodeclaro/Taxdown/asesor): apaga el motor de divisa y valora el coste FCY al tipo del día de COMPRA (Art. 35.1), embebiendo el efecto divisa en la línea de la acción", + "Método tradicional: valora las acciones como Autodeclaro/Taxdown o un asesor (compra al tipo del día de COMPRA, venta al del día de venta; Art. 35.1), con el efecto divisa dentro de la línea de la acción. Apaga TODO el motor de divisa: no calcula ningún resultado de divisa, tampoco en conversiones USD→EUR propias ni en las automáticas del bróker. Si conviertes divisa, usa el modo por defecto", ) .option( "--skip-auto-convert", diff --git a/src/engine/ecb.ts b/src/engine/ecb.ts index 7eed2c19..f870cbdd 100644 --- a/src/engine/ecb.ts +++ b/src/engine/ecb.ts @@ -2,8 +2,10 @@ * ECB exchange rate fetcher. * * Fetches official ECB daily reference rates via the SDMX REST API. - * DGT consultas vinculantes (V2324-10, V0583-16) require "tipo de cambio - * vigente" — ECB daily rates serve as the safe-harbor official source. + * The ECB rate is the official exchange rate by law (Ley 46/1998 art. 36: "tendrá + * la consideración de cambio oficial ... el que publique para el euro el Banco + * Central Europeo"). The DGT values foreign-currency income at the rate in force + * when it becomes payable (V1024-11, dividends; V0463-21, interest). */ import Decimal from "decimal.js"; diff --git a/src/engine/fx-fifo.ts b/src/engine/fx-fifo.ts index 78cbe787..d29c2cdf 100644 --- a/src/engine/fx-fifo.ts +++ b/src/engine/fx-fifo.ts @@ -863,7 +863,8 @@ export class FxFifoEngine { * rate — reproducing the pre-#230 full-proceeds behavior exactly. This is the * load-bearing safety property: nothing changes for single-year/AFx files. * - * SAME FILTERS AS THE BUY/CONSUMER SIDE (V2324-10 symmetry). STK/FUND/BOND only + * SAME FILTERS AS THE BUY/CONSUMER SIDE (so every parked principal has a + * matching re-add; an engine invariant, not a DGT rule). STK/FUND/BOND only * (CRYPTO permutas' proceedsFcy is a coin, not fiat → crypto path; OPT/FOP/CASH * excluded — CASH conversions are the FX engine's own events). `currency ≠ EUR`, * ECB-resolvable, `proceedsFcy > 0`, and NOT a short close (`isShort`): a cover @@ -945,7 +946,7 @@ export class FxFifoEngine { * here equals the principal the SELL re-adds via `costBasisFcy` — the two sides * reconcile. * - * SAME FILTERS AS THE SELL SIDE (V2324-10 symmetry): `buySell === "BUY"`, + * SAME FILTERS AS THE SELL SIDE (engine invariant, not a DGT rule): `buySell === "BUY"`, * STK/FUND/BOND only, `currency ≠ EUR`, ECB-resolvable, NOT an FXCONV/AFx trade. * EXCLUDES short-cover buys (`openCloseIndicator === "C"`): a cover is the CLOSE * of a short, not a fresh FCY outflow to acquire a long position — mirroring the @@ -1063,7 +1064,7 @@ export class FxFifoEngine { } /** Detect FXCONV (automatic broker conversions for settlement) */ - private static isFxconv(trade: Trade): boolean { + static isFxconv(trade: Trade): boolean { const desc = (trade.description || "").toUpperCase(); const exch = (trade.exchange || "").toUpperCase(); const notes = (trade.notes || "").toUpperCase().split(";"); diff --git a/src/generators/report.ts b/src/generators/report.ts index b7f4dc01..962e731b 100644 --- a/src/generators/report.ts +++ b/src/generators/report.ts @@ -590,7 +590,10 @@ export function generateTaxReport( // held divisa); the opt-out (trackAutoConvert === false) restores the // per-trade isFxconv() skip. Manual CASH/income and tracked stock round-trips // always accrue/move FCY lots. - // skipFx: monodivisa mode — treat all as EUR, no separate FX saldo (like Autodeclaro/Taxdown) + // skipFx: monodivisa mode — the WHOLE FX engine is off: no FX result at all, not + // even for the taxpayer's own FCY→EUR conversions or broker AFx/FXCONV ones. It + // matches tools like Autodeclaro/Taxdown only in how shares are valued (buy at + // the buy-date rate, sale at the sale-date rate; see traditionalCostBasis). let fxDisposals: ReturnType = []; let fxTransmissionValue = new Decimal(0); let fxAcquisitionValue = new Decimal(0); @@ -746,7 +749,7 @@ export function generateTaxReport( severity: "info", message: "Si otra herramienta muestra un importe distinto, puede deberse a que no calcula las ganancias por tipo de cambio (Art. 33.1 LIRPF).", - hint: "Puedes activar el modo monodivisa en tu perfil fiscal para comparar con herramientas como Autodeclaro o Taxdown.", + hint: "Puedes activar el modo monodivisa en tu perfil fiscal para comparar: valora las acciones igual que Autodeclaro o Taxdown (compra al tipo del día de compra, venta al del día de venta), pero no calcula ningún resultado de divisa, tampoco en las conversiones USD→EUR. Si conviertes divisa, el modo por defecto es el que lo calcula.", }); // Method-consistency warning: the FX gain on a foreign currency is realized // here only when the currency is converted to euros (defer / carry-basis, @@ -781,6 +784,29 @@ export function generateTaxReport( } } + // Monodivisa drops every currency conversion silently (the FX engine is off), so + // say how many this year's file had. Mirrors extractFxEvents' filter: a non-EUR + // CASH trade, minus AFx/FXCONV rows when the user also opted out of those. + if (options?.skipFx) { + const trackAutoConvert = options.trackAutoConvert !== false; + const skippedConversions = statement.trades.filter( + (tr) => + tr.assetCategory === "CASH" && + tr.currency !== "EUR" && + (trackAutoConvert || !FxFifoEngine.isFxconv(tr)) && + normalizeDate(tr.settlementDate || tr.tradeDate).startsWith(yearStr), + ).length; + if (skippedConversions > 0) { + allMessages.push({ + id: "report.monodivisa_conversions_skipped", + severity: "info", + message: `El modo monodivisa ha dejado sin calcular ${skippedConversions} conversión(es) de divisa de este ejercicio (manuales o automáticas del bróker). Este modo no calcula ningún resultado de divisa (casillas 1633/1637).`, + hint: "El modo por defecto sí calcula las conversiones de divisa. Si has convertido divisa (por ejemplo, de USD a EUR), desactiva el modo monodivisa en tu perfil fiscal para incluir su resultado.", + context: { count: String(skippedConversions) }, + }); + } + } + // Final boundary guard (audit [HIGH/ERR]): scan every top-level monetary total // destined for a casilla and coerce any non-finite (NaN/Infinity) value to 0, // so a corrupt source amount can never render as a literal "NaN"/"Infinito" in diff --git a/src/i18n/locales/ca.ts b/src/i18n/locales/ca.ts index c6293ad4..fc120093 100644 --- a/src/i18n/locales/ca.ts +++ b/src/i18n/locales/ca.ts @@ -241,11 +241,11 @@ const ca: TranslationKeys = { "profile.ccaa_label": "Comunitat Autònoma:", "profile.phone_label": "Telèfon:", "profile.phone_placeholder": "600123456", - "profile.monodivisa_label": "Mode simplificat (monodivisa EUR)", + "profile.monodivisa_label": "Mètode tradicional (monodivisa, cost al tipus de compra)", "profile.monodivisa_detail": - "No calcula guanys per tipus de canvi de forma separada (caselles 1633/1637): l'efecte divisa queda embegut en el cost de l'acció, valorat al tipus del dia de COMPRA (Art. 35.1). Compatible amb Autodeclaro, Taxdown i altres serveis (i amb el mètode tradicional que fan servir alguns assessors) que tracten totes les operacions com a moneda única EUR. Nota: en una actualització recent aquest mode valora el cost al tipus de la data de compra; el guany de valors en moneda estrangera pot diferir de xifres desades en versions anteriors — revisa-la si ja vas presentar amb una versió prèvia.", + "Valora cada acció en moneda estrangera com el mètode tradicional i eines com Autodeclaro o Taxdown: la compra al tipus de canvi del dia de compra i la venda al del dia de venda (Art. 35.1). L'efecte divisa queda dins del guany de l'acció. A més, apaga tot el càlcul de divisa: no calcula cap resultat de divisa (caselles 1633/1637), tampoc en les conversions USD→EUR que facis tu ni en les automàtiques del bróker. Si converteixes divisa, fes servir el mode per defecte, que sí que les calcula. Nota: en una actualització recent aquest mode valora el cost al tipus de la data de compra; el guany de valors en moneda estrangera pot diferir de xifres desades en versions anteriors — revisa-la si ja vas presentar amb una versió prèvia.", "profile.monodivisa_warning": - "⚠ Aquest mode pot distorsionar els guanys patrimonials declarats (infraestimar o sobreestimar). El mode complet (per defecte) és més rigorós segons l'Art. 33.1 LIRPF (DGT V2324-10).", + "⚠ Aquest mode pot distorsionar els guanys patrimonials declarats (infraestimar o sobreestimar). El mode complet (per defecte) és més rigorós segons l'Art. 33.1 LIRPF (DGT V2422-20).", "profile.track_autoconvert_label": "Processar les autoconversions del bróker (AFx/FXCONV)", "profile.track_autoconvert_detail": "Activat per defecte. Interactive Brokers no reconverteix a euros en vendre una acció, així que el saldo en divisa és real i convertir-lo després genera un guany o pèrdua patrimonial (art. 33.1 LIRPF). Desactiva-ho només si el teu bróker fa un round-trip complet EUR↔divisa i vols ignorar l'efecte de la divisa.", @@ -629,7 +629,7 @@ const ca: TranslationKeys = { "guide_rw.capital_gains_note": "Si tens moltes operacions, pots consolidar-les en una sola línia per tipus d'actiu usant les dates genèriques 01/01 i 31/12. Renta Web accepta imports agregats.", "guide_rw.fx_note": - "Els guanys per tipus de canvi es declaren apart dels guanys de valors. Només apareixen si has operat amb divises manualment (ex. conversions EUR→USD a IBKR). Si uses mode monodivisa, aquesta secció no aplica.", + "Els guanys per tipus de canvi es declaren a part dels guanys de valors. Apareixen quan converteixes divisa a euros o a una altra divisa (p. ex. USD→GBP) —incloses les conversions automàtiques del teu bróker (p. ex. AFx/FXCONV a IBKR)—, no només en les conversions manuals. Mentre mantens la divisa (p. ex. compres i vens accions en USD sense passar a euros), la diferència de canvi queda diferida fins que la converteixes efectivament, a euros o a una altra divisa (Art. 14.2.e LIRPF). Si uses mode monodivisa, aquesta secció no aplica.", "guide_rw.dividends_note": "Els dividends de brokers estrangers no porten retenció espanyola. La retenció estrangera (withholding tax) NO es posa aquí: es dedueix apart a la casella 0588 (doble imposició).", "guide_rw.interest_note": @@ -640,7 +640,7 @@ const ca: TranslationKeys = { "guide_rw.blocked_losses_hint": "Si DeclaRenta mostra pèrdues bloquejades, marca la casella «Pèrdues patrimonials no imputables» a Renta Web. Aquestes pèrdues es difereixen a l'exercici següent perquè es va recomprar el mateix valor en els 2 mesos posteriors (cotitzats) o 1 any (no cotitzats). L'import se suma a l'adquisició de la nova posició.", "guide_rw.closing_tip": - "Després d'introduir totes les dades, usa el botó «Verificar declaració» de Renta Web per comprovar errors. Si una altra eina (Autodeclaro, Taxdown) mostra un import diferent en guanys patrimonials, pot ser perquè no calcula els guanys per tipus de canvi per separat — activa el mode monodivisa al teu perfil per comparar.", + "Després d'introduir totes les dades, usa el botó «Verificar declaració» de Renta Web per comprovar errors. Si una altra eina (Autodeclaro, Taxdown) mostra un import diferent en guanys patrimonials, pot ser perquè valora d'una altra manera les accions en divisa — activa el mode monodivisa al teu perfil per comparar. Aquest mode valora les accions com aquestes eines, però no calcula cap resultat de divisa, tampoc en les conversions USD→EUR; si converteixes divisa, el mode per defecte és el que el calcula.", // PDF report "pdf.subtitle": "Informe fiscal — Exercici", @@ -809,7 +809,11 @@ const ca: TranslationKeys = { "report.competitor_reconciliation": "Si una altra eina mostra un import diferent, pot ser perquè no calcula els guanys per tipus de canvi (Art. 33.1 LIRPF).", "report.competitor_reconciliation.hint": - "Pots activar el mode monodivisa al teu perfil fiscal per comparar amb eines com Autodeclaro o Taxdown.", + "Pots activar el mode monodivisa al teu perfil fiscal per comparar: valora les accions igual que Autodeclaro o Taxdown (compra al tipus del dia de compra, venda al del dia de venda), però no calcula cap resultat de divisa, tampoc en les conversions USD→EUR. Si converteixes divisa, el mode per defecte és el que el calcula.", + "report.monodivisa_conversions_skipped": + "El mode monodivisa ha deixat sense calcular {{count}} conversió(ns) de divisa d'aquest exercici (manuals o automàtiques del bróker). Aquest mode no calcula cap resultat de divisa (caselles 1633/1637).", + "report.monodivisa_conversions_skipped.hint": + "El mode per defecte sí que calcula les conversions de divisa. Si has convertit divisa (per exemple, d'USD a EUR), desactiva el mode monodivisa al teu perfil fiscal per incloure'n el resultat.", "report.non_finite_total": "S'ha detectat un valor no finit (NaN/Infinit) en un total calculat; revisa els fitxers importats.", "report.non_finite_total.hint": diff --git a/src/i18n/locales/en.ts b/src/i18n/locales/en.ts index ee08799d..6c21fe44 100644 --- a/src/i18n/locales/en.ts +++ b/src/i18n/locales/en.ts @@ -241,11 +241,11 @@ const en: TranslationKeys = { "profile.ccaa_label": "Autonomous Community:", "profile.phone_label": "Phone:", "profile.phone_placeholder": "600123456", - "profile.monodivisa_label": "Simplified mode (single-currency EUR)", + "profile.monodivisa_label": "Traditional method (single-currency, cost at the buy-date rate)", "profile.monodivisa_detail": - "Does not calculate FX gains separately (casillas 1633/1637): the currency effect is embedded in the stock cost, valued at the BUY-date rate (Art. 35.1). Compatible with Autodeclaro, Taxdown, and other services (and the traditional method some advisors use) that treat all operations as single-currency EUR. Note: in a recent update this mode values the cost at the buy-date rate; the gain on foreign-currency holdings may differ from figures saved in earlier versions — re-check it if you already filed with a previous version.", + "Values each foreign-currency share the way the traditional method and tools such as Autodeclaro or Taxdown do: the buy at the buy-date exchange rate and the sale at the sale-date rate (Art. 35.1). The currency effect stays inside the share's gain. It also switches off the whole currency calculation: no currency result is computed at all (casillas 1633/1637), not even for USD→EUR conversions you make yourself or your broker's automatic conversions. If you convert currency, use the default mode, which computes them. Note: in a recent update this mode values the cost at the buy-date rate; the gain on foreign-currency holdings may differ from figures saved in earlier versions — re-check it if you already filed with a previous version.", "profile.monodivisa_warning": - "⚠ This mode may distort reported capital gains (understate or overstate). The full mode (default) is more rigorous per Art. 33.1 LIRPF (DGT V2324-10).", + "⚠ This mode may distort reported capital gains (understate or overstate). The full mode (default) is more rigorous per Art. 33.1 LIRPF (DGT V2422-20).", "profile.track_autoconvert_label": "Process broker auto-conversions (AFx/FXCONV)", "profile.track_autoconvert_detail": "On by default. Interactive Brokers does not convert back to euros when you sell a stock, so the currency balance is real and converting it later produces a capital gain or loss (Art. 33.1 LIRPF). Turn it off only if your broker does a full EUR↔currency round-trip and you want to ignore the currency effect.", @@ -627,7 +627,7 @@ const en: TranslationKeys = { "guide_rw.capital_gains_note": "If you have many operations, you can consolidate them in one line per asset type using generic dates 01/01 and 31/12. Renta Web accepts aggregated amounts.", "guide_rw.fx_note": - "FX gains are declared separately from securities gains. They only appear if you manually traded currencies (e.g. EUR→USD conversions in IBKR). If using single-currency mode, this section does not apply.", + "FX gains are declared separately from securities gains. They appear when you convert foreign currency to euros or to another currency (e.g. USD→GBP) — including your broker's automatic conversions (e.g. AFx/FXCONV in IBKR) — not only manual conversions. While you hold the currency (e.g. buying and selling stocks in USD without converting to euros), the exchange difference stays deferred until you actually convert it, to euros or to another currency (Art. 14.2.e LIRPF). If using single-currency mode, this section does not apply.", "guide_rw.dividends_note": "Dividends from foreign brokers have no Spanish withholding. Foreign withholding tax is NOT entered here: it is deducted separately in box 0588 (double taxation).", "guide_rw.interest_note": @@ -638,7 +638,7 @@ const en: TranslationKeys = { "guide_rw.blocked_losses_hint": 'If DeclaRenta shows blocked losses, tick the "Non-attributable capital losses" box in Renta Web. These losses are deferred to the next year because the same security was repurchased within 2 months (listed) or 1 year (unlisted). The amount is added to the acquisition cost of the new position.', "guide_rw.closing_tip": - 'After entering all data, use the "Verify declaration" button in Renta Web to check for errors. If another tool (Autodeclaro, Taxdown) shows a different capital gains amount, it may be because they don\'t calculate FX gains separately — enable single-currency mode in your profile to compare.', + 'After entering all data, use the "Verify declaration" button in Renta Web to check for errors. If another tool (Autodeclaro, Taxdown) shows a different capital gains amount, it may be because it values foreign-currency shares differently — enable single-currency mode in your profile to compare. That mode values shares like those tools, but computes no currency result at all, not even for USD→EUR conversions; if you convert currency, the default mode is the one that computes it.', // PDF report "pdf.subtitle": "Tax report — Year", @@ -807,7 +807,11 @@ const en: TranslationKeys = { "report.competitor_reconciliation": "If another tool shows a different amount, it may be because it does not calculate foreign-exchange gains (Art. 33.1 LIRPF).", "report.competitor_reconciliation.hint": - "You can enable single-currency mode in your fiscal profile to compare with tools such as Autodeclaro or Taxdown.", + "You can enable single-currency mode in your fiscal profile to compare: it values shares the same way as Autodeclaro or Taxdown (buy at the buy-date rate, sale at the sale-date rate), but computes no currency result at all, not even for USD→EUR conversions. If you convert currency, the default mode is the one that computes it.", + "report.monodivisa_conversions_skipped": + "Single-currency mode left {{count}} currency conversion(s) from this tax year uncalculated (manual or automatic broker conversions). This mode computes no currency result at all (boxes 1633/1637).", + "report.monodivisa_conversions_skipped.hint": + "The default mode does calculate currency conversions. If you converted currency (for example, from USD to EUR), turn off single-currency mode in your fiscal profile to include their result.", "report.non_finite_total": "A non-finite value (NaN/Infinity) was detected in a calculated total; please review the imported files.", "report.non_finite_total.hint": diff --git a/src/i18n/locales/es.ts b/src/i18n/locales/es.ts index c0e462f1..d943591d 100644 --- a/src/i18n/locales/es.ts +++ b/src/i18n/locales/es.ts @@ -253,11 +253,11 @@ const es = { "profile.ccaa_label": "Comunidad Autónoma:", "profile.phone_label": "Teléfono:", "profile.phone_placeholder": "600123456", - "profile.monodivisa_label": "Modo simplificado (monodivisa EUR)", + "profile.monodivisa_label": "Método tradicional (monodivisa, coste al tipo de compra)", "profile.monodivisa_detail": - "No calcula ganancias por tipo de cambio de forma separada (casillas 1633/1637): el efecto divisa queda embebido en el coste de la acción, valorado al tipo del día de COMPRA (Art. 35.1). Compatible con el enfoque de Autodeclaro, Taxdown y otros servicios (y con el método tradicional que usan algunos asesores) que tratan todas las operaciones como moneda única EUR. Nota: en una actualización reciente este modo valora el coste al tipo de la fecha de compra; la ganancia de valores en moneda extranjera puede diferir de cifras guardadas en versiones anteriores — revísala si ya presentaste con una versión previa.", + "Valora cada acción en moneda extranjera como el método tradicional y herramientas como Autodeclaro o Taxdown: la compra al tipo de cambio del día de compra y la venta al del día de venta (Art. 35.1). El efecto divisa queda dentro de la ganancia de la acción. Además, apaga todo el cálculo de divisa: no calcula ningún resultado de divisa (casillas 1633/1637), tampoco en las conversiones USD→EUR que hagas tú ni en las automáticas del bróker. Si conviertes divisa, usa el modo por defecto, que sí las calcula. Nota: en una actualización reciente este modo valora el coste al tipo de la fecha de compra; la ganancia de valores en moneda extranjera puede diferir de cifras guardadas en versiones anteriores — revísala si ya presentaste con una versión previa.", "profile.monodivisa_warning": - "⚠ Este modo puede distorsionar las ganancias patrimoniales declaradas (infraestimar o sobreestimar). El modo completo (por defecto) es más riguroso según el Art. 33.1 LIRPF (DGT V2324-10).", + "⚠ Este modo puede distorsionar las ganancias patrimoniales declaradas (infraestimar o sobreestimar). El modo completo (por defecto) es más riguroso según el Art. 33.1 LIRPF (DGT V2422-20).", "profile.track_autoconvert_label": "Procesar autoconversiones del bróker (AFx/FXCONV)", "profile.track_autoconvert_detail": "Activado por defecto. Interactive Brokers no reconvierte a euros al vender una acción, así que el saldo en divisa es real y su conversión posterior genera ganancia o pérdida patrimonial (Art. 33.1 LIRPF). Desactívalo solo si tu bróker hace un round-trip completo EUR↔divisa y quieres ignorar el efecto de la divisa.", @@ -662,7 +662,7 @@ const es = { "guide_rw.capital_gains_note": "Si tienes muchas operaciones, puedes consolidarlas en una sola línea por tipo de activo usando las fechas genéricas 01/01 y 31/12. Renta Web acepta importes agregados.", "guide_rw.fx_note": - "Las ganancias por tipo de cambio se declaran aparte de las ganancias de valores. Solo aparecen si has operado con divisas manualmente (ej. conversiones EUR→USD en IBKR). Si usas modo monodivisa, esta sección no aplica.", + "Las ganancias por tipo de cambio se declaran aparte de las ganancias de valores. Aparecen cuando conviertes divisa a euros o a otra divisa (p. ej. USD→GBP) —incluidas las conversiones automáticas de tu bróker (p. ej. AFx/FXCONV en IBKR)—, no solo en las conversiones manuales. Mientras mantienes la divisa (p. ej. compras y vendes acciones en USD sin pasar a euros), la diferencia de cambio queda diferida hasta que la conviertes efectivamente, a euros o a otra divisa (Art. 14.2.e LIRPF). Si usas modo monodivisa, esta sección no aplica.", "guide_rw.dividends_note": "Los dividendos de brokers extranjeros no llevan retención española. La retención extranjera (withholding tax) NO se pone aquí: se deduce aparte en la casilla 0588 (doble imposición).", "guide_rw.interest_note": @@ -673,7 +673,7 @@ const es = { "guide_rw.blocked_losses_hint": "Si DeclaRenta muestra pérdidas bloqueadas, marca la casilla «Pérdidas patrimoniales no imputables» en Renta Web. Estas pérdidas se difieren al ejercicio siguiente porque se recompró el mismo valor en los 2 meses posteriores (cotizados) o 1 año (no cotizados). El importe se suma a la adquisición de la nueva posición.", "guide_rw.closing_tip": - "Tras introducir todos los datos, usa el botón «Verificar declaración» de Renta Web para comprobar errores. Si otra herramienta (Autodeclaro, Taxdown) muestra un importe distinto en ganancias patrimoniales, puede deberse a que no calcula las ganancias por tipo de cambio por separado — activa el modo monodivisa en tu perfil para comparar.", + "Tras introducir todos los datos, usa el botón «Verificar declaración» de Renta Web para comprobar errores. Si otra herramienta (Autodeclaro, Taxdown) muestra un importe distinto en ganancias patrimoniales, puede deberse a que valora de otra forma las acciones en divisa — activa el modo monodivisa en tu perfil para comparar. Ese modo valora las acciones como esas herramientas, pero no calcula ningún resultado de divisa, tampoco en las conversiones USD→EUR; si conviertes divisa, el modo por defecto es el que lo calcula.", // PDF report "pdf.subtitle": "Informe fiscal — Ejercicio", @@ -846,7 +846,11 @@ const es = { "report.competitor_reconciliation": "Si otra herramienta muestra un importe distinto, puede deberse a que no calcula las ganancias por tipo de cambio (Art. 33.1 LIRPF).", "report.competitor_reconciliation.hint": - "Puedes activar el modo monodivisa en tu perfil fiscal para comparar con herramientas como Autodeclaro o Taxdown.", + "Puedes activar el modo monodivisa en tu perfil fiscal para comparar: valora las acciones igual que Autodeclaro o Taxdown (compra al tipo del día de compra, venta al del día de venta), pero no calcula ningún resultado de divisa, tampoco en las conversiones USD→EUR. Si conviertes divisa, el modo por defecto es el que lo calcula.", + "report.monodivisa_conversions_skipped": + "El modo monodivisa ha dejado sin calcular {{count}} conversión(es) de divisa de este ejercicio (manuales o automáticas del bróker). Este modo no calcula ningún resultado de divisa (casillas 1633/1637).", + "report.monodivisa_conversions_skipped.hint": + "El modo por defecto sí calcula las conversiones de divisa. Si has convertido divisa (por ejemplo, de USD a EUR), desactiva el modo monodivisa en tu perfil fiscal para incluir su resultado.", "report.non_finite_total": "Se detectó un valor no finito (NaN/Infinito) en un total calculado; revise los archivos importados.", "report.non_finite_total.hint": diff --git a/src/i18n/locales/eu.ts b/src/i18n/locales/eu.ts index ea2ce415..591bb5dd 100644 --- a/src/i18n/locales/eu.ts +++ b/src/i18n/locales/eu.ts @@ -242,11 +242,11 @@ const eu: TranslationKeys = { "profile.ccaa_label": "Autonomia Erkidegoa:", "profile.phone_label": "Telefonoa:", "profile.phone_placeholder": "600123456", - "profile.monodivisa_label": "Modu sinplifikatua (EUR monodibisa)", + "profile.monodivisa_label": "Metodo tradizionala (monodibisa, kostua erosketa-eguneko tasan)", "profile.monodivisa_detail": - "Ez ditu kanbio-tasaren irabaziak bereizita kalkulatzen (1633/1637 laukitxoak): dibisaren eragina akzioaren kostuan txertatuta geratzen da, EROSKETA-eguneko tasarekin balioetsita (35.1 art.). Autodeclaro, Taxdown eta eragiketa guztiak EUR moneta bakar gisa tratatzen dituzten beste zerbitzu batzuekin bateragarria (eta aholkulari batzuek erabiltzen duten metodo tradizionalarekin). Oharra: azken eguneratze batean modu honek kostua erosketa-eguneko tasarekin balioesten du; atzerriko monetako baloreen irabazia aurreko bertsioetan gordetako zifrekin alde egin dezake — berrikus ezazu aurreko bertsio batekin aurkeztu bazenuen.", + "Atzerriko monetako akzio bakoitza metodo tradizionalak eta Autodeclaro edo Taxdown bezalako tresnek bezala balioesten du: erosketa erosketa-eguneko kanbio-tasan eta salmenta salmenta-egunekoan (35.1 art.). Dibisaren eragina akzioaren irabaziaren barruan geratzen da. Gainera, dibisaren kalkulu osoa itzaltzen du: ez du dibisa-emaitzarik batere kalkulatzen (1633/1637 laukitxoak), ezta zuk egindako USD→EUR bihurketetan edo brokerraren bihurketa automatikoetan ere. Dibisa bihurtzen baduzu, erabili modu lehenetsia, horiek kalkulatzen baititu. Oharra: azken eguneratze batean modu honek kostua erosketa-eguneko tasarekin balioesten du; atzerriko monetako baloreen irabazia aurreko bertsioetan gordetako zifrekin alde egin dezake — berrikus ezazu aurreko bertsio batekin aurkeztu bazenuen.", "profile.monodivisa_warning": - "⚠ Modu honek adierazitako ondare-irabaziak distortsionatu ditzake (gutxietsi edo gehiegietsi). Modu osoa (lehenetsita) zorrotzagoa da 33.1 Art. LIRPF (DGT V2324-10) arabera.", + "⚠ Modu honek adierazitako ondare-irabaziak distortsionatu ditzake (gutxietsi edo gehiegietsi). Modu osoa (lehenetsita) zorrotzagoa da 33.1 Art. LIRPF (DGT V2422-20) arabera.", "profile.track_autoconvert_label": "Prozesatu artekariaren auto-bihurketak (AFx/FXCONV)", "profile.track_autoconvert_detail": "Lehenetsita aktibatuta. Interactive Brokersek ez du eurotara berriz bihurtzen akzio bat saltzean, beraz dibisa-saldoa erreala da eta gero bihurtzeak ondare-irabazi edo -galera sortzen du (LIRPF 33.1 art.). Desaktibatu soilik zure artekariak EUR↔dibisa round-trip osoa egiten badu eta dibisaren eragina alde batera utzi nahi baduzu.", @@ -629,7 +629,7 @@ const eu: TranslationKeys = { "guide_rw.capital_gains_note": "Eragiketa asko badituzu, lerro bakarrean konsolidatu ditzakezu aktibo mota bakoitzeko 01/01 eta 31/12 data generikoak erabiliz. Renta Web-ek zenbateko agregatuak onartzen ditu.", "guide_rw.fx_note": - "Kanbio-tasagatiko irabaziak balore irabazietatik bereizita aitortzen dira. Dibisekin eskuz operatu baduzu bakarrik agertzen dira (adib. EUR→USD bihurketak IBKR-n). Monodibisa modua erabiltzen baduzu, atal hau ez da aplikagarria.", + "Kanbio-tasagatiko irabaziak balore irabazietatik bereizita aitortzen dira. Dibisa euro edo beste dibisa batera bihurtzen duzunean agertzen dira (adib. USD→GBP) —zure brokerraren bihurketa automatikoak barne (adib. AFx/FXCONV IBKR-n)—, eta ez eskuzko bihurketetan soilik. Dibisa daukazun bitartean (adib. USD akzioak erosi eta saldu euro bihurtu gabe), kanbio-diferentzia atzeratuta geratzen da benetan bihurtu arte, euro edo beste dibisa batera (Art. 14.2.e LIRPF). Monodibisa modua erabiltzen baduzu, atal hau ez da aplikagarria.", "guide_rw.dividends_note": "Atzerriko broker-en dibidenduek ez dute Espainiako atxikipenik. Atzerriko atxikipena (withholding tax) EZ da hemen jartzen: 0588 gelaxkan kentzen da bereizita (zergapetze bikoitza).", "guide_rw.interest_note": @@ -640,7 +640,7 @@ const eu: TranslationKeys = { "guide_rw.blocked_losses_hint": "DeclaRenta-k blokeatutako galerak erakusten baditu, markatu «Egozteko ondare galerak» gelaxka Renta Web-en. Galera hauek hurrengo ekitaldira atzeratzen dira balio bera 2 hilabetetan (kotizatuak) edo urtebetean (kotizatu gabeak) berrerosi zelako. Zenbatekoa posizio berriaren eskuraketa kostuari gehitzen zaio.", "guide_rw.closing_tip": - "Datu guztiak sartu ondoren, erabili Renta Web-eko «Aitorpena egiaztatu» botoia akatsak egiaztatzeko. Beste tresna batek (Autodeclaro, Taxdown) ondare irabazietan zenbateko desberdina erakusten badu, kanbio-tasagatiko irabaziak bereizita kalkulatzen ez dituelako izan daiteke — aktibatu monodibisa modua zure profilean konparatzeko.", + "Datu guztiak sartu ondoren, erabili Renta Web-eko «Aitorpena egiaztatu» botoia akatsak egiaztatzeko. Beste tresna batek (Autodeclaro, Taxdown) ondare irabazietan zenbateko desberdina erakusten badu, dibisako akzioak beste modu batera balioesten dituelako izan daiteke — aktibatu monodibisa modua zure profilean konparatzeko. Modu horrek tresna horiek bezala balioesten ditu akzioak, baina ez du dibisa-emaitzarik batere kalkulatzen, ezta USD→EUR bihurketetan ere; dibisa bihurtzen baduzu, modu lehenetsiak kalkulatzen du.", // PDF report "pdf.subtitle": "Zerga txostena — Ekitaldia", @@ -811,7 +811,11 @@ const eu: TranslationKeys = { "report.competitor_reconciliation": "Beste tresna batek zenbateko desberdina erakusten badu, baliteke kanbio-tasagatiko irabaziak ez kalkulatzea izatea (33.1 art. LIRPF).", "report.competitor_reconciliation.hint": - "Moneta bakarreko modua aktiba dezakezu zure zerga-profilean Autodeclaro edo Taxdown bezalako tresnekin alderatzeko.", + "Moneta bakarreko (monodibisa) modua aktiba dezakezu zure zerga-profilean alderatzeko: akzioak Autodeclaro edo Taxdown bezala balioesten ditu (erosketa erosketa-eguneko tasan, salmenta salmenta-egunekoan), baina ez du dibisa-emaitzarik batere kalkulatzen, ezta USD→EUR bihurketetan ere. Dibisa bihurtzen baduzu, modu lehenetsiak kalkulatzen du.", + "report.monodivisa_conversions_skipped": + "Monodibisa moduak ekitaldi honetako {{count}} dibisa-bihurketa kalkulatu gabe utzi ditu (eskuzkoak edo brokerraren automatikoak). Modu honek ez du dibisa-emaitzarik batere kalkulatzen (1633/1637 laukiak).", + "report.monodivisa_conversions_skipped.hint": + "Modu lehenetsiak dibisa-bihurketak kalkulatzen ditu. Dibisa bihurtu baduzu (adibidez, USDtik EURera), desaktibatu monodibisa modua zure zerga-profilean haien emaitza sartzeko.", "report.non_finite_total": "Balio ez-finitu bat (NaN/Infinitua) detektatu da kalkulatutako total batean; berrikusi inportatutako fitxategiak.", "report.non_finite_total.hint": diff --git a/src/i18n/locales/gl.ts b/src/i18n/locales/gl.ts index 3779c150..ca52394c 100644 --- a/src/i18n/locales/gl.ts +++ b/src/i18n/locales/gl.ts @@ -241,11 +241,11 @@ const gl: TranslationKeys = { "profile.ccaa_label": "Comunidade Autónoma:", "profile.phone_label": "Teléfono:", "profile.phone_placeholder": "600123456", - "profile.monodivisa_label": "Modo simplificado (monodivisa EUR)", + "profile.monodivisa_label": "Método tradicional (monodivisa, custo ao tipo de compra)", "profile.monodivisa_detail": - "Non calcula ganancias por tipo de cambio de forma separada (casillas 1633/1637): o efecto divisa queda embebido no custo da acción, valorado ao tipo do día de COMPRA (Art. 35.1). Compatible con Autodeclaro, Taxdown e outros servizos (e co método tradicional que usan algúns asesores) que tratan todas as operacións como moeda única EUR. Nota: nunha actualización recente este modo valora o custo ao tipo da data de compra; a ganancia de valores en moeda estranxeira pode diferir de cifras gardadas en versións anteriores — revísaa se xa presentaches cunha versión previa.", + "Valora cada acción en moeda estranxeira como o método tradicional e ferramentas como Autodeclaro ou Taxdown: a compra ao tipo de cambio do día de compra e a venda ao do día de venda (Art. 35.1). O efecto divisa queda dentro da ganancia da acción. Ademais, apaga todo o cálculo de divisa: non calcula ningún resultado de divisa (casillas 1633/1637), tampouco nas conversións USD→EUR que fagas ti nin nas automáticas do bróker. Se convertes divisa, usa o modo por defecto, que si as calcula. Nota: nunha actualización recente este modo valora o custo ao tipo da data de compra; a ganancia de valores en moeda estranxeira pode diferir de cifras gardadas en versións anteriores — revísaa se xa presentaches cunha versión previa.", "profile.monodivisa_warning": - "⚠ Este modo pode distorsionar as ganancias patrimoniais declaradas (infraestimar ou sobreestimar). O modo completo (por defecto) é máis rigoroso segundo o Art. 33.1 LIRPF (DGT V2324-10).", + "⚠ Este modo pode distorsionar as ganancias patrimoniais declaradas (infraestimar ou sobreestimar). O modo completo (por defecto) é máis rigoroso segundo o Art. 33.1 LIRPF (DGT V2422-20).", "profile.track_autoconvert_label": "Procesar as autoconversións do bróker (AFx/FXCONV)", "profile.track_autoconvert_detail": "Activado por defecto. Interactive Brokers non reconverte a euros ao vender unha acción, así que o saldo en divisa é real e convertelo despois xera unha ganancia ou perda patrimonial (art. 33.1 LIRPF). Desactívao só se o teu bróker fai un round-trip completo EUR↔divisa e queres ignorar o efecto da divisa.", @@ -629,7 +629,7 @@ const gl: TranslationKeys = { "guide_rw.capital_gains_note": "Se tes moitas operacións, podes consolidalas nunha soa liña por tipo de activo usando as datas xenéricas 01/01 e 31/12. Renta Web acepta importes agregados.", "guide_rw.fx_note": - "As ganancias por tipo de cambio decláranse aparte das ganancias de valores. Só aparecen se operaches con divisas manualmente (ex. conversións EUR→USD en IBKR). Se usas modo monodivisa, esta sección non aplica.", + "As ganancias por tipo de cambio decláranse aparte das ganancias de valores. Aparecen cando convertes divisa a euros ou a outra divisa (p. ex. USD→GBP) —incluídas as conversións automáticas do teu bróker (p. ex. AFx/FXCONV en IBKR)—, non só nas conversións manuais. Mentres manteñas a divisa (p. ex. compras e vendes accións en USD sen pasar a euros), a diferenza de cambio queda diferida ata que a convertes efectivamente, a euros ou a outra divisa (Art. 14.2.e LIRPF). Se usas modo monodivisa, esta sección non aplica.", "guide_rw.dividends_note": "Os dividendos de brokers estranxeiros non levan retención española. A retención estranxeira (withholding tax) NON se pon aquí: dedúcese aparte na casilla 0588 (dobre imposición).", "guide_rw.interest_note": @@ -640,7 +640,7 @@ const gl: TranslationKeys = { "guide_rw.blocked_losses_hint": "Se DeclaRenta amosa perdas bloqueadas, marca a casilla «Perdas patrimoniais non imputables» en Renta Web. Estas perdas diférense ao exercicio seguinte porque se recomprou o mesmo valor nos 2 meses posteriores (cotizados) ou 1 ano (non cotizados). O importe súmase á adquisición da nova posición.", "guide_rw.closing_tip": - "Tras introducir todos os datos, usa o botón «Verificar declaración» de Renta Web para comprobar erros. Se outra ferramenta (Autodeclaro, Taxdown) amosa un importe distinto en ganancias patrimoniais, pode deberse a que non calcula as ganancias por tipo de cambio por separado — activa o modo monodivisa no teu perfil para comparar.", + "Tras introducir todos os datos, usa o botón «Verificar declaración» de Renta Web para comprobar erros. Se outra ferramenta (Autodeclaro, Taxdown) amosa un importe distinto en ganancias patrimoniais, pode deberse a que valora doutro xeito as accións en divisa — activa o modo monodivisa no teu perfil para comparar. Ese modo valora as accións como esas ferramentas, pero non calcula ningún resultado de divisa, tampouco nas conversións USD→EUR; se convertes divisa, o modo por defecto é o que o calcula.", // PDF report "pdf.subtitle": "Informe fiscal — Exercicio", @@ -809,7 +809,11 @@ const gl: TranslationKeys = { "report.competitor_reconciliation": "Se outra ferramenta amosa un importe distinto, pode deberse a que non calcula as ganancias por tipo de cambio (Art. 33.1 LIRPF).", "report.competitor_reconciliation.hint": - "Podes activar o modo monodivisa no teu perfil fiscal para comparar con ferramentas como Autodeclaro ou Taxdown.", + "Podes activar o modo monodivisa no teu perfil fiscal para comparar: valora as accións igual que Autodeclaro ou Taxdown (compra ao tipo do día de compra, venda ao do día de venda), pero non calcula ningún resultado de divisa, tampouco nas conversións USD→EUR. Se convertes divisa, o modo por defecto é o que o calcula.", + "report.monodivisa_conversions_skipped": + "O modo monodivisa deixou sen calcular {{count}} conversión(s) de divisa deste exercicio (manuais ou automáticas do bróker). Este modo non calcula ningún resultado de divisa (casillas 1633/1637).", + "report.monodivisa_conversions_skipped.hint": + "O modo por defecto si calcula as conversións de divisa. Se convertiches divisa (por exemplo, de USD a EUR), desactiva o modo monodivisa no teu perfil fiscal para incluír o seu resultado.", "report.non_finite_total": "Detectouse un valor non finito (NaN/Infinito) nun total calculado; revisa os arquivos importados.", "report.non_finite_total.hint": diff --git a/tests/generators/report.test.ts b/tests/generators/report.test.ts index 12c8d30c..e9cd60cc 100644 --- a/tests/generators/report.test.ts +++ b/tests/generators/report.test.ts @@ -822,6 +822,82 @@ describe("generateTaxReport", () => { expect(hint).toBeUndefined(); }); + // Issue #230: monodivisa switches off the whole FX engine, so a real currency + // conversion is dropped without a trace. The report must say how many. + describe("monodivisa notice for dropped currency conversions (#230)", () => { + const rates = makeRateMap({ + "2024-11-04": "0.9100", + "2025-01-10": "0.9200", + "2025-03-15": "0.9300", + "2025-06-15": "0.9500", + "2025-09-20": "0.9400", + }); + const conversion = (id: string, date: string, qty: string, extra: Partial = {}): Trade => + makeTrade({ + tradeID: id, + tradeDate: date, + settlementDate: date, + symbol: "EUR.USD", + description: "EUR.USD", + isin: "", + assetCategory: "CASH", + currency: "USD", + quantity: qty, + tradePrice: "1.0870", + tradeMoney: qty, + proceeds: new Decimal(qty).negated().toString(), + buySell: qty.startsWith("-") ? "SELL" : "BUY", + exchange: "IDEALFX", + ...extra, + }); + const stockTrades = [ + makeTrade({ tradeID: "s1", tradeDate: "2025-03-15", quantity: "10", tradePrice: "100", buySell: "BUY" }), + makeTrade({ tradeID: "s2", tradeDate: "2025-09-20", quantity: "-10", tradePrice: "120", buySell: "SELL" }), + ]; + const withConversions = (): FlexStatement => + makeStatement({ + trades: [ + // Prior year: outside the report year, not counted. + conversion("fx-2024", "2024-11-04", "1000"), + conversion("fx-buy", "2025-01-10", "5000"), + // Broker auto-conversion (IBKR AFx). + conversion("fx-afx", "2025-06-15", "-5000", { notes: "AFx" }), + ...stockTrades, + ], + }); + const notice = (report: ReturnType) => + report.messages.find((m) => m.id === "report.monodivisa_conversions_skipped"); + + it("monodivisa on with conversions → one info message with this year's count", () => { + const report = generateTaxReport(withConversions(), rates, 2025, { skipFx: true }); + const msg = notice(report); + expect(msg).toBeDefined(); + expect(msg!.severity).toBe("info"); + expect(msg!.context).toEqual({ count: "2" }); + expect(msg!.message).toContain("2 conversión(es) de divisa"); + expect(msg!.hint).toContain("modo por defecto"); + expect(report.messages.filter((m) => m.id === "report.monodivisa_conversions_skipped")).toHaveLength(1); + // The notice changes no figure: the FX block stays zero. + expect(report.fxGains.transmissionValue.toString()).toBe("0"); + expect(report.fxGains.acquisitionValue.toString()).toBe("0"); + }); + + it("does not count AFx rows when the user also opted out of auto-conversions", () => { + const report = generateTaxReport(withConversions(), rates, 2025, { skipFx: true, trackAutoConvert: false }); + expect(notice(report)?.context).toEqual({ count: "1" }); + }); + + it("monodivisa off → no notice (the FX engine computes the conversions)", () => { + const report = generateTaxReport(withConversions(), rates, 2025); + expect(notice(report)).toBeUndefined(); + }); + + it("monodivisa on without conversions → no notice", () => { + const report = generateTaxReport(makeStatement({ trades: stockTrades }), rates, 2025, { skipFx: true }); + expect(notice(report)).toBeUndefined(); + }); + }); + describe("titulares (per-contribuyente split)", () => { function makeMixedStatement(): FlexStatement { return makeStatement({ diff --git a/tests/i18n/localize-message.test.ts b/tests/i18n/localize-message.test.ts index 78630356..daebcf52 100644 --- a/tests/i18n/localize-message.test.ts +++ b/tests/i18n/localize-message.test.ts @@ -67,14 +67,37 @@ describe("localizeMessage / localizeHint", () => { const m: LocalizableMessage = { id: "report.competitor_reconciliation", message: "irrelevant", - hint: "Puedes activar el modo monodivisa en tu perfil fiscal para comparar con herramientas como Autodeclaro o Taxdown.", + hint: "Puedes activar el modo monodivisa en tu perfil fiscal para comparar: valora las acciones igual que Autodeclaro o Taxdown (compra al tipo del día de compra, venta al del día de venta), pero no calcula ningún resultado de divisa, tampoco en las conversiones USD→EUR. Si conviertes divisa, el modo por defecto es el que lo calcula.", }; expect(localizeHint(m)).toBe( - "You can enable single-currency mode in your fiscal profile to compare with tools such as Autodeclaro or Taxdown.", + "You can enable single-currency mode in your fiscal profile to compare: it values shares the same way as Autodeclaro or Taxdown (buy at the buy-date rate, sale at the sale-date rate), but computes no currency result at all, not even for USD→EUR conversions. If you convert currency, the default mode is the one that computes it.", ); }); }); + describe("monodivisa dropped-conversions notice (#230)", () => { + const m: LocalizableMessage = { + id: "report.monodivisa_conversions_skipped", + message: + "El modo monodivisa ha dejado sin calcular 42 conversión(es) de divisa de este ejercicio (manuales o automáticas del bróker). Este modo no calcula ningún resultado de divisa (casillas 1633/1637).", + hint: "El modo por defecto sí calcula las conversiones de divisa. Si has convertido divisa (por ejemplo, de USD a EUR), desactiva el modo monodivisa en tu perfil fiscal para incluir su resultado.", + context: { count: "42" }, + }; + + it("Spanish locale text is byte-identical to the engine's message and hint", () => { + expect(localizeMessage(m)).toBe(m.message); + expect(localizeHint(m)).toBe(m.hint); + }); + + it.each(["en", "ca", "eu", "gl"] as const)("%s interpolates the count and is not the Spanish fallback", async (loc) => { + await setLocale(loc); + expect(localizeMessage(m)).toContain("42"); + expect(localizeMessage(m)).not.toContain("{{count}}"); + expect(localizeMessage(m)).not.toBe(m.message); + expect(localizeHint(m)).not.toBe(m.hint); + }); + }); + describe("unknown id → falls back to the engine's message/hint verbatim", () => { it("returns m.message unchanged for an id with no locale key", async () => { await setLocale("en"); diff --git a/tests/integration/fx-carry-basis-e2e.test.ts b/tests/integration/fx-carry-basis-e2e.test.ts index babd99cf..fe482961 100644 --- a/tests/integration/fx-carry-basis-e2e.test.ts +++ b/tests/integration/fx-carry-basis-e2e.test.ts @@ -497,9 +497,10 @@ describe("carry-basis e2e #3: buy consumes the cheap tranche → leftover micro- // 4. MONODIVISA — Test #1's statement with { skipFx: true } → all FX zero. // =========================================================================== // -// Monodivisa mode (Autodeclaro/Taxdown parity) disables the whole FX FIFO -// engine — including the carry-basis stock-buy/sell producers (they live inside -// the same `skipFx` block in report.ts) — AND values the stock cost at the +// Monodivisa mode disables the whole FX FIFO engine (it matches Autodeclaro/ +// Taxdown only in how shares are valued, not in currency results) — including +// the carry-basis stock-buy/sell producers (they live inside the same `skipFx` +// block in report.ts) — AND values the stock cost at the // ACQUISITION-date rate (traditional method, Art. 35.1). So the headline scenario // that produces €155 of carry-basis FX gain with FX ON produces ZERO FX with FX // OFF, while the buy→sale FX drift on the AAPL principal (1000 USD × (1.00 − 0.95) diff --git a/tests/integration/fx-stock-proceeds-e2e.test.ts b/tests/integration/fx-stock-proceeds-e2e.test.ts index 61ae91c5..d7889e3e 100644 --- a/tests/integration/fx-stock-proceeds-e2e.test.ts +++ b/tests/integration/fx-stock-proceeds-e2e.test.ts @@ -243,9 +243,10 @@ describe("issue #230 e2e: sell foreign stock but never convert → FX deferred ( // 3. MONODIVISA — same as #1 but skipFx:true → traditional method (Art. 35.1). // =========================================================================== // -// Monodivisa mode (Autodeclaro/Taxdown parity) disables the FX FIFO engine -// entirely AND values the stock cost at the ACQUISITION-date rate (the -// traditional method some advisors use, Art. 35.1). The foreign-stock-proceeds +// Monodivisa mode disables the FX FIFO engine entirely (no FX result at all, +// not even for real FCY→EUR conversions; it matches Autodeclaro/Taxdown only in +// how shares are valued) AND values the stock cost at the ACQUISITION-date +// rate (the traditional method some advisors use, Art. 35.1). The foreign-stock-proceeds // producer lives inside the same skipFx block, so it is suppressed too: no FX // disposal, all FX casillas zero. The buy→sale FX drift is NOT lost — it is // EMBEDDED in the stock line (cost at the buy rate, proceeds at the sale rate),