Make code for virtual operation clearer in AccountPanel

This commit is contained in:
Grégory Soutadé 2017-09-12 20:57:22 +02:00
parent 6865b75da8
commit 53cf28e397
1 changed files with 7 additions and 7 deletions

View File

@ -520,7 +520,7 @@ void AccountPanel::UpdateStats()
std::map<int, int>* virtuals = 0;
Account account;
Operation op;
bool blocked_account ;
bool force_debit;
QString v;
QDate selectedDate;
QTextCharFormat textFormat;
@ -568,7 +568,7 @@ void AccountPanel::UpdateStats()
if (it->meta) continue;
op = *it;
blocked_account = false;
force_debit = false;
if ((mode == REAL_MODE || mode == CHECK_MODE) && op._virtual)
continue;
@ -585,7 +585,7 @@ void AccountPanel::UpdateStats()
// A Transfert on a blocked account must be considered as a debit
op.amount = -op.amount;
// op.transfert = 0;
blocked_account = true;
force_debit = true;
}
// else
// continue;
@ -604,19 +604,19 @@ void AccountPanel::UpdateStats()
}
else
{
if ((!op.transfert || account.blocked) && user->GetCategoryName(op.category) != _("Unknown"))
if ((!op.transfert || force_debit) && user->GetCategoryName(op.category) != _("Unknown"))
_categoriesValues[_categoriesIndexes[user->GetCategoryName(op.category)]] += -op.amount ;
if (!op.transfert || account.blocked)
if (!op.transfert || force_debit)
totalDebit += -op.amount;
if (day >= op.day)
{
if (!op.transfert || account.blocked)
if (!op.transfert || force_debit)
curDebit += -op.amount;
}
if (blocked_account)
if (force_debit)
op.amount = -op.amount;
}
finalAccountAmount[op.account] += op.amount;