Month generation OK

This commit is contained in:
2010-06-23 20:30:42 +02:00
parent 7d1f9ee120
commit 271b3ef1e7
4 changed files with 21 additions and 16 deletions

View File

@@ -223,10 +223,10 @@ void AccountPanel::LoadYear(int year, bool showMonth)
{
User* user = _kiss->GetUser();
int curMonth = -1;
std::map<unsigned int, std::vector<operation> >::iterator it;
wxDateTime curDate;
wxTreeItemId parentNode, curMonthNode;
//std::map<int, std::vector<int> > Database::GetAllOperations(User* user)
std::map<int, std::vector<int> > ops ;
std::vector<int>::iterator it;
if (user->_operations[year])
{
@@ -237,19 +237,20 @@ void AccountPanel::LoadYear(int year, bool showMonth)
_curYear = year ;
_kiss->LoadYear(year);
ops = _kiss->GetAllOperations();
curDate.SetToCurrent();
parentNode = _tree.GetSelection();
for (it = user->_operations[year]->begin(); it != user->_operations[year]->end(); it++)
for (it = ops[year].begin(); it != ops[year].end(); it++)
{
if (curMonth == -1 || (year == curDate.GetYear() && (int)it->first <= curDate.GetMonth()))
if (curMonth == -1 || (year == curDate.GetYear() && *it <= curDate.GetMonth()))
{
curMonth = it->first;
curMonthNode = _tree.AppendItem(parentNode, months[it->first]);
curMonth = *it;
curMonthNode = _tree.AppendItem(parentNode, months[*it]);
}
else
_tree.AppendItem(parentNode, months[it->first]);
_tree.AppendItem(parentNode, months[*it]);
}
_tree.Expand(parentNode);
@@ -945,7 +946,7 @@ void AccountPanel::GenerateMonth(int month, int year)
it != user->_operations[year]->end();
it++, i++)
{
if ((int)it->first >= month)
if ((int)it->first > month)
break;
}
years = _tree.InsertItem(years, i, monthString);

View File

@@ -65,15 +65,18 @@ GenerateDialog::GenerateDialog(KissCount* kiss, wxUI *parent, int month, int yea
{
if (_monthFrom->GetString(i) == months[month])
{
toSelect = i+1;
toSelect = i;
break;
}
}
}
_monthFrom->Select(toSelect);
}
OnYearFromChange(event);
else
{
_yearFrom->Select(0);
OnYearFromChange(event);
}
for(i=2000; i<=2050; i++)
_yearTo->Append(wxString::Format(_("%d"), i));
@@ -171,7 +174,7 @@ void GenerateDialog::OnOK(wxCommandEvent& event)
{
int monthFrom, yearFrom, monthTo, yearTo, i;
if (_yearFrom->GetString(_yearTo->GetCurrentSelection()) == _(""))
if (_yearFrom->GetString(_yearFrom->GetCurrentSelection()) == _(""))
{
monthFrom = -1;
yearFrom = -1;