/* Financial summary — quiet, professional read-out of the plan */ function SumRow({ label, value, sub, strong, tone, last }) { const col = tone === "green" ? "var(--green)" : tone === "red" ? "var(--red)" : "var(--ink)"; const missing = value === "—"; return (
{label} {sub &&
{sub}
}
{value}
); } function SumGroup({ title, children }) { return (
{title}
{children}
); } function FinancialSummary({ live }) { const { t } = useLang(); const dash = "—"; const money = (n) => (isFinite(n) && n > 0 ? fmtBaht(n) : dash); const profTone = live.profit >= 0 ? "green" : "red"; return (

{t("fs.heading")}

{t("fs.desc")}
0 ? live.reserveMonths.toFixed(1) + " mo" : dash} /> 0 ? `${live.profit < 0 ? "−" : ""}${fmtBaht(Math.abs(live.profit))} · ${fmtPct(live.margin)}` : dash} /> {live.netProfit !== undefined && ( 0 ? fmtBaht(live.taxTotal) : live.sales > 0 ? "฿0" : dash} /> = 0 ? "green" : "red"} strong last value={live.sales > 0 ? `${live.netProfit < 0 ? "−" : ""}${fmtBaht(Math.abs(live.netProfit))} · ${fmtPct(live.netMargin)}` : dash} /> )}
); } function PageSummary({ note, items }) { return (
Financial summary {note && · {note}}
{items.map((it, i) => (
{it.label}
{it.value}
{it.sub &&
{it.sub}
}
))}
); } Object.assign(window, { FinancialSummary, PageSummary });