html-table.scm: centralize (gnc:html-table-set-last-row-style!)

This html-table modifier seems common enough to centralize into
html-table.scm.
This commit is contained in:
Christopher Lam
2018-05-06 23:39:45 +08:00
parent 97ab1b19fe
commit 23410ca429
9 changed files with 22 additions and 63 deletions

View File

@@ -97,13 +97,6 @@
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define (set-last-row-style! table tag . rest)
(let ((arg-list
(cons table
(cons (- (gnc:html-table-num-rows table) 1)
(cons tag rest)))))
(apply gnc:html-table-set-row-style! arg-list)))
(define (date-col columns-used)
(vector-ref columns-used 0))
(define (num-col columns-used)
@@ -591,7 +584,7 @@
(gnc:html-table-append-row!
table
(list "<br>"))
(set-last-row-style!
(gnc:html-table-set-last-row-style!
table "td"
'attribute (list "valign" "top"))
table))
@@ -609,7 +602,7 @@
table "table"
'attribute (list "border" 0)
'attribute (list "cellpadding" 0))
(set-last-row-style!
(gnc:html-table-set-last-row-style!
table "td"
'attribute (list "valign" "top"))
table))

View File

@@ -39,13 +39,6 @@
(use-modules (gnucash report standard-reports))
(use-modules (gnucash report business-reports))
(define (set-last-row-style! table tag . rest)
(let ((arg-list
(cons table
(cons (- (gnc:html-table-num-rows table) 1)
(cons tag rest)))))
(apply gnc:html-table-set-row-style! arg-list)))
(define (date-col columns-used)
(vector-ref columns-used 0))
(define (description-col columns-used)
@@ -585,7 +578,7 @@
;; This string is supposed to be an abbrev. for "Reference"?
(string-append (_ "REF") ":&nbsp;" reference))))))
orders)
(set-last-row-style!
(gnc:html-table-set-last-row-style!
table "td"
'attribute (list "valign" "top"))
table))
@@ -605,7 +598,7 @@
table "table"
'attribute (list "border" 0)
'attribute (list "cellpadding" 0))
(set-last-row-style!
(gnc:html-table-set-last-row-style!
table "td"
'attribute (list "valign" "top"))
table))

View File

@@ -57,13 +57,6 @@
(use-modules (gnucash report standard-reports))
(use-modules (gnucash report business-reports))
(define (set-last-row-style! table tag . rest)
(let ((arg-list
(cons table
(cons (- (gnc:html-table-num-rows table) 1)
(cons tag rest)))))
(apply gnc:html-table-set-row-style! arg-list)))
(define (date-col columns-used)
(vector-ref columns-used 0))
(define (description-col columns-used)
@@ -646,7 +639,7 @@
(list
(string-append (_ "REF") ":&nbsp;" reference))))))
orders)
(set-last-row-style!
(gnc:html-table-set-last-row-style!
table "td"
'attribute (list "valign" "top"))
table))
@@ -671,7 +664,7 @@
table "table"
'attribute (list "border" 0)
'attribute (list "cellpadding" 0))
(set-last-row-style!
(gnc:html-table-set-last-row-style!
table "td"
'attribute (list "valign" "top"))
table))

View File

@@ -33,13 +33,6 @@
(use-modules (gnucash report standard-reports))
(use-modules (gnucash report business-reports))
(define (set-last-row-style! table tag . rest)
(let ((arg-list
(cons table
(cons (- (gnc:html-table-num-rows table) 1)
(cons tag rest)))))
(apply gnc:html-table-set-row-style! arg-list)))
(define (date-col columns-used)
(vector-ref columns-used 0))
(define (description-col columns-used)
@@ -561,7 +554,7 @@
(list
(string-append (_ "REF") ":&nbsp;" reference))))))
orders)
(set-last-row-style!
(gnc:html-table-set-last-row-style!
table "td"
'attribute (list "valign" "top"))
table))
@@ -582,7 +575,7 @@
table "table"
'attribute (list "border" 0)
'attribute (list "cellpadding" 0))
(set-last-row-style!
(gnc:html-table-set-last-row-style!
table "td"
'attribute (list "valign" "top"))
table))

