[equity-statement] compact and rename to add-report-line

This commit is contained in:
Christopher Lam 2019-09-30 15:30:20 +08:00
parent fd6b102f8e
commit 99b5d79a44

View File

@ -437,7 +437,7 @@
(period-for (string-append " " (_ "for Period")))) (period-for (string-append " " (_ "for Period"))))
;; a helper to add a line to our report ;; a helper to add a line to our report
(define (report-line (define (add-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 (let* ((neg? (and amount
@ -475,58 +475,47 @@
(gnc:report-percent-done 80) (gnc:report-percent-done 80)
(report-line (add-report-line
build-table build-table
(string-append (_ "Capital") ", " (string-append (_ "Capital") ", " (qof-print-date start-date-printable))
(qof-print-date start-date-printable)) #f start-total-equity 1 start-exchange-fn #f "primary-subheading")
#f start-total-equity
1 start-exchange-fn #f "primary-subheading" (add-report-line
)
(report-line
build-table build-table
(string-append (_ "Net income") period-for) (string-append (_ "Net income") period-for)
(string-append (_ "Net loss") period-for) (string-append (_ "Net loss") period-for)
net-income net-income 0 end-exchange-fn #f #f)
0 end-exchange-fn #f #f
) (add-report-line
(report-line
build-table build-table
(string-append (_ "Investments") period-for) (string-append (_ "Investments") period-for) #f
#f investments 0 end-exchange-fn #f #f)
investments
0 end-exchange-fn #f #f (add-report-line
)
(report-line
build-table build-table
(string-append (_ "Withdrawals") period-for) (string-append (_ "Withdrawals") period-for)
#f #f withdrawals 0 end-exchange-fn #f #f)
withdrawals
0 end-exchange-fn #f #f (unless (gnc-commodity-collector-allzero? net-unrealized-gains)
) (add-report-line
(or (gnc-commodity-collector-allzero? net-unrealized-gains)
(report-line
build-table build-table
(_ "Unrealized Gains") (_ "Unrealized Gains")
(_ "Unrealized Losses") (_ "Unrealized Losses")
net-unrealized-gains net-unrealized-gains
0 end-exchange-fn #f #f 0 end-exchange-fn #f #f))
)
) (add-report-line
(report-line
build-table build-table
(_ "Increase in capital") (_ "Increase in capital")
(_ "Decrease in capital") (_ "Decrease in capital")
capital-increase capital-increase
1 end-exchange-fn use-rules? #f 1 end-exchange-fn use-rules? #f)
)
(report-line (add-report-line
build-table build-table
(string-append (_ "Capital") ", " (string-append (_ "Capital") ", " (qof-print-date end-date)) #f
(qof-print-date end-date))
#f
end-total-equity end-total-equity
1 end-exchange-fn #f "primary-subheading" 1 end-exchange-fn #f "primary-subheading")
)
(gnc:html-document-add-object! doc build-table) (gnc:html-document-add-object! doc build-table)