import type { BusinessFinancialPlanInput } from '@/lib/business-financial-plan'; import { buildIntegralFinancialTables, newReportAssumptions, isReportAssumptions, } from '@/lib/integral-financial-report'; import { InvestmentReportTables } from './investment-report-tables'; import { BusinessPlanWarnings } from './business-plan-warnings'; import { financialPlanWarnings } from '@/lib/financial-plan-warnings'; import { buildAnnualExampleTables } from '@/lib/annual-example-report'; import { StartupAssetRequirements } from './startup-asset-requirements'; export function IntegralFinancialPlan({ plan, onChange, }: { plan: BusinessFinancialPlanInput; onChange: (plan: BusinessFinancialPlanInput) => void; }) { if (plan.reportSource === 'annual_example') { try { return (

Relatório do exemplo sintético anual

As onze tabelas abaixo usam o exemplo editável. Os dados reais do investimento ficam conservados separadamente.

); } catch (error) { return (

{error instanceof Error ? error.message : 'Confira o cenário de exemplo.'}

); } } if (plan.reportAssumptions && !isReportAssumptions(plan.reportAssumptions)) return (

Os dados complementares guardados não têm uma estrutura reconhecida. Foram preservados e não serão substituídos automaticamente.

); const a = plan.reportAssumptions ?? newReportAssumptions(plan.periods ?? 12); const update = (patch: Partial) => onChange({ ...plan, reportAssumptions: { ...a, ...patch } }); const numeric = ( label: string, value: string, save: (value: string) => void, ) => ( ); return (
Relatório financeiro integral — dados do investimento

Utiliza as vendas, custos e agendas do plano financeiro. Não utiliza o cenário sintético. Todos os montantes são projecções declaradas em {plan.currency || 'moeda por seleccionar'}. Campos em falta permanecem por determinar; indique zero apenas quando aplicável.

{!plan.startupAssetRequirements && numeric( 'Activos fixos anteriores (valor líquido)', a.openingFixedAssets, (openingFixedAssets) => update({ openingFixedAssets }), )} {!plan.startupAssetRequirements && numeric( 'Outros activos anteriores', a.openingOtherAssets, (openingOtherAssets) => update({ openingOtherAssets }), )} {numeric( 'Capital e resultados anteriores', a.openingEquity, (openingEquity) => update({ openingEquity }), )}
Despesas de arranque — reconhecidas e pagas na abertura {a.startupExpenses.map((row, index) => (
{numeric( `Montante de arranque ${index + 1}`, row.amount, (amount) => update({ startupExpenses: a.startupExpenses.map( (entry, i) => i === index ? { ...entry, amount } : entry, ), }), )}
))}

Os saldos anteriores têm de reconciliar entre si. Não inclua os novos activos no saldo anterior, nem os novos capitais nos resultados anteriores.

Sem linhas significa que não declarou despesas de arranque; para confirmar a inexistência, registe uma linha «Sem despesas de arranque» com zero.

Impostos por mês — estimativa e tesouraria

Não activa taxas fiscais nem certifica pagamentos. Preencha cada mês, incluindo zero declarado.

{Array.from({ length: plan.periods ?? 12 }, (_, index) => (
{numeric( `Imposto reconhecido — mês ${index + 1}`, a.taxExpenseByMonth[index] ?? '', (value) => update({ taxExpenseByMonth: Array.from( { length: plan.periods ?? 12 }, (_, i) => i === index ? value : (a.taxExpenseByMonth[i] ?? ''), ), }), )} {numeric( `Pagamento fiscal previsto — mês ${index + 1}`, a.taxPaymentByMonth[index] ?? '', (value) => update({ taxPaymentByMonth: Array.from( { length: plan.periods ?? 12 }, (_, i) => i === index ? value : (a.taxPaymentByMonth[i] ?? ''), ), }), )}
))}
); }