Compute a posting's cost from an annotated price
This commit is contained in:
parent
c85cf0d810
commit
ae8ab81062
1 changed files with 10 additions and 0 deletions
|
|
@ -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 << ": "
|
DEBUG("textual.parse", "line " << linenum << ": "
|
||||||
|
|
@ -1095,6 +1104,7 @@ post_t * instance_t::parse_post(char * line,
|
||||||
p = skip_ws(next);
|
p = skip_ws(next);
|
||||||
if (*p) {
|
if (*p) {
|
||||||
post->cost = amount_t();
|
post->cost = amount_t();
|
||||||
|
post->drop_flags(POST_COST_CALCULATED);
|
||||||
|
|
||||||
beg = p - line;
|
beg = p - line;
|
||||||
ptristream cstream(p, len - beg);
|
ptristream cstream(p, len - beg);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue