From a33a1f2f1b40b5202739a76284cf5eb980a71fda Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Sun, 25 Jan 2026 09:43:23 +0800 Subject: [PATCH] [trep-engine.scm] upgrade grid-add formerly, grid-add was simply adding a new (vector row col data) to the grid. it was assuming there was no existing data in row/col. upgrade so that it will consider the existing grid row/col; if there's existing data it will add the monetary amounts into it. --- gnucash/report/trep-engine.scm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gnucash/report/trep-engine.scm b/gnucash/report/trep-engine.scm index c33515f456..4070749e2e 100644 --- a/gnucash/report/trep-engine.scm +++ b/gnucash/report/trep-engine.scm @@ -2092,9 +2092,13 @@ be excluded from periodic reporting.") (define (grid-cols grid) (delete-duplicates (map get-grid-col grid))) (define (grid-add grid row col data) - ;; we don't need to check for duplicate cells in a row/col because - ;; in the trep it should never happen. - (cons (make-grid-cell row col data) grid)) + (let lp ((grid grid) (rv '()) (added? #f)) + (match grid + (() (if added? rv (cons (make-grid-cell row col data) rv))) + (((? (cut cell-match? <> row col) this) . rest) + (let ((coll (apply gnc:monetaries-add (append (get-grid-datum this) data)))) + (lp rest (cons (make-grid-cell row col (coll 'format gnc:make-gnc-monetary #f)) rv) #t))) + ((this . rest) (lp rest (cons this rv) added?))))) (define (grid->html-table grid) (define (