From acf359a7973aa30686529ce46d18617ac51d77f8 Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Thu, 19 Sep 2019 21:07:41 +0800 Subject: [PATCH] [trial-balance] upgrade coll-plus and coll-minus to report-wide fns --- .../report/standard-reports/trial-balance.scm | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/gnucash/report/standard-reports/trial-balance.scm b/gnucash/report/standard-reports/trial-balance.scm index 35aa425a18..49a4ba4855 100644 --- a/gnucash/report/standard-reports/trial-balance.scm +++ b/gnucash/report/standard-reports/trial-balance.scm @@ -316,6 +316,19 @@ options)) +;; (coll-plus collectors ...) equiv to (+ collectors ...) +(define (coll-plus . collectors) + (let ((res (gnc:make-commodity-collector))) + (for-each (lambda (coll) (res 'merge coll #f)) collectors) + res)) + +;; (coll-minus collectors ...) equiv to (- collector0 collector1 ...) +(define (coll-minus . collectors) + (let ((res (gnc:make-commodity-collector))) + (res 'merge (car collectors) #f) + (for-each (lambda (coll) (res 'minusmerge coll #f)) (cdr collectors)) + res)) + ;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; trial-balance-renderer ;; set up the document and add the table @@ -665,12 +678,6 @@ splits) total)) - (define (coll-minus . collectors) - (let ((res (gnc:make-commodity-collector))) - (res 'merge (car collectors) #f) - (for-each (lambda (mon) (res 'minusmerge mon #f)) (cdr collectors)) - res)) - (while (< row rows) (let* ((env (gnc:html-acct-table-get-row-env acct-table row)) (acct (get-val env 'account))