From 9bbe29b42d5068253dcf746e94de2b48f10f0d54 Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Sat, 24 Jan 2026 21:29:12 +0800 Subject: [PATCH] [trep-engine.scm] tally secondary subtotals in subtotal table when displaying secondary-level subtotals, also tally the amounts in the row-total grid --- .../reports/standard/test/test-transaction.scm | 14 +++++++------- gnucash/report/trep-engine.scm | 8 +++++--- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/gnucash/report/reports/standard/test/test-transaction.scm b/gnucash/report/reports/standard/test/test-transaction.scm index 646f4b2140..11dbb05f48 100644 --- a/gnucash/report/reports/standard/test/test-transaction.scm +++ b/gnucash/report/reports/standard/test/test-transaction.scm @@ -962,10 +962,10 @@ "-#51.00" "-#51.00" "-#51.00" "-#51.00" "-#51.00" "-#51.00" "-#612.00" "-#51.00") (get-row-col sxml 5 #f)) (test-equal "summary gbp total-row is correct" - (list "Grand Total" "#0.00" "#0.00") + (list "Total" "#0.00" "#0.00" "#0.00" "#0.00" "#0.00" "#0.00" "#0.00" "#0.00" "#0.00" "#0.00" "#0.00" "#0.00" "#0.00" "#0.00") (get-row-col sxml 6 #f)) (test-equal "summary total-row is correct" - (list "$0.00" "$0.00") + (list "$0.00" "$0.00" "$0.00" "$0.00" "$0.00" "$0.00" "$0.00" "$0.00" "$0.00" "$0.00" "$0.00" "$0.00" "$0.00" "$0.00") (get-row-col sxml 7 #f))) (set-option! options "General" "Start Date" (cons 'absolute (gnc-dmy2time64 01 01 1969))) @@ -981,19 +981,19 @@ (list "Income" "-$29.00" "-$29.00" "-$9.67") (get-row-col sxml 3 #f)) (test-equal "sparse summary-table - row 4" - (list "Grand Total" "$3.00" "$1.00") + (list "Total" "$0.00" "$11.00" "-$8.00" "$3.00" "$1.00") (get-row-col sxml 4 #f)) (test-equal "sparse summary-table - col 1" - (list "Bank" "Expenses" "Income" "Grand Total") + (list "Bank" "Expenses" "Income" "Total") (get-row-col sxml #f 1)) (test-equal "sparse summary-table - col 2" - (list "$29.00" "-$29.00") + (list "$29.00" "-$29.00" "$0.00") (get-row-col sxml #f 2)) (test-equal "sparse summary-table - col 3" - (list "-$5.00" "$16.00") + (list "-$5.00" "$16.00" "$11.00") (get-row-col sxml #f 3)) (test-equal "sparse summary-table - col 4" - (list "-$23.00" "$15.00") + (list "-$23.00" "$15.00" "-$8.00") (get-row-col sxml #f 4)) (test-equal "sparse summary-table - col 5" (list "$1.00" "$31.00" "-$29.00" "$3.00") diff --git a/gnucash/report/trep-engine.scm b/gnucash/report/trep-engine.scm index a1815b83bf..36a55b0b9e 100644 --- a/gnucash/report/trep-engine.scm +++ b/gnucash/report/trep-engine.scm @@ -1780,8 +1780,10 @@ be excluded from periodic reporting.") (or (and first-column-merge? (retrieve-commodity (cadr columns) commodity)) zero)))) - (set! grid - (grid-add grid row col (map get-commodity-grid-amount list-of-commodities))) + (let ((amounts (map get-commodity-grid-amount list-of-commodities))) + (set! grid (grid-add grid row col amounts)) + (when (eq? level 'secondary) + (set! grid (grid-add grid 'row-total col amounts)))) ;; each commodity subtotal gets a separate line in the html-table ;; each line comprises: indenting, first-column, data-columns @@ -2136,7 +2138,7 @@ be excluded from periodic reporting.") (append (list (cond ((not first?) "") - ((eq? row 'row-total) (G_ "Grand Total")) + ((eq? row 'row-total) (G_ "Total")) (else (cdr row)))) (map (lambda (col) (make-table-cell row col commodity 1)) list-of-cols)