Generate & delete month/year OK

This commit is contained in:
2010-06-24 21:02:42 +02:00
parent 271b3ef1e7
commit e72e36f27d
6 changed files with 133 additions and 11 deletions

View File

@@ -84,6 +84,19 @@ void KissCount::DeleteOperation(struct operation op)
_db->DeleteOperation(op);
}
void KissCount::DeleteOperations(int month, int year)
{
_db->DeleteOperations(_user, month, year);
if (month != -1)
(*_user->_operations[year]).erase(month);
if (month == -1 || !_user->_operations[year]->size())
{
delete _user->_operations[year];
_user->_operations.erase(year);
}
}
void KissCount::SetAccountAmount(int month, int year, wxString accountId, double amount)
{
_db->SetAccountAmount(month, year, accountId, amount);
@@ -149,10 +162,14 @@ void KissCount::GenerateMonth(int monthFrom, int yearFrom, int monthTo, int year
operation op;
_db->GenerateMonth(_user, monthFrom, yearFrom, monthTo, yearTo);
if (!_user->_operations[yearTo])
_user->_operations[yearTo] = new std::map<unsigned int, std::vector<operation> >();
if (monthFrom != -1 && yearFrom != -1)
{
LoadYear(yearFrom, false);
for(it = (*_user->_operations[yearFrom])[monthFrom].begin();
it != (*_user->_operations[yearFrom])[monthFrom].end()
&& it->fix_cost;

View File

@@ -25,6 +25,7 @@ class KissCount
wxString AddOperation(struct operation op);
void UpdateOperation(struct operation op);
void DeleteOperation(struct operation op);
void DeleteOperations(int month, int year);
double GetAccountAmount(wxString id, int month, int year);
void SetAccountAmount(int month, int year, wxString accountId, double value);