[category-barchart] simplify table constructor

This commit is contained in:
Christopher Lam 2020-08-17 23:07:55 +08:00
parent 582ded3996
commit f8e976e913

View File

@ -602,28 +602,21 @@ developing over time"))
(when show-table? (when show-table?
(let ((table (gnc:make-html-table)) (let ((table (gnc:make-html-table))
(scu (gnc-commodity-get-fraction report-currency)) (scu (gnc-commodity-get-fraction report-currency))
(cols>1? (> (length all-data) 1))) (cols>1? (pair? (cdr all-data))))
(define (make-cell contents) (define (make-cell contents)
(gnc:make-html-table-cell/markup "number-cell" contents)) (gnc:make-html-table-cell/markup "number-cell" contents))
(define (monetary-round mon)
(gnc:make-gnc-monetary
report-currency
(gnc-numeric-convert
(gnc:gnc-monetary-amount mon)
scu GNC-HOW-RND-ROUND)))
(for-each (for-each
(lambda (date row) (lambda (date row)
(gnc:html-table-append-row! (gnc:html-table-append-row!
table (map make-cell (append (list date) table
(map monetary-round row) (append (list (make-cell date))
(map make-cell row)
(if cols>1? (if cols>1?
(list (list
(monetary-round (make-cell (apply gnc:monetary+ row)))
(apply gnc:monetary+ row))) '()))))
'())))))
date-string-list date-string-list
(apply zip (map cadr all-data))) (apply zip (map cadr all-data)))