mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Reports: Add option to display a table of data beneath barcharts.
Patch by Joachim Herb. BP git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@17316 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
6454d1d6bf
commit
43e2e82482
1
AUTHORS
1
AUTHORS
@ -161,6 +161,7 @@ Alexandru Harsanyi <haral@codec.ro> for core dumps, lockups, gtk work
|
|||||||
John Hasler <john@dhh.gt.org> engine patch
|
John Hasler <john@dhh.gt.org> engine patch
|
||||||
Jon Kåre Hellan <hellan@acm.org> misc core dump fixes
|
Jon Kåre Hellan <hellan@acm.org> misc core dump fixes
|
||||||
Hendrik-Jan Heins <hjh@passys.nl> Dutch translation
|
Hendrik-Jan Heins <hjh@passys.nl> Dutch translation
|
||||||
|
Joachim Herb <joachim.herb@gmx.de> Data table option for barchart reports
|
||||||
Claus Hindsgaul <claus_h@image.dk> messages Danish translation
|
Claus Hindsgaul <claus_h@image.dk> messages Danish translation
|
||||||
Ori Hoch <ori@uumpa.com> Hebrew translation
|
Ori Hoch <ori@uumpa.com> Hebrew translation
|
||||||
Péter Hosszú <hosszu@web.de> Hungarian translation
|
Péter Hosszú <hosszu@web.de> Hungarian translation
|
||||||
|
@ -146,13 +146,20 @@ developing over time"))
|
|||||||
"c" (N_ "Maximum number of bars in the chart") 8
|
"c" (N_ "Maximum number of bars in the chart") 8
|
||||||
2 24 0 1))
|
2 24 0 1))
|
||||||
|
|
||||||
|
(add-option
|
||||||
|
(gnc:make-simple-boolean-option
|
||||||
|
gnc:pagename-display
|
||||||
|
(N_ "Show table")
|
||||||
|
"d" (N_ "Display a table of the selected data.")
|
||||||
|
#f))
|
||||||
|
|
||||||
(gnc:options-add-plot-size!
|
(gnc:options-add-plot-size!
|
||||||
options gnc:pagename-display
|
options gnc:pagename-display
|
||||||
optname-plot-width optname-plot-height "d" 400 400)
|
optname-plot-width optname-plot-height "e" 400 400)
|
||||||
|
|
||||||
(gnc:options-add-sort-method!
|
(gnc:options-add-sort-method!
|
||||||
options gnc:pagename-display
|
options gnc:pagename-display
|
||||||
optname-sort-method "e" 'amount)
|
optname-sort-method "f" 'amount)
|
||||||
|
|
||||||
(gnc:options-set-default-section options gnc:pagename-general)
|
(gnc:options-set-default-section options gnc:pagename-general)
|
||||||
|
|
||||||
@ -209,8 +216,10 @@ developing over time"))
|
|||||||
|
|
||||||
(work-done 0)
|
(work-done 0)
|
||||||
(work-to-do 0)
|
(work-to-do 0)
|
||||||
|
(show-table? (get-option gnc:pagename-display (N_ "Show table")))
|
||||||
(document (gnc:make-html-document))
|
(document (gnc:make-html-document))
|
||||||
(chart (gnc:make-html-barchart))
|
(chart (gnc:make-html-barchart))
|
||||||
|
(table (gnc:make-html-table))
|
||||||
(topl-accounts (gnc:filter-accountlist-type
|
(topl-accounts (gnc:filter-accountlist-type
|
||||||
account-types
|
account-types
|
||||||
(gnc-account-get-children-sorted
|
(gnc-account-get-children-sorted
|
||||||
@ -518,7 +527,79 @@ developing over time"))
|
|||||||
chart (append urls urls)))
|
chart (append urls urls)))
|
||||||
|
|
||||||
(gnc:report-percent-done 98)
|
(gnc:report-percent-done 98)
|
||||||
(gnc:html-document-add-object! document chart))
|
(gnc:html-document-add-object! document chart)
|
||||||
|
(if show-table?
|
||||||
|
(begin
|
||||||
|
(gnc:html-table-append-column! table date-string-list)
|
||||||
|
|
||||||
|
(letrec
|
||||||
|
((addcol
|
||||||
|
(lambda (col)
|
||||||
|
(if (not (null? col))
|
||||||
|
(begin
|
||||||
|
(gnc:html-table-append-column!
|
||||||
|
table (car col))
|
||||||
|
(addcol (cdr col))
|
||||||
|
)
|
||||||
|
))
|
||||||
|
))
|
||||||
|
(addcol (map cadr all-data))
|
||||||
|
)
|
||||||
|
|
||||||
|
(gnc:html-table-set-col-headers!
|
||||||
|
table
|
||||||
|
(append
|
||||||
|
(list (_ "Date"))
|
||||||
|
(map (lambda (pair)
|
||||||
|
(regexp-substitute/global #f "&"
|
||||||
|
(if (string? (car pair))
|
||||||
|
(car pair)
|
||||||
|
((if show-fullname?
|
||||||
|
gnc-account-get-full-name
|
||||||
|
xaccAccountGetName) (car pair)))
|
||||||
|
'pre " " (_ "and") " " 'post))
|
||||||
|
all-data)
|
||||||
|
(if (> (gnc:html-table-num-columns table) 2)
|
||||||
|
(list (_ "Grand Total"))
|
||||||
|
(list nil)
|
||||||
|
)
|
||||||
|
))
|
||||||
|
|
||||||
|
(if (> (gnc:html-table-num-columns table) 2)
|
||||||
|
(letrec
|
||||||
|
((sumtot
|
||||||
|
(lambda (row)
|
||||||
|
(if (null? row)
|
||||||
|
'()
|
||||||
|
(cons (sumrow (car row)) (sumtot (cdr row)))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(sumrow
|
||||||
|
(lambda (row)
|
||||||
|
(if (not (null? row))
|
||||||
|
(+ (car row) (sumrow (cdr row)))
|
||||||
|
0
|
||||||
|
)
|
||||||
|
)
|
||||||
|
))
|
||||||
|
(gnc:html-table-append-column!
|
||||||
|
table
|
||||||
|
(sumtot (apply zip (map cadr all-data)))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
;; set numeric columns to align right
|
||||||
|
(for-each
|
||||||
|
(lambda (col)
|
||||||
|
(gnc:html-table-set-col-style!
|
||||||
|
table col "td"
|
||||||
|
'attribute (list "align" "right")))
|
||||||
|
'(1 2 3 4 5 6 7 8 9 10 11 12 13 14))
|
||||||
|
(gnc:html-document-add-object! document table)
|
||||||
|
) ;; begin if
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
;; else if empty data
|
;; else if empty data
|
||||||
(gnc:html-document-add-object!
|
(gnc:html-document-add-object!
|
||||||
|
@ -120,9 +120,16 @@
|
|||||||
(N_ "Show a Net Worth bar?"))
|
(N_ "Show a Net Worth bar?"))
|
||||||
#t))
|
#t))
|
||||||
|
|
||||||
|
(add-option
|
||||||
|
(gnc:make-simple-boolean-option
|
||||||
|
gnc:pagename-display
|
||||||
|
(N_ "Show table")
|
||||||
|
"c" (N_ "Display a table of the selected data.")
|
||||||
|
#f))
|
||||||
|
|
||||||
(gnc:options-add-plot-size!
|
(gnc:options-add-plot-size!
|
||||||
options gnc:pagename-display
|
options gnc:pagename-display
|
||||||
optname-plot-width optname-plot-height "c" 500 400)
|
optname-plot-width optname-plot-height "d" 500 400)
|
||||||
|
|
||||||
(gnc:options-set-default-section options gnc:pagename-general)
|
(gnc:options-set-default-section options gnc:pagename-general)
|
||||||
|
|
||||||
@ -179,6 +186,7 @@
|
|||||||
(report-title (get-option gnc:pagename-general
|
(report-title (get-option gnc:pagename-general
|
||||||
gnc:optname-reportname))
|
gnc:optname-reportname))
|
||||||
(classified-accounts (gnc:decompose-accountlist accounts))
|
(classified-accounts (gnc:decompose-accountlist accounts))
|
||||||
|
(show-table? (get-option gnc:pagename-display (N_ "Show table")))
|
||||||
(document (gnc:make-html-document))
|
(document (gnc:make-html-document))
|
||||||
(chart (gnc:make-html-barchart))
|
(chart (gnc:make-html-barchart))
|
||||||
(non-zeros #f))
|
(non-zeros #f))
|
||||||
@ -356,7 +364,45 @@
|
|||||||
|
|
||||||
;; Test for all-zero data here.
|
;; Test for all-zero data here.
|
||||||
(if non-zeros
|
(if non-zeros
|
||||||
|
(begin
|
||||||
(gnc:html-document-add-object! document chart)
|
(gnc:html-document-add-object! document chart)
|
||||||
|
(if show-table?
|
||||||
|
(let ((table (gnc:make-html-table)))
|
||||||
|
(gnc:html-table-set-col-headers!
|
||||||
|
table
|
||||||
|
(append
|
||||||
|
(list (_ "Date"))
|
||||||
|
(if show-sep?
|
||||||
|
(if inc-exp?
|
||||||
|
(list (_ "Income") (_ "Expense"))
|
||||||
|
(list (_ "Assets") (_ "Liabilities")))
|
||||||
|
'())
|
||||||
|
(if show-net?
|
||||||
|
(if inc-exp?
|
||||||
|
(list (_ "Net Profit"))
|
||||||
|
(list (_ "Net Worth")))
|
||||||
|
'()))
|
||||||
|
)
|
||||||
|
(gnc:html-table-append-column! table date-string-list)
|
||||||
|
(if show-sep?
|
||||||
|
(begin
|
||||||
|
(gnc:html-table-append-column! table assets-list)
|
||||||
|
(gnc:html-table-append-column! table liability-list)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(if show-net?
|
||||||
|
(gnc:html-table-append-column! table net-list)
|
||||||
|
)
|
||||||
|
;; set numeric columns to align right
|
||||||
|
(for-each
|
||||||
|
(lambda (col)
|
||||||
|
(gnc:html-table-set-col-style!
|
||||||
|
table col "td"
|
||||||
|
'attribute (list "align" "right")))
|
||||||
|
'(1 2 3))
|
||||||
|
|
||||||
|
(gnc:html-document-add-object! document table))
|
||||||
|
))
|
||||||
(gnc:html-document-add-object!
|
(gnc:html-document-add-object!
|
||||||
document
|
document
|
||||||
(gnc:html-make-empty-data-warning
|
(gnc:html-make-empty-data-warning
|
||||||
|
Loading…
Reference in New Issue
Block a user