import { getRevenueForecast12Months } from "@/lib/forecast-queries"; export const revalidate = 0; export default async function ForecastPage() { const forecast = await getRevenueForecast12Months(); const totalForecast = forecast.reduce((sum, m) => sum + m.total, 0); return (

Revenue Forecast

Proiezione 12 mesi basata sulle offerte attive, i loro accepted_total e le durate in mesi. Ogni offerta distribuisce il suo totale equamente per i mesi di durata a partire dalla data di inizio.

{forecast.map((month) => { const maxTotal = Math.max(...forecast.map((m) => m.total), 1); const pct = Math.round((month.total / maxTotal) * 100); return ( ); })}
Mese Fatturato previsto Barra
{month.label} {month.total > 0 ? `€${month.total.toFixed(2)}` : } {month.total > 0 && (
)}
Totale 12 mesi €{totalForecast.toFixed(2)}
{forecast.every((m) => m.total === 0) && (

Nessuna offerta con accepted_total trovata. Assegna micro-offerte ai progetti e imposta il totale accettato.

)}
); }