gnucash maint: [equity-statement] compact functions and use collector arithmetic
Christopher Lam
clam at code.gnucash.org
Sun Sep 29 06:37:15 EDT 2019
Updated via https://github.com/Gnucash/gnucash/commit/307ca4e2 (commit)
from https://github.com/Gnucash/gnucash/commit/5aa59e0c (commit)
commit 307ca4e27da1646b7911ad776c931529c4a46b88
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sun Sep 29 18:36:25 2019 +0800
[equity-statement] compact functions and use collector arithmetic
diff --git a/gnucash/report/standard-reports/equity-statement.scm b/gnucash/report/standard-reports/equity-statement.scm
index aedc140f1..8287e014d 100644
--- a/gnucash/report/standard-reports/equity-statement.scm
+++ b/gnucash/report/standard-reports/equity-statement.scm
@@ -371,22 +371,17 @@
amount report-commodity exchange-fn)))))
(label (if neg? (or neg-label pos-label) pos-label))
(pos-bal (if neg?
- (let ((bal (gnc:make-commodity-collector)))
- (bal 'minusmerge amount #f)
- bal)
+ (gnc:collector- amount)
amount))
(bal (gnc:sum-collector-commodity
- pos-bal report-commodity exchange-fn))
- (balance
- (or (and (gnc:uniform-commodity? pos-bal report-commodity)
- bal)
- (and show-fcur?
- (gnc-commodity-table
- pos-bal report-commodity exchange-fn))
- bal
- ))
- (column (or col 0))
- )
+ pos-bal report-commodity exchange-fn))
+ (balance
+ (cond
+ ((gnc:uniform-commodity? pos-bal report-commodity) bal)
+ (show-fcur? (gnc-commodity-table
+ pos-bal report-commodity exchange-fn))
+ (else bal)))
+ (column (or col 0)))
(gnc:html-table-add-labeled-amount-line!
table 3 row-style rule?
label 0 1 "text-cell"
@@ -408,9 +403,11 @@
(define (unrealized-gains-at-date book-balance exchange-fn date)
(define weighted-fn
(gnc:case-exchange-fn 'weighted-average report-commodity date))
- (gnc:collector-
- (gnc:sum-collector-commodity book-balance report-commodity exchange-fn)
- (gnc:sum-collector-commodity book-balance report-commodity weighted-fn)))
+ (gnc:monetaries-add (gnc:sum-collector-commodity
+ book-balance report-commodity exchange-fn)
+ (gnc:monetary-neg
+ (gnc:sum-collector-commodity
+ book-balance report-commodity weighted-fn))))
;; If you ask me, any outstanding(TM) retained earnings and
;; unrealized gains should be added directly into equity,
Summary of changes:
.../report/standard-reports/equity-statement.scm | 31 ++++++++++------------
1 file changed, 14 insertions(+), 17 deletions(-)
More information about the gnucash-changes
mailing list