[Gnucash-changes] Fix xaccAccountGetBalanceAsOfDate() (bug #150757).
Derek Atkins
warlord at cvs.gnucash.org
Sat Aug 28 22:35:08 EDT 2004
Log Message:
-----------
Fix xaccAccountGetBalanceAsOfDate() (bug #150757).
* src/engine/Account.c: fix xaccAccountGetBalanceAsOfDate() to properly
compute the balance at the end of the split list. Fixes #150757.
Tags:
----
gnucash-1-8-branch
Modified Files:
--------------
gnucash:
ChangeLog
gnucash/src/engine:
Account.c
Revision Data
-------------
Index: ChangeLog
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/ChangeLog,v
retrieving revision 1.1461.2.351
retrieving revision 1.1461.2.352
diff -LChangeLog -LChangeLog -u -r1.1461.2.351 -r1.1461.2.352
--- ChangeLog
+++ ChangeLog
@@ -1,4 +1,9 @@
-2004-18-21 Derek Atkins <derek at ihtfp.com>
+2004-08-28 Derek Atkins <derek at ihtfp.com>
+
+ * src/engine/Account.c: fix xaccAccountGetBalanceAsOfDate() to properly
+ compute the balance at the end of the split list. Fixes #150757.
+
+2004-08-21 Derek Atkins <derek at ihtfp.com>
* src/report/standard-reports/advanced-portfolio.scm:
Add option to include zero-amount splits in computations.
Index: Account.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/engine/Account.c,v
retrieving revision 1.222.2.4
retrieving revision 1.222.2.5
diff -Lsrc/engine/Account.c -Lsrc/engine/Account.c -u -r1.222.2.4 -r1.222.2.5
--- src/engine/Account.c
+++ src/engine/Account.c
@@ -1938,12 +1938,17 @@
lp = lp->next;
}
- if( lp && lp->prev )
- {
- /* Since lp is now pointing to a split which was past the reconcile
- * date, get the running balance of the previous split.
- */
- balance = xaccSplitGetBalance( (Split *)lp->prev->data );
+ if( lp ) {
+ if ( lp->prev ) {
+ /* Since lp is now pointing to a split which was past the reconcile
+ * date, get the running balance of the previous split.
+ */
+ balance = xaccSplitGetBalance( (Split *)lp->prev->data );
+ }
+ else {
+ /* AsOf date must be before any entries, return zero. */
+ balance = gnc_numeric_zero();
+ }
}
/* Otherwise there were no splits posted after the given date,
More information about the gnucash-changes
mailing list