mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Add support to display negative values in red. Modify the budget report appropriately.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18231 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
ba946a9913
commit
2e09bf1126
@ -206,6 +206,9 @@
|
||||
amount)
|
||||
)
|
||||
|
||||
(define (negative-numeric-p x)
|
||||
(if (gnc-numeric-p x) (gnc-numeric-negative-p x) #f))
|
||||
|
||||
;; Adds a line to tbe budget report.
|
||||
;;
|
||||
;; Parameters:
|
||||
@ -273,14 +276,14 @@
|
||||
(if show-actual?
|
||||
(begin
|
||||
(gnc:html-table-set-cell/tag!
|
||||
html-table rownum current-col "number-cell" act-val)
|
||||
html-table rownum current-col (if (negative-numeric-p act-numeric-val) "number-cell-neg" "number-cell") act-val)
|
||||
(set! current-col (+ current-col 1))
|
||||
)
|
||||
)
|
||||
(if show-diff?
|
||||
(begin
|
||||
(gnc:html-table-set-cell/tag!
|
||||
html-table rownum current-col "number-cell" dif-val)
|
||||
html-table rownum current-col (if (negative-numeric-p dif-numeric-val) "number-cell-neg" "number-cell") dif-val)
|
||||
(set! current-col (+ current-col 1))
|
||||
)
|
||||
)
|
||||
@ -303,20 +306,21 @@
|
||||
(if show-actual?
|
||||
(begin
|
||||
(gnc:html-table-set-cell/tag!
|
||||
html-table rownum current-col "total-number-cell"
|
||||
html-table rownum current-col (if (negative-numeric-p act-total) "total-number-cell" "total-number-cell-neg")
|
||||
(gnc:make-gnc-monetary comm act-total))
|
||||
(set! current-col (+ current-col 1))
|
||||
)
|
||||
)
|
||||
(if show-diff?
|
||||
(begin
|
||||
(gnc:html-table-set-cell/tag!
|
||||
html-table rownum current-col "total-number-cell"
|
||||
(if bgt-total-unset? "."
|
||||
(let* ((diff-val
|
||||
(gnc:make-gnc-monetary comm
|
||||
(gnc-numeric-sub bgt-total
|
||||
act-total GNC-DENOM-AUTO
|
||||
(+ GNC-DENOM-LCD GNC-RND-NEVER)))))
|
||||
(gnc:html-table-set-cell/tag!
|
||||
html-table rownum current-col (if (negative-numeric-p diff-val) "total-number-cell-neg" "total-number-cell")
|
||||
(if bgt-total-unset? "." diff-val)
|
||||
)
|
||||
(set! current-col (+ current-col 1))
|
||||
)
|
||||
)
|
||||
|
@ -124,30 +124,35 @@
|
||||
(N_ "Fonts")
|
||||
(N_ "Number cell") "c" (N_ "Font info for regular number cells")
|
||||
"Arial 10"))
|
||||
(opt-register
|
||||
(gnc:make-simple-boolean-option
|
||||
(N_ "Fonts")
|
||||
(N_ "Negative Values in Red") "d" (N_ "Display negative values in red.")
|
||||
#t))
|
||||
(opt-register
|
||||
(gnc:make-font-option
|
||||
(N_ "Fonts")
|
||||
(N_ "Number header") "c" (N_ "Font info for number headers")
|
||||
(N_ "Number header") "e" (N_ "Font info for number headers")
|
||||
"Arial 10"))
|
||||
(opt-register
|
||||
(gnc:make-font-option
|
||||
(N_ "Fonts")
|
||||
(N_ "Text cell") "c" (N_ "Font info for regular text cells")
|
||||
(N_ "Text cell") "f" (N_ "Font info for regular text cells")
|
||||
"Arial 10"))
|
||||
(opt-register
|
||||
(gnc:make-font-option
|
||||
(N_ "Fonts")
|
||||
(N_ "Total number cell") "c" (N_ "Font info for number cells containing a total")
|
||||
(N_ "Total number cell") "g" (N_ "Font info for number cells containing a total")
|
||||
"Arial Bold 12"))
|
||||
(opt-register
|
||||
(gnc:make-font-option
|
||||
(N_ "Fonts")
|
||||
(N_ "Total label cell") "c" (N_ "Font info for cells containing total labels")
|
||||
(N_ "Total label cell") "h" (N_ "Font info for cells containing total labels")
|
||||
"Arial Bold 12"))
|
||||
(opt-register
|
||||
(gnc:make-font-option
|
||||
(N_ "Fonts")
|
||||
(N_ "Centered label cell") "c" (N_ "Font info for centered label cells")
|
||||
(N_ "Centered label cell") "i" (N_ "Font info for centered label cells")
|
||||
"Arial Bold 12"))
|
||||
|
||||
options))
|
||||
@ -169,6 +174,7 @@
|
||||
(spacing (opt-val "Tables" "Table cell spacing"))
|
||||
(padding (opt-val "Tables" "Table cell padding"))
|
||||
(border (opt-val "Tables" "Table border width"))
|
||||
(negative-red? (opt-val "Fonts" "Negative Values in Red"))
|
||||
(title-font-info (font-name-to-style-info (opt-val "Fonts" "Title")))
|
||||
(account-link-font-info (font-name-to-style-info (opt-val "Fonts" "Account link")))
|
||||
(number-cell-font-info (font-name-to-style-info (opt-val "Fonts" "Number cell")))
|
||||
@ -200,6 +206,11 @@
|
||||
'tag "td"
|
||||
'attribute (list "class" "number-cell"))
|
||||
|
||||
(gnc:html-document-set-style!
|
||||
ssdoc "number-cell-neg"
|
||||
'tag "td"
|
||||
'attribute (list "class" "number-cell-neg"))
|
||||
|
||||
(gnc:html-document-set-style!
|
||||
ssdoc "number-header"
|
||||
'tag "th"
|
||||
@ -215,6 +226,11 @@
|
||||
'tag "td"
|
||||
'attribute (list "class" "total-number-cell"))
|
||||
|
||||
(gnc:html-document-set-style!
|
||||
ssdoc "total-number-cell-neg"
|
||||
'tag "td"
|
||||
'attribute (list "class" "total-number-cell-neg"))
|
||||
|
||||
(gnc:html-document-set-style!
|
||||
ssdoc "total-label-cell"
|
||||
'tag "td"
|
||||
@ -259,9 +275,11 @@
|
||||
"a { " account-link-font-info " }\n"
|
||||
"th { text-align: right; " number-header-font-info " }\n"
|
||||
"td.number-cell { text-align: right; " number-cell-font-info " }\n"
|
||||
"td.number-cell-neg { text-align: right; " (if negative-red? "color: red; " "") number-cell-font-info " }\n"
|
||||
"td.number-header { text-align: right; " number-header-font-info " }\n"
|
||||
"td.text-cell { text-align: left; " text-cell-font-info " }\n"
|
||||
"td.total-number-cell { text-align:right; " total-number-cell-font-info " }\n"
|
||||
"td.total-number-cell-neg { text-align:right; " (if negative-red? "color: red; " "") total-number-cell-font-info " }\n"
|
||||
"td.total-label-cell { text-align: left; " total-label-cell-font-info " }\n"
|
||||
"td.centered-label-cell { text-align: center; " centered-label-cell-font-info " }\n"
|
||||
))
|
||||
|
@ -237,6 +237,12 @@
|
||||
'attribute (list "align" "right")
|
||||
'attribute (list "nowrap"))
|
||||
|
||||
(gnc:html-document-set-style!
|
||||
ssdoc "number-cell-neg"
|
||||
'tag "td"
|
||||
'attribute (list "align" "right")
|
||||
'attribute (list "nowrap"))
|
||||
|
||||
(if (and bgpixmap
|
||||
(not (string=? bgpixmap "")))
|
||||
(gnc:html-document-set-style!
|
||||
@ -280,6 +286,11 @@
|
||||
'tag '("td" "b")
|
||||
'attribute (list "align" "right"))
|
||||
|
||||
(gnc:html-document-set-style!
|
||||
ssdoc "total-number-cell-neg"
|
||||
'tag '("td" "b")
|
||||
'attribute (list "align" "right"))
|
||||
|
||||
(gnc:html-document-set-style!
|
||||
ssdoc "total-label-cell"
|
||||
'tag '("td" "b")
|
||||
|
@ -231,6 +231,12 @@
|
||||
'attribute (list "align" "right")
|
||||
'attribute (list "nowrap"))
|
||||
|
||||
(gnc:html-document-set-style!
|
||||
ssdoc "number-cell-neg"
|
||||
'tag "td"
|
||||
'attribute (list "align" "right")
|
||||
'attribute (list "nowrap"))
|
||||
|
||||
(if (and bgpixmap
|
||||
(not (string=? bgpixmap "")))
|
||||
(gnc:html-document-set-style!
|
||||
@ -274,6 +280,11 @@
|
||||
'tag '("td" "b")
|
||||
'attribute (list "align" "right"))
|
||||
|
||||
(gnc:html-document-set-style!
|
||||
ssdoc "total-number-cell-neg"
|
||||
'tag '("td" "b")
|
||||
'attribute (list "align" "right"))
|
||||
|
||||
(gnc:html-document-set-style!
|
||||
ssdoc "total-label-cell"
|
||||
'tag '("td" "b")
|
||||
|
@ -108,6 +108,12 @@
|
||||
'attribute (list "align" "right")
|
||||
'attribute (list "nowrap"))
|
||||
|
||||
(gnc:html-document-set-style!
|
||||
ssdoc "number-cell-neg"
|
||||
'tag "td"
|
||||
'attribute (list "align" "right")
|
||||
'attribute (list "nowrap"))
|
||||
|
||||
(gnc:html-document-set-style!
|
||||
ssdoc "number-header"
|
||||
'tag "th"
|
||||
@ -123,6 +129,11 @@
|
||||
'tag '("td" "b")
|
||||
'attribute (list "align" "right"))
|
||||
|
||||
(gnc:html-document-set-style!
|
||||
ssdoc "total-number-cell-neg"
|
||||
'tag '("td" "b")
|
||||
'attribute (list "align" "right"))
|
||||
|
||||
(gnc:html-document-set-style!
|
||||
ssdoc "total-label-cell"
|
||||
'tag '("td" "b")
|
||||
|
Loading…
Reference in New Issue
Block a user