mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[report-utilities][API] gnc:accounts-and-all-descendants
return a list of accounts and their descendant accounts
This commit is contained in:
parent
38b2d4708b
commit
ae4b7e1582
@ -686,6 +686,7 @@
|
|||||||
(export gnc:account-get-type-string-plural)
|
(export gnc:account-get-type-string-plural)
|
||||||
(export gnc:accounts-get-commodities)
|
(export gnc:accounts-get-commodities)
|
||||||
(export gnc:get-current-account-tree-depth)
|
(export gnc:get-current-account-tree-depth)
|
||||||
|
(export gnc:accounts-and-all-descendants)
|
||||||
(export gnc:acccounts-get-all-subaccounts)
|
(export gnc:acccounts-get-all-subaccounts)
|
||||||
(export gnc:make-stats-collector) ;deprecated
|
(export gnc:make-stats-collector) ;deprecated
|
||||||
(export gnc:make-drcr-collector) ;deprecated
|
(export gnc:make-drcr-collector) ;deprecated
|
||||||
|
@ -149,6 +149,15 @@ construct gnc:make-gnc-monetary and use gnc:monetary->string instead.")
|
|||||||
(append-map gnc-account-get-descendants-sorted
|
(append-map gnc-account-get-descendants-sorted
|
||||||
accountlist))
|
accountlist))
|
||||||
|
|
||||||
|
;; Return accountslist *and* their descendant accounts
|
||||||
|
(define (gnc:accounts-and-all-descendants accountslist)
|
||||||
|
(sort-and-delete-duplicates
|
||||||
|
(append accountslist
|
||||||
|
(gnc:acccounts-get-all-subaccounts accountslist))
|
||||||
|
(lambda (a b)
|
||||||
|
(string<? (gnc-account-get-full-name a) (gnc-account-get-full-name b)))
|
||||||
|
equal?))
|
||||||
|
|
||||||
;;; Here's a statistics collector... Collects max, min, total, and makes
|
;;; Here's a statistics collector... Collects max, min, total, and makes
|
||||||
;;; it easy to get at the mean.
|
;;; it easy to get at the mean.
|
||||||
|
|
||||||
|
@ -511,6 +511,15 @@
|
|||||||
(list (account-lookup "Expenses")
|
(list (account-lookup "Expenses")
|
||||||
(account-lookup "GBP Bank"))))
|
(account-lookup "GBP Bank"))))
|
||||||
|
|
||||||
|
(test-equal "gnc:accounts-and-all-descendants"
|
||||||
|
(list (account-lookup "GBP Bank")
|
||||||
|
(account-lookup "GBP Savings")
|
||||||
|
(account-lookup "Expenses")
|
||||||
|
(account-lookup "Fuel"))
|
||||||
|
(gnc:accounts-and-all-descendants
|
||||||
|
(list (account-lookup "Expenses")
|
||||||
|
(account-lookup "GBP Bank"))))
|
||||||
|
|
||||||
(teardown)))
|
(teardown)))
|
||||||
|
|
||||||
(define (test-monetary-adders)
|
(define (test-monetary-adders)
|
||||||
|
Loading…
Reference in New Issue
Block a user