Fix a bug: current account value is badly computed if operations are not in date order

This commit is contained in:
Grégory Soutadé 2018-08-26 18:10:46 +02:00
parent 38770639be
commit f1de45d08a
1 changed files with 6 additions and 11 deletions

View File

@ -623,11 +623,9 @@ void AccountPanel::UpdateStats()
if (op.amount >= 0)
{
if (!op.transfert && !account.blocked)
totalCredit += op.amount;
if (day >= op.day)
{
if (!op.transfert && !account.blocked)
totalCredit += op.amount;
if (day >= op.day)
curCredit += op.amount;
}
}
@ -637,11 +635,9 @@ void AccountPanel::UpdateStats()
_categoriesValues[_categoriesIndexes[user->GetCategoryName(op.category)]] += -op.amount ;
if (!op.transfert || force_debit)
totalDebit += -op.amount;
if (day >= op.day)
{
if (!op.transfert || force_debit)
totalDebit += -op.amount;
if (day >= op.day)
curDebit += -op.amount;
}
@ -649,9 +645,8 @@ void AccountPanel::UpdateStats()
op.amount = -op.amount;
}
finalAccountAmount[op.account] += op.amount;
curAccountAmounts[op.day][op.account] += op.amount;
for(i=op.day+1; i<nbDays; i++)
curAccountAmounts[i][op.account] = curAccountAmounts[op.day][op.account];
for(i=op.day; i<nbDays; i++)
curAccountAmounts[i][op.account] += op.amount;
}
if (mode != CHECK_MODE)