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
97 lines
3.5 KiB
JavaScript
97 lines
3.5 KiB
JavaScript
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
import { serializeBusinessPlanSnapshot } from '../../resources/js/lib/business-financial-plan.ts';
|
|
import { ivaTreatmentForCae } from '../../resources/js/lib/iva-activity.ts';
|
|
import {
|
|
monthlyIvaInput,
|
|
monthlyIvaKey,
|
|
monthlyIvaTreatment,
|
|
} from '../../resources/js/lib/monthly-iva.ts';
|
|
|
|
const settings = { start: '2026-01', basis: 'net', declared: true, auto: true };
|
|
function draftWith(cae) {
|
|
const zero = Object.fromEntries(
|
|
[
|
|
'openingCash',
|
|
'monthlyCollections',
|
|
'monthlyVariableCostPayments',
|
|
'monthlyInventoryPurchases',
|
|
'monthlyOperatingExpenses',
|
|
'monthlyOperatingPayments',
|
|
'monthlyPayrollExpense',
|
|
'monthlyPayrollPayments',
|
|
'assetInvestment',
|
|
'inventory',
|
|
'receivables',
|
|
'payables',
|
|
'equity',
|
|
'shareholderLoans',
|
|
'bankLoanProceeds',
|
|
'grants',
|
|
'assetDepreciation',
|
|
'monthlyInterestExpense',
|
|
'monthlyInterestPayment',
|
|
'monthlyPrincipalRepayment',
|
|
].map((key) => [key, '0']),
|
|
);
|
|
return {
|
|
currency: 'MZN',
|
|
business_plan_snapshot: serializeBusinessPlanSnapshot({
|
|
...zero,
|
|
currency: 'MZN',
|
|
periods: 2,
|
|
depreciationLifeMonths: 60,
|
|
products: [
|
|
{
|
|
label: 'Serviço',
|
|
monthlyUnits: '10',
|
|
unitPrice: '1000',
|
|
unitVariableCost: '0',
|
|
},
|
|
],
|
|
...(cae
|
|
? {
|
|
economicClassification: {
|
|
code: cae,
|
|
revision: 'CAE-Rev.2',
|
|
sourceSha256:
|
|
'cb3dee56db5b2c3f12e3071615725051828a9e1eba17662aa5e78d5f3356b0fc',
|
|
},
|
|
}
|
|
: {}),
|
|
}),
|
|
};
|
|
}
|
|
|
|
test('IVA follows the activity: health and education at 5% (artigo 17-A), everything else at 16%', () => {
|
|
assert.equal(ivaTreatmentForCae('86201').rate, 5);
|
|
assert.match(ivaTreatmentForCae('86201').article, /17-A\(a\)/);
|
|
assert.equal(ivaTreatmentForCae('85300').rate, 5);
|
|
assert.match(ivaTreatmentForCae('85300').article, /17-A\(b\)/);
|
|
assert.match(ivaTreatmentForCae('85492').article, /17-A\(c\)/);
|
|
assert.ok(
|
|
ivaTreatmentForCae('85300').conditions.some((c) =>
|
|
/reconhecido/.test(c),
|
|
),
|
|
);
|
|
for (const code of ['55111', '01111', '85410'])
|
|
assert.equal(ivaTreatmentForCae(code).rate, 16, code);
|
|
assert.equal(ivaTreatmentForCae(undefined).fromActivity, false);
|
|
assert.equal(ivaTreatmentForCae('55111').fromActivity, true);
|
|
});
|
|
|
|
test('the monthly IVA asks the server for the reduced version only for a 17-A activity, and earlier hotel results stay current', () => {
|
|
const clinic = monthlyIvaInput(draftWith('86201'), settings);
|
|
assert.equal(clinic.operation, 'internal_reduced_17a_net');
|
|
assert.equal(monthlyIvaTreatment(draftWith('86201')).rate, 5);
|
|
const hotel = monthlyIvaInput(draftWith('55111'), settings);
|
|
assert.equal('operation' in hotel, false);
|
|
const unclassified = monthlyIvaInput(draftWith(null), settings);
|
|
assert.equal(monthlyIvaKey(hotel), monthlyIvaKey(unclassified));
|
|
assert.notEqual(
|
|
monthlyIvaKey(clinic),
|
|
monthlyIvaKey(hotel),
|
|
'a change of activity makes the earlier result stale',
|
|
);
|
|
});
|