diff options
author | John Wiegley <johnw@newartisans.com> | 2004-08-05 21:47:53 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2004-08-05 21:47:53 -0400 |
commit | 50f75e0a5c3ee31c2bcc1fcbd8da42e24ccf072f (patch) | |
tree | 1ebf3b1adf32c537b95cce4f3074cde2eebc7147 /valexpr.cc | |
parent | 7e87a0a0b1a8b76c44f4f678d8bfb5129ba6c5da (diff) | |
download | fork-ledger-50f75e0a5c3ee31c2bcc1fcbd8da42e24ccf072f.tar.gz fork-ledger-50f75e0a5c3ee31c2bcc1fcbd8da42e24ccf072f.tar.bz2 fork-ledger-50f75e0a5c3ee31c2bcc1fcbd8da42e24ccf072f.zip |
added support for account sorting
Diffstat (limited to 'valexpr.cc')
-rw-r--r-- | valexpr.cc | 42 |
1 files changed, 22 insertions, 20 deletions
@@ -116,34 +116,36 @@ void node_t::compute(balance_t& result, const details_t& details) const break; case BALANCE: - if (details.balance) { - result = details.balance->quantity; - if (details.xact) - result -= details.xact->amount; - else if (details.account) - result -= details.account->value.quantity; + if (details.xact) { + result = details.xact->total.quantity; + result -= details.xact->amount; + } + else if (details.account) { + result = details.account->total.quantity; + result -= details.account->value.quantity; } break; case COST_BALANCE: - if (details.balance) { - result = details.balance->cost; - if (details.xact) - result -= details.xact->cost; - else if (details.account) - result -= details.account->value.cost; + if (details.xact) { + result = details.xact->total.cost; + result -= details.xact->cost; + } + else if (details.account) { + result = details.account->total.cost; + result -= details.account->value.cost; } break; case TOTAL: - if (details.balance) - result = details.balance->quantity; + if (details.xact) + result = details.xact->total.quantity; else if (details.account) result = details.account->total.quantity; break; case COST_TOTAL: - if (details.balance) - result = details.balance->cost; + if (details.xact) + result = details.xact->total.cost; else if (details.account) result = details.account->total.cost; break; @@ -164,15 +166,15 @@ void node_t::compute(balance_t& result, const details_t& details) const break; case INDEX: - if (details.index) - result = *details.index + 1; + if (details.xact) + result = details.xact->index + 1; break; case F_ARITH_MEAN: - if (details.index) { + if (details.xact) { assert(left); left->compute(result, details); - result /= amount_t(*details.index + 1); + result /= amount_t(details.xact->index + 1); } break; |