summaryrefslogtreecommitdiff
path: root/src/report.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-10-26 18:52:26 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-10-26 18:52:26 -0400
commit151a8d87ee299b54da262346471aa71a729a6eb2 (patch)
treee2151c34eb1a2756e5e4324465ebf629ef4859e6 /src/report.cc
parentd85a415bc5119d4271ca7355fe3e0ce3951c0d23 (diff)
downloadledger-151a8d87ee299b54da262346471aa71a729a6eb2.tar.gz
ledger-151a8d87ee299b54da262346471aa71a729a6eb2.tar.bz2
ledger-151a8d87ee299b54da262346471aa71a729a6eb2.zip
Fixed sorting in bal reports when --flat is used
Note that sorting on the "total" is not the same thing as sorting on the "display_total" when multiple commodities are in use and the -X flag is selected! One should always sort on display_total, since that's the value which is shown in the report. 'T' is a synonym for display_total.
Diffstat (limited to 'src/report.cc')
-rw-r--r--src/report.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/report.cc b/src/report.cc
index 34231b5c..b15d9974 100644
--- a/src/report.cc
+++ b/src/report.cc
@@ -81,11 +81,14 @@ void report_t::accounts_report(acct_handler_ptr handler)
true), walker);
scoped_ptr<accounts_iterator> iter;
- if (! HANDLED(sort_))
+ if (! HANDLED(sort_)) {
iter.reset(new basic_accounts_iterator(*session.master));
- else
- iter.reset(new sorted_accounts_iterator(HANDLER(sort_).str(),
- HANDLED(flat), *session.master.get()));
+ } else {
+ expr_t sort_expr(HANDLER(sort_).str());
+ sort_expr.set_context(this);
+ iter.reset(new sorted_accounts_iterator(*session.master.get(),
+ sort_expr, HANDLED(flat)));
+ }
if (HANDLED(display_))
pass_down_accounts(handler, *iter.get(),