Skip to content

Commit

Permalink
Merge branch 'maint'
Browse files Browse the repository at this point in the history
  • Loading branch information
jralls committed Feb 5, 2023
2 parents 6946d21 + 9c87585 commit 31d45fc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
5 changes: 5 additions & 0 deletions gnucash/report/reports/standard/advanced-portfolio.scm
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,11 @@ by preventing negative stock balances.<br/>")
(lambda (foreign domestic date)
(find-price (gnc-pricedb-lookup-latest-any-currency pricedb foreign)
domestic)))
((pricedb-before)
(lambda (foreign domestic date)
(find-price (gnc-pricedb-lookup-nearest-before-any-currency-t64
pricedb foreign (time64CanonicalDayTime date))
domestic)))
((pricedb-nearest)
(lambda (foreign domestic date)
(find-price (gnc-pricedb-lookup-nearest-in-time-any-currency-t64
Expand Down
18 changes: 11 additions & 7 deletions gnucash/report/reports/standard/portfolio.scm
Original file line number Diff line number Diff line change
Expand Up @@ -216,19 +216,23 @@
(cons #f (gnc-numeric-zero)))))
(if price (gnc-price-list-destroy price))
fn)))
((pricedb-before)
(lambda (foreign date)
(let ((price (gnc-pricedb-lookup-nearest-before-any-currency-t64
pricedb foreign (time64CanonicalDayTime date))))
(cond
((null? price) (cons #f 0))
(else (let ((p (car price)))
(gnc-price-ref p)
(gnc-price-list-destroy price)
(cons p (gnc-price-get-value p))))))))
((pricedb-nearest)
(lambda (foreign date)
(let* ((price
(gnc-pricedb-lookup-nearest-in-time-any-currency-t64
pricedb foreign (time64CanonicalDayTime date)))
(fn (if (and price (> (length price) 0))
(let* ((the_price
(if (gnc-commodity-equiv
foreign
(gnc-price-get-commodity (car price)))
(car price)
(gnc-price-invert (car price))))
(v (gnc-price-get-value (car price))))
(let* ((v (gnc-price-get-value (car price))))
(gnc-price-ref (car price))
(cons (car price) v))
(cons #f (gnc-numeric-zero)))))
Expand Down

0 comments on commit 31d45fc

Please sign in to comment.