Change structures into class
This commit is contained in:
parent
77df503118
commit
496ef95ce0
@ -69,17 +69,17 @@ double KissCount::GetAccountAmount(wxString id, int month, int year)
|
|||||||
return _db->GetAccountAmount(id, month, year);
|
return _db->GetAccountAmount(id, month, year);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KissCount::UpdateOperation(struct operation op)
|
void KissCount::UpdateOperation(Operation op)
|
||||||
{
|
{
|
||||||
_db->UpdateOperation(op);
|
_db->UpdateOperation(op);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString KissCount::AddOperation(struct operation op)
|
wxString KissCount::AddOperation(Operation op)
|
||||||
{
|
{
|
||||||
return _db->AddOperation(_user, op);
|
return _db->AddOperation(_user, op);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KissCount::DeleteOperation(struct operation op)
|
void KissCount::DeleteOperation(Operation op)
|
||||||
{
|
{
|
||||||
_db->DeleteOperation(op);
|
_db->DeleteOperation(op);
|
||||||
}
|
}
|
||||||
@ -102,15 +102,15 @@ void KissCount::SetAccountAmount(int month, int year, wxString accountId, double
|
|||||||
_db->SetAccountAmount(month, year, accountId, amount);
|
_db->SetAccountAmount(month, year, accountId, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KissCount::AddAccount(struct account ac)
|
void KissCount::AddAccount(Account ac)
|
||||||
{
|
{
|
||||||
ac.id = _db->AddAccount(_user, ac);
|
ac.id = _db->AddAccount(_user, ac);
|
||||||
_user->_accounts.push_back(ac);
|
_user->_accounts.push_back(ac);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KissCount::UpdateAccount(struct account ac)
|
void KissCount::UpdateAccount(Account ac)
|
||||||
{
|
{
|
||||||
std::vector<struct account>::iterator it;
|
std::vector<Account>::iterator it;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
_db->UpdateAccount(ac);
|
_db->UpdateAccount(ac);
|
||||||
@ -119,9 +119,9 @@ void KissCount::UpdateAccount(struct account ac)
|
|||||||
_user->_accounts[i] = ac;
|
_user->_accounts[i] = ac;
|
||||||
}
|
}
|
||||||
|
|
||||||
void KissCount::DeleteAccount(struct account ac)
|
void KissCount::DeleteAccount(Account ac)
|
||||||
{
|
{
|
||||||
std::vector<struct account>::iterator it;
|
std::vector<Account>::iterator it;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
_db->DeleteAccount(ac);
|
_db->DeleteAccount(ac);
|
||||||
@ -133,7 +133,7 @@ void KissCount::DeleteAccount(struct account ac)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString KissCount::AddCategory(struct category category)
|
wxString KissCount::AddCategory(Category category)
|
||||||
{
|
{
|
||||||
wxString id;
|
wxString id;
|
||||||
id = _db->AddCategory(_user, category);
|
id = _db->AddCategory(_user, category);
|
||||||
@ -144,7 +144,7 @@ wxString KissCount::AddCategory(struct category category)
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void KissCount::UpdateCategory(struct category category)
|
void KissCount::UpdateCategory(Category category)
|
||||||
{
|
{
|
||||||
_db->UpdateCategory(category);
|
_db->UpdateCategory(category);
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ void KissCount::UpdateCategory(struct category category)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void KissCount::DeleteCategory(struct category category)
|
void KissCount::DeleteCategory(Category category)
|
||||||
{
|
{
|
||||||
_db->DeleteCategory(_user, category);
|
_db->DeleteCategory(_user, category);
|
||||||
|
|
||||||
@ -175,13 +175,13 @@ std::map<int, std::vector<int> > KissCount::GetAllOperations()
|
|||||||
|
|
||||||
void KissCount::GenerateMonth(int monthFrom, int yearFrom, int monthTo, int yearTo)
|
void KissCount::GenerateMonth(int monthFrom, int yearFrom, int monthTo, int yearTo)
|
||||||
{
|
{
|
||||||
std::vector<operation>::iterator it;
|
std::vector<Operation>::iterator it;
|
||||||
operation op;
|
Operation op;
|
||||||
|
|
||||||
_db->GenerateMonth(_user, monthFrom, yearFrom, monthTo, yearTo);
|
_db->GenerateMonth(_user, monthFrom, yearFrom, monthTo, yearTo);
|
||||||
|
|
||||||
if (!_user->_operations[yearTo])
|
if (!_user->_operations[yearTo])
|
||||||
_user->_operations[yearTo] = new std::map<unsigned int, std::vector<operation> >();
|
_user->_operations[yearTo] = new std::map<unsigned int, std::vector<Operation> >();
|
||||||
|
|
||||||
if (monthFrom != -1 && yearFrom != -1)
|
if (monthFrom != -1 && yearFrom != -1)
|
||||||
{
|
{
|
||||||
@ -221,7 +221,7 @@ void KissCount::ChangeName(wxString name)
|
|||||||
void KissCount::NewUser(wxString name)
|
void KissCount::NewUser(wxString name)
|
||||||
{
|
{
|
||||||
wxDateTime curDate;
|
wxDateTime curDate;
|
||||||
struct account ac = {wxT(""), wxT("Account 1"), wxT(""), false, true};
|
Account ac = {wxT(""), wxT("Account 1"), wxT(""), false, true};
|
||||||
|
|
||||||
_db->NewUser(name);
|
_db->NewUser(name);
|
||||||
if (_user) delete _user;
|
if (_user) delete _user;
|
||||||
|
@ -26,20 +26,20 @@ class KissCount
|
|||||||
|
|
||||||
void LoadYear(int year, bool force=false);
|
void LoadYear(int year, bool force=false);
|
||||||
|
|
||||||
wxString AddOperation(struct operation op);
|
wxString AddOperation(Operation op);
|
||||||
void UpdateOperation(struct operation op);
|
void UpdateOperation(Operation op);
|
||||||
void DeleteOperation(struct operation op);
|
void DeleteOperation(Operation op);
|
||||||
void DeleteOperations(int month, int year);
|
void DeleteOperations(int month, int year);
|
||||||
|
|
||||||
double GetAccountAmount(wxString id, int month, int year);
|
double GetAccountAmount(wxString id, int month, int year);
|
||||||
void SetAccountAmount(int month, int year, wxString accountId, double value);
|
void SetAccountAmount(int month, int year, wxString accountId, double value);
|
||||||
void AddAccount(struct account ac);
|
void AddAccount(Account ac);
|
||||||
void UpdateAccount(struct account ac);
|
void UpdateAccount(Account ac);
|
||||||
void DeleteAccount(struct account ac);
|
void DeleteAccount(Account ac);
|
||||||
|
|
||||||
wxString AddCategory(struct category category);
|
wxString AddCategory(Category category);
|
||||||
void UpdateCategory(struct category category);
|
void UpdateCategory(Category category);
|
||||||
void DeleteCategory(struct category category);
|
void DeleteCategory(Category category);
|
||||||
|
|
||||||
std::map<int, std::vector<int> > GetAllOperations();
|
std::map<int, std::vector<int> > GetAllOperations();
|
||||||
|
|
||||||
|
@ -169,10 +169,10 @@ User* Database::LoadUser(wxString name)
|
|||||||
wxSQLite3ResultSet set;
|
wxSQLite3ResultSet set;
|
||||||
wxString req;
|
wxString req;
|
||||||
User* user;
|
User* user;
|
||||||
struct account account;
|
Account account;
|
||||||
struct category category;
|
Category category;
|
||||||
|
|
||||||
std::vector<struct account>::iterator it;
|
std::vector<Account>::iterator it;
|
||||||
|
|
||||||
req = wxT("SELECT * FROM user WHERE name='") + name + wxT("'");
|
req = wxT("SELECT * FROM user WHERE name='") + name + wxT("'");
|
||||||
|
|
||||||
@ -259,10 +259,10 @@ void Database::LoadYear(User* user, int year)
|
|||||||
{
|
{
|
||||||
wxSQLite3ResultSet set;
|
wxSQLite3ResultSet set;
|
||||||
wxString req;
|
wxString req;
|
||||||
std::vector<struct account>::iterator it;
|
std::vector<Account>::iterator it;
|
||||||
|
|
||||||
if (user->_operations[year] == NULL)
|
if (user->_operations[year] == NULL)
|
||||||
user->_operations[year] = new std::map<unsigned int, std::vector<operation> >();
|
user->_operations[year] = new std::map<unsigned int, std::vector<Operation> >();
|
||||||
|
|
||||||
if (!user->_accounts.size()) return;
|
if (!user->_accounts.size()) return;
|
||||||
|
|
||||||
@ -282,7 +282,7 @@ void Database::LoadYear(User* user, int year)
|
|||||||
|
|
||||||
while (set.NextRow())
|
while (set.NextRow())
|
||||||
{
|
{
|
||||||
operation op;
|
Operation op;
|
||||||
op.id = set.GetAsString(wxT("id"));
|
op.id = set.GetAsString(wxT("id"));
|
||||||
op.account = set.GetAsString(wxT("account"));
|
op.account = set.GetAsString(wxT("account"));
|
||||||
op.day = set.GetInt(wxT("day"));
|
op.day = set.GetInt(wxT("day"));
|
||||||
@ -325,7 +325,7 @@ double Database::GetAccountAmount(wxString id, int month, int year)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database::UpdateOperation(struct operation op)
|
void Database::UpdateOperation(Operation op)
|
||||||
{
|
{
|
||||||
wxString req;
|
wxString req;
|
||||||
req = wxT("UPDATE operation SET ") ;
|
req = wxT("UPDATE operation SET ") ;
|
||||||
@ -347,7 +347,7 @@ void Database::UpdateOperation(struct operation op)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString Database::AddOperation(User* user, struct operation op)
|
wxString Database::AddOperation(User* user, Operation op)
|
||||||
{
|
{
|
||||||
wxString req, res;
|
wxString req, res;
|
||||||
wxSQLite3ResultSet set;
|
wxSQLite3ResultSet set;
|
||||||
@ -396,7 +396,7 @@ wxString Database::AddOperation(User* user, struct operation op)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database::DeleteOperation(struct operation op)
|
void Database::DeleteOperation(Operation op)
|
||||||
{
|
{
|
||||||
wxString req;
|
wxString req;
|
||||||
req = wxT("DELETE FROM operation WHERE id='") + op.id + wxT("'");
|
req = wxT("DELETE FROM operation WHERE id='") + op.id + wxT("'");
|
||||||
@ -407,7 +407,7 @@ void Database::DeleteOperation(struct operation op)
|
|||||||
void Database::DeleteOperations(User* user, int month, int year)
|
void Database::DeleteOperations(User* user, int month, int year)
|
||||||
{
|
{
|
||||||
wxString req;
|
wxString req;
|
||||||
std::vector<struct account>::iterator it;
|
std::vector<Account>::iterator it;
|
||||||
|
|
||||||
it = user->_accounts.begin();
|
it = user->_accounts.begin();
|
||||||
req = wxT("DELETE FROM account_amount WHERE account IN('") + it->id;
|
req = wxT("DELETE FROM account_amount WHERE account IN('") + it->id;
|
||||||
@ -470,7 +470,7 @@ void Database::SetAccountAmount(int month, int year, wxString accountId, double
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString Database::AddAccount(User* user, struct account ac)
|
wxString Database::AddAccount(User* user, Account ac)
|
||||||
{
|
{
|
||||||
wxString req, res;
|
wxString req, res;
|
||||||
wxSQLite3ResultSet set;
|
wxSQLite3ResultSet set;
|
||||||
@ -506,7 +506,7 @@ wxString Database::AddAccount(User* user, struct account ac)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database::UpdateAccount(struct account ac)
|
void Database::UpdateAccount(Account ac)
|
||||||
{
|
{
|
||||||
wxString req;
|
wxString req;
|
||||||
req = wxT("UPDATE account SET ") ;
|
req = wxT("UPDATE account SET ") ;
|
||||||
@ -525,7 +525,7 @@ void Database::UpdateAccount(struct account ac)
|
|||||||
EXECUTE_SQL_UPDATE(req, );
|
EXECUTE_SQL_UPDATE(req, );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database::DeleteAccount(struct account ac)
|
void Database::DeleteAccount(Account ac)
|
||||||
{
|
{
|
||||||
wxString req;
|
wxString req;
|
||||||
req = wxT("DELETE FROM account WHERE id='") + ac.id + wxT("'");
|
req = wxT("DELETE FROM account WHERE id='") + ac.id + wxT("'");
|
||||||
@ -533,7 +533,7 @@ void Database::DeleteAccount(struct account ac)
|
|||||||
EXECUTE_SQL_UPDATE(req, );
|
EXECUTE_SQL_UPDATE(req, );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString Database::AddCategory(User* user, struct category category)
|
wxString Database::AddCategory(User* user, Category category)
|
||||||
{
|
{
|
||||||
wxString req, res;
|
wxString req, res;
|
||||||
wxSQLite3ResultSet set;
|
wxSQLite3ResultSet set;
|
||||||
@ -569,7 +569,7 @@ wxString Database::AddCategory(User* user, struct category category)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database::UpdateCategory(struct category category)
|
void Database::UpdateCategory(Category category)
|
||||||
{
|
{
|
||||||
wxString req;
|
wxString req;
|
||||||
wxString color;
|
wxString color;
|
||||||
@ -589,7 +589,7 @@ void Database::UpdateCategory(struct category category)
|
|||||||
EXECUTE_SQL_UPDATE(req, );
|
EXECUTE_SQL_UPDATE(req, );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database::DeleteCategory(User* user, struct category category)
|
void Database::DeleteCategory(User* user, Category category)
|
||||||
{
|
{
|
||||||
wxString req;
|
wxString req;
|
||||||
|
|
||||||
@ -608,7 +608,7 @@ std::map<int, std::vector<int> > Database::GetAllOperations(User* user)
|
|||||||
{
|
{
|
||||||
wxString req;
|
wxString req;
|
||||||
wxSQLite3ResultSet set, set2;
|
wxSQLite3ResultSet set, set2;
|
||||||
std::vector<struct account>::iterator it;
|
std::vector<Account>::iterator it;
|
||||||
std::map<int, std::vector<int> > res;
|
std::map<int, std::vector<int> > res;
|
||||||
int year;
|
int year;
|
||||||
|
|
||||||
@ -659,7 +659,7 @@ std::map<int, std::vector<int> > Database::GetAllOperations(User* user)
|
|||||||
|
|
||||||
void Database::GenerateMonth(User* user, int monthFrom, int yearFrom, int monthTo, int yearTo)
|
void Database::GenerateMonth(User* user, int monthFrom, int yearFrom, int monthTo, int yearTo)
|
||||||
{
|
{
|
||||||
std::vector<struct account>::iterator it;
|
std::vector<Account>::iterator it;
|
||||||
wxString req;
|
wxString req;
|
||||||
wxSQLite3ResultSet set;
|
wxSQLite3ResultSet set;
|
||||||
double amount;
|
double amount;
|
||||||
@ -823,7 +823,7 @@ void Database::NewUser(wxString name)
|
|||||||
void Database::KillMe(User* user)
|
void Database::KillMe(User* user)
|
||||||
{
|
{
|
||||||
wxString req;
|
wxString req;
|
||||||
std::vector<struct account>::iterator it;
|
std::vector<Account>::iterator it;
|
||||||
|
|
||||||
req = wxT("DELETE FROM preference WHERE user='") + user->_id + wxT("'");
|
req = wxT("DELETE FROM preference WHERE user='") + user->_id + wxT("'");
|
||||||
EXECUTE_SQL_UPDATE(req, );
|
EXECUTE_SQL_UPDATE(req, );
|
||||||
|
@ -24,20 +24,20 @@ class Database
|
|||||||
User* LoadUser(wxString name);
|
User* LoadUser(wxString name);
|
||||||
void LoadYear(User* user, int year);
|
void LoadYear(User* user, int year);
|
||||||
|
|
||||||
void UpdateOperation(struct operation op);
|
void UpdateOperation(Operation op);
|
||||||
wxString AddOperation(User* user, struct operation op);
|
wxString AddOperation(User* user, Operation op);
|
||||||
void DeleteOperation(struct operation op);
|
void DeleteOperation(Operation op);
|
||||||
void DeleteOperations(User* user, int month, int year);
|
void DeleteOperations(User* user, int month, int year);
|
||||||
double GetAccountAmount(wxString id, int month, int year);
|
double GetAccountAmount(wxString id, int month, int year);
|
||||||
void SetAccountAmount(int month, int year, wxString accountId, double amount);
|
void SetAccountAmount(int month, int year, wxString accountId, double amount);
|
||||||
|
|
||||||
wxString AddAccount(User* user, struct account ac);
|
wxString AddAccount(User* user, Account ac);
|
||||||
void UpdateAccount(struct account ac);
|
void UpdateAccount(Account ac);
|
||||||
void DeleteAccount(struct account ac);
|
void DeleteAccount(Account ac);
|
||||||
|
|
||||||
wxString AddCategory(User* user, struct category category);
|
wxString AddCategory(User* user, Category category);
|
||||||
void UpdateCategory(struct category category);
|
void UpdateCategory(Category category);
|
||||||
void DeleteCategory(User* user, struct category category);
|
void DeleteCategory(User* user, Category category);
|
||||||
|
|
||||||
std::map<int, std::vector<int> > GetAllOperations(User* user);
|
std::map<int, std::vector<int> > GetAllOperations(User* user);
|
||||||
void GenerateMonth(User* user, int monthFrom, int yearFrom, int monthTo, int yearTo);
|
void GenerateMonth(User* user, int monthFrom, int yearFrom, int monthTo, int yearTo);
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
User::~User()
|
User::~User()
|
||||||
{
|
{
|
||||||
std::map<unsigned int, std::map<unsigned int, std::vector<operation> >* >::iterator it;
|
std::map<unsigned int, std::map<unsigned int, std::vector<Operation> >* >::iterator it;
|
||||||
|
|
||||||
for (it = _operations.begin(); it != _operations.end(); it++)
|
for (it = _operations.begin(); it != _operations.end(); it++)
|
||||||
{
|
{
|
||||||
@ -14,10 +14,10 @@ User::~User()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct category User::GetCategory(wxString catId)
|
Category User::GetCategory(wxString catId)
|
||||||
{
|
{
|
||||||
struct category cat;
|
Category cat;
|
||||||
std::vector<category>::iterator it;
|
std::vector<Category>::iterator it;
|
||||||
|
|
||||||
for (it=_categories.begin(); it !=_categories.end(); it++)
|
for (it=_categories.begin(); it !=_categories.end(); it++)
|
||||||
if (it->id == catId)
|
if (it->id == catId)
|
||||||
@ -34,7 +34,7 @@ struct category User::GetCategory(wxString catId)
|
|||||||
|
|
||||||
wxString User::GetCategoryName(wxString catId)
|
wxString User::GetCategoryName(wxString catId)
|
||||||
{
|
{
|
||||||
std::vector<category>::iterator it;
|
std::vector<Category>::iterator it;
|
||||||
for (it=_categories.begin(); it !=_categories.end(); it++)
|
for (it=_categories.begin(); it !=_categories.end(); it++)
|
||||||
if (it->id == catId)
|
if (it->id == catId)
|
||||||
return it->name;
|
return it->name;
|
||||||
@ -44,7 +44,7 @@ wxString User::GetCategoryName(wxString catId)
|
|||||||
|
|
||||||
wxString User::GetCategoryId(wxString catName)
|
wxString User::GetCategoryId(wxString catName)
|
||||||
{
|
{
|
||||||
std::vector<category>::iterator it;
|
std::vector<Category>::iterator it;
|
||||||
for (it=_categories.begin(); it !=_categories.end(); it++)
|
for (it=_categories.begin(); it !=_categories.end(); it++)
|
||||||
if (it->name == catName)
|
if (it->name == catName)
|
||||||
return it->id;
|
return it->id;
|
||||||
@ -54,7 +54,7 @@ wxString User::GetCategoryId(wxString catName)
|
|||||||
|
|
||||||
wxString User::GetAccountName(wxString accountId)
|
wxString User::GetAccountName(wxString accountId)
|
||||||
{
|
{
|
||||||
std::vector<struct account>::iterator it;
|
std::vector<Account>::iterator it;
|
||||||
for (it=_accounts.begin(); it !=_accounts.end(); it++)
|
for (it=_accounts.begin(); it !=_accounts.end(); it++)
|
||||||
if (it->id == accountId)
|
if (it->id == accountId)
|
||||||
return it->name;
|
return it->name;
|
||||||
@ -64,7 +64,7 @@ wxString User::GetAccountName(wxString accountId)
|
|||||||
|
|
||||||
wxString User::GetAccountId(wxString accountName)
|
wxString User::GetAccountId(wxString accountName)
|
||||||
{
|
{
|
||||||
std::vector<struct account>::iterator it;
|
std::vector<Account>::iterator it;
|
||||||
for (it=_accounts.begin(); it !=_accounts.end(); it++)
|
for (it=_accounts.begin(); it !=_accounts.end(); it++)
|
||||||
if (it->name == accountName)
|
if (it->name == accountName)
|
||||||
return it->id;
|
return it->id;
|
||||||
|
40
model/User.h
40
model/User.h
@ -6,35 +6,9 @@
|
|||||||
#include <wx/wx.h>
|
#include <wx/wx.h>
|
||||||
#include <wx/colour.h>
|
#include <wx/colour.h>
|
||||||
|
|
||||||
struct operation {
|
#include "Category.h"
|
||||||
wxString id;
|
#include "Account.h"
|
||||||
unsigned int day;
|
#include "Operation.h"
|
||||||
unsigned int month;
|
|
||||||
unsigned int year;
|
|
||||||
double amount;
|
|
||||||
wxString description;
|
|
||||||
wxString category;
|
|
||||||
bool fix_cost;
|
|
||||||
wxString account;
|
|
||||||
bool checked;
|
|
||||||
} ;
|
|
||||||
|
|
||||||
struct account {
|
|
||||||
wxString id;
|
|
||||||
wxString name;
|
|
||||||
wxString number;
|
|
||||||
bool shared;
|
|
||||||
bool _default;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct category
|
|
||||||
{
|
|
||||||
wxString id;
|
|
||||||
wxString parent;
|
|
||||||
wxString name;
|
|
||||||
wxColour color;
|
|
||||||
wxString font;
|
|
||||||
};
|
|
||||||
|
|
||||||
class User
|
class User
|
||||||
{
|
{
|
||||||
@ -44,12 +18,12 @@ public:
|
|||||||
wxString _id;
|
wxString _id;
|
||||||
wxString _name;
|
wxString _name;
|
||||||
wxString _password;
|
wxString _password;
|
||||||
std::vector<struct account> _accounts;
|
std::vector<Account> _accounts;
|
||||||
std::map<unsigned int, std::map<unsigned int, std::vector<struct operation> >* > _operations;
|
std::map<unsigned int, std::map<unsigned int, std::vector<Operation> >* > _operations;
|
||||||
std::vector<struct category> _categories;
|
std::vector<Category> _categories;
|
||||||
std::map<wxString, wxString> _preferences;
|
std::map<wxString, wxString> _preferences;
|
||||||
|
|
||||||
struct category GetCategory(wxString catId);
|
Category GetCategory(wxString catId);
|
||||||
wxString GetCategoryName(wxString catId);
|
wxString GetCategoryName(wxString catId);
|
||||||
wxString GetCategoryId(wxString catName);
|
wxString GetCategoryId(wxString catName);
|
||||||
wxString GetAccountName(wxString accountId);
|
wxString GetAccountName(wxString accountId);
|
||||||
|
@ -29,8 +29,8 @@ AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : wxScrolledWindow(&(*
|
|||||||
int i ;
|
int i ;
|
||||||
DEFAULT_FONT(font);
|
DEFAULT_FONT(font);
|
||||||
User* user = _kiss->GetUser();
|
User* user = _kiss->GetUser();
|
||||||
std::vector<struct account>::iterator accountIt;
|
std::vector<Account>::iterator accountIt;
|
||||||
std::vector<category>::iterator categoryIt;
|
std::vector<Category>::iterator categoryIt;
|
||||||
wxColour categoryColors[] = {wxColour(0x00, 0x45, 0x86),
|
wxColour categoryColors[] = {wxColour(0x00, 0x45, 0x86),
|
||||||
wxColour(0xFF, 0x3E, 0x0E),
|
wxColour(0xFF, 0x3E, 0x0E),
|
||||||
wxColour(0xFF, 0xD3, 0x20),
|
wxColour(0xFF, 0xD3, 0x20),
|
||||||
@ -210,7 +210,7 @@ void AccountPanel::ChangeUser()
|
|||||||
{
|
{
|
||||||
User* user = _kiss->GetUser();
|
User* user = _kiss->GetUser();
|
||||||
int curYear = -1;
|
int curYear = -1;
|
||||||
std::map<unsigned int, std::map<unsigned int, std::vector<operation> >* >::iterator it;
|
std::map<unsigned int, std::map<unsigned int, std::vector<Operation> >* >::iterator it;
|
||||||
wxDateTime curDate;
|
wxDateTime curDate;
|
||||||
wxTreeItemId rootNode, curNode;
|
wxTreeItemId rootNode, curNode;
|
||||||
|
|
||||||
@ -290,14 +290,14 @@ void AccountPanel::LoadYear(int year, bool showMonth)
|
|||||||
|
|
||||||
void AccountPanel::ShowMonth(int month, int year)
|
void AccountPanel::ShowMonth(int month, int year)
|
||||||
{
|
{
|
||||||
std::vector<operation> operations;
|
std::vector<Operation> operations;
|
||||||
std::vector<operation>::iterator it;
|
std::vector<Operation>::iterator it;
|
||||||
_fixCosts = 0;
|
_fixCosts = 0;
|
||||||
int curLine = 0;
|
int curLine = 0;
|
||||||
User* user = _kiss->GetUser();
|
User* user = _kiss->GetUser();
|
||||||
DEFAULT_FONT(font);
|
DEFAULT_FONT(font);
|
||||||
std::vector<category>::iterator categoryIt;
|
std::vector<Category>::iterator categoryIt;
|
||||||
std::map<unsigned int, std::vector<operation> >::iterator monthIt;
|
std::map<unsigned int, std::vector<Operation> >::iterator monthIt;
|
||||||
wxDateTime curDate;
|
wxDateTime curDate;
|
||||||
curDate.SetToCurrent();
|
curDate.SetToCurrent();
|
||||||
|
|
||||||
@ -377,9 +377,9 @@ void AccountPanel::ShowMonth(int month, int year)
|
|||||||
// SetMinSize(GetSize());
|
// SetMinSize(GetSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AccountPanel::InsertOperation(User* user, operation* op, int line, bool fix)
|
void AccountPanel::InsertOperation(User* user, Operation* op, int line, bool fix)
|
||||||
{
|
{
|
||||||
std::vector<operation>::iterator it;
|
std::vector<Operation>::iterator it;
|
||||||
int curLine, curWeek, week, i;
|
int curLine, curWeek, week, i;
|
||||||
int r, g, b;
|
int r, g, b;
|
||||||
wxColour color;
|
wxColour color;
|
||||||
@ -474,7 +474,7 @@ void AccountPanel::InsertOperation(User* user, operation* op, int line, bool fix
|
|||||||
|
|
||||||
void AccountPanel::InitAccountsGrid(User* user, int month, int year)
|
void AccountPanel::InitAccountsGrid(User* user, int month, int year)
|
||||||
{
|
{
|
||||||
std::vector<struct account>::iterator it;
|
std::vector<Account>::iterator it;
|
||||||
int curLine = 0;
|
int curLine = 0;
|
||||||
double value;
|
double value;
|
||||||
int i, a;
|
int i, a;
|
||||||
@ -511,12 +511,12 @@ void AccountPanel::UpdateStats()
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
User* user = _kiss->GetUser();
|
User* user = _kiss->GetUser();
|
||||||
std::vector<operation>::iterator it;
|
std::vector<Operation>::iterator it;
|
||||||
double curCredit, curDebit, totalCredit, totalDebit, remains, value;
|
double curCredit, curDebit, totalCredit, totalDebit, remains, value;
|
||||||
std::map<wxString, double> curAccountAmount, finalAccountAmount;
|
std::map<wxString, double> curAccountAmount, finalAccountAmount;
|
||||||
std::map<wxString, double>::iterator doubleIt;
|
std::map<wxString, double>::iterator doubleIt;
|
||||||
std::map<wxString, int>::iterator intIt;
|
std::map<wxString, int>::iterator intIt;
|
||||||
std::vector<struct account>::iterator accountIt;
|
std::vector<Account>::iterator accountIt;
|
||||||
unsigned int day;
|
unsigned int day;
|
||||||
|
|
||||||
day = _calendar->GetDate().GetDay()-1;
|
day = _calendar->GetDate().GetDay()-1;
|
||||||
@ -585,7 +585,7 @@ void AccountPanel::OnOperationModified(wxGridEvent& event)
|
|||||||
User* user = _kiss->GetUser();
|
User* user = _kiss->GetUser();
|
||||||
int row = event.GetRow()-1;
|
int row = event.GetRow()-1;
|
||||||
int col = event.GetCol();
|
int col = event.GetCol();
|
||||||
struct operation new_op, cur_op;
|
Operation new_op, cur_op;
|
||||||
int op_complete = 6, i;
|
int op_complete = 6, i;
|
||||||
wxString value ;
|
wxString value ;
|
||||||
wxDateTime date;
|
wxDateTime date;
|
||||||
@ -998,7 +998,7 @@ void AccountPanel::GenerateMonth(int month, int year)
|
|||||||
wxTreeItemId root, years, node ;
|
wxTreeItemId root, years, node ;
|
||||||
wxTreeItemIdValue cookie;
|
wxTreeItemIdValue cookie;
|
||||||
wxString monthString, yearString;
|
wxString monthString, yearString;
|
||||||
std::map<unsigned int, std::vector<operation> >::iterator it;
|
std::map<unsigned int, std::vector<Operation> >::iterator it;
|
||||||
int i;
|
int i;
|
||||||
User* user = _kiss->GetUser();
|
User* user = _kiss->GetUser();
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ private:
|
|||||||
PiePlot* _pie;
|
PiePlot* _pie;
|
||||||
double *_categoriesValues;
|
double *_categoriesValues;
|
||||||
std::map<wxString, int> _categoriesIndexes;
|
std::map<wxString, int> _categoriesIndexes;
|
||||||
std::vector<operation>* _curOperations;
|
std::vector<Operation>* _curOperations;
|
||||||
wxString* _categories, *_accounts;
|
wxString* _categories, *_accounts;
|
||||||
std::map<wxString, double> _accountsInitValues;
|
std::map<wxString, double> _accountsInitValues;
|
||||||
CategorySimpleDataset* _dataset;
|
CategorySimpleDataset* _dataset;
|
||||||
@ -69,7 +69,7 @@ private:
|
|||||||
void InitStatsGrid(User* user);
|
void InitStatsGrid(User* user);
|
||||||
void InitAccountsGrid(User* user, int month, int year);
|
void InitAccountsGrid(User* user, int month, int year);
|
||||||
void UpdateStats();
|
void UpdateStats();
|
||||||
void InsertOperation(User* user, operation* op, int line, bool fix);
|
void InsertOperation(User* user, Operation* op, int line, bool fix);
|
||||||
void GetTreeSelection(int* month, int* year);
|
void GetTreeSelection(int* month, int* year);
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE();
|
DECLARE_EVENT_TABLE();
|
||||||
|
@ -85,9 +85,9 @@ PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*p
|
|||||||
|
|
||||||
void PreferencesPanel::InitAccounts(User* user)
|
void PreferencesPanel::InitAccounts(User* user)
|
||||||
{
|
{
|
||||||
std::vector<struct account>::iterator it;
|
std::vector<Account>::iterator it;
|
||||||
int curLine = 0;
|
int curLine = 0;
|
||||||
struct account account ;
|
Account account ;
|
||||||
DEFAULT_FONT(font);
|
DEFAULT_FONT(font);
|
||||||
|
|
||||||
_accountsGrid->CreateGrid(0, NUMBER_COLS_ACCOUNT);
|
_accountsGrid->CreateGrid(0, NUMBER_COLS_ACCOUNT);
|
||||||
@ -135,7 +135,7 @@ void PreferencesPanel::InitAccounts(User* user)
|
|||||||
|
|
||||||
void PreferencesPanel::InitCategories(User* user)
|
void PreferencesPanel::InitCategories(User* user)
|
||||||
{
|
{
|
||||||
std::vector<category>::iterator it;
|
std::vector<Category>::iterator it;
|
||||||
int curLine = 0;
|
int curLine = 0;
|
||||||
DEFAULT_FONT(font);
|
DEFAULT_FONT(font);
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ void PreferencesPanel::OnAccountModified(wxGridEvent& event)
|
|||||||
{
|
{
|
||||||
int op_complete = 2;
|
int op_complete = 2;
|
||||||
wxString value ;
|
wxString value ;
|
||||||
struct account new_account, account;
|
Account new_account, account;
|
||||||
User* user = _kiss->GetUser();
|
User* user = _kiss->GetUser();
|
||||||
int row = event.GetRow();
|
int row = event.GetRow();
|
||||||
int col = event.GetCol();
|
int col = event.GetCol();
|
||||||
@ -329,7 +329,7 @@ void PreferencesPanel::OnCategoryModified(wxGridEvent& event)
|
|||||||
int row = event.GetRow();
|
int row = event.GetRow();
|
||||||
int col = event.GetCol();
|
int col = event.GetCol();
|
||||||
static bool inModification = false ;
|
static bool inModification = false ;
|
||||||
struct category new_cat;
|
Category new_cat;
|
||||||
|
|
||||||
if (inModification) return;
|
if (inModification) return;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user