TP->T64: gnucash/report/standard-reports/price-scatter.scm

This commit is contained in:
Christopher Lam 2017-11-21 06:50:52 +08:00
parent bca83e8480
commit b2eb687c37

View File

@ -140,11 +140,11 @@
(gnc:make-gnc-monetary c n)))
(let* ((to-date-tp (gnc:timepair-end-day-time
(let* ((to-date (gnc:time64-end-day-time
(gnc:date-option-absolute-time
(get-option gnc:pagename-general
optname-to-date))))
(from-date-tp (gnc:timepair-start-day-time
(from-date (gnc:time64-start-day-time
(gnc:date-option-absolute-time
(get-option gnc:pagename-general
optname-from-date))))
@ -168,8 +168,8 @@
optname-price-source))
(dates-list (gnc:make-date-list
(gnc:timepair-end-day-time from-date-tp)
(gnc:timepair-end-day-time to-date-tp)
(gnc:time64-end-day-time from-date)
(gnc:time64-end-day-time to-date)
(gnc:deltasym-to-delta interval)))
(document (gnc:make-html-document))
@ -200,8 +200,8 @@
" - "
(sprintf #f
(_ "%s to %s")
(gnc-print-date from-date-tp)
(gnc-print-date to-date-tp))))
(qof-print-date from-date)
(qof-print-date to-date))))
(gnc:html-scatter-set-width! chart width)
(gnc:html-scatter-set-height! chart height)
(gnc:html-scatter-set-marker! chart
@ -241,15 +241,15 @@
(case price-source
((actual-transactions)
(gnc:get-commodity-inst-prices
currency-accounts to-date-tp
currency-accounts to-date
price-commodity report-currency))
((weighted-average)
(gnc:get-commodity-totalavg-prices
currency-accounts to-date-tp
currency-accounts to-date
price-commodity report-currency))
((pricedb)
(map (lambda (p)
(list (gnc-price-get-time p)
(list (gnc-price-get-time64 p)
(gnc-price-get-value p)))
(gnc-pricedb-get-prices
(gnc-pricedb-get-db (gnc-get-current-book))
@ -259,13 +259,13 @@
(set! data (filter
(lambda (x)
(and
(gnc:timepair-ge to-date-tp (first x))
(gnc:timepair-ge (first x) from-date-tp)))
(>= to-date (first x))
(>= (first x) from-date)))
data))
;; some output
;;(warn "data" (map (lambda (x) (list
;; (gnc-print-date (car x))
;; (qof-print-date x)
;; (gnc-numeric-to-double (second x))))
;; data))
@ -285,8 +285,8 @@
(set! data
(map (lambda (x)
(list
(/ (- (car (first x))
(car from-date-tp))
(/ (- (first x)
from-date)
;; FIXME: These hard-coded values are more
;; or less totally bogus. OTOH this whole
;; scaling thing is totally bogus as well,