summaryrefslogtreecommitdiff
path: root/walk.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2006-03-03 09:45:44 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 02:41:28 -0400
commit96d6d62ad94082ca777c2c88b88e0346a5d00e65 (patch)
treeb50a26a9c4c0cc0ab90b1772cc75368739501fa5 /walk.cc
parent7d3e45958e805f8acaf399ef14d53757979240ab (diff)
downloadfork-ledger-96d6d62ad94082ca777c2c88b88e0346a5d00e65.tar.gz
fork-ledger-96d6d62ad94082ca777c2c88b88e0346a5d00e65.tar.bz2
fork-ledger-96d6d62ad94082ca777c2c88b88e0346a5d00e65.zip
Began support for improved commodity handling.
Diffstat (limited to 'walk.cc')
-rw-r--r--walk.cc14
1 files changed, 4 insertions, 10 deletions
diff --git a/walk.cc b/walk.cc
index c6ea3254..4bb6a38a 100644
--- a/walk.cc
+++ b/walk.cc
@@ -44,14 +44,8 @@ void add_transaction_to(const transaction_t& xact, value_t& value)
transaction_xdata_(xact).dflags & TRANSACTION_COMPOSITE) {
value += transaction_xdata_(xact).composite_amount;
}
- else if (xact.cost || xact.amount.commodity().price || value) {
- if (xact.amount.commodity().price) {
- amount_t price(*xact.amount.commodity().price);
- price *= xact.amount;
- value.add(base_amount(xact.amount), &price, xact.cost);
- } else {
- value.add(base_amount(xact.amount), NULL, xact.cost);
- }
+ else if (xact.cost || xact.amount.commodity().annotated || value) {
+ value.add(xact.amount, xact.cost);
}
else {
value = xact.amount;
@@ -500,7 +494,7 @@ void set_comm_as_payee::operator()(transaction_t& xact)
entry_t& entry = entry_temps.back();
entry._date = xact.date();
entry.code = xact.entry->code;
- entry.payee = xact.amount.commodity().symbol;
+ entry.payee = xact.amount.commodity().symbol();
xact_temps.push_back(xact);
transaction_t& temp = xact_temps.back();
@@ -829,7 +823,7 @@ void walk_commodities(commodities_map& commodities,
continue;
entry_temps.push_back(entry_t());
- acct_temps.push_back(account_t(NULL, (*i).second->symbol));
+ acct_temps.push_back(account_t(NULL, (*i).second->symbol()));
if ((*i).second->history())
for (history_map::iterator j = (*i).second->history()->prices.begin();