mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Bug 722140: Add option to control inclusion of trading accounts in cash flow report.
This commit is contained in:
parent
e4d97f6d74
commit
5db0cb98d4
@ -51,6 +51,7 @@
|
|||||||
(define optname-price-source (N_ "Price Source"))
|
(define optname-price-source (N_ "Price Source"))
|
||||||
(define optname-show-rates (N_ "Show Exchange Rates"))
|
(define optname-show-rates (N_ "Show Exchange Rates"))
|
||||||
(define optname-show-full-names (N_ "Show Full Account Names"))
|
(define optname-show-full-names (N_ "Show Full Account Names"))
|
||||||
|
(define optname-include-trading-accounts (N_ "Include Trading Accounts in report"))
|
||||||
|
|
||||||
;; options generator
|
;; options generator
|
||||||
(define (cash-flow-options-generator)
|
(define (cash-flow-options-generator)
|
||||||
@ -93,6 +94,13 @@
|
|||||||
ACCT-TYPE-STOCK ACCT-TYPE-MUTUAL)
|
ACCT-TYPE-STOCK ACCT-TYPE-MUTUAL)
|
||||||
(gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
|
(gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
|
||||||
#f)
|
#f)
|
||||||
|
|
||||||
|
;; Trading accounts?
|
||||||
|
(gnc:register-option
|
||||||
|
options
|
||||||
|
(gnc:make-simple-boolean-option
|
||||||
|
gnc:pagename-accounts optname-include-trading-accounts
|
||||||
|
"b" (N_ "Include transfers to and from Trading Accounts in the report.") #f))
|
||||||
|
|
||||||
;; Set the general page as default option tab
|
;; Set the general page as default option tab
|
||||||
(gnc:options-set-default-section options gnc:pagename-general)
|
(gnc:options-set-default-section options gnc:pagename-general)
|
||||||
@ -119,6 +127,8 @@
|
|||||||
optname-show-subaccounts))
|
optname-show-subaccounts))
|
||||||
(accounts (get-option gnc:pagename-accounts
|
(accounts (get-option gnc:pagename-accounts
|
||||||
optname-accounts))
|
optname-accounts))
|
||||||
|
(include-trading-accounts (get-option gnc:pagename-accounts
|
||||||
|
optname-include-trading-accounts))
|
||||||
(row-num 0)
|
(row-num 0)
|
||||||
(work-done 0)
|
(work-done 0)
|
||||||
(work-to-do 0)
|
(work-to-do 0)
|
||||||
@ -261,6 +271,7 @@
|
|||||||
(for-each
|
(for-each
|
||||||
(lambda (s)
|
(lambda (s)
|
||||||
(let* ((s-account (xaccSplitGetAccount s))
|
(let* ((s-account (xaccSplitGetAccount s))
|
||||||
|
(s-account-type (xaccAccountGetType s-account))
|
||||||
(s-amount (xaccSplitGetAmount s))
|
(s-amount (xaccSplitGetAmount s))
|
||||||
(s-value (xaccSplitGetValue s))
|
(s-value (xaccSplitGetValue s))
|
||||||
(s-commodity (xaccAccountGetCommodity s-account)))
|
(s-commodity (xaccAccountGetCommodity s-account)))
|
||||||
@ -275,6 +286,7 @@
|
|||||||
;(gnc:debug (xaccAccountGetName s-account))
|
;(gnc:debug (xaccAccountGetName s-account))
|
||||||
(if (and ;; make sure we don't have
|
(if (and ;; make sure we don't have
|
||||||
(not (null? s-account)) ;; any dangling splits
|
(not (null? s-account)) ;; any dangling splits
|
||||||
|
(or include-trading-accounts (not (eq? s-account-type ACCT-TYPE-TRADING)))
|
||||||
(not (account-in-list? s-account accounts)))
|
(not (account-in-list? s-account accounts)))
|
||||||
(if (not (split-in-list? s seen-split-list))
|
(if (not (split-in-list? s seen-split-list))
|
||||||
(begin
|
(begin
|
||||||
|
Loading…
Reference in New Issue
Block a user