gnucash master: Multiple changes pushed
Christopher Lam
clam at code.gnucash.org
Mon Jun 8 10:38:03 EDT 2020
Updated via https://github.com/Gnucash/gnucash/commit/d281a3f2 (commit)
via https://github.com/Gnucash/gnucash/commit/555e4dd3 (commit)
via https://github.com/Gnucash/gnucash/commit/b000d411 (commit)
via https://github.com/Gnucash/gnucash/commit/fed4dfba (commit)
from https://github.com/Gnucash/gnucash/commit/b5aeca94 (commit)
commit d281a3f2706d8213b7d64f62a702467fde76be95
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Mon Jun 8 19:44:33 2020 +0800
Bug 797786: [balsheet-pnl] show trading-accounts if set
diff --git a/gnucash/report/reports/standard/balsheet-pnl.scm b/gnucash/report/reports/standard/balsheet-pnl.scm
index 4d2ac760f..6037ef786 100644
--- a/gnucash/report/reports/standard/balsheet-pnl.scm
+++ b/gnucash/report/reports/standard/balsheet-pnl.scm
@@ -1110,10 +1110,11 @@ also show overall period profit & loss."))
(add-to-table
multicol-table-right (_ "Equity")
(append equity-accounts
- (if common-currency
- (list (vector (_ "Unrealized Gains")
- unrealized-gain-fn))
- '())
+ (cond
+ (use-trading-accts? trading-accounts)
+ (common-currency (list (vector (_ "Unrealized Gains")
+ unrealized-gain-fn)))
+ (else '()))
(if (null? income-expense)
'()
(list (vector (_ "Retained Earnings")
commit 555e4dd34b4ae3c3c58cddd0b9ceeb0cd53ff1f8
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Mon Jun 8 19:29:58 2020 +0800
Bug 797786: [balsheet-pnl] add liability&equity section in bs
diff --git a/gnucash/report/reports/standard/balsheet-pnl.scm b/gnucash/report/reports/standard/balsheet-pnl.scm
index 055faeb12..4d2ac760f 100644
--- a/gnucash/report/reports/standard/balsheet-pnl.scm
+++ b/gnucash/report/reports/standard/balsheet-pnl.scm
@@ -891,6 +891,7 @@ also show overall period profit & loss."))
(assoc-ref split-up-accounts ACCT-TYPE-EQUITY))
(trading-accounts
(assoc-ref split-up-accounts ACCT-TYPE-TRADING))
+ (use-trading-accts? (qof-book-use-trading-accounts (gnc-get-current-book)))
(asset-liability (append-reverse asset-accounts liability-accounts))
(income-expense (append-reverse income-accounts expense-accounts))
@@ -1119,6 +1120,24 @@ also show overall period profit & loss."))
retained-earnings-fn))))
#:negate-amounts? #t)
+
+ (add-to-table multicol-table-right (_ "Liability and Equity")
+ (append liability-accounts
+ equity-accounts
+ (cond
+ (use-trading-accts? trading-accounts)
+ (common-currency (list (vector (_ "Unrealized Gains")
+ unrealized-gain-fn)))
+ (else '()))
+ (if (null? income-expense)
+ '()
+ (list (vector (_ "Retained Earnings")
+ retained-earnings-fn))))
+ #:negate-amounts? #t
+ #:show-title? #f
+ #:show-accounts? #f
+ #:show-total? #t)
+
(if (and common-currency show-rates?)
(add-to-table multicol-table-right (_ "Exchange Rates")
asset-liability
diff --git a/gnucash/report/reports/standard/test/test-balsheet-pnl.scm b/gnucash/report/reports/standard/test/test-balsheet-pnl.scm
index 27fb2fdfc..4683c2316 100644
--- a/gnucash/report/reports/standard/test/test-balsheet-pnl.scm
+++ b/gnucash/report/reports/standard/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"
- "Retained Earnings" "Total For Equity")
+ "Retained Earnings" "Total For Equity" "Total For Liability and 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"
@@ -505,7 +505,7 @@
"30 FUNDS" "$2,000.00" "30 FUNDS" "#200.00" "#200.00" "$100,000.00"
"30 FUNDS" "#200.00" "$106,709.00" "$9,500.00" "$9,500.00" "$500.00"
"$9,000.00" "$9,500.00" "$103,600.00" "$0.00" "#0.00" "$103,600.00"
- "#0.00")
+ "#0.00" "$113,100.00" "#0.00")
(sxml->table-row-col sxml 1 #f 2))
;; the following tests many parts of multicolumn balance sheet:
@@ -520,21 +520,24 @@
"$6,870.00" "$0.00" "$100.00" "$4,000.00" "$2,000.00" "$2,000.00"
"10 FUNDS " "$130.00" "$130.00" "#100.00 " "$100,000.00" "$113,100.00"
"$9,500.00" "$9,500.00" "$500.00" "$9,000.00" "$9,500.00" "$103,600.00"
- "$0.00" "$0.00" "$103,600.00" "#1.00 $1.3000" "1 FUNDS $200.0000")
+ "$0.00" "$0.00" "$103,600.00" "$113,100.00" "#1.00 $1.3000"
+ "1 FUNDS $200.0000")
(sxml->table-row-col sxml 1 #f 2))
(test-equal "bal-1/1/71"
'("01/01/71" "$116,009.00" "$116,009.00" "$4,709.00" "$2,000.00"
"$2,609.00" "$0.00" "$100.00" "$11,000.00" "$2,000.00" "$9,000.00"
"30 FUNDS " "$300.00" "$300.00" "#200.00 " "$100,000.00" "$116,009.00"
"$9,500.00" "$9,500.00" "$500.00" "$9,000.00" "$9,500.00" "$103,600.00"
- "$2,909.00" "$0.00" "$106,509.00" "#1.00 $1.5000" "1 FUNDS $300.0000")
+ "$2,909.00" "$0.00" "$106,509.00" "$116,009.00" "#1.00 $1.5000"
+ "1 FUNDS $300.0000")
(sxml->table-row-col sxml 1 #f 3))
(test-equal "bal-1/1/72"
'("01/01/72" "$117,529.00" "$117,529.00" "$4,709.00" "$2,000.00"
"$2,609.00" "$0.00" "$100.00" "$12,500.00" "$2,000.00" "$10,500.00"
"30 FUNDS " "$320.00" "$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.00 $1.6000" "1 FUNDS $350.0000")
+ "$4,429.00" "$0.00" "$108,029.00" "$117,529.00" "#1.00 $1.6000"
+ "1 FUNDS $350.0000")
(sxml->table-row-col sxml 1 #f 4)))
;; the following includes non-zero retained earnings of $1,270
@@ -548,7 +551,7 @@
"$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.00 $1.7000" "1 FUNDS $500.0000")
+ "$113,819.00" "$123,319.00" "#1.00 $1.7000" "1 FUNDS $500.0000")
(sxml->table-row-col sxml 1 #f 2)))))
(define (multicol-pnl-tests)
commit b000d4114c436deab4062e51cdeb605020c77e9a
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Mon Jun 8 17:57:28 2020 +0800
Bug 797786: [balsheet-pnl] retained earnings include closing entries
diff --git a/gnucash/report/reports/standard/balsheet-pnl.scm b/gnucash/report/reports/standard/balsheet-pnl.scm
index d82f53fa4..055faeb12 100644
--- a/gnucash/report/reports/standard/balsheet-pnl.scm
+++ b/gnucash/report/reports/standard/balsheet-pnl.scm
@@ -38,10 +38,12 @@
;; the column-data record. the gnc:account-accumulate-at-dates will
;; create a record for each report-date with split-data as follows:
(define-record-type :col-datum
- (make-datum last-split split-balance split-value-balance)
+ (make-datum last-split split-balance split-balance-with-closing
+ split-value-balance)
col-datum?
(last-split col-datum-get-last-split)
(split-balance col-datum-get-split-balance)
+ (split-balance-with-closing col-datum-get-split-balance-with-closing)
(split-value-balance col-datum-get-split-value-balance))
@@ -771,6 +773,7 @@ also show overall period profit & loss."))
(gnc:account-accumulate-at-dates
acc report-dates
#:nosplit->elt (make-datum #f (amt->monetary 0)
+ (amt->monetary 0)
(gnc:make-commodity-collector))
#:split->elt
(lambda (s)
@@ -778,7 +781,9 @@ also show overall period profit & loss."))
(val-coll 'add
(xaccTransGetCurrency (xaccSplitGetParent s))
(xaccSplitGetValue s)))
- (make-datum s (amt->monetary (xaccSplitGetNoclosingBalance s))
+ (make-datum s
+ (amt->monetary (xaccSplitGetNoclosingBalance s))
+ (amt->monetary (xaccSplitGetBalance s))
(gnc:collector+ val-coll)))))))
accounts))
@@ -791,6 +796,13 @@ also show overall period profit & loss."))
(map col-datum-get-split-balance cols-data))))
accounts))
+ (accounts-balances-with-closing
+ (map
+ (lambda (acc)
+ (cons acc (let ((cols-data (assoc-ref accounts-cols-data acc)))
+ (map col-datum-get-split-balance-with-closing cols-data))))
+ accounts))
+
(exchange-fn (and common-currency
(gnc:case-exchange-time-fn
price-source common-currency
@@ -951,9 +963,9 @@ also show overall period profit & loss."))
;; a vector of collectors whereby collector is the sum of
;; incomes and expenses at report dates
- (income-expense-balances
+ (income-expense-balances-with-closing
(sum-balances-of-accounts
- accounts-balances income-expense gnc:monetaries-add))
+ accounts-balances-with-closing income-expense gnc:monetaries-add))
;; an alist of (cons account list-of-collectors) whereby each
;; collector is the split-value-balances at report
@@ -1012,7 +1024,7 @@ also show overall period profit & loss."))
((pricedb-latest) (current-time))
(else (list-ref report-dates col-idx))))
(income-expense-balance
- (vector-ref income-expense-balances col-idx)))
+ (vector-ref income-expense-balances-with-closing col-idx)))
(if (and common-currency
(every has-price?
(gnc:accounts-get-commodities income-expense #f)))
commit fed4dfba6dd027d834c8a32cb341aedeed1b6508
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Mon Jun 8 18:00:30 2020 +0800
[balance-sheet] hide trading-accounts if use-trading-accts? is unset
diff --git a/gnucash/report/reports/standard/balance-sheet.scm b/gnucash/report/reports/standard/balance-sheet.scm
index 7d7f81f82..f7fc81bc7 100644
--- a/gnucash/report/reports/standard/balance-sheet.scm
+++ b/gnucash/report/reports/standard/balance-sheet.scm
@@ -424,7 +424,9 @@
(account-list-balance income-expense-accounts reportdate)))
(trading-balance
- (gnc:collector- (account-list-balance trading-accounts reportdate)))
+ (if use-trading-accts?
+ (gnc:collector- (account-list-balance trading-accounts reportdate))
+ (gnc:collector+)))
(unrealized-gain-collector
(if use-trading-accts?
Summary of changes:
gnucash/report/reports/standard/balance-sheet.scm | 4 +-
gnucash/report/reports/standard/balsheet-pnl.scm | 50 ++++++++++++++++++----
.../reports/standard/test/test-balsheet-pnl.scm | 15 ++++---
3 files changed, 53 insertions(+), 16 deletions(-)
More information about the gnucash-changes
mailing list