Fix the bug described in comment 19 of bug 537476, balance sheet wrong without trading accounts.

The problems is that xaccQueryAddAccountMatch and xaccQueryAddAccountGUIDMatch
match all accounts rather than no accounts when given a null account list.  This means
that gnc:accountlist-get-comm-balance-at-date returns a balance for all accounts when
given no accounts.  This caused the balance sheet report to fail if there were no trading
accounts.  There is a similar problem with gnc:account-get-trans-type-splits-interval in 
gnc:html-acct-table-add-accounts! in html-acct-table.scm that is also fixed.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18455 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Mike Alexander 2009-12-01 05:15:02 +00:00
parent bf7a7a7497
commit e150417410
2 changed files with 32 additions and 22 deletions

View File

@ -679,26 +679,31 @@
shares))))
splits))
(merge-splits (gnc:account-get-trans-type-splits-interval
accts #f start-date end-date)
#f)
(cond
((equal? balance-mode 'post-closing) #t)
((equal? balance-mode 'pre-closing)
(merge-splits (gnc:account-get-trans-type-splits-interval
accts closing-pattern start-date end-date)
#t))
((equal? balance-mode 'pre-adjusting)
(merge-splits (gnc:account-get-trans-type-splits-interval
accts closing-pattern start-date end-date)
#t)
(merge-splits (gnc:account-get-trans-type-splits-interval
accts adjusting-pattern start-date end-date)
#t))
(else (begin (display "you fail it")
(newline))))
;; If you pass a null account list to gnc:account-get-trans-type-splits-interval
;; it returns splits from all accounts rather than from no accounts. This is
;; probably a bug but we'll work around it for now.
(if (not (null? accts))
(begin
(merge-splits (gnc:account-get-trans-type-splits-interval
accts #f start-date end-date)
#f)
(cond
((equal? balance-mode 'post-closing) #t)
((equal? balance-mode 'pre-closing)
(merge-splits (gnc:account-get-trans-type-splits-interval
accts closing-pattern start-date end-date)
#t))
((equal? balance-mode 'pre-adjusting)
(merge-splits (gnc:account-get-trans-type-splits-interval
accts closing-pattern start-date end-date)
#t)
(merge-splits (gnc:account-get-trans-type-splits-interval
accts adjusting-pattern start-date end-date)
#t))
(else (begin (display "you fail it")
(newline))))))
hash-table
)

View File

@ -507,8 +507,13 @@
neg-retained-earnings
#f)
(set! neg-trading-balance
(gnc:accountlist-get-comm-balance-at-date
trading-accounts date-tp))
;; If you pass a null account list to gnc:accountlist-get-comm-balance-at-date
;; it calculates a balance for all accounts, instead of no accounts. This is
;; probably a bug, but for now we'll work around it.
(if (null? trading-accounts)
(gnc:make-commodity-collector)
(gnc:accountlist-get-comm-balance-at-date
trading-accounts date-tp)))
(set! trading-balance (gnc:make-commodity-collector))
(trading-balance 'minusmerge
neg-trading-balance