|
@@ -189,6 +189,9 @@ tr.r-total td.neg{color:#fca5a5!important}
|
|
|
<div id="total-wrap">
|
|
<div id="total-wrap">
|
|
|
<input type="checkbox" id="show-total" onchange="render()">
|
|
<input type="checkbox" id="show-total" onchange="render()">
|
|
|
<label for="show-total">Show Year Totals</label>
|
|
<label for="show-total">Show Year Totals</label>
|
|
|
|
|
+ <span style="color:#cbd5e1;margin:0 4px">|</span>
|
|
|
|
|
+ <input type="checkbox" id="totals-only" onchange="onTotalsOnly()">
|
|
|
|
|
+ <label for="totals-only">Totals Only</label>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
@@ -362,11 +365,21 @@ async function load() {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// ── Totals-only toggle: force show-total on when totals-only is enabled ──
|
|
|
|
|
+function onTotalsOnly() {
|
|
|
|
|
+ const totalsOnly = document.getElementById('totals-only').checked;
|
|
|
|
|
+ const showTotal = document.getElementById('show-total');
|
|
|
|
|
+ if (totalsOnly) { showTotal.checked = true; showTotal.disabled = true; }
|
|
|
|
|
+ else { showTotal.disabled = false; }
|
|
|
|
|
+ render();
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// ── Render table ──
|
|
// ── Render table ──
|
|
|
function render() {
|
|
function render() {
|
|
|
if (!plData || !plData.rows) return;
|
|
if (!plData || !plData.rows) return;
|
|
|
|
|
|
|
|
- const showTotal = document.getElementById('show-total').checked;
|
|
|
|
|
|
|
+ const showTotal = document.getElementById('show-total').checked;
|
|
|
|
|
+ const totalsOnly = document.getElementById('totals-only').checked;
|
|
|
|
|
|
|
|
// Only real month columns (no DB TOTAL)
|
|
// Only real month columns (no DB TOTAL)
|
|
|
const monthCols = (plData.columns || []).filter(c => !c.is_total);
|
|
const monthCols = (plData.columns || []).filter(c => !c.is_total);
|
|
@@ -379,12 +392,13 @@ function render() {
|
|
|
else { yearGroups.push({ year: c.year, cols: [c] }); }
|
|
else { yearGroups.push({ year: c.year, cols: [c] }); }
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- // Build flat display-column list: months interleaved with optional year-total sentinels
|
|
|
|
|
- // sentinel: { isYTotal: true, year, cols: [...month cols for this year] }
|
|
|
|
|
|
|
+ // Build flat display-column list.
|
|
|
|
|
+ // In totals-only mode: one year-total sentinel per year, no individual months.
|
|
|
|
|
+ // Otherwise: months interleaved with optional year-total sentinels.
|
|
|
const dispCols = [];
|
|
const dispCols = [];
|
|
|
yearGroups.forEach(yg => {
|
|
yearGroups.forEach(yg => {
|
|
|
- yg.cols.forEach(c => dispCols.push(c));
|
|
|
|
|
- if (showTotal) dispCols.push({ isYTotal: true, year: yg.year, cols: yg.cols });
|
|
|
|
|
|
|
+ if (!totalsOnly) yg.cols.forEach(c => dispCols.push(c));
|
|
|
|
|
+ if (totalsOnly || showTotal) dispCols.push({ isYTotal: true, year: yg.year, cols: yg.cols });
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
const selCount = selected.size;
|
|
const selCount = selected.size;
|