Clarify viability simulation purpose and preserve PEC cash-flow hypotheses
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-11-11 10:37:33 +02:00
parent aae79c712d
commit a708f079b3
24 changed files with 754 additions and 42 deletions
+9 -5
View File
@@ -1,3 +1,4 @@
import {validatePecPlan,pecPlanReport,type PecPlan} from './irpc-pec-plan.ts';
import {
decimalFraction,
fraction,
@@ -10,6 +11,7 @@ export const pecObligationSource =
'RIRPC,Decreto9/2008,art29(1–5),BR16/I16-04-2008,original SHA256 fc373ff5637edf75ec6a9595dec8763a8503d4ee786e3b7d8f1c742eae9d80ee.0,5% do volume de negócios anterior,limites30.000/100.000MZN,menos PPC efectivamente pagos no ano anterior.Junho/Agosto/Outubro;opção de pagamento único prevista,sem data ou repartição inventada. Ano de início excluído29(4);sem volume anterior exige último montante29(5). Recorte2026,residente geral comercial/industrial/agrícola,ano civil,MZN. Regimes/períodos especiais,rectificação29(3),base de anos anteriores29(5),guias/juros separados.';
export type PecObligation = {
version: 1;
plan?: PecPlan;
scope: '' | 'ordinary_resident' | 'other';
subjectNuit: string;
year: string;
@@ -38,6 +40,7 @@ export const newPecObligation = (
ppcReference: '',
});
export function validatePecObligation(p: PecObligation) {
if(p?.plan!==undefined)validatePecPlan(p.plan);
if (
!p ||
p.version !== 1 ||
@@ -51,7 +54,7 @@ export function validatePecObligation(p: PecObligation) {
!['', 'ordinary_resident', 'other'].includes(p.scope)
)
throw Error(
'Preparação da obrigação PEC não recuperável;original preservado.',
'Preparação da estimativa PEC não recuperável;original preservado.',
);
}
export function calculatePecObligation(
@@ -129,7 +132,7 @@ export function calculatePecObligation(
const residual = subtractFractions(limited, ppc);
if (BigInt(residual.numerator) < 0n)
pending.push(
'PEC:PPC anteriores excedem o montante limitado;caso separado para reconciliação,não gera obrigação negativa ou reembolso.',
'PEC:PPC anteriores excedem o montante limitado;caso separado para reconciliação,não gera estimativa negativa ou reembolso.',
);
else total = residual;
}
@@ -160,9 +163,10 @@ export function pecObligationReport(
show = (v: FiscalFraction | null) =>
v ? fractionPresentation(v).decimal + ' MZN' : 'Indeterminado';
return [
...(p.plan ? pecPlanReport(p.plan,m.total,m.notApplicable,year) : []),
[
'IRPC — L8',
'PEC — obrigação preparada',
'PEC — estimativa fiscal',
m.pending.length
? m.pending.join(' ')
: m.notApplicable
@@ -171,11 +175,11 @@ export function pecObligationReport(
show(m.percentage) +
';limitado antes de PPC: ' +
show(m.limited) +
';obrigação total: ' +
';total estimado: ' +
show(m.total) +
';meses: ' +
m.months.join(', ') +
'. Montantes por prestação e opção de pagamento único não determinados neste recorte. Preparação não é pagamento nem dedução anual.',
(p.plan ? '. Plano explícito apresentado separadamente;prazo legal não validado.' : '. Montantes por prestação e opção de pagamento único não determinados neste recorte.') + ' Preparação não é pagamento nem dedução anual.',
p.activityReference +
'; ' +
p.turnoverReference +