Fluxo de caixa: IVA das compras declaradas, deduzido na taxa geral e custo nas actividades a 5%

O investidor marca no IVA mensal quais categorias de compras têm factura
com IVA à taxa geral (mercadorias e custos variáveis, despesas
operacionais, aquisição de activos); por omissão nenhuma. O IVA pago aos
fornecedores entra no fluxo de caixa com cada pagamento.

Nas actividades à taxa geral é deduzido ao IVA das vendas na declaração
desse mês (CIVA, artigo 17(1)); se a dedução exceder o IVA facturado, o
crédito passa para os meses seguintes, sem reembolso presumido, e o
balanço mostra-o como crédito. Nas actividades à taxa reduzida do artigo
17-A não é dedutível (CIVA, artigo 20(2), Lei 22/2022, texto arquivado no
portal) e aparece como custo em Lucros e Perdas. O balanço continua
reconciliado e o resumo do dossier soma o IVA pago nas compras.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MzJmxFy3izprXr5dSq91jM
This commit is contained in:
Claude
2026-12-05 07:19:56 +02:00
committed by nala
parent 1f1a6bf8ba
commit 3c7f6089d5
5 changed files with 267 additions and 10 deletions
+117 -1
View File
@@ -52,7 +52,11 @@ test('IVA enters the treasury: received with the sales collections, delivered th
`month ${i}`,
);
}
const due = row(withVat, 'balance', 'IVA a entregar ao Estado');
const due = row(
withVat,
'balance',
'IVA a entregar ao Estado (crédito, se negativo)',
);
assert.equal(
money(due[periods]),
billed[periods - 1],
@@ -187,3 +191,115 @@ test('the treasury uses only a completed IVA result that still matches the sales
'a result for other sales is not used',
);
});
test('IVA on declared purchases: deducted for the general rate, a cost for activities at 5% (CIVA arts. 17(1) and 20(2)); the balance still reconciles', () => {
const input = plan(13);
input.monthlyVariableCostPayments = '200';
input.monthlyOperatingPayments = '100';
input.monthlyOperatingExpenses = '100';
const forecast = forecastBusinessPlan(input);
const billed = forecast.rows.map((r) => (money(r.revenue) * 16n) / 100n);
const base = {
ratePercent: '16',
billedByMonth: billed,
source: 'Operação interna geral',
purchases: { purchases: true, operating: false, assets: false },
};
const without = buildIntegralFinancialTables(input);
const general = buildIntegralFinancialTables(input, {
...base,
deductionAllowed: true,
});
const paid = row(general, 'cashflow', 'IVA pago nas compras');
forecast.rows.forEach((r, i) =>
assert.equal(
money(paid[i + 1]),
(money(r.variableCostPayments) * 16n + 50n) / 100n,
'only the declared category',
),
);
const delivered = row(general, 'cashflow', 'IVA entregue ao Estado');
assert.equal(
money(delivered[2]),
billed[0] - money(paid[1]),
'month 1 delivers sales IVA less the purchase IVA deducted',
);
assert.deepEqual(
row(general, 'profit-loss', 'Lucro líquido'),
row(without, 'profit-loss', 'Lucro líquido'),
'deductible IVA is neither revenue nor cost',
);
assert.deepEqual(
row(general, 'balance', 'Diferença do balanço'),
row(without, 'balance', 'Diferença do balanço'),
);
const reduced = buildIntegralFinancialTables(input, {
...base,
ratePercent: '5',
billedByMonth: forecast.rows.map((r) => (money(r.revenue) * 5n) / 100n),
deductionAllowed: false,
});
const notDeductible = row(
reduced,
'profit-loss',
'IVA não dedutível nas compras',
);
assert.ok(notDeductible, 'a cost for the 17-A activity');
const profitWith = row(reduced, 'profit-loss', 'Lucro líquido');
const profitWithout = row(without, 'profit-loss', 'Lucro líquido');
for (let i = 1; i <= 13; i++)
assert.equal(
money(profitWith[i]),
money(profitWithout[i]) - money(notDeductible[i]),
);
assert.equal(
money(row(reduced, 'cashflow', 'IVA entregue ao Estado')[2]),
(money(forecast.rows[0].revenue) * 5n) / 100n,
'nothing is deducted at the reduced rate',
);
assert.deepEqual(
row(reduced, 'balance', 'Diferença do balanço'),
row(without, 'balance', 'Diferença do balanço'),
);
assert.match(
reduced.find((t) => t.id === 'cashflow').notes.join(' '),
/20\(2\)/,
);
});
test('a deduction larger than the sales IVA becomes a credit carried forward, never a refund', () => {
const input = plan(13);
input.assetInvestment = '600';
const forecast = forecastBusinessPlan(input);
const billed = forecast.rows.map((r) => (money(r.revenue) * 16n) / 100n);
billed[0] = 0n;
const tables = buildIntegralFinancialTables(input, {
ratePercent: '16',
billedByMonth: billed,
source: 'Operação interna geral',
purchases: { purchases: false, operating: false, assets: true },
deductionAllowed: true,
});
const delivered = row(tables, 'cashflow', 'IVA entregue ao Estado');
assert.equal(
delivered[2],
'0.00',
'month 1 ends in credit: nothing delivered',
);
assert.equal(
money(delivered[3]),
billed[1] - (600n * 100n * 16n) / 100n,
'the credit reduces the next declaration',
);
assert.equal(
money(
row(
tables,
'balance',
'IVA a entregar ao Estado (crédito, se negativo)',
)[1],
),
-9600n,
);
});