This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user