From 54c4575f27a6b6033aac147ee542b2fc6943cc3a Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Thu, 28 Nov 2019 12:17:34 +0800 Subject: [PATCH] [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. --- gnucash/report/standard-reports/balsheet-pnl.scm | 13 ++++++++----- .../standard-reports/test/test-balsheet-pnl.scm | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/gnucash/report/standard-reports/balsheet-pnl.scm b/gnucash/report/standard-reports/balsheet-pnl.scm index d8a48d471e..36804aabbe 100644 --- a/gnucash/report/standard-reports/balsheet-pnl.scm +++ b/gnucash/report/standard-reports/balsheet-pnl.scm @@ -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?) diff --git a/gnucash/report/standard-reports/test/test-balsheet-pnl.scm b/gnucash/report/standard-reports/test/test-balsheet-pnl.scm index 9fa490a884..98e272c35c 100644 --- a/gnucash/report/standard-reports/test/test-balsheet-pnl.scm +++ b/gnucash/report/standard-reports/test/test-balsheet-pnl.scm @@ -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"