// Screen: Compounding — formula library + cost rollup detail function Compounding({ density }) { const { useState } = React; const [selId, setSelId] = useState(FORMULAS[0].id); const sel = FORMULAS.find(f => f.id === selId); const ingCost = sel.ingredients.reduce((a, x) => a + x.cost, 0); const labor = 6.5; const totalCost = ingCost + labor; const margin = (sel.price - totalCost) / sel.price; return (
| Formula | BUD | Fills MTD | Cost | Price | Margin |
|---|---|---|---|---|---|
|
{f.name}
{f.category} · {f.form}
|
{f.bud} | {f.mtdFills} | ${(f.costPerUnit + 6.5).toFixed(2)} | ${f.price.toFixed(2)} | {(m * 100).toFixed(0)}% |
| Ingredient | Qty | Cost |
|---|---|---|
| {ing.name} | {ing.qty} | ${ing.cost.toFixed(2)} |