mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Add option to advanced portfolio to include $0 splits (#143772).
* src/report/standard-reports/advanced-portfolio.scm: Add option to include zero-amount splits in computations. Fixes #143722. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@10224 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
2004-18-21 Derek Atkins <derek@ihtfp.com>
|
||||||
|
|
||||||
|
* src/report/standard-reports/advanced-portfolio.scm:
|
||||||
|
Add option to include zero-amount splits in computations.
|
||||||
|
Fixes #143722.
|
||||||
|
|
||||||
2004-18-19 Derek Atkins <derek@ihtfp.com>
|
2004-18-19 Derek Atkins <derek@ihtfp.com>
|
||||||
|
|
||||||
Neil Williams's "QOF create: functionality added" patch:
|
Neil Williams's "QOF create: functionality added" patch:
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
(define optname-price-source (N_ "Price Source"))
|
(define optname-price-source (N_ "Price Source"))
|
||||||
(define optname-shares-digits (N_ "Share decimal places"))
|
(define optname-shares-digits (N_ "Share decimal places"))
|
||||||
(define optname-zero-shares (N_ "Include accounts with no shares"))
|
(define optname-zero-shares (N_ "Include accounts with no shares"))
|
||||||
|
(define optname-include-gains (N_ "Include gains and losses"))
|
||||||
|
|
||||||
(define (options-generator)
|
(define (options-generator)
|
||||||
(let* ((options (gnc:new-options))
|
(let* ((options (gnc:new-options))
|
||||||
@@ -78,6 +79,13 @@
|
|||||||
"e" (N_ "The number of decimal places to use for share numbers") 2
|
"e" (N_ "The number of decimal places to use for share numbers") 2
|
||||||
0 6 0 1))
|
0 6 0 1))
|
||||||
|
|
||||||
|
(gnc:register-option
|
||||||
|
options
|
||||||
|
(gnc:make-simple-boolean-option
|
||||||
|
gnc:pagename-general optname-include-gains "f"
|
||||||
|
(N_ "Include splits with no shares for calculating money-in and money-out")
|
||||||
|
#f))
|
||||||
|
|
||||||
;; Account tab
|
;; Account tab
|
||||||
(add-option
|
(add-option
|
||||||
(gnc:make-account-list-option
|
(gnc:make-account-list-option
|
||||||
@@ -127,7 +135,7 @@
|
|||||||
(string=? (gnc:split-get-guid s1) (gnc:split-get-guid s2)))
|
(string=? (gnc:split-get-guid s1) (gnc:split-get-guid s2)))
|
||||||
|
|
||||||
(define (table-add-stock-rows table accounts to-date
|
(define (table-add-stock-rows table accounts to-date
|
||||||
currency price-fn exchange-fn include-empty
|
currency price-fn exchange-fn include-empty include-gains
|
||||||
total-value total-moneyin total-moneyout
|
total-value total-moneyin total-moneyout
|
||||||
total-gain)
|
total-gain)
|
||||||
|
|
||||||
@@ -178,7 +186,7 @@
|
|||||||
((same-split? s split)
|
((same-split? s split)
|
||||||
;; (gnc:debug "amount" (gnc:numeric-to-double (gnc:split-get-amount s)) )
|
;; (gnc:debug "amount" (gnc:numeric-to-double (gnc:split-get-amount s)) )
|
||||||
(cond
|
(cond
|
||||||
((not (gnc:numeric-zero-p (gnc:split-get-amount s)))
|
((or include-gains (not (gnc:numeric-zero-p (gnc:split-get-amount s))))
|
||||||
(unitscoll 'add commodity (gnc:split-get-amount s)) ;; Is the stock transaction?
|
(unitscoll 'add commodity (gnc:split-get-amount s)) ;; Is the stock transaction?
|
||||||
(if (< 0 (gnc:numeric-to-double
|
(if (< 0 (gnc:numeric-to-double
|
||||||
(gnc:split-get-amount s)))
|
(gnc:split-get-amount s)))
|
||||||
@@ -282,6 +290,8 @@
|
|||||||
gnc:optname-reportname))
|
gnc:optname-reportname))
|
||||||
(include-empty (get-option gnc:pagename-accounts
|
(include-empty (get-option gnc:pagename-accounts
|
||||||
optname-zero-shares))
|
optname-zero-shares))
|
||||||
|
(include-gains (get-option gnc:pagename-general
|
||||||
|
optname-include-gains))
|
||||||
|
|
||||||
(total-value (gnc:make-commodity-collector))
|
(total-value (gnc:make-commodity-collector))
|
||||||
(total-moneyin (gnc:make-commodity-collector))
|
(total-moneyin (gnc:make-commodity-collector))
|
||||||
@@ -330,7 +340,7 @@
|
|||||||
|
|
||||||
(table-add-stock-rows
|
(table-add-stock-rows
|
||||||
table accounts to-date currency price-fn exchange-fn
|
table accounts to-date currency price-fn exchange-fn
|
||||||
include-empty total-value total-moneyin total-moneyout total-gain)
|
include-empty include-gains total-value total-moneyin total-moneyout total-gain)
|
||||||
|
|
||||||
(gnc:html-table-append-row/markup!
|
(gnc:html-table-append-row/markup!
|
||||||
table
|
table
|
||||||
|
|||||||
Reference in New Issue
Block a user