Removed the --reconcilable option, since the pending flag is now being

used.
This commit is contained in:
John Wiegley 2005-02-20 01:07:58 +00:00
parent 57b470be97
commit ba8981a3f6
4 changed files with 8 additions and 28 deletions

View file

@ -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);

11
main.cc
View file

@ -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

View file

@ -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)

View file

@ -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);