Bug 681225 - income statement displays blank base currency entries when trading account transactions are present during the report period

Skip splits in trading accounts when calculating
average cost price source.
This commit is contained in:
Geert Janssens 2015-06-16 21:38:14 +02:00
parent 8dc91cf764
commit e67e512501

View File

@ -644,8 +644,11 @@
(if (not (null? curr-accounts))
;; Go through all splits and add up all value-amounts
;; and share-amounts
;; However skip splits in trading accounts as these counterbalance
;; the actual value and share amounts back to zero
(for-each
(lambda (a)
(if (not (eq? (xaccAccountGetType (xaccSplitGetAccount a)) ACCT-TYPE-TRADING))
(let* ((transaction-comm (xaccTransGetCurrency
(xaccSplitGetParent a)))
(account-comm (xaccAccountGetCommodity
@ -697,7 +700,7 @@
(car comm-list) sumlist)))))
;; And add the balances to the comm-list entry.
((caadr pair) 'add (cadr foreignlist))
((cdadr pair) 'add (caddr foreignlist))))))
((cdadr pair) 'add (caddr foreignlist)))))))
(gnc:get-all-commodity-splits curr-accounts end-date)))
(gnc:resolve-unknown-comm sumlist report-commodity)))