From a90b874995e2234da9e2d360e693fe48b8e11ece Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Mon, 7 Oct 2019 21:54:38 +0800 Subject: [PATCH] Bug 759005 - Print negatives in red, bis addendum to 9d0d3fd3b; addition to negative monetaries, also print negative numbers in red --- gnucash/report/report-system/html-table.scm | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/gnucash/report/report-system/html-table.scm b/gnucash/report/report-system/html-table.scm index 636c041299..a54206897c 100644 --- a/gnucash/report/report-system/html-table.scm +++ b/gnucash/report/report-system/html-table.scm @@ -141,17 +141,19 @@ (define (gnc:html-table-cell-render cell doc) ;; This function renders a html-table-cell to a document tree - ;; segment. Note: if the html-table-cell datum is a negative - ;; gnc:monetary, it fixes the tag eg. "number-cell" becomes - ;; "number-cell-red". The gnc:monetary renderer does not have an - ;; automatic -neg tag modifier. See bug 759005 and bug 797357. + ;; segment. Note: if the html-table-cell datum is a negative number + ;; or gnc:monetary, it fixes the tag eg. "number-cell" becomes + ;; "number-cell-red". The number and gnc:monetary renderers do not + ;; have an automatic -neg tag modifier. See bug 759005 and 797357. (let* ((retval '()) (push (lambda (l) (set! retval (cons l retval)))) (cell-tag (gnc:html-table-cell-tag cell)) (cell-data (gnc:html-table-cell-data cell)) (tag (if (and (= 1 (length cell-data)) - (gnc:gnc-monetary? (car cell-data)) - (negative? (gnc:gnc-monetary-amount (car cell-data)))) + (or (and (gnc:gnc-monetary? (car cell-data)) + (negative? (gnc:gnc-monetary-amount (car cell-data)))) + (and (number? (car cell-data)) + (negative? (car cell-data))))) (string-append cell-tag "-neg") cell-tag))) (gnc:html-document-push-style doc (gnc:html-table-cell-style cell))