diff options
-rw-r--r-- | src/account.cc | 2 | ||||
-rw-r--r-- | src/filters.cc | 4 | ||||
-rw-r--r-- | src/output.cc | 4 | ||||
-rw-r--r-- | src/post.cc | 10 | ||||
-rw-r--r-- | src/post.h | 2 | ||||
-rw-r--r-- | src/report.h | 5 |
6 files changed, 19 insertions, 8 deletions
diff --git a/src/account.cc b/src/account.cc index ceeb1c12..3e0ad086 100644 --- a/src/account.cc +++ b/src/account.cc @@ -626,7 +626,7 @@ void account_t::xdata_t::details_t::update(post_t& post, if (gather_all) { accounts_referenced.insert(post.account->fullname()); - payees_referenced.insert(post.xact->payee); + payees_referenced.insert(post.payee()); } } diff --git a/src/filters.cc b/src/filters.cc index 03baadc6..f60ce062 100644 --- a/src/filters.cc +++ b/src/filters.cc @@ -1042,10 +1042,10 @@ void by_payee_posts::flush() void by_payee_posts::operator()(post_t& post) { - payee_subtotals_map::iterator i = payee_subtotals.find(post.xact->payee); + payee_subtotals_map::iterator i = payee_subtotals.find(post.payee()); if (i == payee_subtotals.end()) { payee_subtotals_pair - temp(post.xact->payee, + temp(post.payee(), shared_ptr<subtotal_posts>(new subtotal_posts(handler, amount_expr))); std::pair<payee_subtotals_map::iterator, bool> result = payee_subtotals.insert(temp); diff --git a/src/output.cc b/src/output.cc index de0444cf..cc4845a3 100644 --- a/src/output.cc +++ b/src/output.cc @@ -313,9 +313,9 @@ void report_payees::flush() void report_payees::operator()(post_t& post) { - std::map<string, std::size_t>::iterator i = payees.find(post.xact->payee); + std::map<string, std::size_t>::iterator i = payees.find(post.payee()); if (i == payees.end()) - payees.insert(payees_pair(post.xact->payee, 1)); + payees.insert(payees_pair(post.payee(), 1)); else (*i).second++; } diff --git a/src/post.cc b/src/post.cc index 675749fc..7c42e3c5 100644 --- a/src/post.cc +++ b/src/post.cc @@ -123,6 +123,14 @@ optional<date_t> post_t::effective_date() const return date; } +string post_t::payee() const +{ + if (optional<value_t> post_payee = get_tag(_("Payee"))) + return post_payee->as_string(); + else + return xact->payee; +} + namespace { value_t get_this(post_t& post) { return scope_value(&post); @@ -160,7 +168,7 @@ namespace { } value_t get_payee(post_t& post) { - return string_value(post.xact->payee); + return string_value(post.payee()); } value_t get_note(post_t& post) { @@ -112,6 +112,8 @@ public: virtual date_t actual_date() const; virtual optional<date_t> effective_date() const; + string payee() const; + bool must_balance() const { return ! has_flags(POST_VIRTUAL) || has_flags(POST_MUST_BALANCE); } diff --git a/src/report.h b/src/report.h index eff375cc..a453d351 100644 --- a/src/report.h +++ b/src/report.h @@ -816,8 +816,9 @@ public: " %(justify(scrub(display_total), total_width, " " 4 + meta_width + date_width + payee_width + account_width" " + amount_width + total_width + prepend_width, true, color))\n%/" - "%(justify(\" \", 2 + date_width + payee_width))" - "%$3 %$4 %$5\n"); + "%(justify(\" \", date_width))" + " %(justify((has_tag(\"Payee\") ? payee : \" \"), payee_width))" + " %$3 %$4 %$5\n"); }); OPTION(report_t, related); // -r |