Fix a bug with blocked account computation
This commit is contained in:
@@ -414,6 +414,7 @@ void AccountPanel::UpdateStats()
|
||||
std::map<wxString, double>* notChecked = NULL;
|
||||
Account account;
|
||||
Operation op;
|
||||
bool blocked_account ;
|
||||
|
||||
curCredit = curDebit = totalCredit = totalDebit = percents = 0.0;
|
||||
|
||||
@@ -438,6 +439,7 @@ void AccountPanel::UpdateStats()
|
||||
if (it->meta) continue;
|
||||
|
||||
op = *it;
|
||||
blocked_account = false;
|
||||
|
||||
// A credit on a blocked account must be considered as a debit
|
||||
if (op.transfert.Length() && op.amount > 0)
|
||||
@@ -448,11 +450,15 @@ void AccountPanel::UpdateStats()
|
||||
{
|
||||
op.amount = -op.amount;
|
||||
op.transfert = wxT("");
|
||||
blocked_account = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (op.amount >= 0)
|
||||
{
|
||||
if (!op.transfert.Length())
|
||||
totalCredit += op.amount;
|
||||
|
||||
if (day >= op.day)
|
||||
{
|
||||
if (!op.transfert.Length())
|
||||
@@ -460,8 +466,6 @@ void AccountPanel::UpdateStats()
|
||||
if (!checkMode || (checkMode && op.checked))
|
||||
curAccountAmount[op.account] += op.amount;
|
||||
}
|
||||
if (!op.transfert.Length())
|
||||
totalCredit += op.amount;
|
||||
if (!checkMode || (checkMode && op.checked))
|
||||
finalAccountAmount[op.account] += op.amount;
|
||||
}
|
||||
@@ -469,6 +473,13 @@ void AccountPanel::UpdateStats()
|
||||
{
|
||||
if (!op.transfert.Length())
|
||||
_categoriesValues[_categoriesIndexes[user->GetCategoryName(op.category)]] += -op.amount ;
|
||||
|
||||
if (!op.transfert.Length())
|
||||
totalDebit += -op.amount;
|
||||
|
||||
if (blocked_account)
|
||||
op.amount = -op.amount;
|
||||
|
||||
if (day >= op.day)
|
||||
{
|
||||
if (!op.transfert.Length())
|
||||
@@ -476,8 +487,6 @@ void AccountPanel::UpdateStats()
|
||||
if (!checkMode || (checkMode && op.checked))
|
||||
curAccountAmount[op.account] += op.amount;
|
||||
}
|
||||
if (!op.transfert.Length())
|
||||
totalDebit += -op.amount;
|
||||
if (!checkMode || (checkMode && op.checked))
|
||||
finalAccountAmount[op.account] += op.amount;
|
||||
}
|
||||
|
Reference in New Issue
Block a user