Patch for Pnl-report and multiple currencies
Christian Stimming
stimming@uclink.berkeley.edu
Sat, 02 Sep 2000 04:00:28 -0700
This is a multi-part message in MIME format.
--------------1466A6BB5808354771E9A42C
Content-Type: text/plain; charset=iso-8859-2
Content-Transfer-Encoding: 7bit
Hi!
The Profit and Loss report in gnucash-1.4.5 (as in prior versions) has a
nasty bug when using multiple currencies: All balances are printed with
the default currency rather than the appropriate currency for each
account.
The attached patch fixes this.
However, the Total Balance still shows no useful value in the case of
multiple currencies. The simple (and probably the only practical)
solution would be to print one Total Balance for each currency. (Maybe
I'll post that soon...)
Have fun
Christian
--------------1466A6BB5808354771E9A42C
Content-Type: text/plain; charset=iso-8859-2;
name="gnucash-1.4.5-patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="gnucash-1.4.5-patch"
diff -urN gnucash/src/scm/report/balance-and-pnl.scm gnucash-1.4.5a/src/scm/report/balance-and-pnl.scm
--- gnucash/src/scm/report/balance-and-pnl.scm Fri Jun 9 16:59:40 2000
+++ gnucash-1.4.5a/src/scm/report/balance-and-pnl.scm Sat Sep 2 03:32:59 2000
@@ -77,7 +77,9 @@
(gnc:account-get-type level-2-account))))
(html-table-row-align
(list
- account-name type-name (gnc:amount->formatted-string l2-value #f))
+ account-name type-name
+ (gnc:amount->formatted-currency-string
+ l2-value (gnc:account-get-currency level-2-account) #f))
(list "left" "center" "right"))))
(define (render-level-1-account account l1-value)
@@ -85,7 +87,8 @@
(type (gnc:account-get-type-string (gnc:account-get-type account))))
(html-table-row-align
(list name type " "
- (gnc:amount->formatted-string l1-value #f)
+ (gnc:amount->formatted-currency-string
+ l1-value (gnc:account-get-currency account) #f)
" " " ")
(list "left" "center" "right" "right" "right" "right"))))
diff -urN gnucash/src/scm/report-utilities.scm gnucash-1.4.5a/src/scm/report-utilities.scm
--- gnucash/src/scm/report-utilities.scm Fri Jun 2 02:00:28 2000
+++ gnucash-1.4.5a/src/scm/report-utilities.scm Sat Sep 2 03:30:44 2000
@@ -32,6 +32,12 @@
(define (gnc:amount->formatted-string amount shares_value?)
(gnc:amount->string amount #t #t shares_value?))
+(define (gnc:amount->formatted-currency-string amount
+ this_currency shares_value?)
+ (gnc:amount->string-helper (exact->inexact amount)
+ #t #t shares_value?
+ this_currency))
+
(define (gnc:account-has-shares? account)
(let ((type (gnc:account-type->symbol (gnc:account-get-type account))))
(member type '(STOCK MUTUAL CURRENCY))))
--------------1466A6BB5808354771E9A42C--