diff options
-rw-r--r-- | config.cc | 4 | ||||
-rw-r--r-- | main.cc | 11 | ||||
-rw-r--r-- | reconcile.cc | 15 | ||||
-rw-r--r-- | reconcile.h | 6 |
4 files changed, 8 insertions, 28 deletions
@@ -834,10 +834,6 @@ OPT_BEGIN(reconcile, ":") { config.reconcile_balance = optarg; } OPT_END(reconcile); -OPT_BEGIN(reconcilable, "") { - config.reconcile_balance = "<all>"; -} OPT_END(reconcilable); - OPT_BEGIN(reconcile_date, ":") { config.reconcile_date = optarg; } OPT_END(reconcile_date); @@ -99,20 +99,13 @@ chain_xact_handlers(const std::string& command, // transactions which can be reconciled to a given balance // (calculated against the transactions which it receives). if (! config.reconcile_balance.empty()) { - bool reconcilable = false; - value_t target_balance; - if (config.reconcile_balance == "<all>") - reconcilable = true; - else - target_balance = value_t(config.reconcile_balance); - + value_t target_balance(config.reconcile_balance); time_t cutoff = now; if (! config.reconcile_date.empty()) parse_date(config.reconcile_date.c_str(), &cutoff); - ptrs.push_back(formatter = new reconcile_transactions(formatter, target_balance, - cutoff, reconcilable)); + cutoff)); } // sort_transactions will sort all the transactions it sees, based diff --git a/reconcile.cc b/reconcile.cc index e87f2277..ac2b7665 100644 --- a/reconcile.cc +++ b/reconcile.cc @@ -43,27 +43,20 @@ void reconcile_transactions::flush() bool found_pending = false; for (transactions_list::iterator x = xacts.begin(); x != xacts.end(); - x++) - if (! cutoff || std::difftime((*x)->entry->date, cutoff) < 0) + x++) { + if (! cutoff || std::difftime((*x)->entry->date, cutoff) < 0) { switch ((*x)->entry->state) { case entry_t::CLEARED: cleared_balance += (*x)->amount; - if (! found_pending) - break; - // fall through... + break; case entry_t::UNCLEARED: case entry_t::PENDING: pending_balance += (*x)->amount; - if (all_pending) - found_pending = true; *last_ptr = *x; last_ptr = xact_next_ptr(*x); break; } - - if (all_pending) { - push_to_handler(first); - return; + } } if (cleared_balance.type >= value_t::BALANCE) diff --git a/reconcile.h b/reconcile.h index 18e690c7..c49ed205 100644 --- a/reconcile.h +++ b/reconcile.h @@ -10,16 +10,14 @@ class reconcile_transactions : public item_handler<transaction_t> { value_t balance; time_t cutoff; - bool all_pending; transactions_list xacts; public: reconcile_transactions(item_handler<transaction_t> * handler, - const value_t& _balance, const time_t _cutoff, - const bool _all_pending) + const value_t& _balance, const time_t _cutoff) : item_handler<transaction_t>(handler), - balance(_balance), cutoff(_cutoff), all_pending(_all_pending) {} + balance(_balance), cutoff(_cutoff) {} void push_to_handler(transaction_t * first); |