Make code for virtual operation clearer in AccountPanel
This commit is contained in:
parent
6865b75da8
commit
53cf28e397
|
@ -520,7 +520,7 @@ void AccountPanel::UpdateStats()
|
||||||
std::map<int, int>* virtuals = 0;
|
std::map<int, int>* virtuals = 0;
|
||||||
Account account;
|
Account account;
|
||||||
Operation op;
|
Operation op;
|
||||||
bool blocked_account ;
|
bool force_debit;
|
||||||
QString v;
|
QString v;
|
||||||
QDate selectedDate;
|
QDate selectedDate;
|
||||||
QTextCharFormat textFormat;
|
QTextCharFormat textFormat;
|
||||||
|
@ -568,7 +568,7 @@ void AccountPanel::UpdateStats()
|
||||||
if (it->meta) continue;
|
if (it->meta) continue;
|
||||||
|
|
||||||
op = *it;
|
op = *it;
|
||||||
blocked_account = false;
|
force_debit = false;
|
||||||
|
|
||||||
if ((mode == REAL_MODE || mode == CHECK_MODE) && op._virtual)
|
if ((mode == REAL_MODE || mode == CHECK_MODE) && op._virtual)
|
||||||
continue;
|
continue;
|
||||||
|
@ -585,7 +585,7 @@ void AccountPanel::UpdateStats()
|
||||||
// A Transfert on a blocked account must be considered as a debit
|
// A Transfert on a blocked account must be considered as a debit
|
||||||
op.amount = -op.amount;
|
op.amount = -op.amount;
|
||||||
// op.transfert = 0;
|
// op.transfert = 0;
|
||||||
blocked_account = true;
|
force_debit = true;
|
||||||
}
|
}
|
||||||
// else
|
// else
|
||||||
// continue;
|
// continue;
|
||||||
|
@ -604,19 +604,19 @@ void AccountPanel::UpdateStats()
|
||||||
}
|
}
|
||||||
else
|
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 ;
|
_categoriesValues[_categoriesIndexes[user->GetCategoryName(op.category)]] += -op.amount ;
|
||||||
|
|
||||||
if (!op.transfert || account.blocked)
|
if (!op.transfert || force_debit)
|
||||||
totalDebit += -op.amount;
|
totalDebit += -op.amount;
|
||||||
|
|
||||||
if (day >= op.day)
|
if (day >= op.day)
|
||||||
{
|
{
|
||||||
if (!op.transfert || account.blocked)
|
if (!op.transfert || force_debit)
|
||||||
curDebit += -op.amount;
|
curDebit += -op.amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blocked_account)
|
if (force_debit)
|
||||||
op.amount = -op.amount;
|
op.amount = -op.amount;
|
||||||
}
|
}
|
||||||
finalAccountAmount[op.account] += op.amount;
|
finalAccountAmount[op.account] += op.amount;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user