2001-05-07 Christian Stimming <stimming@tuhh.de>

* src/scm/commodity-utilities.scm: Always use the absolute value
	when building a weighted average.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4127 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas
2001-05-08 08:02:54 +00:00
parent 9a1469eff2
commit f9fb478f48
2 changed files with 13 additions and 7 deletions

View File

@@ -1,3 +1,8 @@
2001-05-07 Christian Stimming <stimming@tuhh.de>
* src/scm/commodity-utilities.scm: Always use the absolute value
when building a weighted average.
2001-05-06 Christian Stimming <stimming@tuhh.de>
* src/scm/report/price-scatter.scm: add options for marker shape

View File

@@ -220,8 +220,11 @@
(gnc:split-get-parent a)))
(account-comm (gnc:account-get-commodity
(gnc:split-get-account a)))
(share-amount (gnc:split-get-share-amount a))
(value-amount (gnc:split-get-value a))
;; Always use the absolute value here.
(share-amount (gnc:numeric-abs
(gnc:split-get-share-amount a)))
(value-amount (gnc:numeric-abs
(gnc:split-get-value a)))
(tmp (assoc transaction-comm sumlist))
(comm-list (if (not tmp)
(assoc account-comm sumlist)
@@ -240,16 +243,14 @@
(set! sumlist (cons comm-list sumlist)))
;; yes, check for second commodity.
(let*
;; Put the amounts in the right place.
((foreignlist
;; this will adjust the signs appropriately
(if (gnc:commodity-equiv? transaction-comm
(car comm-list))
(list account-comm
(gnc:numeric-neg share-amount)
(gnc:numeric-neg value-amount))
share-amount value-amount)
(list transaction-comm
value-amount
share-amount)))
value-amount share-amount)))
;; second commodity already existing in comm-list?
(pair (assoc (car foreignlist) (cadr comm-list))))
;; if not, create a new entry in comm-list.