Fix a looooooooot of bugs
This commit is contained in:
@@ -161,6 +161,14 @@ wxString KissCount::AddAccount(Account& ac)
|
||||
return ac.id;
|
||||
}
|
||||
|
||||
bool sortAccounts(Account ac1, Account ac2)
|
||||
{
|
||||
if (ac1._default) return true;
|
||||
if (ac2._default) return false;
|
||||
|
||||
return (ac1.name.Cmp(ac2.name) < 0);
|
||||
}
|
||||
|
||||
void KissCount::UpdateAccount(Account& ac)
|
||||
{
|
||||
std::vector<Account>::iterator it;
|
||||
@@ -170,6 +178,9 @@ void KissCount::UpdateAccount(Account& ac)
|
||||
for (i=0, it=_user->_accounts.begin(); it !=_user->_accounts.end(); it++, i++)
|
||||
if (it->id == ac.id)
|
||||
_user->_accounts[i] = ac;
|
||||
|
||||
if (ac._default)
|
||||
std::sort(_user->_accounts.begin(), _user->_accounts.end(), sortAccounts);
|
||||
}
|
||||
|
||||
void KissCount::DeleteAccount(Account& ac)
|
||||
@@ -389,7 +400,7 @@ std::vector<Operation>* KissCount::Search(wxString* description, wxDateTime* dat
|
||||
return _db->Search(_user, description, dateFrom, dateTo, amountFrom, amountTo, categories, Fix, accounts, true);
|
||||
}
|
||||
|
||||
bool KissCount::SearchPreviousOperation(Operation* res, wxString& description, int month, int year)
|
||||
bool KissCount::SearchPreviousOperation(Operation* res, Operation& op, int month, int year)
|
||||
{
|
||||
std::vector<Operation>* operations;
|
||||
wxDateTime* date ;
|
||||
@@ -405,7 +416,7 @@ bool KissCount::SearchPreviousOperation(Operation* res, wxString& description, i
|
||||
|
||||
date = new wxDateTime(0, (wxDateTime::Month)month, year);
|
||||
|
||||
operations = _db->Search(_user, &description, date, NULL, NULL, NULL, v, BOTH, v, false);
|
||||
operations = _db->Search(_user, &op.description, date, NULL, NULL, NULL, v, op.fix_cost ? FIX_OP : NON_FIX_OP, v, false);
|
||||
|
||||
delete date;
|
||||
|
||||
|
@@ -84,7 +84,7 @@ public:
|
||||
wxString* amountFrom, wxString* amountTo,
|
||||
std::vector<wxString> categories, int Fix, std::vector<wxString> accounts);
|
||||
|
||||
bool SearchPreviousOperation(Operation* res, wxString& description, int month, int year);
|
||||
bool SearchPreviousOperation(Operation* res, Operation& op, int month, int year);
|
||||
|
||||
void GetStats(int monthFrom, int yearFrom, int monthTo, int yearTo,
|
||||
std::map<wxString, std::map<int, std::map<int, double> > >* accountAmounts,
|
||||
|
Reference in New Issue
Block a user