From e40bee0ff6ba884fa4d0dfd8c2a93a87124939ed Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Mon, 9 Dec 2019 18:20:57 +0800 Subject: [PATCH] [Bug 797520] Balance Sheet (Multicolumn) the retained earnings amount in the equity section has its sign reversed c21bb66d6 had a regression: income-expense-balances was originally negated, only to be negated again for use in retained-earnings-fn. The previous change forgot to negate income-expense-balances. This commit removes the negation before use of income-expense-balances in retained-earnings-fn, thereby simplifying code. --- .../report/standard-reports/balsheet-pnl.scm | 9 +++------ .../standard-reports/test/test-balsheet-pnl.scm | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/gnucash/report/standard-reports/balsheet-pnl.scm b/gnucash/report/standard-reports/balsheet-pnl.scm index ac616febc9..c7d40b6fa1 100644 --- a/gnucash/report/standard-reports/balsheet-pnl.scm +++ b/gnucash/report/standard-reports/balsheet-pnl.scm @@ -1034,12 +1034,9 @@ also show overall period profit & loss.")) (if (and common-currency (every has-price? (gnc:accounts-get-commodities income-expense #f))) - (gnc:monetary-neg - (monetaries->exchanged income-expense-balance - common-currency price-source date)) - (map - gnc:monetary-neg - (income-expense-balance 'format gnc:make-gnc-monetary #f)))))) + (monetaries->exchanged income-expense-balance + common-currency price-source date) + (income-expense-balance 'format gnc:make-gnc-monetary #f))))) (chart (and-let* (include-chart? incr diff --git a/gnucash/report/standard-reports/test/test-balsheet-pnl.scm b/gnucash/report/standard-reports/test/test-balsheet-pnl.scm index 98e272c35c..96b5f7c9b4 100644 --- a/gnucash/report/standard-reports/test/test-balsheet-pnl.scm +++ b/gnucash/report/standard-reports/test/test-balsheet-pnl.scm @@ -535,7 +535,22 @@ "$320.00" "#200.00 " "$100,000.00" "$117,529.00" "$9,500.00" "$9,500.00" "$500.00" "$9,000.00" "$9,500.00" "$103,600.00" "$4,429.00" "$0.00" "$108,029.00" "1 FUNDS $350.00" "#1.00 $1.60") - (sxml->table-row-col sxml 1 #f 4))))) + (sxml->table-row-col sxml 1 #f 4))) + + ;; the following includes non-zero retained earnings of $1,270 + (set-option! multi-bs-options "General" "End Date" + (cons 'absolute (gnc-dmy2time64 1 3 1980))) + (set-option! multi-bs-options "General" "Period duration" #f) + (let ((sxml (options->sxml multicol-balsheet-uuid multi-bs-options + "multicol-balsheet-retained"))) + (test-equal "bal-1/3/80" + '("$123,319.00" "$123,319.00" "$5,129.00" "$2,000.00" "$3,029.00" + "$0.00" "$100.00" "$17,000.00" "$2,000.00" "$15,000.00" "30 FUNDS " + "$1,190.00" "$1,190.00" "#700.00 " "$100,000.00" "$123,319.00" + "$9,500.00" "$9,500.00" "$500.00" "$9,000.00" "$9,500.00" + "$103,600.00" "$8,949.00" "$1,270.00" "$113,819.00" "1 FUNDS $500.00" + "#1.00 $1.70") + (sxml->table-row-col sxml 1 #f 2))))) (define (multicol-pnl-tests) (define (default-testing-options)