mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Revert advanced-portfolio.scm r13244 because it breaks the report.
* src/report/standard-reports/advanced-portfolio.scm: revert r13244 in this file because it's badly formed and breaks the report. Reopened bug #314554. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13252 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
f06a206c07
commit
effc0e7a9c
@ -1,3 +1,9 @@
|
||||
2006-02-13 Derek Atkins <derek@ihtfp.com>
|
||||
|
||||
* src/report/standard-reports/advanced-portfolio.scm:
|
||||
revert r13244 in this file because it's badly formed and
|
||||
breaks the report. Reopened bug #314554.
|
||||
|
||||
2006-02-12 Neil Williams <linux@codehelp.co.uk>
|
||||
|
||||
* src/calculation/fin.c : Fix Bug 107876 - financial
|
||||
|
@ -170,9 +170,8 @@
|
||||
(price-list (price-fn commodity to-date))
|
||||
(price (if (> (length price-list) 0)
|
||||
(car price-list) #f))
|
||||
(commod-currency (gnc:price-get-currency price))
|
||||
(value (exchange-fn (gnc:make-gnc-monetary commodity units)
|
||||
currency))
|
||||
|
||||
(value (exchange-fn (gnc:make-gnc-monetary commodity units) currency to-date))
|
||||
)
|
||||
|
||||
;; (gnc:debug "---" name "---")
|
||||
@ -186,11 +185,7 @@
|
||||
(lambda (s)
|
||||
(cond
|
||||
((same-split? s split)
|
||||
;; (gnc:debug "amount " (gnc:numeric-to-double (gnc:split-get-amount s))
|
||||
;; " acct " (gnc:account-get-name (gnc:split-get-account s)) )
|
||||
;; (gnc:debug "value " (gnc:numeric-to-double (gnc:split-get-value s))
|
||||
;; " in " (gnc:commodity-get-printname commod-currency)
|
||||
;; " from " (gnc:transaction-get-description (gnc:split-get-parent s)))
|
||||
;; (gnc:debug "amount" (gnc:numeric-to-double (gnc:split-get-amount s)) )
|
||||
(cond
|
||||
((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?
|
||||
@ -208,17 +203,17 @@
|
||||
(cond
|
||||
((gnc:numeric-negative-p (gnc:split-get-value s))
|
||||
(moneyoutcoll
|
||||
'add commod-currency
|
||||
'add currency
|
||||
(gnc:numeric-neg (gnc:split-get-value s))))
|
||||
(else (moneyincoll
|
||||
'add commod-currency
|
||||
'add currency
|
||||
(gnc:numeric-neg (gnc:split-get-value s))))))))
|
||||
|
||||
((split-account-type? s 'expense)
|
||||
(brokeragecoll 'add commod-currency (gnc:split-get-value s)))
|
||||
(brokeragecoll 'add currency (gnc:split-get-value s)))
|
||||
|
||||
((split-account-type? s 'income)
|
||||
(dividendcoll 'add commod-currency (gnc:split-get-value s)))
|
||||
(dividendcoll 'add currency (gnc:split-get-value s)))
|
||||
)
|
||||
)
|
||||
(gnc:transaction-get-splits parent)
|
||||
@ -237,12 +232,8 @@
|
||||
(gaincoll 'add (gnc:gnc-monetary-commodity value) (gnc:gnc-monetary-amount value))
|
||||
(gaincoll 'merge moneyincoll #f)
|
||||
|
||||
(let ((moneyin (gnc:monetary-neg
|
||||
(gnc:sum-collector-commodity moneyincoll currency exchange-fn)))
|
||||
(moneyout (gnc:sum-collector-commodity moneyoutcoll currency exchange-fn))
|
||||
(gain (gnc:sum-collector-commodity gaincoll currency exchange-fn))
|
||||
)
|
||||
(total-value 'add (gnc:gnc-monetary-commodity value) (gnc:gnc-monetary-amount value))
|
||||
(if (or include-empty (not (gnc:numeric-zero-p units)))
|
||||
(begin (total-value 'add (gnc:gnc-monetary-commodity value) (gnc:gnc-monetary-amount value))
|
||||
(total-moneyin 'merge moneyincoll #f)
|
||||
(total-moneyout 'merge moneyoutcoll #f)
|
||||
(total-gain 'merge gaincoll #f)
|
||||
@ -263,18 +254,17 @@
|
||||
(gnc:price-get-currency price)
|
||||
(gnc:price-get-value price)))
|
||||
#f))
|
||||
(gnc:make-html-table-header-cell/markup "number-cell" value)
|
||||
(gnc:make-html-table-header-cell/markup "number-cell" moneyin)
|
||||
(gnc:make-html-table-header-cell/markup "number-cell" moneyout)
|
||||
(gnc:make-html-table-header-cell/markup "number-cell" gain)
|
||||
(gnc:make-html-table-header-cell/markup
|
||||
"number-cell"
|
||||
(sprintf #f "%.2f%%"
|
||||
(* 100 (/ (gnc:numeric-to-double
|
||||
(gnc:gnc-monetary-amount gain))
|
||||
(gnc:numeric-to-double
|
||||
(gnc:gnc-monetary-amount moneyin))))
|
||||
))
|
||||
"number-cell" value)
|
||||
(gnc:make-html-table-header-cell/markup
|
||||
"number-cell" (gnc:monetary-neg (gnc:sum-collector-commodity moneyincoll currency exchange-fn)))
|
||||
(gnc:make-html-table-header-cell/markup
|
||||
"number-cell" (gnc:sum-collector-commodity moneyoutcoll currency exchange-fn))
|
||||
(gnc:make-html-table-header-cell/markup
|
||||
"number-cell" (gnc:sum-collector-commodity gaincoll currency exchange-fn))
|
||||
(gnc:make-html-table-header-cell/markup
|
||||
"number-cell" (sprintf #f "%.2f%%" (* 100 (/ (gnc:numeric-to-double (cadr (gaincoll 'getpair currency #f)))
|
||||
(gnc:numeric-to-double (cadr (moneyincoll 'getpair currency #t)))))))
|
||||
)
|
||||
)
|
||||
(table-add-stock-rows-internal rest (not odd-row?))
|
||||
@ -285,7 +275,7 @@
|
||||
)))
|
||||
|
||||
(set! work-to-do (gnc:accounts-count-splits accounts))
|
||||
(table-add-stock-rows-internal accounts #t))
|
||||
(table-add-stock-rows-internal accounts #t)))
|
||||
|
||||
;; Tell the user that we're starting.
|
||||
(gnc:report-starting reportname)
|
||||
@ -319,9 +309,15 @@
|
||||
report-title
|
||||
(sprintf #f " %s" (gnc:print-date to-date))))
|
||||
|
||||
;; (gnc:debug "accounts" accounts)
|
||||
(if (not (null? accounts))
|
||||
; at least 1 account selected
|
||||
(let* ((exchange-fn (gnc:case-exchange-fn price-source currency to-date))
|
||||
(let* ((exchange-fn
|
||||
(case price-source
|
||||
('pricedb-latest
|
||||
(lambda (foreign domestic date)
|
||||
(gnc:exchange-by-pricedb-latest foreign domestic)))
|
||||
('pricedb-nearest gnc:exchange-by-pricedb-nearest)))
|
||||
(pricedb (gnc:book-get-pricedb (gnc:get-current-book)))
|
||||
(price-fn
|
||||
(case price-source
|
||||
@ -330,8 +326,7 @@
|
||||
(gnc:pricedb-lookup-latest-any-currency pricedb foreign)))
|
||||
('pricedb-nearest
|
||||
(lambda (foreign date)
|
||||
(gnc:pricedb-lookup-nearest-in-time-any-currency
|
||||
pricedb foreign (gnc:timepair-canonical-day-time date)))))))
|
||||
(gnc:pricedb-lookup-nearest-in-time-any-currency pricedb foreign date))))))
|
||||
|
||||
(gnc:html-table-set-col-headers!
|
||||
table
|
||||
@ -346,11 +341,6 @@
|
||||
(_ "Gain")
|
||||
(_ "Total Return")))
|
||||
|
||||
(set! accounts (sort accounts
|
||||
(lambda (a b)
|
||||
(string<? (gnc:account-get-name a)
|
||||
(gnc:account-get-name b)))))
|
||||
|
||||
(table-add-stock-rows
|
||||
table accounts to-date currency price-fn exchange-fn
|
||||
include-empty include-gains total-value total-moneyin total-moneyout total-gain)
|
||||
|
Loading…
Reference in New Issue
Block a user