diff options
author | John Wiegley <johnw@newartisans.com> | 2009-02-27 03:49:59 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-02-27 03:49:59 -0400 |
commit | 645e43ef75b1af78ef6a4013684d76fd7d6e7118 (patch) | |
tree | cd68d1857a366cc9662c8be7c838bb9414a6d0a7 | |
parent | f1795e628b0027aed2dc344c757167887c337bc1 (diff) | |
download | fork-ledger-645e43ef75b1af78ef6a4013684d76fd7d6e7118.tar.gz fork-ledger-645e43ef75b1af78ef6a4013684d76fd7d6e7118.tar.bz2 fork-ledger-645e43ef75b1af78ef6a4013684d76fd7d6e7118.zip |
The print command now prints xact's effective date
-rw-r--r-- | src/item.cc | 7 | ||||
-rw-r--r-- | src/report.h | 2 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/item.cc b/src/item.cc index 93aba0b3..028d230e 100644 --- a/src/item.cc +++ b/src/item.cc @@ -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': diff --git a/src/report.h b/src/report.h index f92cb236..74a49052 100644 --- a/src/report.h +++ b/src/report.h @@ -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 ? \"! \" : \"\")) : \"\")" |