Fix two bugs (No entry in Search Panel and Date in Search (Database))
Add auto detection for account and category using description Auto add date with curMonth & curYear for new operation
This commit is contained in:
@@ -294,3 +294,36 @@ std::vector<Operation>* KissCount::Search(wxString* description, wxDateTime* dat
|
||||
|
||||
return _db->Search(_user, description, dateFrom, dateTo, amountFrom, amountTo, categories, accounts);
|
||||
}
|
||||
|
||||
bool KissCount::SearchPreviousOperation(Operation* res, wxString& description, int month, int year)
|
||||
{
|
||||
std::vector<Operation>* operations;
|
||||
wxDateTime* date ;
|
||||
//wxDateSpan threeMonths(0, 3); Not working :(
|
||||
std::vector<wxString> v;
|
||||
|
||||
month -= 3;
|
||||
if (month < 0)
|
||||
{
|
||||
year -= 1;
|
||||
month += 12;
|
||||
}
|
||||
|
||||
date = new wxDateTime(0, (wxDateTime::Month)month, year);
|
||||
|
||||
operations = Search(&description, date, NULL, NULL, NULL, v, v);
|
||||
|
||||
delete date;
|
||||
|
||||
if (!operations->size())
|
||||
{
|
||||
delete operations;
|
||||
return false;
|
||||
}
|
||||
|
||||
*res = (*operations)[operations->size()-1];
|
||||
|
||||
delete operations;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -70,6 +70,8 @@ class KissCount
|
||||
std::vector<Operation>* Search(wxString* description, wxDateTime* dateFrom, wxDateTime* dateTo,
|
||||
wxString* amountFrom, wxString* amountTo,
|
||||
std::vector<wxString> categories, std::vector<wxString> accounts);
|
||||
|
||||
bool SearchPreviousOperation(Operation* res, wxString& description, int month, int year);
|
||||
private:
|
||||
wxUI* _wxUI;
|
||||
Database* _db;
|
||||
|
||||
Reference in New Issue
Block a user