Balance sheet report issues in 1.7.6
Ed Warnicke
hagbard@physics.rutgers.edu
Sun, 29 Dec 2002 06:10:46 -0500
This is a multi-part message in MIME format.
--------------030402020005020207030807
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
I've been using gnuncash 1.7.x since it faded into debian recently.
There seemed to be some problems with the balance sheet report.
First, I don't see how "Unrealized Gains(Losses)" belongs under Liabilities
( although I could easily be wrong, but if I'm wrong I'd like to know
why :).
Second, the "Liabilities & Equity" entry was the sum of
the total-equity-balance and the sign-reversed-liability-balance.
Since the liability-balance is generally intrinsically negative, this
means that the sign-reversed-liability-balance is intrinsically
positive, and means that the greater your liabilities, the greater your
liabilities and equities. I don't think that's quite right.
I've attached a patch which moves "Unrealized Gains(Losses)" to the
summary area at the bottom of the report, and corrects the way
most accounts are getting rolled up. Please review the patch and
let me know what you think.
Ed
--------------030402020005020207030807
Content-Type: text/plain;
name="balance-sheet.scm.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="balance-sheet.scm.patch"
--- balance-sheet.scm.orig 2002-12-29 02:13:53.000000000 -0500
+++ balance-sheet.scm 2002-12-29 03:26:28.000000000 -0500
@@ -301,15 +301,36 @@
(retained-profit-balance 'minusmerge
neg-retained-profit-balance
#f)
+ (let* ((weighted-fn
+ (gnc:case-exchange-fn 'weighted-average
+ report-currency to-date-tp))
+
+ (value
+ (gnc:gnc-monetary-amount
+ (gnc:sum-collector-commodity asset-balance
+ report-currency
+ exchange-fn)))
+
+ (cost
+ (gnc:gnc-monetary-amount
+ (gnc:sum-collector-commodity asset-balance
+ report-currency
+ weighted-fn)))
+
+ (unrealized-gain (gnc:numeric-sub-fixed value cost)))
+
+ (unrealized-gain-collector 'add report-currency unrealized-gain))
(total-equity-balance 'minusmerge equity-balance #f)
(total-equity-balance 'merge
retained-profit-balance
- #f)
+ #f)
+ (total-equity-balance 'merge unrealized-gain-collector #f)
(sign-reversed-liability-balance 'minusmerge
liability-balance
#f)
+
(equity-plus-liability 'merge
- sign-reversed-liability-balance
+ liability-balance
#f)
(equity-plus-liability 'merge
total-equity-balance
@@ -346,31 +367,6 @@
(add-subtotal-line
asset-table (_ "Liabilities") sign-reversed-liability-balance)
- (let* ((weighted-fn
- (gnc:case-exchange-fn 'weighted-average
- report-currency to-date-tp))
-
- (value
- (gnc:gnc-monetary-amount
- (gnc:sum-collector-commodity asset-balance
- report-currency
- exchange-fn)))
-
- (cost
- (gnc:gnc-monetary-amount
- (gnc:sum-collector-commodity asset-balance
- report-currency
- weighted-fn)))
-
- (unrealized-gain (gnc:numeric-sub-fixed value cost)))
-
- (unrealized-gain-collector 'add report-currency unrealized-gain)
- (equity-plus-liability 'add report-currency unrealized-gain)
-
- (add-subtotal-line
- asset-table (_ "Unrealized Gains(Losses)")
- unrealized-gain-collector))
-
(gnc:html-table-append-ruler!
asset-table (* (if show-fcur? 3 2) tree-depth))
@@ -380,6 +376,9 @@
(html-table-merge asset-table equity-table)
(add-subtotal-line
asset-table (_ "Net Profit") retained-profit-balance)
+ (add-subtotal-line
+ asset-table (_ "Unrealized Gains(Losses)")
+ unrealized-gain-collector)
(add-subtotal-line
asset-table (_ "Total Equity") total-equity-balance)
--------------030402020005020207030807--