feat: reconcile L6 economic income and extend L8 credits
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-11-10 13:23:11 +02:00
parent c359364de3
commit ac67f9c13a
27 changed files with 1828 additions and 30 deletions
+15 -1
View File
@@ -155,6 +155,17 @@ export function closeNormalProfit(
schedules?: SchedulesModel,
costs?: NormalCostsModel,
depreciation?: NormalDepreciationModel,
economic?: {
effects: {
id: string;
topic: string;
amount: FiscalFraction | null;
effect: FiscalFraction | null;
reason: string;
}[];
net: FiscalFraction;
pending: string[];
},
): NormalProfitModel {
validateNormalProfit(input);
const pending: string[] = [],
@@ -291,9 +302,10 @@ export function closeNormalProfit(
const mapped = [
...(schedules?.effects ?? []),
...(costs?.effects ?? []),
...(economic?.effects ?? []),
].filter((e) => e.topic === key);
const covered =
(schedules || costs) &&
(schedules || costs || economic) &&
mapped.length > 0 &&
mapped.every((e) => e.effect !== null) &&
value !== null &&
@@ -324,6 +336,7 @@ export function closeNormalProfit(
}
if (schedules) pending.push(...schedules.pending);
if (costs) pending.push(...costs.pending);
if (economic) pending.push(...economic.pending);
if (depreciation && !schedules) pending.push(...depreciation.pending);
return {
input: structuredClone(input),
@@ -335,6 +348,7 @@ export function closeNormalProfit(
? addFractions([
accounting,
additions,
...(economic ? [economic.net] : []),
...(schedules ? [schedules.net] : []),
...(costs ? [costs.net] : []),
...(depreciation && !schedules && depreciation.adjustment