summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/entry.cc15
-rw-r--r--src/textual.cc19
2 files changed, 21 insertions, 13 deletions
diff --git a/src/entry.cc b/src/entry.cc
index b43970e9..1a906cc4 100644
--- a/src/entry.cc
+++ b/src/entry.cc
@@ -320,6 +320,21 @@ bool entry_base_t::finalize()
}
}
+ // Add the final calculated totals each to their related account
+
+ if (dynamic_cast<entry_t *>(this)) {
+ foreach (xact_t * xact, xacts) {
+ account_t::xdata_t& xdata(xact->account->xdata());
+
+ // jww (2008-08-09): For now, this feature only works for
+ // non-specific commodities.
+ if (xdata.value.is_null())
+ xdata.value = xact->amount.strip_annotations();
+ else
+ xdata.value += xact->amount.strip_annotations();
+ }
+ }
+
return true;
}
diff --git a/src/textual.cc b/src/textual.cc
index e46ae22a..f10125ea 100644
--- a/src/textual.cc
+++ b/src/textual.cc
@@ -304,19 +304,6 @@ xact_t * parse_xact(char * line, account_t * account, entry_t * entry = NULL)
parse_assign:
if (entry != NULL) {
- // Add this amount to the related account now
-
- account_t::xdata_t& xdata(xact->account->xdata());
-
- if (! xact->amount.is_null()) {
- if (xdata.value.is_null())
- xdata.value = xact->amount;
- else
- xdata.value += xact->amount;
- DEBUG("ledger.textual.parse", "line " << linenum << ": " <<
- "XACT assign: account total = " << xdata.value);
- }
-
// Parse the optional assigned (= AMOUNT)
if (in.good() && ! in.eof()) {
@@ -349,6 +336,11 @@ xact_t * parse_xact(char * line, account_t * account, entry_t * entry = NULL)
// jww (2008-08-02): Save total_expr somewhere!
+ account_t::xdata_t& xdata(xact->account->xdata());
+
+ DEBUG("ledger.xact.assign", "account balance = " << xdata.value);
+ DEBUG("ledger.xact.assign", "xact amount = " << amt);
+
amount_t diff;
if (xdata.value.is_amount()) {
diff = amt - xdata.value.as_amount();
@@ -367,6 +359,7 @@ xact_t * parse_xact(char * line, account_t * account, entry_t * entry = NULL)
diff = amt;
}
+ DEBUG("ledger.xact.assign", "diff = " << diff);
DEBUG("ledger.textual.parse", "line " << linenum << ": " <<
"XACT assign: diff = " << diff);