The print command now prints xact's effective date

This commit is contained in:
John Wiegley 2009-02-27 03:49:59 -04:00
parent f1795e628b
commit 645e43ef75
2 changed files with 9 additions and 0 deletions

View file

@ -188,6 +188,11 @@ namespace {
value_t get_date(item_t& item) {
return item.date();
}
value_t get_effective_date(item_t& item) {
if (optional<date_t> effective = item.effective_date())
return *effective;
return NULL_VALUE;
}
value_t get_note(item_t& item) {
return string_value(item.note ? *item.note : empty_string);
}
@ -300,6 +305,8 @@ expr_t::ptr_op_t item_t::lookup(const string& name)
return WRAP_FUNCTOR(get_wrapper<&get_end_line>);
else if (name == "end_pos")
return WRAP_FUNCTOR(get_wrapper<&get_end_pos>);
else if (name == "effective_date")
return WRAP_FUNCTOR(get_wrapper<&get_effective_date>);
break;
case 'f':

View file

@ -510,6 +510,8 @@ public:
OPTION__(report_t, print_format_, CTOR(report_t, print_format_) {
on("%(format_date(xact.date, \"%Y/%m/%d\"))"
"%(!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 ? \"! \" : \"\")) : \"\")"