Don't print an xact's amount if it was calculated
That is, if the user didn't enter an amount for that transaction in their ledger journal, don't print one out either.
This commit is contained in:
parent
7a0e61f458
commit
b345a45c9b
2 changed files with 10 additions and 4 deletions
|
|
@ -64,11 +64,11 @@ report_t::report_t(session_t& _session)
|
|||
"%(entry.cleared ? \" *\" : (entry.pending ? \" !\" : \"\"))"
|
||||
"%(code ? \" (\" + code + \")\" : \"\") %(payee)%(entry.comment | \"\")\n"
|
||||
" %(entry.uncleared ? (cleared ? \"* \" : (pending ? \"! \" : \"\")) : \"\")"
|
||||
"%-34(account)"
|
||||
" %12(amount)%(comment | \"\")\n%/"
|
||||
"%-23(account)"
|
||||
" %12(calculated ? \"\" : amount)%(comment | \"\")\n%/"
|
||||
" %(entry.uncleared ? (cleared ? \"* \" : (pending ? \"! \" : \"\")) : \"\")"
|
||||
"%-34(account)"
|
||||
" %12(amount)%(comment | \"\")\n%/\n");
|
||||
"%-23(account)"
|
||||
" %12(calculated ? \"\" : amount)%(comment | \"\")\n%/\n");
|
||||
|
||||
HANDLER(balance_format_).on(
|
||||
"%20(print_balance(strip(display_total), 20))"
|
||||
|
|
|
|||
|
|
@ -76,6 +76,10 @@ namespace {
|
|||
return value_t(static_cast<scope_t *>(&xact));
|
||||
}
|
||||
|
||||
value_t get_is_calculated(xact_t& xact) {
|
||||
return xact.has_flags(XACT_CALCULATED);
|
||||
}
|
||||
|
||||
value_t get_entry(xact_t& xact) {
|
||||
return value_t(static_cast<scope_t *>(xact.entry));
|
||||
}
|
||||
|
|
@ -175,6 +179,8 @@ expr_t::ptr_op_t xact_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 == "calculated")
|
||||
return WRAP_FUNCTOR(get_wrapper<&get_is_calculated>);
|
||||
break;
|
||||
|
||||
case 'e':
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue