Completar combinação CBF15 com saldos anteriores e conferir PEC residual
tests / ci (push) Canceled after 0s
tests / ci (push) Canceled after 0s
This commit is contained in:
@@ -565,6 +565,9 @@ function key(d: Record<string, unknown>, b: AnnualBook) {
|
||||
acquisitionScope(d),
|
||||
input,
|
||||
dependencies(d, !!b.investmentCredit),
|
||||
...(b.investmentCredit && b.creditCarry?.lots.length
|
||||
? ['CBF15-credit-carry-combination/1']
|
||||
: []),
|
||||
]);
|
||||
}
|
||||
export function annualCurrent(d: Record<string, unknown>, b: AnnualBook) {
|
||||
@@ -1303,16 +1306,6 @@ export function calculateAnnual(d: Record<string, unknown>, b: AnnualBook) {
|
||||
if (b.investmentCredit && !investmentPreview)
|
||||
pending.push('CréditoCBF15 exige colecta L6 recuperável.');
|
||||
if (investmentPreview) pending.push(...investmentPreview.pending);
|
||||
if (
|
||||
investmentPreview?.available &&
|
||||
cmp(investmentPreview.available, zero()) > 0n &&
|
||||
(!investmentPreview.projectCeiling ||
|
||||
cmp(investmentPreview.projectCeiling, zero()) > 0n) &&
|
||||
b.creditCarry?.lots.length
|
||||
)
|
||||
pending.push(
|
||||
'CombinaçãoCBF15 com saldos anteriores exige correspondência própria; transportes anteriores preservados.',
|
||||
);
|
||||
if (
|
||||
b.investmentCredit?.qualification.state === 'known' &&
|
||||
b.investmentCredit.qualification.eligible === 'yes' &&
|
||||
@@ -1462,7 +1455,7 @@ export function calculateAnnual(d: Record<string, unknown>, b: AnnualBook) {
|
||||
)
|
||||
: null;
|
||||
if (carry) pending.push(...carry.pending);
|
||||
if (investmentPreview?.projectCeiling && !pending.length) {
|
||||
if (investmentPreview && !pending.length) {
|
||||
const beforeInternational = economicPreview?.afterCredit ?? colecta;
|
||||
const preview = b.internationalCredits
|
||||
? internationalDeduction(
|
||||
@@ -1478,10 +1471,25 @@ export function calculateAnnual(d: Record<string, unknown>, b: AnnualBook) {
|
||||
carry.priorInternational,
|
||||
)
|
||||
: (preview?.afterCredit ?? beforeInternational);
|
||||
if (!remaining || cmp(investmentPreview.projectCeiling, remaining) > 0n)
|
||||
if (
|
||||
investmentPreview.projectCeiling &&
|
||||
(!remaining || cmp(investmentPreview.projectCeiling, remaining) > 0n)
|
||||
)
|
||||
pending.push(
|
||||
'Quota residualCBF15 do projecto excede a colecta após créditos económicos/internacionais; reconcilie a atribuição antes de deduzir.',
|
||||
);
|
||||
if (!pending.length && carry?.pec && remaining) {
|
||||
const afterInvestment = deductInvestmentCredit(
|
||||
investmentPreview, remaining, true,
|
||||
).afterCredit;
|
||||
if (
|
||||
afterInvestment &&
|
||||
cmp(addFractions([carry.pec, carry.priorPec]), afterInvestment) > 0n
|
||||
)
|
||||
pending.push(
|
||||
'As parcelas de PEC corrente e anterior excedem a colecta residual após CBF15; reconcilie a escolha documentada sem reduzir valores automaticamente.',
|
||||
);
|
||||
}
|
||||
}
|
||||
const ready = pending.length === 0 && colecta !== null,
|
||||
economic = b.economicCredits
|
||||
|
||||
Reference in New Issue
Block a user