[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,8 +516,7 @@
(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
@ -525,18 +524,15 @@
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
(lambda (monetary)
(gnc:html-table-append-row/markup! (gnc:html-table-append-row/markup!
table table subtotal-style
subtotal-style (list (gnc:make-html-table-cell/markup "total-label-cell" label)
(append (cons (gnc:make-html-table-cell/markup (gnc:make-html-table-cell/size/markup
"total-label-cell" label) 1 (colspan monetary) "total-number-cell"
'()) (display-subtotal monetary)))))
(list (gnc:make-html-table-cell/size/markup currency-totals))))
1 (colspan currency)
"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))