Skip to content

Commit

Permalink
Bug 798625 - "Last up through report date" changed in 4.12
Browse files Browse the repository at this point in the history
Don't adjust report dates with time64CanonicalDayTime. They're set
to 23:59:59 local which is always >= neutral time at which prices
and transactions are timestamped. Local noon is before neutral time for
all time zones east of UTC+2.
  • Loading branch information
jralls committed Jan 7, 2023
1 parent 2733d23 commit f7324d1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
8 changes: 4 additions & 4 deletions gnucash/report/commodity-utilities.scm
Expand Up @@ -739,7 +739,7 @@
(gnc-pricedb-get-db (gnc-get-current-book))
(gnc:gnc-monetary-amount foreign)
(gnc:gnc-monetary-commodity foreign)
domestic (time64CanonicalDayTime date))))))
domestic date)))))

(define (gnc:exchange-by-pricedb-nearest-before foreign domestic date)
(and (gnc:gnc-monetary? foreign) date
Expand All @@ -751,7 +751,7 @@
(gnc-pricedb-get-db (gnc-get-current-book))
(gnc:gnc-monetary-amount foreign)
(gnc:gnc-monetary-commodity foreign)
domestic (time64CanonicalDayTime date))))))
domestic date)))))

;; Exchange by the nearest price from pricelist. This function takes
;; the <gnc-monetary> 'foreign' amount, the <gnc:commodity*>
Expand Down Expand Up @@ -817,9 +817,9 @@
(define pdb (gnc-pricedb-get-db (gnc-get-current-book)))
(case source
((pricedb-nearest) (cut gnc-pricedb-get-nearest-price pdb <> target-curr
(time64CanonicalDayTime date)))
date))
((pricedb-before) (cut gnc-pricedb-get-nearest-before-price pdb <> target-curr
(time64CanonicalDayTime date)))
date))
((pricedb-latest) (cut gnc-pricedb-get-latest-price pdb <> target-curr))
(else
(lambda (commodity)
Expand Down
8 changes: 2 additions & 6 deletions gnucash/report/trep-engine.scm
Expand Up @@ -1316,17 +1316,13 @@ be excluded from periodic reporting.")
(opt-val pagename-currency
optname-currency)))
""))))
;; For conversion to row-currency. Use midday as the
;; transaction time so it matches a price on the same day.
;; Otherwise it uses midnight which will likely match a
;; price on the previous day
;; For conversion to row-currency.
(converted-amount (lambda (s)
(exchange-fn
(gnc:make-gnc-monetary (split-currency s)
(split-amount s))
(row-currency s)
(time64CanonicalDayTime
(xaccTransGetDate (xaccSplitGetParent s))))))
(xaccTransGetDate (xaccSplitGetParent s)))))
(converted-debit-amount (lambda (s) (and (positive? (split-amount s))
(converted-amount s))))
(converted-credit-amount (lambda (s)
Expand Down

0 comments on commit f7324d1

Please sign in to comment.