View File

@@ -46,13 +46,6 @@
(define desc-header (N_ "Description"))
(define amount-header (N_ "Amount"))
(define (set-last-row-style! table tag . rest)
(let ((arg-list
(cons table
(cons (- (gnc:html-table-num-rows table) 1)
(cons tag rest)))))
(apply gnc:html-table-set-row-style! arg-list)))
(define (date-col columns-used)
(vector-ref columns-used 0))
(define (date-due-col columns-used)
@@ -479,7 +472,7 @@
(gnc:html-table-append-row!
table
(list "<br/>"))
(set-last-row-style!
(gnc:html-table-set-last-row-style!
table "td"
'attribute (list "valign" "top"))
table))
@@ -497,7 +490,7 @@
table "table"
'attribute (list "border" 0)
'attribute (list "cellpadding" 0))
(set-last-row-style!
(gnc:html-table-set-last-row-style!
table "td"
'attribute (list "valign" "top"))
table))

View File

@@ -117,13 +117,6 @@
(else
(_ "Vendor"))))
(define (set-last-row-style! table tag . rest)
(let ((arg-list
(cons table
(cons (- (gnc:html-table-num-rows table) 1)
(cons tag rest)))))
(apply gnc:html-table-set-row-style! arg-list)))
(define (date-col columns-used)
(vector-ref columns-used 0))
(define (date-due-col columns-used)
@@ -689,7 +682,7 @@
(gnc:html-table-append-row!
table
(list "<br>"))
(set-last-row-style!
(gnc:html-table-set-last-row-style!
table "td"
'attribute (list "valign" "top"))
table))
@@ -707,7 +700,7 @@
table "table"
'attribute (list "border" 0)
'attribute (list "cellpadding" 0))
(set-last-row-style!
(gnc:html-table-set-last-row-style!
table "td"
'attribute (list "valign" "top"))
table))

View File

@@ -756,3 +756,10 @@
(push (gnc:html-document-markup-end doc "table"))
(gnc:html-document-pop-style doc)
retval))
(define (gnc:html-table-set-last-row-style! table tag . rest)
(let ((arg-list
(cons table
(cons (1- (gnc:html-table-num-rows table))
(cons tag rest)))))
(apply gnc:html-table-set-row-style! arg-list)))

View File

@@ -601,6 +601,7 @@
(export gnc:html-table-set-col-headers-style!)
(export gnc:html-table-row-headers-style)
(export gnc:html-table-set-row-headers-style!)
(export gnc:html-table-set-last-row-style!)
(export gnc:html-table-set-style!)
(export gnc:html-table-set-col-style!)
(export gnc:html-table-set-row-style!)

View File

@@ -29,13 +29,6 @@
(gnc:module-load "gnucash/report/report-system" 0)
(define (set-last-row-style! table tag . rest)
(let ((arg-list
(cons table
(cons (- (gnc:html-table-num-rows table) 1)
(cons tag rest)))))
(apply gnc:html-table-set-row-style! arg-list)))
(define (date-col columns-used)
(vector-ref columns-used 0))
(define (num-col columns-used)
@@ -790,7 +783,7 @@
(list
(string-append (_ "Client") ":&nbsp;")
(string-expand address #\newline "<br>")))
(set-last-row-style!
(gnc:html-table-set-last-row-style!
table "td"
'attribute (list "valign" "top"))
table))
@@ -810,7 +803,7 @@
(string-expand (qof-print-date (current-time))
#\space "&nbsp;"))
(make-client-table address)))
(set-last-row-style!
(gnc:html-table-set-last-row-style!
table "td"
'attribute (list "valign" "top"))
table))