feat(qa): consolidate eleven financial report tables pending private visual acceptance
This commit is contained in:
@@ -43,6 +43,7 @@ export const dossierReportSections = [
|
||||
|
||||
export type DossierReportSectionId =
|
||||
| (typeof dossierReportSections)[number]['id']
|
||||
| 'financial-report'
|
||||
| 'supply';
|
||||
export type DossierReference = {
|
||||
version: number;
|
||||
@@ -860,6 +861,80 @@ export function createProjectDossierReport(
|
||||
};
|
||||
}
|
||||
|
||||
export const integralFinancialTableIds = [
|
||||
'startup',
|
||||
'market-analysis',
|
||||
'sales',
|
||||
'milestones',
|
||||
'personnel',
|
||||
'funding',
|
||||
'break-even',
|
||||
'profit-loss',
|
||||
'cashflow',
|
||||
'balance',
|
||||
'ratios',
|
||||
] as const;
|
||||
|
||||
/** One saved scenario, one report; existing statement builders remain the source. */
|
||||
export function createIntegralFinancialReport(
|
||||
draft: Record<string, string | string[]>,
|
||||
options: Omit<
|
||||
Parameters<typeof createProjectDossierReport>[1],
|
||||
'selectedSections'
|
||||
> = {},
|
||||
): DossierReportModel {
|
||||
const report = createProjectDossierReport(draft, {
|
||||
...options,
|
||||
selectedSections: new Set(['market', 'finance', 'team', 'execution']),
|
||||
});
|
||||
const tables = report.sections.flatMap((s) => s.tables ?? []);
|
||||
const finance = report.sections.find((s) => s.id === 'finance');
|
||||
const planCurrency = restoreBusinessPlanSnapshot(
|
||||
text(draft, 'business_plan_snapshot'),
|
||||
)?.currency;
|
||||
const declaredCurrency = text(draft, 'currency');
|
||||
const summary = new Set([
|
||||
'Moeda do plano',
|
||||
'Horizonte',
|
||||
'Facturação no horizonte',
|
||||
'Cobranças no horizonte',
|
||||
'Pagamentos no horizonte',
|
||||
'Resultado antes de impostos',
|
||||
'Caixa final projectada',
|
||||
'Reconciliação do financiamento',
|
||||
'Diferença entre usos e fontes',
|
||||
'Resultado líquido no horizonte',
|
||||
]);
|
||||
const ordered = integralFinancialTableIds.flatMap((id) => {
|
||||
const t = tables.find((t) => t.id === id);
|
||||
return t ? [t] : [];
|
||||
});
|
||||
return {
|
||||
...report,
|
||||
sections: [
|
||||
{
|
||||
id: 'financial-report',
|
||||
title: 'Relatório financeiro integral',
|
||||
private: true,
|
||||
paragraphs: [
|
||||
...(planCurrency &&
|
||||
declaredCurrency &&
|
||||
planCurrency !== declaredCurrency
|
||||
? [
|
||||
`Moedas diferentes: o plano financeiro mantém ${planCurrency}; o projecto declara ${declaredCurrency}. Confira os dados complementares antes de comparar montantes. Não foi feita conversão.`,
|
||||
]
|
||||
: []),
|
||||
`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.',
|
||||
],
|
||||
rows:
|
||||
finance?.rows.filter((row) => summary.has(row.field)) ?? [],
|
||||
tables: ordered,
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export function classifyDossierAttachment(
|
||||
file: Pick<File, 'name' | 'type' | 'size'>,
|
||||
): DossierAttachmentKind {
|
||||
|
||||
Reference in New Issue
Block a user