Fix a bug : Initial and final negative account values were not displayed in red

This commit is contained in:
Grégory Soutadé 2017-02-04 15:12:40 +01:00
parent 7003a4795d
commit f3a66790d0
3 changed files with 8 additions and 3 deletions

View File

@ -1,11 +1,12 @@
v0.7 (01/01/2017) v0.7 (04/02/2017)
** User ** ** User **
Set background calendar color to red or yellow when one account is negative or less than 200€ Set background calendar color to red or yellow when one account is negative or less than 200€ (not displayed on hidden and virtual account)
** Dev ** ** Dev **
** Bugs ** ** Bugs **
Bug in expression parser, negative mark before parenthesis considered as positive. Bug in expression parser, negative mark before parenthesis considered as positive.
Bug in FormulaDelegate : string copy was made in a wrong way Bug in FormulaDelegate : string copy was made in a wrong way
Initial and final negative account values were not displayed in red
v0.6 (08/10/2016) v0.6 (08/10/2016)
** User ** ** User **

View File

@ -704,11 +704,13 @@ void AccountPanel::UpdateStats()
if (mode == REAL_MODE) if (mode == REAL_MODE)
value -= (*virtuals)[accountIt->id]; value -= (*virtuals)[accountIt->id];
_accountsGrid->item(i, ACCOUNT_INIT)->setText(v.sprintf("%.2lf", (double)value/100)); _accountsGrid->item(i, ACCOUNT_INIT)->setText(v.sprintf("%.2lf", (double)value/100));
_accountsGrid->item(i, ACCOUNT_INIT)->setForeground((value >= 0) ? QBrush(Qt::black) : QBrush(Qt::red));
value = curAccountAmounts[day][accountIt->id]; value = curAccountAmounts[day][accountIt->id];
_accountsGrid->item(i, ACCOUNT_CUR)->setText(v.sprintf("%.2lf", (double)value/100)); _accountsGrid->item(i, ACCOUNT_CUR)->setText(v.sprintf("%.2lf", (double)value/100));
_accountsGrid->item(i, ACCOUNT_CUR)->setForeground((value >= 0) ? QBrush(Qt::black) : QBrush(Qt::red)); _accountsGrid->item(i, ACCOUNT_CUR)->setForeground((value >= 0) ? QBrush(Qt::black) : QBrush(Qt::red));
value = finalAccountAmount[accountIt->id]; value = finalAccountAmount[accountIt->id];
_accountsGrid->item(i, ACCOUNT_FINAL)->setText(v.sprintf("%.2lf", (double)value/100)); _accountsGrid->item(i, ACCOUNT_FINAL)->setText(v.sprintf("%.2lf", (double)value/100));
_accountsGrid->item(i, ACCOUNT_FINAL)->setForeground((value >= 0) ? QBrush(Qt::black) : QBrush(Qt::red));
} }
else else
{ {
@ -716,11 +718,13 @@ void AccountPanel::UpdateStats()
value2 = (*notChecked)[accountIt->id]; value2 = (*notChecked)[accountIt->id];
_accountsGrid->item(i, ACCOUNT_INIT)->setText(v.sprintf("%.2lf (%.2lf)", (double)value/100, (double)(value-value2)/100)); _accountsGrid->item(i, ACCOUNT_INIT)->setText(v.sprintf("%.2lf (%.2lf)", (double)value/100, (double)(value-value2)/100));
_accountsGrid->item(i, ACCOUNT_INIT)->setForeground((value >= 0) ? QBrush(Qt::black) : QBrush(Qt::red));
value = curAccountAmounts[day][accountIt->id]; value = curAccountAmounts[day][accountIt->id];
_accountsGrid->item(i, ACCOUNT_CUR)->setText(v.sprintf("%.2lf (%.2lf)", (double)value/100, (double)(value-value2)/100)); _accountsGrid->item(i, ACCOUNT_CUR)->setText(v.sprintf("%.2lf (%.2lf)", (double)value/100, (double)(value-value2)/100));
_accountsGrid->item(i, ACCOUNT_CUR)->setForeground((value >= 0) ? QBrush(Qt::black) : QBrush(Qt::red)); _accountsGrid->item(i, ACCOUNT_CUR)->setForeground((value >= 0) ? QBrush(Qt::black) : QBrush(Qt::red));
value = finalAccountAmount[accountIt->id]; value = finalAccountAmount[accountIt->id];
_accountsGrid->item(i, ACCOUNT_FINAL)->setText(v.sprintf("%.2lf (%.2lf)", (double)value/100, (double)(value-value2)/100)); _accountsGrid->item(i, ACCOUNT_FINAL)->setText(v.sprintf("%.2lf (%.2lf)", (double)value/100, (double)(value-value2)/100));
_accountsGrid->item(i, ACCOUNT_FINAL)->setForeground((value >= 0) ? QBrush(Qt::black) : QBrush(Qt::red));
} }
} }

View File

@ -315,7 +315,7 @@ void wxUI::ChangeUser()
void wxUI::OnButtonAbout() void wxUI::OnButtonAbout()
{ {
QMessageBox::information(0, "KissCount " APP_VERSION, _("Personal accounting software") + "\n\nhttp://indefero.soutade.fr/p/kisscount/\n\n" + _("Licenced under GNU GPL v3") + "\n\nCopyright (C) 2010-2015 Grégory Soutadé"); QMessageBox::information(0, "KissCount " APP_VERSION, _("Personal accounting software") + "\n\nhttp://indefero.soutade.fr/p/kisscount/\n\n" + _("Licenced under GNU GPL v3") + "\n\nCopyright (C) 2010-2017 Grégory Soutadé");
} }
void wxUI::OnButtonQuit() void wxUI::OnButtonQuit()