This commit is contained in:
@@ -0,0 +1,148 @@
|
||||
import { useState } from 'react';
|
||||
import { annualBook } from '@/lib/irpc-annual-settlement';
|
||||
import type { NormalBook } from '@/lib/irpc-normal';
|
||||
import {
|
||||
prepareEconomicInclusion,
|
||||
calculateEconomicInclusions,
|
||||
economicInclusionMoney,
|
||||
} from '@/lib/irpc-normal-economic';
|
||||
|
||||
export function SimulationIrpcEconomicInclusion({
|
||||
draft,
|
||||
book,
|
||||
save,
|
||||
}: {
|
||||
draft: Record<string, unknown>;
|
||||
book: NormalBook;
|
||||
save: (b: NormalBook) => void;
|
||||
}) {
|
||||
const [selected, setSelected] = useState('');
|
||||
const [profit, setProfit] = useState('');
|
||||
const [credit, setCredit] = useState('');
|
||||
const [reference, setReference] = useState('');
|
||||
const [error, setError] = useState('');
|
||||
const [preview, setPreview] = useState<{
|
||||
fingerprint: string;
|
||||
book: NormalBook;
|
||||
net: string;
|
||||
} | null>(null);
|
||||
const sources = annualBook(draft)?.economicCredits?.rows ?? [];
|
||||
if (!sources.length) return null;
|
||||
const fingerprint = JSON.stringify([
|
||||
book,
|
||||
sources,
|
||||
selected,
|
||||
profit,
|
||||
credit,
|
||||
reference,
|
||||
]);
|
||||
return (
|
||||
<section
|
||||
className="space-y-3 rounded border p-3"
|
||||
aria-label="Incluir ou corrigir lucros e crédito económico em L6"
|
||||
>
|
||||
<h3 className="font-semibold">
|
||||
Incluir ou corrigir lucros e crédito económico em L6
|
||||
</h3>
|
||||
<p>
|
||||
Escolha a origem preparada em L8. Indique os montantes já
|
||||
considerados na contabilidade e noutros ajustamentos, antes
|
||||
deste mapa; zero deve ser indicado expressamente. A prévia
|
||||
propõe apenas a diferença e conserva o resultado anterior.
|
||||
Depois de confirmar, calcule e guarde L6 pelo percurso
|
||||
existente; L8 exige nova conferência da colecta.
|
||||
</p>
|
||||
<label className="block">
|
||||
Origem dos lucros
|
||||
<select
|
||||
value={selected}
|
||||
onChange={(e) => setSelected(e.target.value)}
|
||||
>
|
||||
<option value="">Escolha a origem</option>
|
||||
{sources.map((r) => (
|
||||
<option key={r.id} value={r.id}>
|
||||
{r.distributionDocument} — {r.distributionParcel}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label className="block">
|
||||
Rendimentos já considerados — MZN (incluindo eventual mais-valia
|
||||
da partilha)
|
||||
<input
|
||||
value={profit}
|
||||
onChange={(e) => setProfit(e.target.value)}
|
||||
/>
|
||||
</label>
|
||||
<label className="block">
|
||||
Crédito nominal já acrescido — MZN
|
||||
<input
|
||||
value={credit}
|
||||
onChange={(e) => setCredit(e.target.value)}
|
||||
/>
|
||||
</label>
|
||||
<label className="block">
|
||||
Suporte da reconciliação
|
||||
<textarea
|
||||
value={reference}
|
||||
onChange={(e) => setReference(e.target.value)}
|
||||
/>
|
||||
</label>
|
||||
{error && <p role="alert">{error}</p>}
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
try {
|
||||
const source = sources.find((r) => r.id === selected);
|
||||
if (!source)
|
||||
throw Error('Escolha explicitamente uma origem.');
|
||||
const next = prepareEconomicInclusion(book, {
|
||||
source,
|
||||
profitAlreadyIncluded: profit,
|
||||
creditAlreadyIncluded: credit,
|
||||
reference,
|
||||
});
|
||||
const model = calculateEconomicInclusions(
|
||||
next.economicInclusions!,
|
||||
next.base!.subjectNuit,
|
||||
next.year,
|
||||
);
|
||||
setPreview({
|
||||
fingerprint,
|
||||
book: next,
|
||||
net: economicInclusionMoney(model.net),
|
||||
});
|
||||
setError('');
|
||||
} catch (e) {
|
||||
setPreview(null);
|
||||
setError(String(e));
|
||||
}
|
||||
}}
|
||||
>
|
||||
Pré-visualizar inclusão/correcção
|
||||
</button>
|
||||
{preview && preview.fingerprint === fingerprint && (
|
||||
<div className="space-y-2 rounded border p-3">
|
||||
<p>
|
||||
Efeito total deste mapa no lucro tributável:{' '}
|
||||
{preview.net} MZN. Substitui as parcelas da mesma
|
||||
origem, sem as acumular.
|
||||
</p>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
if (preview.fingerprint !== fingerprint) return;
|
||||
save(preview.book);
|
||||
setPreview(null);
|
||||
}}
|
||||
>
|
||||
Confirmar preparação em L6
|
||||
</button>
|
||||
<button type="button" onClick={() => setPreview(null)}>
|
||||
Cancelar prévia
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -110,7 +110,10 @@ export function SimulationIrpcEconomic({
|
||||
rowChange({ ...r, ...v });
|
||||
const prefix = 'Crédito económico ' + (i + 1) + ' — ';
|
||||
const field = (
|
||||
key: Exclude<keyof EconomicPosition, 'previousUse'>,
|
||||
key: Exclude<
|
||||
keyof EconomicPosition,
|
||||
'previousUse' | 'liquidation' | 'association'
|
||||
>,
|
||||
label: string,
|
||||
) => (
|
||||
<label key={key} className="block">
|
||||
@@ -145,9 +148,7 @@ export function SimulationIrpcEconomic({
|
||||
</select>
|
||||
</label>
|
||||
);
|
||||
const outside =
|
||||
(!!r.kind && r.kind !== 'ordinary_profit') ||
|
||||
r.article40 === 'yes';
|
||||
const outside = r.article40 === 'yes';
|
||||
const detail = (
|
||||
<>
|
||||
{(
|
||||
@@ -226,7 +227,60 @@ export function SimulationIrpcEconomic({
|
||||
'Suporte da quota proporcional da colecta',
|
||||
],
|
||||
] as const
|
||||
).map(([key, label]) => field(key, label))}
|
||||
)
|
||||
.filter(
|
||||
([key]) =>
|
||||
r.nationalMethod !== 'proportional' ||
|
||||
(key !== 'nationalLimit' &&
|
||||
key !== 'nationalLimitReference'),
|
||||
)
|
||||
.map(([key, label]) => field(key, label))}
|
||||
<label className="block">
|
||||
Quota proporcional
|
||||
<select
|
||||
aria-label={prefix + 'Método da quota'}
|
||||
value={r.nationalMethod ?? 'documented'}
|
||||
onChange={(e) =>
|
||||
patch({
|
||||
nationalMethod: e.target
|
||||
.value as EconomicPosition['nationalMethod'],
|
||||
})
|
||||
}
|
||||
>
|
||||
<option value="documented">
|
||||
Limite documentado
|
||||
</option>
|
||||
<option value="proportional">
|
||||
Derivar da colecta L6 ordinária
|
||||
</option>
|
||||
</select>
|
||||
</label>
|
||||
{r.nationalMethod === 'proportional' && (
|
||||
<label className="block">
|
||||
Correspondência dos lucros mais acréscimo53 na
|
||||
base corrente
|
||||
<textarea
|
||||
aria-label={
|
||||
prefix + 'Correspondência da quota'
|
||||
}
|
||||
value={r.nationalBasisReference ?? ''}
|
||||
onChange={(e) =>
|
||||
patch({
|
||||
nationalBasisReference:
|
||||
e.target.value,
|
||||
})
|
||||
}
|
||||
/>
|
||||
<span className="block">
|
||||
Quota = colecta L6 × (lucros incluídos +
|
||||
crédito nominal acrescido) / matéria
|
||||
colectável L6. Não altera a base nem
|
||||
acrescenta o crédito novamente. O limite
|
||||
manual anterior fica conservado, mas não é
|
||||
usado neste modo.
|
||||
</span>
|
||||
</label>
|
||||
)}
|
||||
{choice(
|
||||
'incomeIncluded',
|
||||
'Lucros ilíquidos e acréscimo incluídos na base corrente',
|
||||
@@ -339,6 +393,155 @@ export function SimulationIrpcEconomic({
|
||||
</option>
|
||||
</select>
|
||||
</label>
|
||||
{r.kind === 'association' && (
|
||||
<fieldset className="space-y-2 rounded border p-3">
|
||||
<legend>Associação — art.64(4)</legend>
|
||||
<label className="block">
|
||||
Modalidade
|
||||
<select
|
||||
aria-label={
|
||||
prefix + 'Modalidade da associação'
|
||||
}
|
||||
value={r.association?.kind ?? ''}
|
||||
onChange={(e) =>
|
||||
patch({
|
||||
association: {
|
||||
kind: e.target.value as
|
||||
| ''
|
||||
| 'participation'
|
||||
| 'quota',
|
||||
effectivelyTaxed:
|
||||
r.association
|
||||
?.effectivelyTaxed ??
|
||||
'',
|
||||
reference:
|
||||
r.association
|
||||
?.reference ?? '',
|
||||
},
|
||||
})
|
||||
}
|
||||
>
|
||||
<option value="">
|
||||
Escolha a modalidade
|
||||
</option>
|
||||
<option value="participation">
|
||||
Em participação
|
||||
</option>
|
||||
<option value="quota">À quota</option>
|
||||
</select>
|
||||
</label>
|
||||
{r.association?.kind === 'participation' && (
|
||||
<label className="block">
|
||||
Rendimentos distribuídos efectivamente
|
||||
tributados
|
||||
<select
|
||||
aria-label={
|
||||
prefix +
|
||||
'Tributação efectiva da participação'
|
||||
}
|
||||
value={
|
||||
r.association.effectivelyTaxed
|
||||
}
|
||||
onChange={(e) =>
|
||||
patch({
|
||||
association: {
|
||||
...r.association!,
|
||||
effectivelyTaxed: e
|
||||
.target.value as
|
||||
| ''
|
||||
| 'yes'
|
||||
| 'no',
|
||||
},
|
||||
})
|
||||
}
|
||||
>
|
||||
<option value="">
|
||||
Informação em falta
|
||||
</option>
|
||||
<option value="yes">
|
||||
Sim — documentado
|
||||
</option>
|
||||
<option value="no">
|
||||
Não — documentado
|
||||
</option>
|
||||
</select>
|
||||
</label>
|
||||
)}
|
||||
<label className="block">
|
||||
Suporte do contrato, rendimentos e adaptação
|
||||
do crédito
|
||||
<input
|
||||
aria-label={
|
||||
prefix + 'Suporte da associação'
|
||||
}
|
||||
value={r.association?.reference ?? ''}
|
||||
onChange={(e) =>
|
||||
patch({
|
||||
association: {
|
||||
kind: '',
|
||||
effectivelyTaxed: '',
|
||||
...r.association,
|
||||
reference: e.target.value,
|
||||
},
|
||||
})
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
</fieldset>
|
||||
)}
|
||||
{r.kind === 'liquidation' && (
|
||||
<fieldset className="space-y-2 rounded border p-3">
|
||||
<legend>
|
||||
Partilha em liquidação — art.64(3)
|
||||
</legend>
|
||||
<p>
|
||||
No rendimento abaixo indique a diferença
|
||||
positiva classificada documentalmente como
|
||||
aplicação de capitais. O crédito limita-se
|
||||
também ao valor atribuído menos entradas
|
||||
efectivas para capital. O excesso mantém
|
||||
tratamento próprio de mais-valia; não
|
||||
integra a quota económica. Confirme a
|
||||
inclusão L6 e o IRPC correspondente apenas à
|
||||
parcela elegível.
|
||||
</p>
|
||||
{(
|
||||
[
|
||||
[
|
||||
'attributed',
|
||||
'Valor atribuído na partilha — MZN',
|
||||
],
|
||||
[
|
||||
'paidInCapital',
|
||||
'Entradas efectivas para capital na contabilidade da liquidada — MZN',
|
||||
],
|
||||
[
|
||||
'reference',
|
||||
'Suporte da partilha e classificação do rendimento',
|
||||
],
|
||||
] as const
|
||||
).map(([key, label]) => (
|
||||
<label key={key} className="block">
|
||||
{label}
|
||||
<input
|
||||
aria-label={prefix + label}
|
||||
value={r.liquidation?.[key] ?? ''}
|
||||
onChange={(e) =>
|
||||
patch({
|
||||
liquidation: {
|
||||
attributed: '',
|
||||
paidInCapital: '',
|
||||
reference: '',
|
||||
...r.liquidation,
|
||||
[key]: e.target.value,
|
||||
},
|
||||
})
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
))}
|
||||
</fieldset>
|
||||
)}
|
||||
{residentConfirmed && r.recipientResident === 'yes' ? (
|
||||
<p>
|
||||
Residência do beneficiário reutilizada da
|
||||
|
||||
@@ -4,6 +4,7 @@ import { SimulationIrpcPeriodFx } from '@/components/simulation-irpc-period-fx';
|
||||
import { SimulationIrpcDepreciation } from '@/components/simulation-irpc-depreciation';
|
||||
import { SimulationIrpcCosts } from '@/components/simulation-irpc-costs';
|
||||
import { SimulationIrpcSchedules } from '@/components/simulation-irpc-schedules';
|
||||
import { SimulationIrpcEconomicInclusion } from '@/components/simulation-irpc-economic-inclusion';
|
||||
import { SimulationIrpcAssessment } from '@/components/simulation-irpc-assessment';
|
||||
import { useState } from 'react';
|
||||
import { SimulationIrpcTaxableBase } from '@/components/simulation-irpc-taxable-base';
|
||||
@@ -438,6 +439,16 @@ export function SimulationIrpcNormal({
|
||||
)}
|
||||
<SimulationIrpcPeriodFx draft={draft} book={b} save={save} />
|
||||
<SimulationIrpcSchedules book={b} save={save} />
|
||||
<SimulationIrpcEconomicInclusion
|
||||
key={JSON.stringify([
|
||||
draft.context_opportunity,
|
||||
b.base?.subjectNuit,
|
||||
b.year,
|
||||
])}
|
||||
draft={draft}
|
||||
book={b}
|
||||
save={save}
|
||||
/>
|
||||
<SimulationIrpcDepreciation
|
||||
draft={draft}
|
||||
book={b}
|
||||
|
||||
@@ -1193,6 +1193,13 @@ export function calculateAnnual(d: Record<string, unknown>, b: AnnualBook) {
|
||||
b.assessmentKey,
|
||||
colecta,
|
||||
issues,
|
||||
{
|
||||
ordinary:
|
||||
assessment?.kind === 'normal' &&
|
||||
assessment.current &&
|
||||
assessment.key === b.assessmentKey,
|
||||
taxableBase: assessment?.record?.model.taxableBase ?? null,
|
||||
},
|
||||
);
|
||||
pending.push(
|
||||
...m.pending.map(
|
||||
@@ -1202,6 +1209,22 @@ export function calculateAnnual(d: Record<string, unknown>, b: AnnualBook) {
|
||||
return m;
|
||||
}) ?? [];
|
||||
if (b.economicCredits) {
|
||||
if (
|
||||
currentBase &&
|
||||
cmp(
|
||||
addFractions(
|
||||
economicRows.flatMap((r) =>
|
||||
r.nationalDerivation
|
||||
? [r.nationalDerivation.included]
|
||||
: [],
|
||||
),
|
||||
),
|
||||
currentBase,
|
||||
) > 0n
|
||||
)
|
||||
pending.push(
|
||||
'As parcelas económicas com quotas derivadas excedem em conjunto a matéria colectável; reconcilie os lucros e acréscimos por origem.',
|
||||
);
|
||||
if (b.economicCredits.rows.length && assessment?.kind !== 'normal')
|
||||
pending.push(
|
||||
'Crédito económico delimitado à colecta normal corrente;efeitos L7 exigem correspondência própria.',
|
||||
@@ -1390,7 +1413,7 @@ export function calculateAnnual(d: Record<string, unknown>, b: AnnualBook) {
|
||||
limitations: [
|
||||
...(b.economicCredits
|
||||
? [
|
||||
'Crédito económico ordinário:IRPC correspondente aos lucros,acréscimo53 já incluído e quota proporcional documentados. Sem cálculo automático da inclusão ou da exclusão40;liquidação64(3),associações64(4),benefícios e regras especiais separados. Sem reembolso ou transporte económico presumidos.',
|
||||
'Crédito económico: IRPC correspondente, inclusão/acréscimo53 e quota proporcional reconciliados com a colecta corrente. Partilha64(3) separa rendimento elegível e excesso com natureza de mais-valia; associações64(4) têm modalidade/adaptação próprias. Preparação L6 é explícita; exclusão40, benefícios e restantes regras mantêm âmbito próprio. Sem reembolso ou transporte económico presumidos.',
|
||||
]
|
||||
: []),
|
||||
...(b.creditCarry
|
||||
@@ -1598,6 +1621,51 @@ export function annualReportRows(
|
||||
r.input.grossUpIncluded +
|
||||
' MZN;quota proporcional: ' +
|
||||
show(r.nationalLimit) +
|
||||
(r.nationalDerivation
|
||||
? '; derivação L6: colecta ' +
|
||||
show(r.nationalDerivation.colecta) +
|
||||
' × lucros mais acréscimo53 ' +
|
||||
show(
|
||||
r.nationalDerivation.included,
|
||||
) +
|
||||
' / matéria colectável ' +
|
||||
show(
|
||||
r.nationalDerivation
|
||||
.taxableBase,
|
||||
) +
|
||||
'; exacta ' +
|
||||
r.nationalLimit?.numerator +
|
||||
'/' +
|
||||
r.nationalLimit?.denominator
|
||||
: '') +
|
||||
(r.liquidation
|
||||
? '; partilha64(3): valor atribuído ' +
|
||||
show(r.liquidation.attributed) +
|
||||
'; entradas efectivas ' +
|
||||
show(r.liquidation.paidInCapital) +
|
||||
'; limite ' +
|
||||
show(r.liquidation.ceiling) +
|
||||
'; rendimento elegível ' +
|
||||
show(r.liquidation.eligibleIncome) +
|
||||
'; excesso com natureza de mais-valia ' +
|
||||
show(
|
||||
r.liquidation.excessCapitalGain,
|
||||
) +
|
||||
'; ' +
|
||||
r.liquidation.version +
|
||||
'; ' +
|
||||
r.liquidation.reference
|
||||
: '') +
|
||||
(r.association
|
||||
? '; ' +
|
||||
r.association.version +
|
||||
'; modalidade ' +
|
||||
r.association.kind +
|
||||
'; tributação efectiva ' +
|
||||
r.association.effectivelyTaxed +
|
||||
'; ' +
|
||||
r.association.reference
|
||||
: '') +
|
||||
';elegível: ' +
|
||||
show(r.eligible) +
|
||||
';uso efectivo anterior: ' +
|
||||
@@ -1616,7 +1684,12 @@ export function annualReportRows(
|
||||
';53: ' +
|
||||
r.input.grossUpReference +
|
||||
';quota: ' +
|
||||
r.input.nationalLimitReference +
|
||||
(r.nationalDerivation
|
||||
? r.nationalDerivation.version +
|
||||
'; correspondência: ' +
|
||||
r.nationalDerivation.reference +
|
||||
'; limite manual anterior conservado, não utilizado'
|
||||
: r.input.nationalLimitReference) +
|
||||
';uso: ' +
|
||||
r.input.previousUse.reference,
|
||||
] as [string, string, string, string],
|
||||
|
||||
@@ -51,6 +51,18 @@ export type EconomicPosition = {
|
||||
grossUpReference: string;
|
||||
nationalLimit: string;
|
||||
nationalLimitReference: string;
|
||||
association?: {
|
||||
kind: '' | 'participation' | 'quota';
|
||||
effectivelyTaxed: Choice;
|
||||
reference: string;
|
||||
};
|
||||
liquidation?: {
|
||||
attributed: string;
|
||||
paidInCapital: string;
|
||||
reference: string;
|
||||
};
|
||||
nationalMethod?: 'documented' | 'proportional';
|
||||
nationalBasisReference?: string;
|
||||
previousUse: CreditEvidence;
|
||||
};
|
||||
export type EconomicCredits = {
|
||||
@@ -113,12 +125,37 @@ export function validateEconomic(c: EconomicCredits) {
|
||||
throw Error(
|
||||
'Crédito económico não recuperável; originais conservados.',
|
||||
);
|
||||
for (const r of c.rows)
|
||||
if (
|
||||
r?.liquidation !== undefined &&
|
||||
(!r.liquidation ||
|
||||
['attributed', 'paidInCapital', 'reference'].some(
|
||||
(k) =>
|
||||
typeof (
|
||||
r.liquidation as unknown as Record<string, unknown>
|
||||
)[k] !== 'string',
|
||||
))
|
||||
)
|
||||
throw Error('Partilha não recuperável; originais conservados.');
|
||||
for (const r of c.rows)
|
||||
if (
|
||||
r?.association !== undefined &&
|
||||
(!r.association ||
|
||||
!['', 'participation', 'quota'].includes(r.association.kind) ||
|
||||
!['', 'yes', 'no'].includes(r.association.effectivelyTaxed) ||
|
||||
typeof r.association.reference !== 'string')
|
||||
)
|
||||
throw Error('Associação não recuperável; originais conservados.');
|
||||
const keys = Object.keys(newEconomicPosition('')).filter(
|
||||
(k) => k !== 'previousUse',
|
||||
);
|
||||
for (const r of c.rows)
|
||||
if (
|
||||
!r ||
|
||||
(r.nationalMethod !== undefined &&
|
||||
!['documented', 'proportional'].includes(r.nationalMethod)) ||
|
||||
(r.nationalBasisReference !== undefined &&
|
||||
typeof r.nationalBasisReference !== 'string') ||
|
||||
keys.some(
|
||||
(k) =>
|
||||
typeof (r as unknown as Record<string, unknown>)[k] !==
|
||||
@@ -201,6 +238,57 @@ export function economicGroupPending(c: EconomicCredits) {
|
||||
);
|
||||
return pending;
|
||||
}
|
||||
export function economicIncome(r: EconomicPosition) {
|
||||
const income = creditMoney(r.income);
|
||||
if (r.kind === 'ordinary_profit') return { income };
|
||||
if (r.kind === 'association') {
|
||||
const a = r.association;
|
||||
if (!a?.kind || !a.reference.trim())
|
||||
throw Error(
|
||||
'Identifique associação em participação ou à quota e o suporte da adaptação64(4).',
|
||||
);
|
||||
if (a.kind === 'participation' && a.effectivelyTaxed !== 'yes')
|
||||
throw Error(
|
||||
'Associação em participação exige rendimentos distribuídos efectivamente tributados; desconhecido não significa sim.',
|
||||
);
|
||||
return {
|
||||
income,
|
||||
association: {
|
||||
version: 'IRPC-economic-association/1',
|
||||
...structuredClone(a),
|
||||
},
|
||||
};
|
||||
}
|
||||
if (r.kind !== 'liquidation')
|
||||
throw Error('Natureza económica por identificar.');
|
||||
if (!r.liquidation?.reference.trim())
|
||||
throw Error(
|
||||
'Partilha64(3): identifique o valor atribuído, entradas efectivas para capital e classificação documental do rendimento.',
|
||||
);
|
||||
const attributed = creditMoney(r.liquidation.attributed),
|
||||
paidInCapital = creditMoney(r.liquidation.paidInCapital);
|
||||
if (creditCompare(income, attributed) > 0n)
|
||||
throw Error(
|
||||
'Rendimento da partilha não pode exceder o valor atribuído.',
|
||||
);
|
||||
const difference = subtractFractions(attributed, paidInCapital);
|
||||
const ceiling =
|
||||
creditCompare(difference, zero()) > 0n ? difference : zero();
|
||||
const eligibleIncome = minimum(income, ceiling);
|
||||
return {
|
||||
income: eligibleIncome,
|
||||
liquidation: {
|
||||
version: 'IRPC-economic-liquidation/1',
|
||||
attributed,
|
||||
paidInCapital,
|
||||
capitalIncome: income,
|
||||
ceiling,
|
||||
eligibleIncome,
|
||||
excessCapitalGain: subtractFractions(income, eligibleIncome),
|
||||
reference: r.liquidation.reference,
|
||||
},
|
||||
};
|
||||
}
|
||||
export function economicPosition(
|
||||
r: EconomicPosition,
|
||||
subjectNuit: string,
|
||||
@@ -208,6 +296,7 @@ export function economicPosition(
|
||||
assessmentKey: string,
|
||||
colecta: FiscalFraction | null,
|
||||
proofIssues: string[],
|
||||
basis?: { ordinary: boolean; taxableBase: FiscalFraction | null },
|
||||
) {
|
||||
const pending = [...proofIssues];
|
||||
let nominal: FiscalFraction | null = null,
|
||||
@@ -216,6 +305,15 @@ export function economicPosition(
|
||||
previousUse: FiscalFraction | null = null,
|
||||
available: FiscalFraction | null = null,
|
||||
included: FiscalFraction | null = null;
|
||||
let liquidation: ReturnType<typeof economicIncome>['liquidation'];
|
||||
let association: ReturnType<typeof economicIncome>['association'];
|
||||
let nationalDerivation: {
|
||||
version: string;
|
||||
included: FiscalFraction;
|
||||
taxableBase: FiscalFraction;
|
||||
colecta: FiscalFraction;
|
||||
reference: string;
|
||||
} | null = null;
|
||||
let status: 'qualified' | 'outside_scope' | 'indeterminate' =
|
||||
'indeterminate';
|
||||
try {
|
||||
@@ -230,10 +328,12 @@ export function economicPosition(
|
||||
throw Error(
|
||||
'Titular, entidade distribuidora, exercício2026 e MZN por corresponder.',
|
||||
);
|
||||
if (r.kind !== 'ordinary_profit') {
|
||||
if (
|
||||
!['ordinary_profit', 'liquidation', 'association'].includes(r.kind)
|
||||
) {
|
||||
status = r.kind ? 'outside_scope' : 'indeterminate';
|
||||
throw Error(
|
||||
'Lucros ordinários64(1–2) por identificar; liquidação64(3) e associações64(4) exigem correspondência específica, sem converter a parcela em crédito internacional.',
|
||||
'Identifique lucros ordinários64(1–2), partilha64(3) ou associação64(4), com correspondência própria; não converter a parcela em crédito internacional.',
|
||||
);
|
||||
}
|
||||
if (
|
||||
@@ -272,8 +372,11 @@ export function economicPosition(
|
||||
throw Error(
|
||||
'Confirme a inclusão dos lucros ilíquidos de retenção e a correspondência com a colecta corrente; a origem pode ter mudado.',
|
||||
);
|
||||
const qualified = economicIncome(r);
|
||||
liquidation = qualified.liquidation;
|
||||
association = qualified.association;
|
||||
const tax = economicTaxProof(r),
|
||||
income = creditMoney(r.income);
|
||||
income = qualified.income;
|
||||
nominal = fraction(
|
||||
BigInt(tax.value.numerator) * 3n,
|
||||
BigInt(tax.value.denominator) * 5n,
|
||||
@@ -293,9 +396,41 @@ export function economicPosition(
|
||||
'Acréscimo53(1)a incluído na base deve corresponder ao crédito nominal60%; reconcilie L6 sem alterar a colecta ou o histórico automaticamente.',
|
||||
);
|
||||
included = addFractions([income, nominal]);
|
||||
nationalLimit = creditLimit(r.nationalLimit);
|
||||
if (r.nationalMethod === 'proportional') {
|
||||
if (
|
||||
!basis?.ordinary ||
|
||||
!basis.taxableBase ||
|
||||
creditCompare(basis.taxableBase, zero()) <= 0n ||
|
||||
!colecta ||
|
||||
creditCompare(colecta, zero()) < 0n ||
|
||||
!r.nationalBasisReference?.trim()
|
||||
)
|
||||
throw Error(
|
||||
'Quota económica derivada exige colecta L6 ordinária corrente, matéria colectável positiva e correspondência dos lucros mais acréscimo53 já incluídos.',
|
||||
);
|
||||
if (creditCompare(included, basis.taxableBase) > 0n)
|
||||
throw Error(
|
||||
'Lucros mais acréscimo53 excedem a matéria colectável; reconcilie a inclusão antes de derivar a quota.',
|
||||
);
|
||||
nationalLimit = fraction(
|
||||
BigInt(colecta.numerator) *
|
||||
BigInt(included.numerator) *
|
||||
BigInt(basis.taxableBase.denominator),
|
||||
BigInt(colecta.denominator) *
|
||||
BigInt(included.denominator) *
|
||||
BigInt(basis.taxableBase.numerator),
|
||||
);
|
||||
nationalDerivation = {
|
||||
version: 'IRPC-economic-quota/1',
|
||||
included,
|
||||
taxableBase: structuredClone(basis.taxableBase),
|
||||
colecta: structuredClone(colecta),
|
||||
reference: r.nationalBasisReference,
|
||||
};
|
||||
} else nationalLimit = creditLimit(r.nationalLimit);
|
||||
if (
|
||||
!r.nationalLimitReference.trim() ||
|
||||
(r.nationalMethod !== 'proportional' &&
|
||||
!r.nationalLimitReference.trim()) ||
|
||||
!colecta ||
|
||||
creditCompare(nationalLimit, colecta) > 0n ||
|
||||
(creditCompare(included, zero()) === 0n &&
|
||||
@@ -327,6 +462,9 @@ export function economicPosition(
|
||||
id: r.id,
|
||||
nominal,
|
||||
nationalLimit,
|
||||
...(nationalDerivation ? { nationalDerivation } : {}),
|
||||
...(liquidation ? { liquidation } : {}),
|
||||
...(association ? { association } : {}),
|
||||
eligible,
|
||||
previousUse,
|
||||
available,
|
||||
@@ -354,7 +492,17 @@ export function economicDeduction(
|
||||
deducted,
|
||||
afterCredit:
|
||||
deducted && colecta ? subtractFractions(colecta, deducted) : null,
|
||||
source: economicSource,
|
||||
source:
|
||||
economicSource +
|
||||
(rows.some((r) => r.association)
|
||||
? ' IRPC-economic-association/1:CIRPC64(4), associação em participação com tributação efectiva documentada ou associação à quota, com adaptação, inclusão L6 e imposto correspondente expressamente suportados.'
|
||||
: '') +
|
||||
(rows.some((r) => r.liquidation)
|
||||
? ' IRPC-economic-liquidation/1:CIRPC64(3); rendimento de capitais documentado limitado à diferença positiva entre valor atribuído e entradas efectivas para capital. Excesso separado como mais-valia, sem crédito económico sobre essa parcela; inclusão L6 e imposto subjacente exigem correspondência expressa.'
|
||||
: '') +
|
||||
(rows.some((r) => r.nationalDerivation)
|
||||
? ' IRPC-economic-quota/1:quota ordinária derivada da colecta e matéria colectável L6 com lucros mais acréscimo53 já correspondidos;sem alterar a base ou o acréscimo.'
|
||||
: ''),
|
||||
officialBalancesConsumed: false,
|
||||
carryCreated: false,
|
||||
};
|
||||
|
||||
@@ -0,0 +1,278 @@
|
||||
import { canonicalParcel } from './fiscal-proof-parcel.ts';
|
||||
import type { NormalBook } from './irpc-normal.ts';
|
||||
import {
|
||||
economicTaxProof,
|
||||
economicDistributionIdentity,
|
||||
economicIncome,
|
||||
validateEconomic,
|
||||
type EconomicPosition,
|
||||
} from './irpc-economic-credit.ts';
|
||||
import {
|
||||
creditMoney,
|
||||
creditLimit,
|
||||
creditCompare,
|
||||
} from './irpc-international-credit.ts';
|
||||
import {
|
||||
addFractions,
|
||||
subtractFractions,
|
||||
fraction,
|
||||
type FiscalFraction,
|
||||
} from './fiscal-rational.ts';
|
||||
|
||||
export type EconomicInclusion = {
|
||||
source: EconomicPosition;
|
||||
profitAlreadyIncluded: string;
|
||||
creditAlreadyIncluded: string;
|
||||
reference: string;
|
||||
};
|
||||
export type EconomicInclusions = { version: 1; rows: EconomicInclusion[] };
|
||||
export const economicInclusionVersion = 'IRPC-economic-inclusion/1';
|
||||
export function validateEconomicInclusions(input: EconomicInclusions) {
|
||||
if (
|
||||
input?.version !== 1 ||
|
||||
!Array.isArray(input.rows) ||
|
||||
input.rows.some(
|
||||
(r) =>
|
||||
!r ||
|
||||
typeof r.profitAlreadyIncluded !== 'string' ||
|
||||
typeof r.creditAlreadyIncluded !== 'string' ||
|
||||
typeof r.reference !== 'string',
|
||||
)
|
||||
)
|
||||
throw Error('Inclusões económicas não recuperáveis.');
|
||||
validateEconomic({
|
||||
version: 1,
|
||||
state: 'known',
|
||||
reference: economicInclusionVersion,
|
||||
rows: input.rows.map((r) => r.source),
|
||||
});
|
||||
}
|
||||
export function economicInclusionMoney(value: FiscalFraction): string {
|
||||
const n = BigInt(value.numerator) * 100n,
|
||||
d = BigInt(value.denominator);
|
||||
if (n % d !== 0n)
|
||||
throw Error(
|
||||
'Correcção com fracção de cêntimo exige tratamento próprio; não arredondar por presunção.',
|
||||
);
|
||||
const cents = n / d,
|
||||
absolute = cents < 0n ? -cents : cents;
|
||||
return (
|
||||
(cents < 0n ? '-' : '') +
|
||||
absolute / 100n +
|
||||
'.' +
|
||||
(absolute % 100n).toString().padStart(2, '0')
|
||||
);
|
||||
}
|
||||
export function calculateEconomicInclusions(
|
||||
input: EconomicInclusions,
|
||||
subject: string,
|
||||
year: string,
|
||||
) {
|
||||
validateEconomicInclusions(input);
|
||||
const pending: string[] = [];
|
||||
const effects: {
|
||||
id: string;
|
||||
topic: string;
|
||||
amount: FiscalFraction | null;
|
||||
effect: FiscalFraction | null;
|
||||
reason: string;
|
||||
}[] = [];
|
||||
const seen = new Set<string>();
|
||||
for (const row of input.rows) {
|
||||
const r = row.source;
|
||||
try {
|
||||
if (
|
||||
!r ||
|
||||
!['ordinary_profit', 'liquidation', 'association'].includes(
|
||||
r.kind,
|
||||
) ||
|
||||
!r.id.trim() ||
|
||||
!/^\d{9}$/.test(r.payerNuit) ||
|
||||
r.subjectNuit !== subject ||
|
||||
r.year !== year ||
|
||||
year !== '2026' ||
|
||||
r.recipientResident !== 'yes' ||
|
||||
r.payerResident !== 'yes' ||
|
||||
r.payerIrpc !== 'yes' ||
|
||||
r.payerExempt !== 'no' ||
|
||||
r.article40 !== 'no' ||
|
||||
!r.qualificationReference?.trim() ||
|
||||
!r.article40Reference?.trim() ||
|
||||
!row.reference?.trim() ||
|
||||
!r.distributionDocument?.trim() ||
|
||||
!r.distributionParcel?.trim() ||
|
||||
!/^2026-\d{2}-\d{2}$/.test(r.distributionDate) ||
|
||||
new Date(r.distributionDate).toISOString().slice(0, 10) !==
|
||||
r.distributionDate
|
||||
)
|
||||
throw Error(
|
||||
'Falta qualificação, origem, titular/exercício ou correspondência da inclusão; art40 e outros âmbitos separados.',
|
||||
);
|
||||
const identity =
|
||||
r.distributionDocument.trim().toUpperCase() +
|
||||
'|' +
|
||||
r.distributionParcel.trim().toUpperCase();
|
||||
const taxIdentity = JSON.stringify([
|
||||
canonicalParcel(r.taxIssuer),
|
||||
canonicalParcel(r.taxDocument),
|
||||
canonicalParcel(r.taxParcel),
|
||||
]);
|
||||
const distributionIdentity = economicDistributionIdentity(r);
|
||||
if (
|
||||
seen.has(distributionIdentity) ||
|
||||
seen.has('tax|' + taxIdentity)
|
||||
)
|
||||
throw Error(
|
||||
'Origem/parcela económica repetida; consolide antes de corrigir a base.',
|
||||
);
|
||||
seen.add(distributionIdentity);
|
||||
seen.add('tax|' + taxIdentity);
|
||||
const qualification = economicIncome(r);
|
||||
const tax = economicTaxProof(r).value;
|
||||
const nominal = fraction(
|
||||
BigInt(tax.numerator) * 3n,
|
||||
BigInt(tax.denominator) * 5n,
|
||||
);
|
||||
if (
|
||||
creditCompare(qualification.income, fraction(0n)) === 0n &&
|
||||
creditCompare(nominal, fraction(0n)) > 0n
|
||||
)
|
||||
throw Error(
|
||||
'Imposto subjacente positivo sem rendimento elegível para crédito económico.',
|
||||
);
|
||||
const specialReference = qualification.liquidation
|
||||
? `${qualification.liquidation.version}; rendimento elegível ${economicInclusionMoney(qualification.liquidation.eligibleIncome)}; excesso com natureza de mais-valia ${economicInclusionMoney(qualification.liquidation.excessCapitalGain)} incluído no rendimento total a reconciliar. ${qualification.liquidation.reference}`
|
||||
: qualification.association
|
||||
? `${qualification.association.version}; ${qualification.association.kind}; ${qualification.association.reference}`
|
||||
: '';
|
||||
const targets = [creditMoney(r.income), nominal];
|
||||
const included = [
|
||||
creditMoney(row.profitAlreadyIncluded),
|
||||
creditMoney(row.creditAlreadyIncluded),
|
||||
];
|
||||
if (
|
||||
r.incomeIncluded === 'yes' &&
|
||||
creditCompare(included[0], targets[0]) < 0n
|
||||
)
|
||||
throw Error(
|
||||
'A origem L8 declara os lucros já incluídos; o montante anterior indicado contradiz essa declaração. Compare e corrija a origem antes de acrescentar novamente.',
|
||||
);
|
||||
if (
|
||||
r.grossUpIncluded.trim() &&
|
||||
creditCompare(creditLimit(r.grossUpIncluded), included[1]) !==
|
||||
0n
|
||||
)
|
||||
throw Error(
|
||||
'O crédito já acrescido indicado não corresponde à origem L8; reconcilie a diferença antes de alterar a base.',
|
||||
);
|
||||
targets.forEach((target, index) => {
|
||||
const effect = subtractFractions(target, included[index]);
|
||||
economicInclusionMoney(effect);
|
||||
effects.push({
|
||||
id: identity + ':' + index,
|
||||
topic: 'incomeCorrections',
|
||||
amount: fraction(
|
||||
BigInt(effect.numerator) < 0n
|
||||
? -BigInt(effect.numerator)
|
||||
: BigInt(effect.numerator),
|
||||
BigInt(effect.denominator),
|
||||
),
|
||||
effect,
|
||||
reason: `${economicInclusionVersion}; CIRPC64(1–2)/53(1)a; ${index ? 'acréscimo nominal' : 'lucros'}: alvo ${economicInclusionMoney(target)}; já considerado ${economicInclusionMoney(included[index])}; diferença ${economicInclusionMoney(effect)}. ${row.reference}${specialReference ? ' ' + specialReference : ''}`,
|
||||
});
|
||||
});
|
||||
} catch (e) {
|
||||
pending.push(String(e));
|
||||
}
|
||||
}
|
||||
return {
|
||||
version: economicInclusionVersion,
|
||||
input: structuredClone(input),
|
||||
effects,
|
||||
pending,
|
||||
net: addFractions(effects.flatMap((e) => (e.effect ? [e.effect] : []))),
|
||||
};
|
||||
}
|
||||
export function prepareEconomicInclusion(
|
||||
book: NormalBook,
|
||||
row: EconomicInclusion,
|
||||
): NormalBook {
|
||||
if (
|
||||
book.special ||
|
||||
book.periodsFx ||
|
||||
(book.schedules && book.schedules.period.kind !== 'calendar') ||
|
||||
book.scope !== 'resident_general' ||
|
||||
book.year !== '2026' ||
|
||||
!book.base ||
|
||||
!book.profit
|
||||
)
|
||||
throw Error(
|
||||
'Prepare primeiro o lucro e a base L6 ordinária do sujeito/ano civil2026/MZN; períodos especiais e conversões têm correspondência própria.',
|
||||
);
|
||||
const old = book.economicInclusions ?? { version: 1 as const, rows: [] };
|
||||
const rows = old.rows.filter(
|
||||
(p) =>
|
||||
economicDistributionIdentity(p.source) !==
|
||||
economicDistributionIdentity(row.source),
|
||||
);
|
||||
const next: EconomicInclusions = {
|
||||
version: 1,
|
||||
rows: [...rows, structuredClone(row)],
|
||||
};
|
||||
const previous = calculateEconomicInclusions(
|
||||
old,
|
||||
book.base.subjectNuit,
|
||||
book.year,
|
||||
),
|
||||
prepared = calculateEconomicInclusions(
|
||||
next,
|
||||
book.base.subjectNuit,
|
||||
book.year,
|
||||
);
|
||||
if (previous.pending.length || prepared.pending.length)
|
||||
throw Error([...previous.pending, ...prepared.pending].join(' '));
|
||||
const topic = book.profit.topics.incomeCorrections;
|
||||
if (
|
||||
!topic.reference.trim() ||
|
||||
!['known', 'absent'].includes(topic.state) ||
|
||||
(topic.state === 'absent' && topic.amount.trim())
|
||||
)
|
||||
throw Error(
|
||||
'Reconcilie as outras correcções aos proveitos antes de substituir parcelas.',
|
||||
);
|
||||
const current =
|
||||
topic.state === 'absent' ? fraction(0n) : creditMoney(topic.amount);
|
||||
const remaining = subtractFractions(
|
||||
current,
|
||||
addFractions(
|
||||
previous.effects.flatMap((e) => (e.amount ? [e.amount] : [])),
|
||||
),
|
||||
);
|
||||
if (BigInt(remaining.numerator) < 0n)
|
||||
throw Error(
|
||||
'Montante de correcções inferior às parcelas anteriores; compare antes de substituir.',
|
||||
);
|
||||
const amount = addFractions([
|
||||
remaining,
|
||||
addFractions(
|
||||
prepared.effects.flatMap((e) => (e.amount ? [e.amount] : [])),
|
||||
),
|
||||
]);
|
||||
return {
|
||||
...book,
|
||||
economicInclusions: next,
|
||||
profit: {
|
||||
...book.profit,
|
||||
topics: {
|
||||
...book.profit.topics,
|
||||
incomeCorrections: {
|
||||
state: 'known',
|
||||
amount: economicInclusionMoney(amount),
|
||||
reference: topic.reference.includes(row.reference)
|
||||
? topic.reference
|
||||
: topic.reference + '\n' + row.reference,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -155,6 +155,17 @@ export function closeNormalProfit(
|
||||
schedules?: SchedulesModel,
|
||||
costs?: NormalCostsModel,
|
||||
depreciation?: NormalDepreciationModel,
|
||||
economic?: {
|
||||
effects: {
|
||||
id: string;
|
||||
topic: string;
|
||||
amount: FiscalFraction | null;
|
||||
effect: FiscalFraction | null;
|
||||
reason: string;
|
||||
}[];
|
||||
net: FiscalFraction;
|
||||
pending: string[];
|
||||
},
|
||||
): NormalProfitModel {
|
||||
validateNormalProfit(input);
|
||||
const pending: string[] = [],
|
||||
@@ -291,9 +302,10 @@ export function closeNormalProfit(
|
||||
const mapped = [
|
||||
...(schedules?.effects ?? []),
|
||||
...(costs?.effects ?? []),
|
||||
...(economic?.effects ?? []),
|
||||
].filter((e) => e.topic === key);
|
||||
const covered =
|
||||
(schedules || costs) &&
|
||||
(schedules || costs || economic) &&
|
||||
mapped.length > 0 &&
|
||||
mapped.every((e) => e.effect !== null) &&
|
||||
value !== null &&
|
||||
@@ -324,6 +336,7 @@ export function closeNormalProfit(
|
||||
}
|
||||
if (schedules) pending.push(...schedules.pending);
|
||||
if (costs) pending.push(...costs.pending);
|
||||
if (economic) pending.push(...economic.pending);
|
||||
if (depreciation && !schedules) pending.push(...depreciation.pending);
|
||||
return {
|
||||
input: structuredClone(input),
|
||||
@@ -335,6 +348,7 @@ export function closeNormalProfit(
|
||||
? addFractions([
|
||||
accounting,
|
||||
additions,
|
||||
...(economic ? [economic.net] : []),
|
||||
...(schedules ? [schedules.net] : []),
|
||||
...(costs ? [costs.net] : []),
|
||||
...(depreciation && !schedules && depreciation.adjustment
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import { inputText } from './input-text.ts';
|
||||
import {
|
||||
calculateEconomicInclusions,
|
||||
validateEconomicInclusions,
|
||||
type EconomicInclusions,
|
||||
} from './irpc-normal-economic.ts';
|
||||
import { irpcSpecialCombinationsVersion } from './irpc-special-combinations.ts';
|
||||
import {
|
||||
irpcSpecialVersion,
|
||||
@@ -104,6 +109,7 @@ export type NormalAdjustment = {
|
||||
reference: string;
|
||||
};
|
||||
export type NormalBook = {
|
||||
economicInclusions?: EconomicInclusions;
|
||||
version: 1;
|
||||
year: string;
|
||||
mappingReference: string;
|
||||
@@ -123,6 +129,7 @@ export type NormalBook = {
|
||||
history?: NormalRecord[];
|
||||
};
|
||||
export type NormalModel = {
|
||||
economicInclusions?: ReturnType<typeof calculateEconomicInclusions>;
|
||||
special?: SpecialModel;
|
||||
formPreparation?: NormalFormPreparationModel;
|
||||
periodsFx?: NormalPeriodFxModel;
|
||||
@@ -213,6 +220,8 @@ function store(d: Record<string, unknown>) {
|
||||
return s;
|
||||
}
|
||||
export function validateNormal(b: NormalBook) {
|
||||
if (b?.economicInclusions !== undefined)
|
||||
validateEconomicInclusions(b.economicInclusions);
|
||||
if (b?.special !== undefined) validateSpecial(b.special);
|
||||
if (b?.forms !== undefined) validateNormalFormPreparation(b.forms);
|
||||
if (b?.periodsFx !== undefined) validateNormalPeriodFx(b.periodsFx);
|
||||
@@ -333,6 +342,7 @@ function key(d: Record<string, unknown>, b: NormalBook) {
|
||||
b.scopeReference,
|
||||
b.rows,
|
||||
...(b.profit ? [b.profit] : []),
|
||||
...(b.economicInclusions ? [b.economicInclusions] : []),
|
||||
...(b.base ? [b.base] : []),
|
||||
...(b.assessment ? [b.assessment] : []),
|
||||
...(b.schedules ? [b.schedules] : []),
|
||||
@@ -569,6 +579,23 @@ export function calculateNormal(
|
||||
!!periodsFx?.short,
|
||||
)
|
||||
: undefined;
|
||||
const economicInclusions = b.economicInclusions
|
||||
? calculateEconomicInclusions(
|
||||
b.economicInclusions,
|
||||
b.base?.subjectNuit ?? '',
|
||||
b.year,
|
||||
)
|
||||
: undefined;
|
||||
if (
|
||||
economicInclusions &&
|
||||
(b.special ||
|
||||
b.periodsFx ||
|
||||
(b.schedules && b.schedules.period.kind !== 'calendar') ||
|
||||
b.scope !== 'resident_general')
|
||||
)
|
||||
economicInclusions.pending.push(
|
||||
'Inclusão económica automática delimitada à base ordinária residente/ano civil2026/MZN; este âmbito exige correspondência própria.',
|
||||
);
|
||||
const profit = b.profit
|
||||
? closeNormalProfit(
|
||||
b.profit,
|
||||
@@ -580,6 +607,7 @@ export function calculateNormal(
|
||||
schedules,
|
||||
costs,
|
||||
depreciation,
|
||||
economicInclusions,
|
||||
)
|
||||
: undefined;
|
||||
if (profit && periodsFx)
|
||||
@@ -677,6 +705,7 @@ export function calculateNormal(
|
||||
? addFractions([accountingProfit, additions])
|
||||
: null,
|
||||
taxableProfit: profit?.taxableProfit ?? null,
|
||||
...(economicInclusions ? { economicInclusions } : {}),
|
||||
taxableBase: base?.taxableBase ?? null,
|
||||
tax: null,
|
||||
rows,
|
||||
@@ -774,6 +803,18 @@ export function normalReportRows(
|
||||
if (!r) return [];
|
||||
const m = r.model;
|
||||
return [
|
||||
...(m.economicInclusions?.effects.map(
|
||||
(e) =>
|
||||
[
|
||||
'IRPC normal — L6',
|
||||
'Inclusão/correcção económica — ' + e.id,
|
||||
'Parcela reconciliada: ' +
|
||||
money(e.amount) +
|
||||
'; efeito com sinal: ' +
|
||||
money(e.effect),
|
||||
e.reason,
|
||||
] as [string, string, string, string],
|
||||
) ?? []),
|
||||
[
|
||||
'IRPC normal — L6',
|
||||
'Ajustamentos ao resultado financeiro',
|
||||
|
||||
Reference in New Issue
Block a user