r18552 - gnucash/trunk/src - Remove the "Compute unrealized gains and losses" option from the balance sheet

Mike Alexander mta at code.gnucash.org
Fri Jan 8 23:54:02 EST 2010


Author: mta
Date: 2010-01-08 23:54:02 -0500 (Fri, 08 Jan 2010)
New Revision: 18552
Trac: http://svn.gnucash.org/trac/changeset/18552

Modified:
   gnucash/trunk/src/engine/engine.i
   gnucash/trunk/src/libqof/qof/qofbook.h
   gnucash/trunk/src/report/standard-reports/balance-sheet.scm
Log:
Remove the "Compute unrealized gains and losses" option from the balance sheet
report.  Instead compute unrealized gains and losses only if the current book
does not use trading accounts.

Modified: gnucash/trunk/src/engine/engine.i
===================================================================
--- gnucash/trunk/src/engine/engine.i	2010-01-05 22:37:30 UTC (rev 18551)
+++ gnucash/trunk/src/engine/engine.i	2010-01-09 04:54:02 UTC (rev 18552)
@@ -116,6 +116,7 @@
 %include <qofquery.h>
 %include <qofquerycore.h>
 %include <qofbookslots.h>
+%include <qofbook.h>
 
 gnc_numeric gnc_numeric_create(gint64 num, gint64 denom);
 gnc_numeric gnc_numeric_zero(void);

Modified: gnucash/trunk/src/libqof/qof/qofbook.h
===================================================================
--- gnucash/trunk/src/libqof/qof/qofbook.h	2010-01-05 22:37:30 UTC (rev 18551)
+++ gnucash/trunk/src/libqof/qof/qofbook.h	2010-01-09 04:54:02 UTC (rev 18552)
@@ -40,6 +40,9 @@
 #ifndef QOF_BOOK_H
 #define QOF_BOOK_H
 
+/* We only want a few things exported to Guile */
+#ifndef SWIG
+
 typedef struct _QofBookClass  QofBookClass;
 
 #include "qofid.h"
@@ -213,6 +216,8 @@
 /** Retrieves arbitrary pointers to structs stored by qof_book_set_data. */
 gpointer qof_book_get_data (const QofBook *book, const gchar *key);
 
+#endif /* SWIG */
+
 /** Returns flag indicating whether this book uses trading accounts */
 gboolean qof_book_use_trading_accounts (const QofBook *book);
 
@@ -229,6 +234,9 @@
  */
 gboolean qof_book_not_saved (const QofBook *book);
 
+/* The following functions are not useful in scripting languages */
+#ifndef SWIG
+
 /** The qof_book_mark_saved() routine marks the book as having been
  *    saved (to a file, to a database). Used by backends to mark the
  *    notsaved flag as FALSE just after loading.  Can also be used
@@ -273,6 +281,8 @@
 /** deprecated */
 #define qof_book_get_guid(X) qof_entity_get_guid (QOF_INSTANCE(X))
 
+#endif /* SWIG */
+
 #endif /* QOF_BOOK_H */
 /** @} */
 /** @} */

Modified: gnucash/trunk/src/report/standard-reports/balance-sheet.scm
===================================================================
--- gnucash/trunk/src/report/standard-reports/balance-sheet.scm	2010-01-05 22:37:30 UTC (rev 18551)
+++ gnucash/trunk/src/report/standard-reports/balance-sheet.scm	2010-01-09 04:54:02 UTC (rev 18552)
@@ -139,9 +139,6 @@
   (N_ "Display any foreign currency amount in an account"))
 (define optname-show-rates (N_ "Show Exchange Rates"))
 (define opthelp-show-rates (N_ "Show the exchange rates used"))
-(define optname-unrealized-gains (N_ "Compute unrealized gains and losses"))
-(define opthelp-unrealized-gains
-  (N_ "Include unrealized gains and losses in the computation.  Will produce incorrect results if the current file uses commodity trading accounts"))
 
 
 ;; options generator
@@ -172,11 +169,6 @@
       gnc:pagename-general optname-report-form
       "d" opthelp-report-form #t))
 
-    (add-option
-     (gnc:make-simple-boolean-option
-      gnc:pagename-general optname-unrealized-gains
-      "e" opthelp-unrealized-gains #t))
-    
     ;; accounts to work on
     (add-option
      (gnc:make-account-list-option
@@ -302,8 +294,8 @@
                                    optname-date))))
          (report-form? (get-option gnc:pagename-general
                                optname-report-form))
-         (compute-unrealized-gains? (get-option gnc:pagename-general
-                                                optname-unrealized-gains))
+         (compute-unrealized-gains? (not (qof-book-use-trading-accounts 
+                                           (gnc-get-current-book))))
          (accounts (get-option gnc:pagename-accounts
                                optname-accounts))	 
 	 (depth-limit (get-option gnc:pagename-accounts 



More information about the gnucash-changes mailing list