Was forced to hack the '=' transaction operator to get it to work. This

feature's implementation needs more work, so it's being pulled from 2.6.1 in
order to be developed further.
This commit is contained in:
John Wiegley 2008-08-09 07:17:12 -04:00
parent ef0d32cd5d
commit d83e2f3487
2 changed files with 26 additions and 10 deletions

View file

@ -272,6 +272,22 @@ bool entry_base_t::finalize()
throw err;
}
// Add the final calculated totals each to their related account
if (dynamic_cast<entry_t *>(this)) {
for (transactions_list::const_iterator x = transactions.begin();
x != transactions.end();
x++) {
account_xdata_t& xdata(account_xdata(*(*x)->account));
// jww (2008-08-09): For now, this feature only works for
// non-specific commodities.
xdata.value += (*x)->amount.strip_annotations();
if ((*x)->account->fullname() == "Assets:Cash")
DEBUG_PRINT("ledger.xact.assign",
"account " << (*x)->account->fullname() << " balance = " << xdata.value);
}
}
return true;
}

View file

@ -293,16 +293,6 @@ transaction_t * parse_transaction(char * line, account_t * account,
parse_assign:
if (entry != NULL) {
// Add this amount to the related account now
account_xdata_t& xdata(account_xdata(*xact->account));
if (xact->amount) {
xdata.value += xact->amount;
DEBUG_PRINT("ledger.textual.parse", "line " << linenum << ": " <<
"XACT assign: account total = " << xdata.value);
}
// Parse the optional assigned (= AMOUNT)
if (in.good() && ! in.eof()) {
@ -327,6 +317,13 @@ parse_assign:
unsigned long end = (long)in.tellg();
account_xdata_t& xdata(account_xdata(*xact->account));
DEBUG_PRINT("ledger.xact.assign",
"account balance = " << xdata.value);
DEBUG_PRINT("ledger.xact.assign",
"xact amount = " << amt);
amount_t diff;
if (xdata.value.type == value_t::AMOUNT)
diff = amt - *((amount_t *) xdata.value.data);
@ -337,6 +334,9 @@ parse_assign:
else
diff = amt;
DEBUG_PRINT("ledger.xact.assign",
"diff = " << diff);
DEBUG_PRINT("ledger.textual.parse", "line " << linenum << ": " <<
"XACT assign: diff = " << diff);