Add checked/not checked criteria into search

This commit is contained in:
2010-12-01 20:30:34 +01:00
parent 765483ff15
commit 84bd6d8b42
7 changed files with 44 additions and 22 deletions

View File

@@ -73,8 +73,9 @@ SearchPanel::SearchPanel(KissCount* kiss, wxUI *parent) : wxScrolledWindow(&(*pa
for(categoryIt = user->_categories.begin(); categoryIt != user->_categories.end(); categoryIt++)
_category->Append(categoryIt->name);
wxString fixop[] = {_("Both"), _("Fix"), _("Non fix")};
_fix = new wxRadioBox(this, wxID_ANY, _("Operations"), wxDefaultPosition, wxDefaultSize, 3, fixop);
wxString stypes[] = {_("Fix"), _("Non fix"), _("Checked"), _("Not checked")};
_optype = new wxCheckListBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 4, stypes);
_optype->Check(0); _optype->Check(1); _optype->Check(2); _optype->Check(3);
_account = new wxCheckListBox(this, wxID_ANY);
for(accountIt = user->_accounts.begin(); accountIt != user->_accounts.end(); accountIt++)
@@ -100,7 +101,7 @@ SearchPanel::SearchPanel(KissCount* kiss, wxUI *parent) : wxScrolledWindow(&(*pa
gridBagSizer->Add(_amountTo, wxGBPosition(1, 4));
gridBagSizer->Add(labelCategory, wxGBPosition(0, 5));
gridBagSizer->Add(_category, wxGBPosition(1, 5));
gridBagSizer->Add(_fix, wxGBPosition(1, 6));
gridBagSizer->Add(_optype, wxGBPosition(1, 6));
gridBagSizer->Add(labelAccount, wxGBPosition(0, 7));
gridBagSizer->Add(_account, wxGBPosition(1, 7));
gridBagSizer->Add(_searchButton, wxGBPosition(2, 0));
@@ -131,7 +132,7 @@ void SearchPanel::OnButtonSearch(wxCommandEvent& event)
std::vector<wxString> categories, accounts;
wxDateTime *dateFrom=NULL, *dateTo=NULL;
User* user= _kiss->GetUser();
int i, fix;
int i, types=0;
std::vector<Operation>::iterator it;
double af, at;
@@ -207,7 +208,10 @@ void SearchPanel::OnButtonSearch(wxCommandEvent& event)
if (_category->IsChecked(i))
categories.push_back(user->_categories[i].id);
fix = _fix->GetSelection();
types |= (_optype->IsChecked(0)) ? FIX_OP : 0;
types |= (_optype->IsChecked(1)) ? NON_FIX_OP : 0;
types |= (_optype->IsChecked(2)) ? CHECKED_OP : 0;
types |= (_optype->IsChecked(3)) ? NOT_CHECKED_OP : 0;
for(i=0; i<user->GetAccountsNumber(); i++)
if (_account->IsChecked(i))
@@ -216,7 +220,7 @@ void SearchPanel::OnButtonSearch(wxCommandEvent& event)
if (_operations)
delete _operations;
_operations = _kiss->Search(description, dateFrom, dateTo, amountFrom, amountTo, categories,fix, accounts);
_operations = _kiss->Search(description, dateFrom, dateTo, amountFrom, amountTo, categories,types, accounts);
if (_operations->size() > 1)
wxMessageBox(wxString::Format(wxT("%d"), _operations->size()) + _(" entries found"), wxT("KissCount"), wxICON_INFORMATION | wxOK);

View File

@@ -58,8 +58,7 @@ private:
GridAccount *_grid;
wxCheckBox *_checkDateFrom, *_checkDateTo;
wxTextCtrl* _description, *_amountFrom, *_amountTo;
wxCheckListBox* _category, *_account;
wxRadioBox* _fix;
wxCheckListBox* _category, *_account, *_optype;
wxButton* _searchButton;
DECLARE_EVENT_TABLE();
};