mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[balsheet-pnl] fixcrash: price-conversion with 'overall-period
previously price-conversion with overall-period would fail when considering the pricing date for the overall-period column. Use the last date for the overall-period.
This commit is contained in:
parent
c3eab984ce
commit
9e3aca2ea9
@ -781,20 +781,30 @@ also show overall period profit & loss."))
|
||||
price-source common-currency
|
||||
(map xaccAccountGetCommodity accounts) enddate
|
||||
#f #f)))
|
||||
|
||||
;; this function will convert the monetary found at col-idx
|
||||
;; into report-currency if the latter exists. The price
|
||||
;; applicable the the col-idx column is used. If the monetary
|
||||
;; cannot be converted (eg. missing price) then it is not converted.
|
||||
(convert-curr-fn (lambda (monetary col-idx)
|
||||
(and common-currency
|
||||
(not (gnc-commodity-equal
|
||||
(gnc:gnc-monetary-commodity monetary)
|
||||
common-currency))
|
||||
(has-price? (gnc:gnc-monetary-commodity monetary))
|
||||
(let* ((date (case price-source
|
||||
((pricedb-latest) (current-time))
|
||||
(else
|
||||
(list-ref report-dates
|
||||
(case report-type
|
||||
((balsheet) col-idx)
|
||||
((pnl) (1+ col-idx))))))))
|
||||
(let ((date
|
||||
(cond
|
||||
((eq? price-source 'pricedb-latest)
|
||||
(current-time))
|
||||
((eq? col-idx 'overall-period)
|
||||
(last report-dates))
|
||||
(else
|
||||
(list-ref report-dates
|
||||
(case report-type
|
||||
((balsheet) col-idx)
|
||||
((pnl) (1+ col-idx))))))))
|
||||
(exchange-fn monetary common-currency date)))))
|
||||
|
||||
;; the following function generates an gnc:html-text object
|
||||
;; to dump exchange rate for a particular column. From the
|
||||
;; accountlist given, obtain commodities, and convert 1 unit
|
||||
|
Loading…
Reference in New Issue
Block a user