/* eslint-disable */ /* © 2026 K2B NETWORK SOLUTIONS LLC. All rights reserved. Proprietary and confidential. Unauthorized copying, distribution, or use of this file, via any medium, is strictly prohibited. Original work product. */ // JBREWS DMS — Cash Command Center. // Live operating-cash forecast from the ledger: today's bank cash, expected // inflows (CIT, warranty, factory, A/R) vs. committed outflows (payoffs, A/P, // floorplan, commissions), a 7/14/30-day net position, a "safe to spend" meter, // and a "Why did cash change?" breakdown of recent bank movement by source. const ccMoney = (n) => "$" + (Number(n) || 0).toLocaleString("en-US", { minimumFractionDigits: 0, maximumFractionDigits: 0 }); const ccMoney2 = (n) => (n < 0 ? "-$" : "$") + Math.abs(Number(n) || 0).toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 }); const CashCommand = ({ onClose, go }) => { const D = window.DMS; const [, force] = React.useReducer(n => n + 1, 0); React.useEffect(() => (D && D.subscribe) ? D.subscribe(force) : undefined, []); const [moveDays, setMoveDays] = React.useState(1); if (!D || !D.cashCommand) return null; const cc = D.cashCommand(); const mv = D.cashMovement(moveDays); const toneColor = { green: "#0E7A37", yellow: "#9A6700", red: "#B23A2E" }[cc.tone] || "#0E7A37"; const toneBg = { green: "linear-gradient(160deg,#0E7A37,#0B5C2A)", yellow: "linear-gradient(160deg,#B8860B,#8A6400)", red: "linear-gradient(160deg,#B23A2E,#8A1C1C)" }[cc.tone]; const toneWord = { green: "SAFE TO SPEND", yellow: "SPEND TIGHT", red: "DO NOT SPEND" }[cc.tone]; const Bar = ({ label, value, color }) => (
{label} {ccMoney(value)}
); return (
{/* LEFT — position + flows */}
{/* safe-to-spend hero */}
{toneWord}
{ccMoney(cc.safeToSpend)}
Bank cash today {ccMoney(cc.today)} − this week's committed outflows.
{cc.tone === "green" ? "✓" : cc.tone === "yellow" ? "!" : "✕"}
{/* 7/14/30 position */}
{[["7-day", cc.net7], ["14-day", cc.net14], ["30-day", cc.net30]].map(([lab, v]) => (
Net {lab} position
= 0 ? "#0E7A37" : "#B23A2E" }}>{ccMoney(v)}
))}
{/* inflows / outflows */}
Expected In
{cc.inflows.length ? cc.inflows.map((x, i) => ) :
None pending.
}
Total in{ccMoney(cc.totalIn)}
Committed Out
{cc.outflows.length ? cc.outflows.map((x, i) => ) :
None due.
}
Total out{ccMoney(cc.totalOut)}
Forecast reads live ledger state — delivered-not-funded deals (CIT), submitted warranty claims, open payables, trade payoffs, floorplan, and unpaid commissions. As you fund deals, pay vendors, and post checks, this updates instantly.
{/* RIGHT — why cash changed */}
Why did cash change?
Net bank movement
= 0 ? "#0E7A37" : "#B23A2E" }}>{ccMoney2(mv.net)}
{mv.rows.length === 0 ? (
No cash movement in this window.
) : mv.rows.map((r, i) => (
= 0 ? "#0E7A37" : "#B23A2E" }} /> {r.src} = 0 ? "#0E7A37" : "#B23A2E" }}>{ccMoney2(r.amount)}
))}
ESC-Close go && go("dashboard")}>Dashboard go && go("pnl")}>P&L
); }; Object.assign(window, { CashCommand });