Bug 797982 - exchange rates' decimal places

use gnc:html-make-rates-table instead of gnc:html-make-exchangerates
to show effective exchange rate or price used
This commit is contained in:
Christopher Lam 2020-10-19 22:29:59 +08:00
parent 4ff3355f02
commit 89c0baee9b
8 changed files with 28 additions and 20 deletions

View File

@ -315,6 +315,7 @@
(gnc:get-current-account-tree-depth)
depth-limit))
;; exchange rates calculation parameters
(price-fn (gnc:case-price-fn price-source report-commodity to-date))
(exchange-fn (gnc:case-exchange-fn price-source report-commodity to-date)))
(gnc:html-document-set-title!
@ -441,8 +442,8 @@
;; add currency information
(when show-rates?
(gnc:html-document-add-object!
doc (gnc:html-make-exchangerates
report-commodity exchange-fn
doc (gnc:html-make-rates-table
report-commodity price-fn
(gnc:accounts-and-all-descendants accounts))))))
(gnc:report-finished)

View File

@ -343,6 +343,7 @@
(tree-depth (if (eq? depth-limit 'all)
(gnc:get-current-account-tree-depth)
depth-limit))
(price-fn (gnc:case-price-fn price-source report-commodity reportdate))
;; exchange rates calculation parameters
(exchange-fn
(gnc:case-exchange-fn price-source report-commodity reportdate)))
@ -550,7 +551,7 @@
(gnc:report-percent-done 90)
(when show-rates?
(gnc:html-document-add-object!
doc (gnc:html-make-exchangerates report-commodity exchange-fn accounts)))
doc (gnc:html-make-rates-table report-commodity price-fn accounts)))
(gnc:report-percent-done 100)))

View File

@ -355,7 +355,8 @@
;; exchange rates calculation parameters
(exchange-fn
(gnc:case-exchange-fn price-source report-commodity date-t64))
)
(price-fn (gnc:case-price-fn price-source report-commodity date-t64)))
(define (add-subtotal-line table pos-label neg-label signed-balance)
(let* ((neg? (and signed-balance neg-label
@ -808,8 +809,7 @@
(if show-rates?
(gnc:html-document-add-object!
doc ;;(gnc:html-markup-p)
(gnc:html-make-exchangerates
report-commodity exchange-fn accounts)))
(gnc:html-make-rates-table report-commodity price-fn accounts)))
(gnc:report-percent-done 100)))))
(gnc:report-finished)

View File

@ -401,7 +401,8 @@
;; exchange rates calculation parameters
(exchange-fn
(gnc:case-exchange-fn price-source report-commodity date-t64))
)
(price-fn (gnc:case-price-fn price-source report-commodity date-t64)))
(define (add-subtotal-line table pos-label neg-label signed-balance)
(let* ((neg? (and signed-balance neg-label
@ -595,7 +596,7 @@
(gnc:report-percent-done 90)
(when show-rates?
(gnc:html-document-add-object!
doc (gnc:html-make-exchangerates report-commodity exchange-fn accounts)))
doc (gnc:html-make-rates-table report-commodity price-fn accounts)))
(gnc:report-percent-done 100))))
(gnc:report-finished)

View File

@ -149,6 +149,8 @@
(exchange-fn (gnc:case-exchange-fn
price-source report-currency to-date-t64))
(price-fn (gnc:case-price-fn price-source report-currency to-date-t64))
(doc (gnc:make-html-document))
(table (gnc:make-html-table))
@ -321,8 +323,8 @@
(if show-rates?
(gnc:html-document-add-object!
doc ;;(gnc:html-markup-p
(gnc:html-make-exchangerates
report-currency exchange-fn accounts))))))
(gnc:html-make-rates-table
report-currency price-fn accounts))))))
;; error condition: no accounts specified

View File

@ -280,7 +280,9 @@
(end-exchange-fn
(gnc:case-exchange-fn
price-source report-commodity end-date))
)
(start-price-fn (gnc:case-price-fn price-source report-commodity start-date))
(end-price-fn (gnc:case-price-fn price-source report-commodity end-date)))
(define (unrealized-gains-at-date book-balance exchange-fn date)
(define cost-fn
@ -496,10 +498,10 @@
(headers (list
(qof-print-date start-date-printable)
(qof-print-date end-date)))
(then (gnc:html-make-exchangerates
report-commodity start-exchange-fn accounts))
(now (gnc:html-make-exchangerates
report-commodity end-exchange-fn accounts)))
(then (gnc:html-make-rates-table
report-commodity start-price-fn accounts))
(now (gnc:html-make-rates-table
report-commodity end-price-fn accounts)))
(gnc:html-table-set-col-headers! curr-tbl headers)
(gnc:html-table-set-style!
curr-tbl "table" 'attribute '("border" "1"))

View File

@ -382,7 +382,7 @@
;; exchange rates calculation parameters
(exchange-fn
(gnc:case-exchange-fn price-source report-commodity end-date))
)
(price-fn (gnc:case-price-fn price-source report-commodity end-date)))
;; Wrapper to call gnc:html-table-add-labeled-amount-line!
;; with the proper arguments.
@ -561,8 +561,8 @@
(gnc:report-percent-done 90)
(when show-rates?
(gnc:html-document-add-object!
doc (gnc:html-make-exchangerates
report-commodity exchange-fn accounts)))
doc (gnc:html-make-rates-table
report-commodity price-fn accounts)))
(gnc:report-percent-done 100)))
(gnc:report-finished)

View File

@ -401,6 +401,7 @@
;; exchange rates calculation parameters
(exchange-fn
(gnc:case-exchange-fn price-source report-commodity end-date))
(price-fn (gnc:case-price-fn price-source report-commodity end-date))
(period-for (string-append " " (G_ "for Period"))))
(gnc:html-document-set-title!
@ -894,8 +895,8 @@
(if show-rates?
(gnc:html-document-add-object!
doc
(gnc:html-make-exchangerates
report-commodity exchange-fn accounts)))
(gnc:html-make-rates-table
report-commodity price-fn accounts)))
(gnc:report-percent-done 100)))
(gnc:report-finished)