mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[budget] use <ol> and <sup> for footnotes
and revert usage of a separate column for footnotes
This commit is contained in:
parent
fa800fadee
commit
a26017830d
@ -263,6 +263,9 @@
|
|||||||
|
|
||||||
options))
|
options))
|
||||||
|
|
||||||
|
(define (html-markup-ol lst)
|
||||||
|
(apply gnc:html-markup "ol" (map (lambda (elt) (gnc:html-markup "li" elt)) lst)))
|
||||||
|
|
||||||
;; creates a footnotes collector. (make-footnote-collector) => coll
|
;; creates a footnotes collector. (make-footnote-collector) => coll
|
||||||
;; (coll elt) adds elt to store, returns html-text containing ref eg. [1]
|
;; (coll elt) adds elt to store, returns html-text containing ref eg. [1]
|
||||||
;; (coll 'list) returns html-text containing <ul> of all elts
|
;; (coll 'list) returns html-text containing <ul> of all elts
|
||||||
@ -270,19 +273,18 @@
|
|||||||
(let ((notes '()) (num 0))
|
(let ((notes '()) (num 0))
|
||||||
(match-lambda
|
(match-lambda
|
||||||
('list
|
('list
|
||||||
(let lp ((num num) (notes notes) (res '()))
|
(let lp ((notes notes) (res '()))
|
||||||
(match notes
|
(match notes
|
||||||
(() (gnc:make-html-text (gnc:html-markup-ul res)))
|
(() (gnc:make-html-text (html-markup-ol res)))
|
||||||
((note . rest)
|
((note . rest) (lp rest (cons note res))))))
|
||||||
(lp (1- num) rest (cons (format #f "~a. ~a" num note) res))))))
|
((or #f "") "")
|
||||||
((or #f "")
|
|
||||||
(gnc:make-html-table-cell/min-width 1))
|
|
||||||
(note
|
(note
|
||||||
(set! notes (cons (gnc:html-string-sanitize note) notes))
|
(set! notes (cons (gnc:html-string-sanitize note) notes))
|
||||||
(set! num (1+ num))
|
(set! num (1+ num))
|
||||||
(let ((cell (gnc:make-html-table-cell (format #f "[~a]" num))))
|
(let ((text (gnc:make-html-text
|
||||||
(gnc:html-table-cell-set-style! cell "td" 'attribute `("title" ,note))
|
(gnc:html-markup "sup" " " (number->string num)))))
|
||||||
cell)))))
|
(gnc:html-text-set-style! text "sup" 'attribute `("title" ,note))
|
||||||
|
text)))))
|
||||||
|
|
||||||
;; Create the html table for the budget report
|
;; Create the html table for the budget report
|
||||||
;;
|
;;
|
||||||
@ -384,31 +386,26 @@
|
|||||||
(define (disp-cols style-tag col0
|
(define (disp-cols style-tag col0
|
||||||
bgt-val act-val dif-val note)
|
bgt-val act-val dif-val note)
|
||||||
(let* ((col1 (+ col0 (if show-budget? 1 0)))
|
(let* ((col1 (+ col0 (if show-budget? 1 0)))
|
||||||
(col2 (+ col1 (if show-note? 1 0)))
|
(col2 (+ col1 (if show-actual? 1 0)))
|
||||||
(col3 (+ col2 (if show-actual? 1 0)))
|
(col3 (+ col2 (if show-diff? 1 0))))
|
||||||
(col4 (+ col3 (if show-diff? 1 0))))
|
|
||||||
(if show-budget?
|
(if show-budget?
|
||||||
(gnc:html-table-set-cell/tag!
|
(gnc:html-table-set-cell/tag!
|
||||||
html-table rownum col0
|
html-table rownum col0 style-tag
|
||||||
style-tag
|
|
||||||
(if (zero? bgt-val) "."
|
(if (zero? bgt-val) "."
|
||||||
(gnc:make-gnc-monetary comm bgt-val))))
|
(gnc:make-gnc-monetary comm bgt-val))
|
||||||
(if show-note?
|
|
||||||
(gnc:html-table-set-cell!
|
|
||||||
html-table rownum col1
|
|
||||||
(footnotes note)))
|
(footnotes note)))
|
||||||
(if show-actual?
|
(if show-actual?
|
||||||
(gnc:html-table-set-cell/tag!
|
(gnc:html-table-set-cell/tag!
|
||||||
html-table rownum col2
|
html-table rownum col1
|
||||||
style-tag
|
style-tag
|
||||||
(gnc:make-gnc-monetary comm act-val)))
|
(gnc:make-gnc-monetary comm act-val)))
|
||||||
(if show-diff?
|
(if show-diff?
|
||||||
(gnc:html-table-set-cell/tag!
|
(gnc:html-table-set-cell/tag!
|
||||||
html-table rownum col3
|
html-table rownum col2
|
||||||
style-tag
|
style-tag
|
||||||
(if (and (zero? bgt-val) (zero? act-val)) "."
|
(if (and (zero? bgt-val) (zero? act-val)) "."
|
||||||
(gnc:make-gnc-monetary comm dif-val))))
|
(gnc:make-gnc-monetary comm dif-val))))
|
||||||
col4))
|
col3))
|
||||||
|
|
||||||
(let loop ((column-list column-list)
|
(let loop ((column-list column-list)
|
||||||
(current-col (1+ colnum)))
|
(current-col (1+ colnum)))
|
||||||
@ -464,8 +461,7 @@
|
|||||||
html-table colnum budget column-list)
|
html-table colnum budget column-list)
|
||||||
(let* ((current-col (1+ colnum))
|
(let* ((current-col (1+ colnum))
|
||||||
(col-span (max 1 (count identity
|
(col-span (max 1 (count identity
|
||||||
(list show-budget? show-actual?
|
(list show-budget? show-actual? show-diff?))))
|
||||||
show-diff? show-note?))))
|
|
||||||
(period-to-date-string (lambda (p)
|
(period-to-date-string (lambda (p)
|
||||||
(qof-print-date
|
(qof-print-date
|
||||||
(gnc-budget-get-period-start-date budget p)))))
|
(gnc-budget-get-period-start-date budget p)))))
|
||||||
@ -501,9 +497,8 @@
|
|||||||
(col0 current-col))
|
(col0 current-col))
|
||||||
(unless (null? column-list)
|
(unless (null? column-list)
|
||||||
(let* ((col1 (+ col0 (if show-budget? 1 0)))
|
(let* ((col1 (+ col0 (if show-budget? 1 0)))
|
||||||
(col2 (+ col1 (if show-note? 1 0)))
|
(col2 (+ col1 (if show-actual? 1 0)))
|
||||||
(col3 (+ col2 (if show-actual? 1 0)))
|
(col3 (+ col2 (if show-diff? 1 0))))
|
||||||
(col4 (+ col3 (if show-diff? 1 0))))
|
|
||||||
(when show-budget?
|
(when show-budget?
|
||||||
(gnc:html-table-set-cell/tag!
|
(gnc:html-table-set-cell/tag!
|
||||||
html-table 1 col0 "centered-label-cell"
|
html-table 1 col0 "centered-label-cell"
|
||||||
@ -511,16 +506,16 @@
|
|||||||
(_ "Bgt")))
|
(_ "Bgt")))
|
||||||
(when show-actual?
|
(when show-actual?
|
||||||
(gnc:html-table-set-cell/tag!
|
(gnc:html-table-set-cell/tag!
|
||||||
html-table 1 col2 "centered-label-cell"
|
html-table 1 col1 "centered-label-cell"
|
||||||
;; Translators: Abbreviation for "Actual" amount
|
;; Translators: Abbreviation for "Actual" amount
|
||||||
(_ "Act")))
|
(_ "Act")))
|
||||||
(when show-diff?
|
(when show-diff?
|
||||||
(gnc:html-table-set-cell/tag!
|
(gnc:html-table-set-cell/tag!
|
||||||
html-table 1 col3 "centered-label-cell"
|
html-table 1 col2 "centered-label-cell"
|
||||||
;; Translators: Abbreviation for "Difference" amount
|
;; Translators: Abbreviation for "Difference" amount
|
||||||
(_ "Diff")))
|
(_ "Diff")))
|
||||||
(loop (cdr column-list)
|
(loop (cdr column-list)
|
||||||
col4))))))
|
col3))))))
|
||||||
|
|
||||||
;; Determines the budget period relative to current period. Budget
|
;; Determines the budget period relative to current period. Budget
|
||||||
;; period is current if it start time <= current time and end time
|
;; period is current if it start time <= current time and end time
|
||||||
@ -765,6 +760,10 @@
|
|||||||
;; table width, since the add-account-balance had put stuff
|
;; table width, since the add-account-balance had put stuff
|
||||||
;; there, but it doesn't seem to matter.
|
;; there, but it doesn't seem to matter.
|
||||||
|
|
||||||
|
(gnc:html-table-set-style!
|
||||||
|
html-table "td"
|
||||||
|
'attribute '("valign" "bottom"))
|
||||||
|
|
||||||
(gnc:html-document-add-object! doc html-table)
|
(gnc:html-document-add-object! doc html-table)
|
||||||
|
|
||||||
(gnc:html-document-add-object! doc (footnotes 'list))))))
|
(gnc:html-document-add-object! doc (footnotes 'list))))))
|
||||||
|
Loading…
Reference in New Issue
Block a user