gnucash maint: [html-style-info] round amounts in price-render

Christopher Lam clam at code.gnucash.org
Sat Jul 25 10:40:11 EDT 2020


Updated	 via  https://github.com/Gnucash/gnucash/commit/e3df32ce (commit)
	from  https://github.com/Gnucash/gnucash/commit/c1bd4c0e (commit)



commit e3df32ce73e39bf94ff6d280cdfe367653b30fcd
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Jul 25 22:29:17 2020 +0800

    [html-style-info] round amounts in price-render
    
    prices may be rendered as exact fractions. ensure they are rounded,
    with minimum of 4 decimal points.

diff --git a/gnucash/report/html-style-info.scm b/gnucash/report/html-style-info.scm
index 6ec971f04..a2f92d87b 100644
--- a/gnucash/report/html-style-info.scm
+++ b/gnucash/report/html-style-info.scm
@@ -163,7 +163,11 @@
 
 ;; renders a price to target currency
 (define (gnc:default-price-renderer currency amount)
-  (xaccPrintAmount amount (gnc-price-print-info currency #t)))
+  (xaccPrintAmount
+   (gnc-numeric-convert
+    amount (min 10000 (* 100 (gnc-commodity-get-fraction currency)))
+    GNC-HOW-RND-ROUND)
+   (gnc-price-print-info currency #t)))
 
 (define (gnc:default-html-gnc-monetary-renderer datum params)
   (let* ((comm (gnc:gnc-monetary-commodity datum))



Summary of changes:
 gnucash/report/html-style-info.scm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)



More information about the gnucash-changes mailing list