diff options
author | John Wiegley <johnw@newartisans.com> | 2004-08-07 21:03:25 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2004-08-07 21:03:25 -0400 |
commit | c6c0179545b4572b7abf46957abd453022f9e213 (patch) | |
tree | f830c5f6ea7113551ff3372870fb2d7f5481d92d /valexpr.cc | |
parent | 5db1e1165b05ae56e0348a4634144072dfcace1f (diff) | |
download | fork-ledger-c6c0179545b4572b7abf46957abd453022f9e213.tar.gz fork-ledger-c6c0179545b4572b7abf46957abd453022f9e213.tar.bz2 fork-ledger-c6c0179545b4572b7abf46957abd453022f9e213.zip |
got more reports working again
Diffstat (limited to 'valexpr.cc')
-rw-r--r-- | valexpr.cc | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -153,6 +153,8 @@ void node_t::compute(balance_t& result, const details_t& details) const case DATE: if (details.entry) result = (unsigned int) details.entry->date; + else + result = (unsigned int) std::time(NULL); break; case CLEARED: @@ -207,12 +209,20 @@ void node_t::compute(balance_t& result, const details_t& details) const left->compute(result, details); std::time_t moment = -1; - if (right && details.entry) { + if (right) { switch (right->type) { - case DATE: moment = details.entry->date; break; + case DATE: + if (details.entry) + moment = details.entry->date; + else + moment = std::time(NULL); + break; + default: - throw compute_error("Invalid date passed to P(v,d)"); + throw compute_error("Invalid date passed to P(value,date)"); } + } else { + moment = std::time(NULL); } result = result.value(moment); break; |