IVA pela actividade: 5% do artigo 17-A para saúde e ensino, 16% para as restantes
Decisão do proprietário de 04/12/2026: o investidor não escolhe a taxa de IVA; ela decorre da actividade (CAE) do plano. Saúde privada (CAE 86), ensino privado reconhecido e formação profissional usam a taxa reduzida do artigo 17-A da Lei 22/2022; as restantes actividades usam a taxa geral. O IVA mensal das vendas mostra a taxa, a base legal e as condições da lei para o investidor confirmar. A taxa reduzida é uma versão governada própria (IVA-REDUZIDA-17A-BASE-LIQUIDA), com ficha em database/qa, registo QA por fiscal:qa-register-iva --reduced, pré-visualização QA e ligação por INVESTMOZ_IVA_REDUCED_RULE_ID/VERSION. Enquanto não estiver publicada, o IVA das actividades a 5% fica por determinar e nunca usa a taxa geral em substituição. Os resultados anteriores à taxa geral continuam actuais. Decisões e pendências da sessão registadas no manual existente. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MzJmxFy3izprXr5dSq91jM
This commit is contained in:
@@ -21,6 +21,7 @@ import {
|
||||
readMonthlyIvaSettings,
|
||||
recoverMonthlyIvaRecord,
|
||||
monthlyIvaCashTreatment,
|
||||
monthlyIvaTreatment,
|
||||
type MonthlyIvaInput,
|
||||
type MonthlyIvaSettings,
|
||||
} from '@/lib/monthly-iva';
|
||||
@@ -70,6 +71,11 @@ export function SimulationMonthlyIva({
|
||||
const [retry, setRetry] = useState(0);
|
||||
const [error, setError] = useState('');
|
||||
const [available, setAvailable] = useState<boolean | null>(null);
|
||||
const [reducedAvailable, setReducedAvailable] = useState<boolean | null>(
|
||||
null,
|
||||
);
|
||||
const treatment = monthlyIvaTreatment(draft);
|
||||
const reduced = treatment.operation === 'internal_reduced_17a_net';
|
||||
const attempt = useRef('');
|
||||
const mounted = useRef(true);
|
||||
const latestSnapshot = useRef(draft.monthly_iva_snapshot);
|
||||
@@ -118,7 +124,9 @@ export function SimulationMonthlyIva({
|
||||
.then(async (response) => {
|
||||
if (!response.ok) throw new Error();
|
||||
const payload = await response.json();
|
||||
if (active) setAvailable(payload?.data?.enabled === true);
|
||||
if (!active) return;
|
||||
setAvailable(payload?.data?.enabled === true);
|
||||
setReducedAvailable(payload?.data?.reduced_enabled === true);
|
||||
})
|
||||
.catch(() => {
|
||||
if (active)
|
||||
@@ -134,7 +142,10 @@ export function SimulationMonthlyIva({
|
||||
if (!settings.auto || busy || attempt.current === actionKey) return;
|
||||
if (
|
||||
!pendingRecord &&
|
||||
(!input || input.currency !== 'MZN' || !available || completed)
|
||||
(!input ||
|
||||
input.currency !== 'MZN' ||
|
||||
!(reduced ? reducedAvailable : available) ||
|
||||
completed)
|
||||
)
|
||||
return;
|
||||
const request = pendingRecord?.input ?? input!;
|
||||
@@ -177,7 +188,17 @@ export function SimulationMonthlyIva({
|
||||
})();
|
||||
}, 700);
|
||||
return () => window.clearTimeout(timer);
|
||||
}, [actionKey, key, settings.auto, busy, available, completed, retry]);
|
||||
}, [
|
||||
actionKey,
|
||||
key,
|
||||
settings.auto,
|
||||
busy,
|
||||
available,
|
||||
reducedAvailable,
|
||||
reduced,
|
||||
completed,
|
||||
retry,
|
||||
]);
|
||||
|
||||
const snapshot = record?.execution.result_snapshot;
|
||||
const projection = snapshot?.monthly_projection as
|
||||
@@ -205,10 +226,36 @@ export function SimulationMonthlyIva({
|
||||
/>
|
||||
<h3 className="font-semibold">IVA mensal das vendas projectadas</h3>
|
||||
<p>{source}</p>
|
||||
<div className="rounded border p-3 text-sm">
|
||||
<p className="font-medium">
|
||||
Taxa pela actividade do plano: {treatment.rate}% —{' '}
|
||||
{treatment.label} ({treatment.article})
|
||||
</p>
|
||||
{!treatment.fromActivity && (
|
||||
<p>
|
||||
Sem actividade (CAE) escolhida no plano financeiro,
|
||||
aplica-se a taxa geral. Escolha a actividade no plano
|
||||
para confirmar a taxa.
|
||||
</p>
|
||||
)}
|
||||
{reduced && (
|
||||
<>
|
||||
<p>Condições da lei para a taxa de 5%:</p>
|
||||
<ul className="list-disc pl-5">
|
||||
{treatment.conditions.map((condition) => (
|
||||
<li key={condition}>{condition}</li>
|
||||
))}
|
||||
</ul>
|
||||
</>
|
||||
)}
|
||||
<p>
|
||||
A taxa não é escolhida neste formulário: segue a actividade
|
||||
e o servidor usa a versão publicada correspondente.
|
||||
</p>
|
||||
</div>
|
||||
<p>
|
||||
Declare se os preços projectados são sem IVA ou com IVA
|
||||
incluído. Nenhuma taxa é fixada neste formulário; o servidor
|
||||
selecciona a versão publicada.
|
||||
incluído.
|
||||
</p>
|
||||
<label className="block">
|
||||
Primeiro mês da projecção
|
||||
@@ -248,14 +295,15 @@ export function SimulationMonthlyIva({
|
||||
saveSettings({ declared: event.target.checked })
|
||||
}
|
||||
/>{' '}
|
||||
Declaro que as vendas projectadas são tributáveis à taxa geral
|
||||
interna e não incluem as operações excluídas deste lote.
|
||||
{reduced
|
||||
? 'Declaro que as vendas projectadas cumprem as condições acima e não incluem as operações excluídas deste lote.'
|
||||
: 'Declaro que as vendas projectadas são tributáveis à taxa geral interna e não incluem as operações excluídas deste lote.'}
|
||||
</label>
|
||||
<p className="text-sm">
|
||||
Sem importações, taxas reduzidas, isenções, regimes especiais,
|
||||
deduções, reembolsos ou apuramento final. Valores com IVA
|
||||
incluído permanecem indeterminados neste lote; não se aplica a
|
||||
taxa ao preço bruto.
|
||||
Sem importações, isenções, regimes especiais, deduções,
|
||||
reembolsos ou apuramento final. Valores com IVA incluído
|
||||
permanecem indeterminados neste lote; não se aplica a taxa ao
|
||||
preço bruto.
|
||||
</p>
|
||||
<p className="text-sm">{monthlyIvaCashTreatment}</p>
|
||||
{!!draft.currency && draft.currency !== 'MZN' && (
|
||||
@@ -272,7 +320,14 @@ export function SimulationMonthlyIva({
|
||||
A consultar a disponibilidade da versão publicada…
|
||||
</p>
|
||||
)}
|
||||
{available === false && (
|
||||
{reduced && reducedAvailable === false && (
|
||||
<p role="status">
|
||||
A taxa de 5% (artigo 17-A) ainda não está publicada neste
|
||||
ambiente. O IVA destas vendas fica por determinar; não se
|
||||
usa a taxa geral em substituição.
|
||||
</p>
|
||||
)}
|
||||
{!reduced && available === false && (
|
||||
<p role="status">
|
||||
A versão publicada de IVA está indisponível neste ambiente
|
||||
para novas execuções. Os pressupostos e históricos
|
||||
@@ -308,7 +363,9 @@ export function SimulationMonthlyIva({
|
||||
disabled={
|
||||
busy ||
|
||||
(!pendingRecord &&
|
||||
(!available || !input || input.currency !== 'MZN'))
|
||||
(!(reduced ? reducedAvailable : available) ||
|
||||
!input ||
|
||||
input.currency !== 'MZN'))
|
||||
}
|
||||
onClick={() => {
|
||||
attempt.current = '';
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
import { operationTreatments } from './iva-operations.ts';
|
||||
|
||||
export type IvaActivityOperation =
|
||||
| 'internal_general_net'
|
||||
| 'internal_reduced_17a_net';
|
||||
|
||||
export type IvaActivityTreatment = {
|
||||
operation: IvaActivityOperation;
|
||||
rate: 16 | 5;
|
||||
label: string;
|
||||
article: string;
|
||||
conditions: string[];
|
||||
/** True when the plan has a documented activity; otherwise the general rate is only the default. */
|
||||
fromActivity: boolean;
|
||||
};
|
||||
|
||||
const treatment = (
|
||||
id: string,
|
||||
operation: IvaActivityOperation,
|
||||
fromActivity: boolean,
|
||||
): IvaActivityTreatment => {
|
||||
const row = operationTreatments.find((item) => item.id === id)!;
|
||||
return {
|
||||
operation,
|
||||
rate: operation === 'internal_general_net' ? 16 : 5,
|
||||
label: row.label,
|
||||
article: row.article,
|
||||
conditions: [...row.conditions],
|
||||
fromActivity,
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* IVA follows the activity, not a choice of rate (owner decision 04/12/2026).
|
||||
* CAE-Rev.2 subclasses that are the operations of artigo 15(10) take the
|
||||
* reduced rate of artigo 17-A; every other activity takes the general rate.
|
||||
* The conditions of the law are shown for the investor to confirm.
|
||||
*/
|
||||
export function ivaTreatmentForCae(code?: string | null): IvaActivityTreatment {
|
||||
const cae = (code ?? '').trim();
|
||||
if (/^86\d{3}$/.test(cae))
|
||||
return treatment('private_health', 'internal_reduced_17a_net', true);
|
||||
if (cae === '85492')
|
||||
return treatment('private_training', 'internal_reduced_17a_net', true);
|
||||
if (/^85(1\d{2}|2[12]\d|300)$/.test(cae))
|
||||
return treatment('private_education', 'internal_reduced_17a_net', true);
|
||||
return treatment('general', 'internal_general_net', cae !== '');
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { inputText } from './input-text.ts';
|
||||
import { ivaTreatmentForCae } from './iva-activity.ts';
|
||||
import {
|
||||
monthlyProjectedSales,
|
||||
restoreBusinessPlanSnapshot,
|
||||
@@ -18,6 +19,8 @@ export type MonthlyIvaInput = {
|
||||
sales_vat_basis: 'net' | 'included' | 'unknown';
|
||||
currency: string;
|
||||
scope_declared: boolean;
|
||||
/** Present only for the reduced rate of artigo 17-A; absent means the general rate. */
|
||||
operation?: 'internal_reduced_17a_net';
|
||||
};
|
||||
export type MonthlyIvaSettings = {
|
||||
start: string;
|
||||
@@ -117,8 +120,19 @@ export function monthlyIvaInput(
|
||||
sales_vat_basis: settings.basis,
|
||||
currency: inputText(draft.currency ?? ''),
|
||||
scope_declared: settings.declared,
|
||||
...(monthlyIvaTreatment(draft).operation === 'internal_reduced_17a_net'
|
||||
? { operation: 'internal_reduced_17a_net' as const }
|
||||
: {}),
|
||||
};
|
||||
}
|
||||
|
||||
/** The IVA of the plan's sales follows the activity declared in the plan (CAE). */
|
||||
export function monthlyIvaTreatment(draft: Record<string, unknown>) {
|
||||
const plan = draft.business_plan_snapshot
|
||||
? restoreBusinessPlanSnapshot(inputText(draft.business_plan_snapshot))
|
||||
: null;
|
||||
return ivaTreatmentForCae(plan?.economicClassification?.code);
|
||||
}
|
||||
export function monthlyIvaKey(
|
||||
input: Omit<MonthlyIvaInput, 'scenario_kind'>,
|
||||
): string {
|
||||
@@ -127,6 +141,8 @@ export function monthlyIvaKey(
|
||||
input.sales_vat_basis,
|
||||
input.scope_declared,
|
||||
input.monthly_sales.map((row) => [row.date, row.amount]),
|
||||
// General-rate keys stay as before, so earlier results remain current.
|
||||
...(input.operation ? [input.operation] : []),
|
||||
]);
|
||||
}
|
||||
export function readMonthlyIvaRecord(raw?: string): MonthlyIvaRecord | null {
|
||||
|
||||
Reference in New Issue
Block a user