Changed "priced" to "cost_calculated" for clarity
This commit is contained in:
parent
f881bf1319
commit
cbd66ba1c9
4 changed files with 21 additions and 16 deletions
|
|
@ -111,8 +111,8 @@ namespace {
|
|||
return post.has_flags(POST_CALCULATED);
|
||||
}
|
||||
|
||||
value_t get_is_priced(post_t& post) {
|
||||
return post.has_flags(POST_PRICED);
|
||||
value_t get_is_cost_calculated(post_t& post) {
|
||||
return post.has_flags(POST_COST_CALCULATED);
|
||||
}
|
||||
|
||||
value_t get_virtual(post_t& post) {
|
||||
|
|
@ -236,6 +236,8 @@ expr_t::ptr_op_t post_t::lookup(const string& name)
|
|||
return WRAP_FUNCTOR(get_wrapper<&get_code>);
|
||||
else if (name == "cost")
|
||||
return WRAP_FUNCTOR(get_wrapper<&get_cost>);
|
||||
else if (name == "cost_calculated")
|
||||
return WRAP_FUNCTOR(get_wrapper<&get_is_cost_calculated>);
|
||||
else if (name == "count")
|
||||
return WRAP_FUNCTOR(get_wrapper<&get_count>);
|
||||
else if (name == "calculated")
|
||||
|
|
@ -261,8 +263,6 @@ expr_t::ptr_op_t post_t::lookup(const string& name)
|
|||
return WRAP_FUNCTOR(get_wrapper<&get_payee>);
|
||||
else if (name == "primary")
|
||||
return WRAP_FUNCTOR(get_wrapper<&get_commodity_is_primary>);
|
||||
else if (name == "priced")
|
||||
return WRAP_FUNCTOR(get_wrapper<&get_is_priced>);
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
|
|
|
|||
|
|
@ -64,10 +64,10 @@ typedef std::list<post_t *> posts_list;
|
|||
class post_t : public item_t
|
||||
{
|
||||
public:
|
||||
#define POST_VIRTUAL 0x10 // the account was specified with (parens)
|
||||
#define POST_MUST_BALANCE 0x20 // posting must balance in the transaction
|
||||
#define POST_CALCULATED 0x40 // posting's amount was calculated
|
||||
#define POST_PRICED 0x80 // posting's cost was calculated
|
||||
#define POST_VIRTUAL 0x10 // the account was specified with (parens)
|
||||
#define POST_MUST_BALANCE 0x20 // posting must balance in the transaction
|
||||
#define POST_CALCULATED 0x40 // posting's amount was calculated
|
||||
#define POST_COST_CALCULATED 0x80 // posting's cost was calculated
|
||||
|
||||
xact_t * xact; // only set for posts of regular xacts
|
||||
account_t * account;
|
||||
|
|
|
|||
15
src/report.h
15
src/report.h
|
|
@ -514,16 +514,21 @@ public:
|
|||
"%(!effective & xact.effective_date ?"
|
||||
" \"=\" + format_date(xact.effective_date, \"%Y/%m/%d\") : \"\")"
|
||||
"%(xact.cleared ? \" *\" : (xact.pending ? \" !\" : \"\"))"
|
||||
"%(code ? \" (\" + code + \")\" : \"\") %(payee)%(xact.comment | \"\")\n"
|
||||
" %(xact.uncleared ? (cleared ? \"* \" : (pending ? \"! \" : \"\")) : \"\")"
|
||||
"%(code ? \" (\" + code + \")\" :"
|
||||
" \"\") %(payee)%(xact.comment | \"\")\n"
|
||||
" %(xact.uncleared ?"
|
||||
" (cleared ? \"* \" : (pending ? \"! \" : \"\")) : \"\")"
|
||||
"%-34(account)"
|
||||
" %12(calculated ? \"\" : justify(scrub(amount), 12, -1, true))"
|
||||
"%(has_cost & !priced ? \" @ \" + justify(scrub(abs(cost / amount)), 0) : \"\")"
|
||||
"%(has_cost & !cost_calculated ?"
|
||||
" \" @ \" + justify(scrub(abs(cost / amount)), 0) : \"\")"
|
||||
"%(comment | \"\")\n%/"
|
||||
" %(xact.uncleared ? (cleared ? \"* \" : (pending ? \"! \" : \"\")) : \"\")"
|
||||
" %(xact.uncleared ?"
|
||||
" (cleared ? \"* \" : (pending ? \"! \" : \"\")) : \"\")"
|
||||
"%-34(account)"
|
||||
" %12(calculated ? \"\" : justify(scrub(amount), 12, -1, true))"
|
||||
"%(has_cost & !priced ? \" @ \" + justify(scrub(abs(cost / amount)), 0) : \"\")"
|
||||
"%(has_cost & !cost_calculated ?"
|
||||
" \" @ \" + justify(scrub(abs(cost / amount)), 0) : \"\")"
|
||||
"%(comment | \"\")\n%/\n");
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ bool xact_base_t::finalize()
|
|||
"annotation price = " << *post->amount.annotation().price);
|
||||
DEBUG("xact.finalize", "amount = " << post->amount);
|
||||
DEBUG("xact.finalize", "priced cost = " << *post->cost);
|
||||
post->add_flags(POST_PRICED);
|
||||
post->add_flags(POST_COST_CALCULATED);
|
||||
add_or_set_value(balance, post->cost->rounded().reduced());
|
||||
} else {
|
||||
// If the amount was a cost, it very likely has the "keep_precision"
|
||||
|
|
@ -185,7 +185,7 @@ bool xact_base_t::finalize()
|
|||
else if (! top_post)
|
||||
top_post = post;
|
||||
|
||||
if (post->cost && ! post->has_flags(POST_PRICED)) {
|
||||
if (post->cost && ! post->has_flags(POST_COST_CALCULATED)) {
|
||||
saw_cost = true;
|
||||
break;
|
||||
}
|
||||
|
|
@ -240,7 +240,7 @@ bool xact_base_t::finalize()
|
|||
if (post->must_balance() && amt.commodity() == comm) {
|
||||
balance -= amt;
|
||||
post->cost = per_unit_cost * amt;
|
||||
post->add_flags(POST_PRICED);
|
||||
post->add_flags(POST_COST_CALCULATED);
|
||||
balance += *post->cost;
|
||||
|
||||
DEBUG("xact.finalize", "set post->cost to = " << *post->cost);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue