From 305c6159afe727c6e6f2f49c37789922df1a5a98 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 30 Aug 2004 05:29:34 -0400 Subject: small fixes --- textual.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'textual.cc') diff --git a/textual.cc b/textual.cc index 1c50d725..b066fdd0 100644 --- a/textual.cc +++ b/textual.cc @@ -148,14 +148,21 @@ bool finalize_entry(entry_t * entry) value_t balance; + bool first = true; for (transactions_list::const_iterator x = entry->transactions.begin(); x != entry->transactions.end(); x++) if (! ((*x)->flags & TRANSACTION_VIRTUAL) || ((*x)->flags & TRANSACTION_BALANCE)) { amount_t * p = (*x)->cost ? (*x)->cost : &(*x)->amount; - if (*p) - balance += *p; + if (*p) { + if (first) { + balance = *p; + first = false; + } else { + balance += *p; + } + } } // If one transaction of a two-line transaction is of a different -- cgit v1.2.3