KissCount

KissCount Commit Details

Date:2011-01-08 12:35:04 (8 years 9 months ago)
Author:Grégory Soutadé
Branch:dev, master, qt5
Commit:63ccfc7f9727e7aac48d6577a9217d9ec59deae2
Parents: b30604fffe1474e6946cfcf2e3eede03fd8d2b0a
Message:Merge of d71f055dfc1f9b9d8f3ad8bbb8048f2d2bab9522

Changes:
Msrc/model/User.h (1 diff)
Msrc/view/StatsPanel.cpp (6 diffs)

File differences

src/model/User.h
5151
5252
5353
54
5455
5556
5657
58
5759
5860
5961
62
6063
64
6165
66
6267
6368
6469
wxString GetCategoryName(wxString& catId);
wxString GetCategoryId(wxString& catName);
const wxFont GetCategoryFont(wxString& catId);
Account GetAccount(const wxString& accountId);
wxString GetAccountName(const wxString& accountId);
wxString GetAccountId(wxString& accountName);
int GetCategoriesNumber();
int GetAccountsNumber();
int GetOperationsNumber(int month, int year);
wxLanguage GetLanguage();
void LinkOrUnlinkOperation(Operation& op);
void Group(const Operation& op);
bool Group(std::vector<Operation>* ops, const Operation& op);
void UnGroup(const Operation& op);
src/view/StatsPanel.cpp
5454
5555
5656
57
58
57
58
5959
6060
61
62
6163
6264
6365
......
152154
153155
154156
155
157
156158
157
158159
159160
160
161
161162
162163
163164
......
193194
194195
195196
196
197
197
198
198199
199
200
200201
201202
202203
......
207208
208209
209210
210
211
211212
212213
213214
214
215
215216
216217
217218
......
234235
235236
236237
237
238
238
239
239240
240
241
241242
242243
243244
244245
245246
246
247
247248
248249
249
250
250
251
251252
252253
253254
254255
255
256
256257
257258
258
259
259260
260261
261262
262263
263264
264
265
265266
266267
267268
......
340341
341342
342343
343
344
344345
345346
346347
_yearTo->Append(wxString::Format(wxT("%d"), it->first));
}
_monthFrom->Select(0);
_monthTo->Select(11);
if (i) i--;
_yearFrom->Select(i);
_yearTo->Select(i);
_monthFrom->Select(0);
_monthTo->Select(11);
wxStaticText* label = new wxStaticText(this, wxID_ANY, _("From"));
hbox->Add(label);
std::map<wxString, std::map<int, std::map<int, double> > > accountAmounts;
std::map<wxString, double> categories;
std::map<wxString, std::vector<double> > operations;
std::map<wxString, std::vector<double> >::iterator accountIdIt2;
std::vector<Account>::iterator accountIt;
std::map<wxString, double>::iterator categoriesIt;
std::map<wxString, std::map<int, std::map<int, double> > >::iterator accountIdIt;
std::map<int, std::map<int, double> >::iterator accountYearIt;
double total;
int size, i, a, b, percents, account, nbDays;
int account, size, i, a, b, percents, nbDays;
double *amounts;
wxString value;
User* user = _kiss->GetUser();
dataset->AddSerie((double *) amounts, nbDays);
delete[] amounts;
for (account = 0, i = 0, accountIdIt2 = operations.begin(); accountIdIt2 != operations.end();
accountIdIt2++, i++, account++)
for (account = 0, i = 0, accountIt = user->_accounts.begin(); accountIt != user->_accounts.end();
account++, accountIt++, i++)
{
if (!((wxCheckListBox*)_account)->IsChecked(account))
if (!_account->IsChecked(account))
{
i-- ;
continue;
for (a=0; a<nbDays; a++)
{
amounts[a*2+0] = a;
amounts[a*2+1] = operations[accountIdIt2->first][a];
amounts[a*2+1] = operations[accountIt->id][a];
}
dataset->AddSerie((double *) amounts, nbDays);
// set serie names to be displayed on legend
dataset->SetSerieName(i+1, user->GetAccountName(accountIdIt2->first));
dataset->SetSerieName(i+1, user->GetAccountName(accountIt->id));
delete[] amounts;
}
}
dataset->AddSerie((double *) amounts, size);
delete[] amounts;
for (account = 0, i = 0, accountIdIt = accountAmounts.begin(); accountIdIt != accountAmounts.end();
accountIdIt++, i++, account++)
for (account = 0, i = 0, accountIt = user->_accounts.begin(); accountIt != user->_accounts.end();
account++, accountIt++, i++)
{
if (!((wxCheckListBox*)_account)->IsChecked(account))
if (!_account->IsChecked(account))
{
i-- ;
continue;
}
size = accountAmounts[accountIdIt->first].size();
size = accountAmounts[accountIt->id].size();
amounts = new double[size*12*2];
size = 0;
for(a = 0, accountYearIt = accountAmounts[accountIdIt->first].begin();
accountYearIt != accountAmounts[accountIdIt->first].end();
for(a = 0, accountYearIt = accountAmounts[accountIt->id].begin();
accountYearIt != accountAmounts[accountIt->id].end();
accountYearIt++, a++)
{
for(b = 0; b<12; b++)
{
if (!accountAmounts[accountIdIt->first][accountYearIt->first].count(b))
if (!accountAmounts[accountIt->id][accountYearIt->first].count(b))
continue;
amounts[size*2+0] = a*12+b;
amounts[size*2+1] = accountAmounts[accountIdIt->first][accountYearIt->first][b];
amounts[size*2+1] = accountAmounts[accountIt->id][accountYearIt->first][b];
size++;
}
}
dataset->AddSerie((double *) amounts, size);
// set serie names to be displayed on legend
dataset->SetSerieName(i+1, user->GetAccountName(accountIdIt->first));
dataset->SetSerieName(i+1, user->GetAccountName(accountIt->id));
delete[] amounts;
}
}
monthTo = _monthTo->GetCurrentSelection();
_yearTo->GetStringSelection().ToLong(&yearTo);
if (yearTo > yearFrom ||
if (yearTo < yearFrom ||
(yearFrom == yearTo && monthFrom > monthTo))
{
wxMessageBox(_("Invalide date range"), _("KissCount"), wxICON_ERROR | wxOK);

Archive Download the corresponding diff file