Support documented full annual noncivil PPC PEC estimates and dossier continuity
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-11-14 09:05:33 +02:00
parent d3eeb70370
commit e473542494
17 changed files with 665 additions and 52 deletions
@@ -1,7 +1,7 @@
import type { AdvanceFiscalPeriod } from '@/lib/irpc-ppc-obligation';
import {
newPecPlan,
calculatePecPlan,
pecPlanSource,
type PecPlan,
} from '@/lib/irpc-pec-plan';
import {
@@ -13,12 +13,14 @@ export function SimulationIrpcPecPlan({
total,
notApplicable,
year,
period,
onChange,
}: {
plan?: PecPlan;
total: FiscalFraction | null;
notApplicable: boolean;
year: string;
period?: AdvanceFiscalPeriod;
onChange: (p: PecPlan) => void;
}) {
if (!plan)
@@ -33,13 +35,13 @@ export function SimulationIrpcPecPlan({
disabled={
!total || notApplicable || BigInt(total.numerator) <= 0n
}
onClick={() => onChange(newPecPlan())}
onClick={() => onChange(newPecPlan(period))}
>
Simular tesouraria PEC
</button>
</div>
);
const m = calculatePecPlan(plan, total, notApplicable, year),
const m = calculatePecPlan(plan, total, notApplicable, year, period),
patch = (p: Partial<PecPlan>) => onChange({ ...plan, ...p });
const field = (
key: 'reference' | 'june' | 'august' | 'october',
@@ -77,6 +79,20 @@ export function SimulationIrpcPecPlan({
. Prazo legal não validado.
</p>
)}
{m.needsPeriodConfirmation && !m.calendarPending && (
<button
type="button"
className="rounded border p-2"
onClick={() =>
patch({
periodFrom: m.contextFrom,
periodTo: m.contextTo,
})
}
>
Conferi a distribuição para {m.contextFrom} — {m.contextTo}
</button>
)}
<details open={m.pending.length > 0}>
<summary>Alterar projecção PEC</summary>
<label className="block">
@@ -100,9 +116,30 @@ export function SimulationIrpcPecPlan({
{field('reference', 'Fundamento do projecção PEC')}
{plan.mode === 'three' && (
<>
{field('june', 'PEC Junho — MZN')}
{field('august', 'PEC Agosto — MZN')}
{field('october', 'PEC Outubro — MZN')}
{field(
'june',
m.calendarPending
? 'PEC primeiro montante — mês por confirmar'
: m.nonCivil
? 'PEC 6.º mês (' + m.months[0] + ') — MZN'
: 'PEC Junho — MZN',
)}
{field(
'august',
m.calendarPending
? 'PEC segundo montante — mês por confirmar'
: m.nonCivil
? 'PEC 8.º mês (' + m.months[1] + ') — MZN'
: 'PEC Agosto — MZN',
)}
{field(
'october',
m.calendarPending
? 'PEC terceiro montante — mês por confirmar'
: m.nonCivil
? 'PEC 10.º mês (' + m.months[2] + ') — MZN'
: 'PEC Outubro — MZN',
)}
</>
)}
{plan.mode === 'single' && (
@@ -128,7 +165,7 @@ export function SimulationIrpcPecPlan({
</p>
<details>
<summary>Fonte do projecção PEC</summary>
<p>{pecPlanSource}</p>
<p>{m.source}</p>
</details>
</section>
);