From 344168abdd31e1df8d683f27da817ee0992d0983 Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Fri, 18 Sep 2026 12:59:45 -0400 Subject: [PATCH] Run the ledger's cumulative across the whole selection It started at the baseline, so it accumulated only the part that can still move and stopped short of the number on the screen. Now it accumulates in display order from the top -- billed, then booked, then the baseline, then each adjustment -- and closes on Selected total. Adjustable keeps its own figure but no running cell: it is a subtotal of the walk, not a point on the line, and printing the running there would put two different totals side by side in one row. Co-Authored-By: Claude Opus 5 (1M context) --- ui/src/components/OperationPanel.jsx | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/ui/src/components/OperationPanel.jsx b/ui/src/components/OperationPanel.jsx index 846879f..af453fe 100644 --- a/ui/src/components/OperationPanel.jsx +++ b/ui/src/components/OperationPanel.jsx @@ -490,13 +490,19 @@ function ScaleLedger({ currentTotals, scaleInputs, setScaleInputs, scalePlug, se // Value only: a cumulative price is meaningless -- prices do not add -- and a // second running column for units doubles the width to say something the // value column already implies. + // Accumulates in display order across everything: the immovable segments + // first, then the walk. So it reads as the whole number being built up -- + // billed, then booked, then the baseline, then each adjustment -- and closes + // on Selected total rather than on Adjustable, which is only the part of it + // that can still move. const runningByKey = (() => { const out = new Map() let acc = 0 - for (const e of lines) { acc += e.value || 0; out.set(e.key, acc) } + for (const seg of exclLines) { acc += seg.value || 0; out.set(`final:${seg.name}`, acc) } + for (const e of lines) { acc += e.value || 0; out.set(e.key, acc) } return out })() - const showRunning = !!valueCol && lines.length > 1 + const showRunning = !!valueCol && (lines.length + exclLines.length) > 1 const numCell = 'text-right font-mono tabular-nums whitespace-nowrap px-2' const rule =
@@ -537,6 +543,11 @@ function ScaleLedger({ currentTotals, scaleInputs, setScaleInputs, scalePlug, se {m.key === 'price' ? fmtNum(priceOf(seg), m.dp) : fmtNum(seg[m.key], m.dp)} ))} + {showRunning && ( + + {fmtNum(runningByKey.get(`final:${seg.name}`), 0)} + + )} ))} @@ -572,9 +583,7 @@ function ScaleLedger({ currentTotals, scaleInputs, setScaleInputs, scalePlug, se {measures.map(m => ( {fmtNum(m.current, m.dp)} ))} - {showRunning && ( - {fmtNum(total.value, 0)} - )} + {showRunning && } @@ -588,6 +597,9 @@ function ScaleLedger({ currentTotals, scaleInputs, setScaleInputs, scalePlug, se : fmtNum(grand[m.key], m.dp)} ))} + {showRunning && ( + {fmtNum(grand.value, 0)} + )} )}