feat(qa): integrate financial example, growth, dividends and detailed declarations
This commit is contained in:
@@ -10,6 +10,8 @@ import {
|
||||
} from './integral-financial-report.ts';
|
||||
import { restoreBusinessPlanSnapshot } from './business-financial-plan.ts';
|
||||
import { fiscalQaRows } from './fiscal-qa-preview.ts';
|
||||
import { financialPlanWarnings } from './financial-plan-warnings.ts';
|
||||
import { buildAnnualExampleTables } from './annual-example-report.ts';
|
||||
import { pathStates } from './investor-path.ts';
|
||||
import {
|
||||
buildProjectDossierRows,
|
||||
@@ -543,8 +545,17 @@ function makeSections(
|
||||
const section = sections.get(id as DossierReportSectionId);
|
||||
if (section) section.tables = [complementaryTables[i]];
|
||||
}
|
||||
if (finance && financialPlan?.reportAssumptions) {
|
||||
if (
|
||||
finance &&
|
||||
financialPlan?.reportAssumptions &&
|
||||
financialPlan.reportSource !== 'annual_example'
|
||||
) {
|
||||
finance.tables = buildIntegralFinancialTables(financialPlan);
|
||||
finance.paragraphs.push(
|
||||
...financialPlanWarnings(financialPlan, finance.tables).map(
|
||||
(w) => `Aviso não bloqueante — ${w.message}`,
|
||||
),
|
||||
);
|
||||
finance.tables.push(
|
||||
buildFinancialRatiosTable(financialPlan, finance.tables),
|
||||
);
|
||||
@@ -581,6 +592,9 @@ function makeSections(
|
||||
'Pagamentos de pessoal',
|
||||
'Juros pagos',
|
||||
'Capital reembolsado',
|
||||
...(financialPlan.dividendsByPeriod
|
||||
? ['Dividendos distribuídos']
|
||||
: []),
|
||||
'Pagamento de obrigações iniciais',
|
||||
'Pagamento fiscal estimado',
|
||||
]),
|
||||
@@ -649,7 +663,53 @@ function makeSections(
|
||||
});
|
||||
}
|
||||
}
|
||||
if (finance && currentCalculation) {
|
||||
if (finance && financialPlan?.reportSource === 'annual_example') {
|
||||
finance.rows = finance.rows
|
||||
.filter((row) => row.field === 'Classificação CAE do plano')
|
||||
.map((row) => ({
|
||||
...row,
|
||||
classification:
|
||||
'Contexto do investimento preservado; não é a classificação do exemplo sintético',
|
||||
}));
|
||||
finance.paragraphs = [
|
||||
'Exemplo sintético anual editável, da mesma versão guardada do plano. Não representa dados reais do investidor nem financiamento confirmado. As entradas do investidor permanecem preservadas.',
|
||||
];
|
||||
try {
|
||||
const example = buildAnnualExampleTables(financialPlan);
|
||||
finance.tables = example.filter(
|
||||
(t) =>
|
||||
!['market-analysis', 'milestones', 'personnel'].includes(
|
||||
t.id,
|
||||
),
|
||||
);
|
||||
for (const [sectionId, tableId] of [
|
||||
['market', 'market-analysis'],
|
||||
['execution', 'milestones'],
|
||||
['team', 'personnel'],
|
||||
] as const) {
|
||||
const section = sections.get(sectionId);
|
||||
if (section) {
|
||||
section.tables = example.filter((t) => t.id === tableId);
|
||||
section.rows = [];
|
||||
section.paragraphs = [
|
||||
'Dados sintéticos de referência do exemplo anual; não são dados reais do investidor.',
|
||||
];
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
finance.tables = [];
|
||||
finance.paragraphs.push(
|
||||
error instanceof Error
|
||||
? error.message
|
||||
: 'Não foi possível recuperar o exemplo.',
|
||||
);
|
||||
}
|
||||
}
|
||||
if (
|
||||
finance &&
|
||||
currentCalculation &&
|
||||
financialPlan?.reportSource !== 'annual_example'
|
||||
) {
|
||||
const snapshot = currentCalculation.snapshot;
|
||||
const result =
|
||||
snapshot &&
|
||||
@@ -939,6 +999,11 @@ export function createIntegralFinancialReport(
|
||||
: []),
|
||||
`Tabelas incluídas: ${ordered.length} de 11. Os valores provêm do mesmo plano e dos dados complementares guardados.`,
|
||||
'Projecções para avaliar o investimento; não são contas realizadas nem confirmação de financiamento. Campos em falta e indicadores indeterminados mantêm-se identificados.',
|
||||
...(finance?.paragraphs.filter(
|
||||
(p) =>
|
||||
p.startsWith('Aviso não bloqueante') ||
|
||||
p.startsWith('Exemplo sintético anual'),
|
||||
) ?? []),
|
||||
],
|
||||
rows:
|
||||
finance?.rows.filter((row) => summary.has(row.field)) ?? [],
|
||||
|
||||
Reference in New Issue
Block a user