summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2010-06-07 08:25:05 -0400
committerJohn Wiegley <johnw@newartisans.com>2010-06-07 08:32:14 -0400
commitae8ab8106218167036ef386159450b56c328f1b9 (patch)
tree61044c383d628d670bf2108a2fa89d726998d19f
parentc85cf0d810846e6ffc2a45b7283adacc202db30f (diff)
downloadfork-ledger-ae8ab8106218167036ef386159450b56c328f1b9.tar.gz
fork-ledger-ae8ab8106218167036ef386159450b56c328f1b9.tar.bz2
fork-ledger-ae8ab8106218167036ef386159450b56c328f1b9.zip
Compute a posting's cost from an annotated price
-rw-r--r--src/textual.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/textual.cc b/src/textual.cc
index 85b1a14b..9f293f29 100644
--- a/src/textual.cc
+++ b/src/textual.cc
@@ -1065,6 +1065,15 @@ post_t * instance_t::parse_post(char * line,
}
}
}
+ else if (post->amount.annotation().price) {
+ post->cost = *post->amount.annotation().price * post->amount;
+ post->add_flags(POST_COST_CALCULATED);
+ DEBUG("textual.parse", "line " << linenum << ": "
+ << "cost (based on price annotation) = "
+ << post->amount.unrounded() << " * "
+ << post->amount.annotation().price->unrounded()
+ << " = " << post->cost->unrounded());
+ }
}
DEBUG("textual.parse", "line " << linenum << ": "
@@ -1095,6 +1104,7 @@ post_t * instance_t::parse_post(char * line,
p = skip_ws(next);
if (*p) {
post->cost = amount_t();
+ post->drop_flags(POST_COST_CALCULATED);
beg = p - line;
ptristream cstream(p, len - beg);