[trep-engine.scm] tally secondary subtotals in subtotal table

when displaying secondary-level subtotals, also tally the amounts in
the row-total grid
pull/2170/head
Christopher Lam 4 weeks ago
parent d3baa74e72
commit 9bbe29b42d

@ -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")

@ -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)

Loading…
Cancel
Save