Removed the --reconcilable option, since the pending flag is now being
used.
This commit is contained in:
parent
57b470be97
commit
ba8981a3f6
4 changed files with 8 additions and 28 deletions
|
|
@ -834,10 +834,6 @@ OPT_BEGIN(reconcile, ":") {
|
||||||
config.reconcile_balance = optarg;
|
config.reconcile_balance = optarg;
|
||||||
} OPT_END(reconcile);
|
} OPT_END(reconcile);
|
||||||
|
|
||||||
OPT_BEGIN(reconcilable, "") {
|
|
||||||
config.reconcile_balance = "<all>";
|
|
||||||
} OPT_END(reconcilable);
|
|
||||||
|
|
||||||
OPT_BEGIN(reconcile_date, ":") {
|
OPT_BEGIN(reconcile_date, ":") {
|
||||||
config.reconcile_date = optarg;
|
config.reconcile_date = optarg;
|
||||||
} OPT_END(reconcile_date);
|
} OPT_END(reconcile_date);
|
||||||
|
|
|
||||||
11
main.cc
11
main.cc
|
|
@ -99,20 +99,13 @@ chain_xact_handlers(const std::string& command,
|
||||||
// transactions which can be reconciled to a given balance
|
// transactions which can be reconciled to a given balance
|
||||||
// (calculated against the transactions which it receives).
|
// (calculated against the transactions which it receives).
|
||||||
if (! config.reconcile_balance.empty()) {
|
if (! config.reconcile_balance.empty()) {
|
||||||
bool reconcilable = false;
|
value_t target_balance(config.reconcile_balance);
|
||||||
value_t target_balance;
|
|
||||||
if (config.reconcile_balance == "<all>")
|
|
||||||
reconcilable = true;
|
|
||||||
else
|
|
||||||
target_balance = value_t(config.reconcile_balance);
|
|
||||||
|
|
||||||
time_t cutoff = now;
|
time_t cutoff = now;
|
||||||
if (! config.reconcile_date.empty())
|
if (! config.reconcile_date.empty())
|
||||||
parse_date(config.reconcile_date.c_str(), &cutoff);
|
parse_date(config.reconcile_date.c_str(), &cutoff);
|
||||||
|
|
||||||
ptrs.push_back(formatter =
|
ptrs.push_back(formatter =
|
||||||
new reconcile_transactions(formatter, target_balance,
|
new reconcile_transactions(formatter, target_balance,
|
||||||
cutoff, reconcilable));
|
cutoff));
|
||||||
}
|
}
|
||||||
|
|
||||||
// sort_transactions will sort all the transactions it sees, based
|
// sort_transactions will sort all the transactions it sees, based
|
||||||
|
|
|
||||||
15
reconcile.cc
15
reconcile.cc
|
|
@ -43,27 +43,20 @@ void reconcile_transactions::flush()
|
||||||
bool found_pending = false;
|
bool found_pending = false;
|
||||||
for (transactions_list::iterator x = xacts.begin();
|
for (transactions_list::iterator x = xacts.begin();
|
||||||
x != xacts.end();
|
x != xacts.end();
|
||||||
x++)
|
x++) {
|
||||||
if (! cutoff || std::difftime((*x)->entry->date, cutoff) < 0)
|
if (! cutoff || std::difftime((*x)->entry->date, cutoff) < 0) {
|
||||||
switch ((*x)->entry->state) {
|
switch ((*x)->entry->state) {
|
||||||
case entry_t::CLEARED:
|
case entry_t::CLEARED:
|
||||||
cleared_balance += (*x)->amount;
|
cleared_balance += (*x)->amount;
|
||||||
if (! found_pending)
|
break;
|
||||||
break;
|
|
||||||
// fall through...
|
|
||||||
case entry_t::UNCLEARED:
|
case entry_t::UNCLEARED:
|
||||||
case entry_t::PENDING:
|
case entry_t::PENDING:
|
||||||
pending_balance += (*x)->amount;
|
pending_balance += (*x)->amount;
|
||||||
if (all_pending)
|
|
||||||
found_pending = true;
|
|
||||||
*last_ptr = *x;
|
*last_ptr = *x;
|
||||||
last_ptr = xact_next_ptr(*x);
|
last_ptr = xact_next_ptr(*x);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (all_pending) {
|
|
||||||
push_to_handler(first);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cleared_balance.type >= value_t::BALANCE)
|
if (cleared_balance.type >= value_t::BALANCE)
|
||||||
|
|
|
||||||
|
|
@ -10,16 +10,14 @@ class reconcile_transactions : public item_handler<transaction_t>
|
||||||
{
|
{
|
||||||
value_t balance;
|
value_t balance;
|
||||||
time_t cutoff;
|
time_t cutoff;
|
||||||
bool all_pending;
|
|
||||||
|
|
||||||
transactions_list xacts;
|
transactions_list xacts;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
reconcile_transactions(item_handler<transaction_t> * handler,
|
reconcile_transactions(item_handler<transaction_t> * handler,
|
||||||
const value_t& _balance, const time_t _cutoff,
|
const value_t& _balance, const time_t _cutoff)
|
||||||
const bool _all_pending)
|
|
||||||
: item_handler<transaction_t>(handler),
|
: item_handler<transaction_t>(handler),
|
||||||
balance(_balance), cutoff(_cutoff), all_pending(_all_pending) {}
|
balance(_balance), cutoff(_cutoff) {}
|
||||||
|
|
||||||
void push_to_handler(transaction_t * first);
|
void push_to_handler(transaction_t * first);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue