[budget-income-statement] remove dead code

indent & tabbing are constants, refactor them out
This commit is contained in:
Christopher Lam 2019-09-30 15:22:23 +08:00
parent 545454e347
commit 72dc9bd301

View File

@ -71,8 +71,6 @@
(define opthelp-budget-period-end (define opthelp-budget-period-end
(N_ "Select a budget period that ends the reporting range.")) (N_ "Select a budget period that ends the reporting range."))
;; FIXME this could use an indent option
(define optname-accounts (N_ "Accounts")) (define optname-accounts (N_ "Accounts"))
(define opthelp-accounts (define opthelp-accounts
(N_ "Report on these accounts, if display depth allows.")) (N_ "Report on these accounts, if display depth allows."))
@ -384,8 +382,6 @@
optname-two-column)) optname-two-column))
(standard-order? (get-option gnc:pagename-display (standard-order? (get-option gnc:pagename-display
optname-standard-order)) optname-standard-order))
(indent 0)
(tabbing #f)
;; decompose the account list ;; decompose the account list
(split-up-accounts (gnc:decompose-accountlist accounts)) (split-up-accounts (gnc:decompose-accountlist accounts))
@ -406,41 +402,23 @@
(gnc:case-exchange-fn price-source report-commodity date-t64)) (gnc:case-exchange-fn price-source report-commodity date-t64))
) )
;; Wrapper to call gnc:html-table-add-labeled-amount-line!
;; with the proper arguments.
(define (add-subtotal-line table pos-label neg-label signed-balance) (define (add-subtotal-line table pos-label neg-label signed-balance)
(define allow-same-column-totals #t) (let* ((neg? (and signed-balance neg-label
(let* ((neg? (and signed-balance (negative?
neg-label
(gnc-numeric-negative-p
(gnc:gnc-monetary-amount (gnc:gnc-monetary-amount
(gnc:sum-collector-commodity (gnc:sum-collector-commodity
signed-balance report-commodity exchange-fn))))) signed-balance report-commodity exchange-fn)))))
(label (if neg? (or neg-label pos-label) pos-label)) (label (if neg? (or neg-label pos-label) pos-label))
(balance (if neg? (balance (if neg? (gnc:collector- signed-balance) signed-balance)))
(gnc:collector- signed-balance)
signed-balance))
)
(gnc:html-table-add-labeled-amount-line! (gnc:html-table-add-labeled-amount-line!
table table (* tree-depth 2) "primary-subheading" #f label 0 1 "total-label-cell"
(+ indent (* tree-depth 2)
(if (equal? tabbing 'canonically-tabbed) 1 0))
"primary-subheading"
(and (not allow-same-column-totals) balance use-rules?)
label indent 1 "total-label-cell"
(gnc:sum-collector-commodity balance report-commodity exchange-fn) (gnc:sum-collector-commodity balance report-commodity exchange-fn)
(+ indent (* tree-depth 2) (- 0 1) (1- (* tree-depth 2)) 1 "total-number-cell")))
(if (equal? tabbing 'canonically-tabbed) 1 0))
1 "total-number-cell")
)
)
;; wrapper around gnc:html-table-append-ruler! ;; wrapper around gnc:html-table-append-ruler!
(define (add-rule table) (define (add-rule table)
(gnc:html-table-append-ruler! (gnc:html-table-append-ruler!
table table (* 2 tree-depth)))
(+ (* 2 tree-depth)
(if (equal? tabbing 'canonically-tabbed) 1 0))))
(cond (cond
((null? accounts) ((null? accounts)
@ -507,34 +485,20 @@
;; a helper to add a line to our report ;; a helper to add a line to our report
(define (report-line (define (report-line
table pos-label neg-label amount col table pos-label neg-label amount col exchange-fn rule? row-style)
exchange-fn rule? row-style) (let* ((neg? (and amount neg-label
(let* ((neg? (and amount (negative?
neg-label
(gnc-numeric-negative-p
(gnc:gnc-monetary-amount (gnc:gnc-monetary-amount
(gnc:sum-collector-commodity (gnc:sum-collector-commodity
amount report-commodity exchange-fn))))) amount report-commodity exchange-fn)))))
(label (if neg? (or neg-label pos-label) pos-label)) (label (if neg? (or neg-label pos-label) pos-label))
(pos-bal (if neg? (abs-amt (if neg? (gnc:collector- amount) amount))
(gnc:collector- amount)
amount))
(bal (gnc:sum-collector-commodity (bal (gnc:sum-collector-commodity
pos-bal report-commodity exchange-fn)) abs-amt report-commodity exchange-fn)))
(balance
(cond
((gnc:uniform-commodity? pos-bal report-commodity) bal)
(show-fcur? (gnc-commodity-table pos-bal report-commodity
exchange-fn))
(else bal)))
(column (or col 0))
)
(gnc:html-table-add-labeled-amount-line! (gnc:html-table-add-labeled-amount-line!
table (* 2 tree-depth) row-style rule? table (* 2 tree-depth) row-style rule?
label 0 1 "text-cell" label 0 1 "text-cell"
bal (+ col 1) 1 "number-cell") bal (1+ col) 1 "number-cell")))
)
)
(gnc:report-percent-done 5) (gnc:report-percent-done 5)