From ba8981a3f63ed945a6bd4bf6fe52057079d6dfd2 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sun, 20 Feb 2005 01:07:58 +0000 Subject: Removed the --reconcilable option, since the pending flag is now being used. --- config.cc | 4 ---- main.cc | 11 ++--------- reconcile.cc | 15 ++++----------- reconcile.h | 6 ++---- 4 files changed, 8 insertions(+), 28 deletions(-) diff --git a/config.cc b/config.cc index 437f90e0..00d800be 100644 --- a/config.cc +++ b/config.cc @@ -834,10 +834,6 @@ OPT_BEGIN(reconcile, ":") { config.reconcile_balance = optarg; } OPT_END(reconcile); -OPT_BEGIN(reconcilable, "") { - config.reconcile_balance = ""; -} OPT_END(reconcilable); - OPT_BEGIN(reconcile_date, ":") { config.reconcile_date = optarg; } OPT_END(reconcile_date); diff --git a/main.cc b/main.cc index bbfbdfab..bf0d302a 100644 --- a/main.cc +++ b/main.cc @@ -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 == "") - 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 { value_t balance; time_t cutoff; - bool all_pending; transactions_list xacts; public: reconcile_transactions(item_handler * handler, - const value_t& _balance, const time_t _cutoff, - const bool _all_pending) + const value_t& _balance, const time_t _cutoff) : item_handler(handler), - balance(_balance), cutoff(_cutoff), all_pending(_all_pending) {} + balance(_balance), cutoff(_cutoff) {} void push_to_handler(transaction_t * first); -- cgit v1.2.3