Support documented full annual noncivil PPC PEC estimates and dossier continuity
tests / ci (push) Canceled after 0s
tests / ci (push) Canceled after 0s
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { advanceCalendar } from './irpc-advance-calendar.ts';
|
||||
import {
|
||||
ordinaryAdvancePeriodIssues,
|
||||
type AdvanceFiscalPeriod,
|
||||
@@ -110,6 +111,7 @@ export function calculatePecObligation(
|
||||
) {
|
||||
validatePecObligation(p);
|
||||
const pending: string[] = [];
|
||||
const calendar = advanceCalendar(period, year, subjectNuit);
|
||||
const turnover = correctedPecTurnover(
|
||||
p.correction,
|
||||
p.previousTurnover,
|
||||
@@ -158,14 +160,43 @@ export function calculatePecObligation(
|
||||
period.from! <= period.to!
|
||||
)
|
||||
)
|
||||
pending.push(...ordinaryAdvancePeriodIssues(period, year, 'PEC'));
|
||||
pending.push(
|
||||
...ordinaryAdvancePeriodIssues(
|
||||
period,
|
||||
year,
|
||||
'PEC',
|
||||
subjectNuit,
|
||||
),
|
||||
);
|
||||
if (calendar.mode === 'annual_non_civil')
|
||||
pending.push(
|
||||
'PEC: início de actividade em período não civil exige correspondência própria;fora deste recorte de continuidade.',
|
||||
);
|
||||
if (!pending.length) {
|
||||
notApplicable = true;
|
||||
total = fraction(0n);
|
||||
}
|
||||
} else if (!pending.length) {
|
||||
pending.push(...ordinaryAdvancePeriodIssues(period, year, 'PEC'));
|
||||
pending.push(
|
||||
...ordinaryAdvancePeriodIssues(period, year, 'PEC', subjectNuit),
|
||||
);
|
||||
if (
|
||||
calendar.mode === 'annual_non_civil' &&
|
||||
(!period?.pecBasisKey ||
|
||||
period.declaration?.pecBasisKey !== period.pecBasisKey)
|
||||
)
|
||||
pending.push(
|
||||
'PEC: montantes ou fontes alterados;reconfira a sua correspondência com o período anterior,sem substituir os valores.',
|
||||
);
|
||||
pending.push(...turnover.pending);
|
||||
if (
|
||||
calendar.mode === 'annual_non_civil' &&
|
||||
Number(p.activityStartYear) >=
|
||||
Number(calendar.previousFrom.slice(0, 4))
|
||||
)
|
||||
pending.push(
|
||||
'PEC: este recorte exige actividade já iniciada antes do período anterior documentado;início ou transição têm correspondência própria.',
|
||||
);
|
||||
if (
|
||||
p.previousYear !== '2025' ||
|
||||
!p.turnoverReference.trim() ||
|
||||
@@ -185,7 +216,14 @@ export function calculatePecObligation(
|
||||
if (!pending.length) {
|
||||
const v = decimalFraction(turnover.value),
|
||||
ppc = decimalFraction(p.previousPpcPaid);
|
||||
if (BigInt(v.numerator) === 0n) {
|
||||
if (
|
||||
BigInt(v.numerator) === 0n &&
|
||||
calendar.mode === 'annual_non_civil'
|
||||
) {
|
||||
pending.push(
|
||||
'PEC29(5): último montante num período não civil exige correspondência da sua origem;fora deste recorte de continuidade.',
|
||||
);
|
||||
} else if (BigInt(v.numerator) === 0n) {
|
||||
const last = p.lastAmount;
|
||||
if (
|
||||
!last ||
|
||||
@@ -235,12 +273,27 @@ export function calculatePecObligation(
|
||||
source.replace('base de anos anteriores29(5),', '') +
|
||||
' ' +
|
||||
pecLastAmountSource;
|
||||
if (calendar.mode === 'annual_non_civil')
|
||||
source =
|
||||
source
|
||||
.replace(
|
||||
'ano civil,MZN',
|
||||
'período anual não civil completo,MZN',
|
||||
)
|
||||
.replace('Junho/Agosto/Outubro', '6.º/8.º/10.º mês do período')
|
||||
.replace(
|
||||
'Regimes/períodos especiais',
|
||||
'Períodos curtos e outros regimes',
|
||||
) +
|
||||
' ' +
|
||||
calendar.source;
|
||||
if (ppcExcess)
|
||||
source +=
|
||||
' Reconciliação da estimativa29(2):PPC documentados cobrem a base limitada;diferença conservada sem gerar direito a reembolso ou crédito.';
|
||||
return {
|
||||
version: pecObligationVersion,
|
||||
source,
|
||||
nonCivil: calendar.mode === 'annual_non_civil',
|
||||
lastAmountSource: p.lastAmount ? pecLastAmountSource : null,
|
||||
pending,
|
||||
percentage,
|
||||
@@ -263,8 +316,7 @@ export function calculatePecObligation(
|
||||
source: pecCorrectionSource,
|
||||
}
|
||||
: null,
|
||||
months:
|
||||
total && !notApplicable ? ['2026-06', '2026-08', '2026-10'] : [],
|
||||
months: total && !notApplicable ? calendar.pecMonths : [],
|
||||
instalmentAmountsDetermined: false,
|
||||
paymentExecuted: false,
|
||||
annualDeductionCreated: false,
|
||||
@@ -359,7 +411,7 @@ export function pecObligationReport(
|
||||
]
|
||||
: []),
|
||||
...(p.plan
|
||||
? pecPlanReport(p.plan, m.total, m.notApplicable, year)
|
||||
? pecPlanReport(p.plan, m.total, m.notApplicable, year, period)
|
||||
: []),
|
||||
[
|
||||
'IRPC — L8',
|
||||
|
||||
Reference in New Issue
Block a user