[new-aging] step 3 - only render APAR details if APAR-accounts>1

This commit will hide the APAR account anchor if there's only one
found. So, for majority of users with single AP/AR accounts, the aging
report will be very similar to old one. For users with multi APAR
accounts, each one will be shown with header (and anchor) and
indenting to highlight grouping.
This commit is contained in:
Christopher Lam 2019-11-10 03:50:55 +08:00
parent 97798f9fd1
commit 6f7c6b9de3

View File

@ -192,8 +192,7 @@ exist but have no suitable transactions."))
(gnc:option-value (gnc:lookup-option options section name))) (gnc:option-value (gnc:lookup-option options section name)))
(define make-heading-list (define make-heading-list
(list "" (list (_ "Company")
(_ "Company")
(_ "Prepayments") (_ "Prepayments")
(_ "Current") (_ "Current")
(_ "0-30 days") (_ "0-30 days")
@ -258,10 +257,12 @@ exist but have no suitable transactions."))
document (gnc:make-html-text empty-APAR-accounts))) document (gnc:make-html-text empty-APAR-accounts)))
(else (else
(let ((table (gnc:make-html-table))) (let ((table (gnc:make-html-table))
(accounts>1? (> (length accounts-and-owners) 1)))
(gnc:html-table-set-col-headers! (gnc:html-table-set-col-headers!
table (append make-heading-list table (append (if accounts>1? '(#f) '())
make-heading-list
(options->address options receivable #f))) (options->address options receivable #f)))
(for-each (for-each
@ -271,13 +272,14 @@ exist but have no suitable transactions."))
(acc-totals (caddr account-and-owners)) (acc-totals (caddr account-and-owners))
(comm (xaccAccountGetCommodity account))) (comm (xaccAccountGetCommodity account)))
(gnc:html-table-append-row! (when accounts>1?
table (list (gnc:make-html-table-cell/size (gnc:html-table-append-row!
1 (+ 2 num-buckets) table (list (gnc:make-html-table-cell/size
(gnc:make-html-text 1 (+ 2 num-buckets)
(gnc:html-markup-anchor (gnc:make-html-text
(gnc:account-anchor-text account) (gnc:html-markup-anchor
(xaccAccountGetName account)))))) (gnc:account-anchor-text account)
(xaccAccountGetName account)))))))
(for-each (for-each
(lambda (owner-and-aging) (lambda (owner-and-aging)
@ -287,7 +289,7 @@ exist but have no suitable transactions."))
(gnc:html-table-append-row! (gnc:html-table-append-row!
table table
(append (append
(list #f) (if accounts>1? '(#f) '())
(cons (cons
(gnc:make-html-text (gnc:make-html-text
(gnc:html-markup-anchor (gnc:html-markup-anchor
@ -309,14 +311,15 @@ exist but have no suitable transactions."))
owners-and-aging) owners-and-aging)
(gnc:html-table-append-row! (gnc:html-table-append-row!
table table
(cons* #f (append
(gnc:make-html-table-cell/markup (if accounts>1? '(#f) '())
"total-label-cell" (_ "Total")) (list (gnc:make-html-table-cell/markup
(map "total-label-cell" (_ "Total")))
(lambda (amt) (map
(gnc:make-html-table-cell/markup (lambda (amt)
"total-number-cell" (gnc:make-gnc-monetary comm amt))) (gnc:make-html-table-cell/markup
acc-totals))))) "total-number-cell" (gnc:make-gnc-monetary comm amt)))
acc-totals)))))
accounts-and-owners) accounts-and-owners)
(for-each gncOwnerFree tofree) (for-each gncOwnerFree tofree)
(gnc:html-document-add-object! document table))))) (gnc:html-document-add-object! document table)))))