Preserve the given cost for print
Patch from John Wiegley
This commit is contained in:
parent
a44572f3ec
commit
b886342064
3 changed files with 6 additions and 3 deletions
|
|
@ -68,6 +68,7 @@ public:
|
|||
amount_t amount; // can be null until finalization
|
||||
optional<expr_t> amount_expr;
|
||||
optional<amount_t> cost;
|
||||
optional<amount_t> given_cost;
|
||||
optional<amount_t> assigned_amount;
|
||||
optional<datetime_t> checkin;
|
||||
optional<datetime_t> checkout;
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ namespace {
|
|||
amtbuf << string(2 - (slip + amt_slip), ' ');
|
||||
amtbuf << amt;
|
||||
|
||||
if (post->cost &&
|
||||
if (post->given_cost &&
|
||||
! post->has_flags(POST_CALCULATED | POST_COST_CALCULATED)) {
|
||||
std::string cost_op;
|
||||
if (post->has_flags(POST_COST_IN_FULL))
|
||||
|
|
@ -254,10 +254,10 @@ namespace {
|
|||
cost_op = "(" + cost_op + ")";
|
||||
|
||||
if (post->has_flags(POST_COST_IN_FULL))
|
||||
amtbuf << " " << cost_op << " " << post->cost->abs();
|
||||
amtbuf << " " << cost_op << " " << post->given_cost->abs();
|
||||
else
|
||||
amtbuf << " " << cost_op << " "
|
||||
<< (*post->cost / post->amount).abs();
|
||||
<< (*post->given_cost / post->amount).abs();
|
||||
}
|
||||
|
||||
if (post->assigned_amount)
|
||||
|
|
|
|||
|
|
@ -1578,6 +1578,8 @@ post_t * instance_t::parse_post(char * line,
|
|||
if (fixed_cost)
|
||||
post->add_flags(POST_COST_FIXATED);
|
||||
|
||||
post->given_cost = post->cost;
|
||||
|
||||
DEBUG("textual.parse", "line " << context.linenum << ": "
|
||||
<< "Total cost is " << *post->cost);
|
||||
DEBUG("textual.parse", "line " << context.linenum << ": "
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue