[balsheet-pnl] fix: hide Equity sections when not needed

* If currencies are not converted, Unrealized Gains are
meaningless. Hide them.

* If there are no income/expense accounts, retained earnings will be
nil. Remove row.
This commit is contained in:
Christopher Lam 2019-11-28 12:17:34 +08:00
parent 7853f5a24a
commit 54c4575f27
2 changed files with 9 additions and 6 deletions

View File

@ -1125,11 +1125,14 @@ also show overall period profit & loss."))
(add-to-table
multicol-table-right (_ "Equity")
(append equity-accounts
(list
(vector (_ "Unrealized Gains")
unrealized-gain-fn)
(vector (_ "Retained Earnings")
retained-earnings-fn)))
(if common-currency
(list (vector (_ "Unrealized Gains")
unrealized-gain-fn))
'())
(if (null? income-expense)
'()
(list (vector (_ "Retained Earnings")
retained-earnings-fn))))
#:negate-amounts? #t)
(if (and common-currency show-rates?)

View File

@ -497,7 +497,7 @@
"Root.Asset.House" "Total For Asset" "Liability" "Root.Liability"
"Root.Liability.Bank2" "Root.Liability.Bank2.CreditCard"
"Root.Liability.Bank2.Loan" "Total For Liability" "Equity" "Root.Equity"
"Unrealized Gains" "Retained Earnings" "Total For Equity")
"Retained Earnings" "Total For Equity")
(sxml->table-row-col sxml 1 #f 1))
(test-equal "default balances"
'("#200.00" "$106,709.00" "30 FUNDS" "#200.00" "$106,709.00" "30 FUNDS"