Fix some bugs and resize images

This commit is contained in:
2010-07-01 21:13:14 +02:00
parent 1d1164ef02
commit 7bdf6bd1e4
6 changed files with 26 additions and 13 deletions

View File

@@ -355,8 +355,6 @@ void AccountPanel::ShowMonth(int month, int year)
InitAccountsGrid(user, month, year);
UpdateStats();
_calendar->EnableMonthChange(true);
_calendar->EnableYearChange(true);
if (curDate.GetMonth() == month && curDate.GetYear() == year)
@@ -370,6 +368,8 @@ void AccountPanel::ShowMonth(int month, int year)
_calendar->EnableYearChange(false);
_calendar->SetSize(_calendar->GetMinSize());
UpdateStats();
// Fit();
// SetMinSize(GetSize());
}
@@ -489,8 +489,8 @@ void AccountPanel::InitAccountsGrid(User* user, int month, int year)
_accountsGrid->SetCellValue(curLine, ACCOUNT_NUMBER, it->number);
_accountsGrid->SetCellValue(curLine, ACCOUNT_NAME, it->name);
value = _kiss->GetAccountAmount(it->id, month, year);
_accountsGrid->SetCellValue(curLine, ACCOUNT_INIT, wxString::Format(wxT("%.2lf"), value));
_accountsGrid->SetCellEditor(curLine, ACCOUNT_INIT, new wxGridCellFloatEditor(-1, 2));
_accountsGrid->SetCellValue(curLine, ACCOUNT_INIT, wxString::Format(wxT("%.2lf"), value));
for (a=0; a<NUMBER_COLS_ACCOUNTS; a++)
_accountsGrid->SetReadOnly(curLine, a, a != ACCOUNT_INIT);
_accountsGrid->SetCellFont(curLine, ACCOUNT_CUR, font);
@@ -510,18 +510,13 @@ void AccountPanel::UpdateStats()
User* user = _kiss->GetUser();
std::vector<operation>::iterator it;
double curCredit, curDebit, totalCredit, totalDebit, remains, value;
wxDateTime date;
std::map<wxString, double> curAccountAmount, finalAccountAmount;
std::map<wxString, double>::iterator doubleIt;
std::map<wxString, int>::iterator intIt;
std::vector<Account>::iterator accountIt;
unsigned int day, month, year ;
date = _calendar->GetDate();
day = date.GetDay()-1;
month = date.GetMonth();
year = date.GetYear();
unsigned int day;
day = _calendar->GetDate().GetDay()-1;
curCredit = curDebit = totalCredit = totalDebit = 0.0;
for (i=0; i<user->GetCategoriesNumber(); i++)
@@ -537,7 +532,7 @@ void AccountPanel::UpdateStats()
{
if (it->amount > 0)
{
if (day >= it->day && month >= it->month && year >= it->year)
if (day >= it->day)
{
curCredit += it->amount;
curAccountAmount[it->account] += it->amount;
@@ -548,7 +543,7 @@ void AccountPanel::UpdateStats()
else
{
_categoriesValues[_categoriesIndexes[user->GetCategoryName(it->category)]] += -it->amount ;
if (day >= it->day && month >= it->month && year >= it->year)
if (day >= it->day)
{
curDebit += -it->amount;
curAccountAmount[it->account] += it->amount;