[register] compact functions, inline single-use function

This commit is contained in:
Christopher Lam 2019-08-24 22:38:29 +08:00
parent cc222515a3
commit d7813206ce

View File

@ -516,27 +516,23 @@
(gnc:monetary-neg monetary) (gnc:monetary-neg monetary)
monetary))) monetary)))
(if (or single-col credit-col debit-col) (when (or single-col credit-col debit-col)
(begin (gnc:html-table-append-row!
(gnc:html-table-append-row! table
table (list
(list (gnc:make-html-table-cell/size
(gnc:make-html-table-cell/size 1 (num-columns-required used-columns)
1 (num-columns-required used-columns) (gnc:make-html-text (gnc:html-markup-hr)))))
(gnc:make-html-text (gnc:html-markup-hr)))))
(for-each (lambda (currency) (for-each
(gnc:html-table-append-row/markup! (lambda (monetary)
table (gnc:html-table-append-row/markup!
subtotal-style table subtotal-style
(append (cons (gnc:make-html-table-cell/markup (list (gnc:make-html-table-cell/markup "total-label-cell" label)
"total-label-cell" label) (gnc:make-html-table-cell/size/markup
'()) 1 (colspan monetary) "total-number-cell"
(list (gnc:make-html-table-cell/size/markup (display-subtotal monetary)))))
1 (colspan currency) currency-totals))))
"total-number-cell"
(display-subtotal currency))))))
currency-totals)))))
(define (accumulate-totals split total-amount total-value (define (accumulate-totals split total-amount total-value
debit-amount debit-value debit-amount debit-value
@ -556,17 +552,6 @@
(total-amount 'add split-currency split-amount) (total-amount 'add split-currency split-amount)
(total-value 'add trans-currency split-value))) (total-value 'add trans-currency split-value)))
(define (add-other-split-rows split table used-columns row-style
action-for-num? ledger-type? total-collector)
(let loop ((splits (xaccTransGetSplitList (xaccSplitGetParent split))))
(when (pair? splits)
(add-split-row table (car splits) used-columns row-style #f #t
action-for-num? ledger-type? #f
(opt-val "Display" "Memo")
(opt-val "Display" "Description")
total-collector)
(loop (cdr splits)))))
(define (splits-leader splits) (define (splits-leader splits)
(let ((accounts (map xaccSplitGetAccount splits))) (let ((accounts (map xaccSplitGetAccount splits)))
(and (pair? accounts) (and (pair? accounts)
@ -664,10 +649,15 @@
double? (opt-val "Display" "Memo") double? (opt-val "Display" "Memo")
(opt-val "Display" "Description") (opt-val "Display" "Description")
total-collector) total-collector)
(if multi-rows? (when multi-rows?
(add-other-split-rows current table used-columns (for-each
"alternate-row" action-for-num? (lambda (split)
ledger-type? total-collector)) (add-split-row table split used-columns "alternate-row"
#f #t action-for-num? ledger-type? #f
(opt-val "Display" "Memo")
(opt-val "Display" "Description") total-collector))
(xaccTransGetSplitList (xaccSplitGetParent current))))
(loop (cdr splits) (loop (cdr splits)
(not odd-row?)))))) (not odd-row?))))))
table)) table))