summaryrefslogtreecommitdiff
path: root/valexpr.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2004-08-09 17:32:20 -0400
committerJohn Wiegley <johnw@newartisans.com>2004-08-09 17:32:20 -0400
commit05b2cc46fdf6accd2ecbdc3c1ce86829bc7bfa68 (patch)
treeab61a5efdcdfe7bb73f346da5e45ac228d6458c0 /valexpr.cc
parent2dc822291f3ecef34eb0ef2920c395b0e056fbda (diff)
downloadfork-ledger-05b2cc46fdf6accd2ecbdc3c1ce86829bc7bfa68.tar.gz
fork-ledger-05b2cc46fdf6accd2ecbdc3c1ce86829bc7bfa68.tar.bz2
fork-ledger-05b2cc46fdf6accd2ecbdc3c1ce86829bc7bfa68.zip
fixed account display bug
Diffstat (limited to 'valexpr.cc')
-rw-r--r--valexpr.cc34
1 files changed, 31 insertions, 3 deletions
diff --git a/valexpr.cc b/valexpr.cc
index 6a3ccde7..15aa69f8 100644
--- a/valexpr.cc
+++ b/valexpr.cc
@@ -158,18 +158,46 @@ void node_t::compute(balance_t& result, const details_t& details) const
break;
case CLEARED:
- if (details.entry)
+ if (details.entry) {
result = details.entry->state == entry_t::CLEARED;
+ }
+ else if (details.account) {
+ bool all_clear = true;
+ for (transactions_list::const_iterator i
+ = details.account->transactions.begin();
+ i != details.account->transactions.end();
+ i++)
+ if ((*i)->entry->state != entry_t::CLEARED) {
+ all_clear = false;
+ break;
+ }
+ result = all_clear;
+ }
break;
case REAL:
- if (details.xact)
+ if (details.xact) {
result = ! (details.xact->flags & TRANSACTION_VIRTUAL);
+ }
+ else if (details.account) {
+ bool all_real = true;
+ for (transactions_list::const_iterator i
+ = details.account->transactions.begin();
+ i != details.account->transactions.end();
+ i++)
+ if ((*i)->flags & TRANSACTION_VIRTUAL) {
+ all_real = false;
+ break;
+ }
+ result = all_real;
+ }
break;
case INDEX:
if (details.xact)
result = details.xact->index + 1;
+ else if (details.account)
+ result = details.account->depth - 1;
break;
case F_ARITH_MEAN:
@@ -359,7 +387,7 @@ node_t * parse_term(std::istream& in)
case 'd': node = new node_t(node_t::DATE); break;
case 'X': node = new node_t(node_t::CLEARED); break;
case 'R': node = new node_t(node_t::REAL); break;
- case 'i': node = new node_t(node_t::INDEX); break;
+ case 'n': node = new node_t(node_t::INDEX); break;
case 'B': node = new node_t(node_t::BALANCE); break;
case 'T': node = new node_t(node_t::TOTAL); break;
case 'C': node = new node_t(node_t::COST_TOTAL); break;