summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2005-02-20 01:07:58 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 02:41:05 -0400
commitba8981a3f63ed945a6bd4bf6fe52057079d6dfd2 (patch)
tree7efccf8c32dda64a4b61ff996ba908550546825a
parent57b470be97f17a0c520e6bc89318b5006d1b1e7e (diff)
downloadfork-ledger-ba8981a3f63ed945a6bd4bf6fe52057079d6dfd2.tar.gz
fork-ledger-ba8981a3f63ed945a6bd4bf6fe52057079d6dfd2.tar.bz2
fork-ledger-ba8981a3f63ed945a6bd4bf6fe52057079d6dfd2.zip
Removed the --reconcilable option, since the pending flag is now being
used.
-rw-r--r--config.cc4
-rw-r--r--main.cc11
-rw-r--r--reconcile.cc15
-rw-r--r--reconcile.h6
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 = "<all>";
-} 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 == "<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);