Tag management : first version
This commit is contained in:
@@ -251,6 +251,33 @@ void KissCount::DeleteCategory(Category& category, int replacement)
|
||||
LoadYear(it->first, true);
|
||||
}
|
||||
|
||||
int KissCount::AddTag(Tag& tag)
|
||||
{
|
||||
tag.id = _db->AddTag(_user, tag);
|
||||
_user->AddTag(tag);
|
||||
|
||||
return tag.id;
|
||||
}
|
||||
|
||||
void KissCount::UpdateTag(Tag& tag)
|
||||
{
|
||||
_db->UpdateTag(tag);
|
||||
_user->UpdateTag(tag);
|
||||
}
|
||||
|
||||
void KissCount::DeleteTag(Tag& tag, int replacement)
|
||||
{
|
||||
std::map<unsigned int, std::map<unsigned int, std::vector<Operation> >* >::iterator it;
|
||||
|
||||
_db->DeleteTag(_user, tag, replacement);
|
||||
_user->DeleteTag(tag);
|
||||
|
||||
for (it= _user->_operations.begin();
|
||||
it != _user->_operations.end();
|
||||
it++)
|
||||
LoadYear(it->first, true);
|
||||
}
|
||||
|
||||
std::map<int, std::vector<int> > KissCount::GetAllOperations()
|
||||
{
|
||||
return _db->GetAllOperations(_user);
|
||||
@@ -411,10 +438,11 @@ const QString& KissCount::GetOperationOrder()
|
||||
|
||||
std::vector<Operation>* KissCount::Search(QString* description, QDate* dateFrom, QDate* dateTo,
|
||||
int* amountFrom, int* amountTo,
|
||||
std::vector<int> categories, int types, std::vector<int> accounts)
|
||||
std::vector<int> categories,
|
||||
int types, std::vector<int> accounts, std::vector<int> tags)
|
||||
{
|
||||
|
||||
return _db->Search(_user, description, dateFrom, dateTo, amountFrom, amountTo, categories, types, accounts, true);
|
||||
return _db->Search(_user, description, dateFrom, dateTo, amountFrom, amountTo, categories, types, accounts, true, tags);
|
||||
}
|
||||
|
||||
bool KissCount::SearchPreviousOperation(Operation* res, Operation& op, int month, int year, bool limitToType, int index)
|
||||
@@ -434,9 +462,9 @@ bool KissCount::SearchPreviousOperation(Operation* res, Operation& op, int month
|
||||
QDate date = QDate(year, month, 0);
|
||||
|
||||
if (limitToType)
|
||||
operations = _db->Search(_user, &op.description, &date, 0, 0, 0, v, op.fix_cost ? +Database::FIX_OP : +Database::NON_FIX_OP, v, false);
|
||||
operations = _db->Search(_user, &op.description, &date, 0, 0, 0, v, op.fix_cost ? +Database::FIX_OP : +Database::NON_FIX_OP, v, false, v);
|
||||
else
|
||||
operations = _db->Search(_user, &op.description, &date, 0, 0, 0, v, Database::ALL_OP, v, false);
|
||||
operations = _db->Search(_user, &op.description, &date, 0, 0, 0, v, Database::ALL_OP, v, false, v);
|
||||
|
||||
if (!operations->size())
|
||||
{
|
||||
@@ -471,16 +499,16 @@ void KissCount::GetHistory(int month, int year, QStringList& list)
|
||||
|
||||
void KissCount::GetStats(int monthFrom, int yearFrom, int monthTo, int yearTo,
|
||||
std::map<int, std::map<int, std::map<int, int> > >* accountAmounts,
|
||||
std::map<int, int>* categories)
|
||||
std::map<int, int>* categories, std::map<int, int>* tags)
|
||||
{
|
||||
_db->GetStats(_user, monthFrom, yearFrom, monthTo, yearTo, accountAmounts, categories);
|
||||
_db->GetStats(_user, monthFrom, yearFrom, monthTo, yearTo, accountAmounts, categories, tags);
|
||||
}
|
||||
|
||||
void KissCount::GetMonthStats(int month, int year, int nbDays,
|
||||
std::map<int, std::vector<int> >* operations,
|
||||
std::map<int, int>* categories)
|
||||
std::map<int, int>* categories, std::map<int, int>* tags)
|
||||
{
|
||||
_db->GetMonthStats(_user, month, year, nbDays, operations, categories);
|
||||
_db->GetMonthStats(_user, month, year, nbDays, operations, categories, tags);
|
||||
}
|
||||
|
||||
void KissCount::UpdateStats()
|
||||
|
||||
@@ -93,6 +93,10 @@ public:
|
||||
void UpdateCategory(Category& category);
|
||||
void DeleteCategory(Category& category, int replacement);
|
||||
|
||||
int AddTag(Tag& tag);
|
||||
void UpdateTag(Tag& tag);
|
||||
void DeleteTag(Tag& tag, int replacement);
|
||||
|
||||
std::map<int, std::vector<int> > GetAllOperations();
|
||||
|
||||
int GenerateMonth(int monthFrom, int yearFrom, int monthTo, int yearTo);
|
||||
@@ -104,17 +108,18 @@ public:
|
||||
|
||||
std::vector<Operation>* Search(QString* description, QDate* dateFrom, QDate* dateTo,
|
||||
int* amountFrom, int* amountTo,
|
||||
std::vector<int> categories, int types, std::vector<int> accounts);
|
||||
std::vector<int> categories,
|
||||
int types, std::vector<int> accounts, std::vector<int> tags);
|
||||
|
||||
bool SearchPreviousOperation(Operation* res, Operation& op, int month, int year, bool limitToType, int index);
|
||||
|
||||
void GetStats(int monthFrom, int yearFrom, int monthTo, int yearTo,
|
||||
std::map<int, std::map<int, std::map<int, int> > >* accountAmounts,
|
||||
std::map<int, int>* categories);
|
||||
std::map<int, int>* categories, std::map<int, int>* tags);
|
||||
|
||||
void GetMonthStats(int month, int year, int nbDays,
|
||||
std::map<int, std::vector<int> >* operations,
|
||||
std::map<int, int>* categories);
|
||||
std::map<int, int>* categories, std::map<int, int>* tags);
|
||||
void UpdateStats();
|
||||
|
||||
std::map<int, int>* GetNotChecked(int month, int year);
|
||||
|
||||
Reference in New Issue
Block a user