Show stats for current month even if next month has not been generated
Bug : Update all panels after generating/deleting month
This commit is contained in:
@@ -174,6 +174,7 @@ void StatsPanel::UpdateStats(int monthFrom, int yearFrom, int monthTo, int yearT
|
||||
wxString value;
|
||||
User* user = _kiss->GetUser();
|
||||
wxDateTime date;
|
||||
bool failed;
|
||||
|
||||
if (_chart)
|
||||
{
|
||||
@@ -256,18 +257,36 @@ void StatsPanel::UpdateStats(int monthFrom, int yearFrom, int monthTo, int yearT
|
||||
}
|
||||
|
||||
size = accountAmounts[accountIt->id].size();
|
||||
amounts = new double[size*12*2];
|
||||
amounts = new double[size*13*2];
|
||||
size = 0;
|
||||
for(a = 0, accountYearIt = accountAmounts[accountIt->id].begin();
|
||||
accountYearIt != accountAmounts[accountIt->id].end();
|
||||
accountYearIt++, a++)
|
||||
{
|
||||
for(b = 0; b<12; b++)
|
||||
for(b = 0; b<=12; b++)
|
||||
{
|
||||
if (!accountAmounts[accountIt->id][accountYearIt->first].count(b))
|
||||
continue;
|
||||
amounts[size*2+0] = a*12+b;
|
||||
amounts[size*2+1] = accountAmounts[accountIt->id][accountYearIt->first][b];
|
||||
if (!accountAmounts[accountIt->id][accountYearIt->first].count(b))
|
||||
{
|
||||
/*
|
||||
If previously afiled, continue to avoid to set
|
||||
account to 0 (only for display)
|
||||
*/
|
||||
if (!b || failed) continue;
|
||||
/*
|
||||
Compute cur month value (if there are operations)
|
||||
as next month value
|
||||
*/
|
||||
amounts[size*2+1] =
|
||||
accountAmounts[accountIt->id][accountYearIt->first][b-1]
|
||||
+ _kiss->CalcAccountAmount(accountIt->id, b-1, accountYearIt->first, NULL);
|
||||
failed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
amounts[size*2+1] = accountAmounts[accountIt->id][accountYearIt->first][b];
|
||||
failed = false;
|
||||
}
|
||||
size++;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user