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
|
price-source common-currency
|
||||||
(map xaccAccountGetCommodity accounts) enddate
|
(map xaccAccountGetCommodity accounts) enddate
|
||||||
#f #f)))
|
#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)
|
(convert-curr-fn (lambda (monetary col-idx)
|
||||||
(and common-currency
|
(and common-currency
|
||||||
(not (gnc-commodity-equal
|
(not (gnc-commodity-equal
|
||||||
(gnc:gnc-monetary-commodity monetary)
|
(gnc:gnc-monetary-commodity monetary)
|
||||||
common-currency))
|
common-currency))
|
||||||
(has-price? (gnc:gnc-monetary-commodity monetary))
|
(has-price? (gnc:gnc-monetary-commodity monetary))
|
||||||
(let* ((date (case price-source
|
(let ((date
|
||||||
((pricedb-latest) (current-time))
|
(cond
|
||||||
(else
|
((eq? price-source 'pricedb-latest)
|
||||||
(list-ref report-dates
|
(current-time))
|
||||||
(case report-type
|
((eq? col-idx 'overall-period)
|
||||||
((balsheet) col-idx)
|
(last report-dates))
|
||||||
((pnl) (1+ col-idx))))))))
|
(else
|
||||||
|
(list-ref report-dates
|
||||||
|
(case report-type
|
||||||
|
((balsheet) col-idx)
|
||||||
|
((pnl) (1+ col-idx))))))))
|
||||||
(exchange-fn monetary common-currency date)))))
|
(exchange-fn monetary common-currency date)))))
|
||||||
|
|
||||||
;; the following function generates an gnc:html-text object
|
;; the following function generates an gnc:html-text object
|
||||||
;; to dump exchange rate for a particular column. From the
|
;; to dump exchange rate for a particular column. From the
|
||||||
;; accountlist given, obtain commodities, and convert 1 unit
|
;; accountlist given, obtain commodities, and convert 1 unit
|
||||||
|
Loading…
Reference in New Issue
Block a user