A lot of work done
This commit is contained in:
parent
c353c02d5b
commit
742c95b2c7
15
init.sql
15
init.sql
|
@ -9,17 +9,26 @@ INSERT INTO default_preference ("type", "name", "value") VALUES ("category", "na
|
||||||
INSERT INTO default_preference ("type", "name", "value") VALUES ("category", "name", "Loisirs");
|
INSERT INTO default_preference ("type", "name", "value") VALUES ("category", "name", "Loisirs");
|
||||||
INSERT INTO default_preference ("type", "name", "value") VALUES ("category", "name", "Frais de fonctionnement");
|
INSERT INTO default_preference ("type", "name", "value") VALUES ("category", "name", "Frais de fonctionnement");
|
||||||
INSERT INTO default_preference ("type", "name", "value") VALUES ("category", "name", "Exceptionnel");
|
INSERT INTO default_preference ("type", "name", "value") VALUES ("category", "name", "Exceptionnel");
|
||||||
|
INSERT INTO default_preference ("type", "name", "value") VALUES ("category_color", "Fixe", "#FFFF99");
|
||||||
|
INSERT INTO default_preference ("type", "name", "value") VALUES ("category_color", "Courses", "#3DEB3D");
|
||||||
|
INSERT INTO default_preference ("type", "name", "value") VALUES ("category_color", "Loisirs", "#3DEB3D");
|
||||||
|
INSERT INTO default_preference ("type", "name", "value") VALUES ("category_color", "Frais de fonctionnement", "#3DEB3D");
|
||||||
|
INSERT INTO default_preference ("type", "name", "value") VALUES ("category_color", "Exceptionnel", "#3DEB3D");
|
||||||
-- No password
|
-- No password
|
||||||
INSERT INTO user ("id", "name", "password") VALUES ("0", "Greg", "da39a3ee5e6b4b0d3255bfef95601890afd80709");
|
INSERT INTO user ("id", "name", "password") VALUES ("0", "Greg", "da39a3ee5e6b4b0d3255bfef95601890afd80709");
|
||||||
INSERT INTO account ("id", "user", "name", "number", "shared", "default_account") VALUES ("0", "0", "Compte Courant", "000" , "0", "1");
|
INSERT INTO account ("id", "user", "name", "number", "shared", "default_account") VALUES ("0", "0", "Compte Courant", "000" , "0", "1");
|
||||||
INSERT INTO account_amount("id", "account", "year", "month", "amount") VALUES("0", "0", "2010", "5", "1000");
|
INSERT INTO account_amount("id", "account", "year", "month", "amount") VALUES("0", "0", "2010", "5", "1000");
|
||||||
-- Fix operation
|
|
||||||
INSERT INTO operation ("id", "user", "account", "year", "month", "day", "amount", "description", "category", "fix_cost") VALUES ("0", "0", "0", "2010", "5", "0", "1234", "Opé 1", "1", "1");
|
INSERT INTO operation ("id", "user", "account", "year", "month", "day", "amount", "description", "category", "fix_cost") VALUES ("0", "0", "0", "2010", "5", "0", "1234", "Opé 1", "1", "1");
|
||||||
-- Others operations
|
|
||||||
INSERT INTO operation ("id", "user", "account", "year", "month", "day", "amount", "description", "category", "fix_cost") VALUES ("1", "0", "0", "2010", "5", "1", "-56", "Opé 2", "2", "0");
|
INSERT INTO operation ("id", "user", "account", "year", "month", "day", "amount", "description", "category", "fix_cost") VALUES ("1", "0", "0", "2010", "5", "1", "-56", "Opé 2", "2", "0");
|
||||||
INSERT INTO operation ("id", "user", "account", "year", "month", "day", "amount", "description", "category", "fix_cost") VALUES ("2", "0", "0", "2010", "5", "29", "-2056", "Opé 3", "3", "0");
|
INSERT INTO operation ("id", "user", "account", "year", "month", "day", "amount", "description", "category", "fix_cost") VALUES ("2", "0", "0", "2010", "5", "8", "12", "Opé 3", "3", "0");
|
||||||
|
INSERT INTO operation ("id", "user", "account", "year", "month", "day", "amount", "description", "category", "fix_cost") VALUES ("3", "0", "0", "2010", "5", "29", "-2056", "Opé 4", "4", "0");
|
||||||
INSERT INTO preference ("user", "type", "name", "value") VALUES ("0", "category", "name", "Fixe");
|
INSERT INTO preference ("user", "type", "name", "value") VALUES ("0", "category", "name", "Fixe");
|
||||||
INSERT INTO preference ("user", "type", "name", "value") VALUES ("0", "category", "name", "Courses");
|
INSERT INTO preference ("user", "type", "name", "value") VALUES ("0", "category", "name", "Courses");
|
||||||
INSERT INTO preference ("user", "type", "name", "value") VALUES ("0", "category", "name", "Loisirs");
|
INSERT INTO preference ("user", "type", "name", "value") VALUES ("0", "category", "name", "Loisirs");
|
||||||
INSERT INTO preference ("user", "type", "name", "value") VALUES ("0", "category", "name", "Frais de fonctionnement");
|
INSERT INTO preference ("user", "type", "name", "value") VALUES ("0", "category", "name", "Frais de fonctionnement");
|
||||||
INSERT INTO preference ("user", "type", "name", "value") VALUES ("0", "category", "name", "Exceptionnel");
|
INSERT INTO preference ("user", "type", "name", "value") VALUES ("0", "category", "name", "Exceptionnel");
|
||||||
|
INSERT INTO preference ("user", "type", "name", "value") VALUES ("0", "category_color", "Fixe", "#FFFF99");
|
||||||
|
INSERT INTO preference ("user", "type", "name", "value") VALUES ("0", "category_color", "Courses", "#3DEB3D");
|
||||||
|
INSERT INTO preference ("user", "type", "name", "value") VALUES ("0", "category_color", "Loisirs", "#3DEB3D");
|
||||||
|
INSERT INTO preference ("user", "type", "name", "value") VALUES ("0", "category_color", "Frais de fonctionnement", "#3DEB3D");
|
||||||
|
INSERT INTO preference ("user", "type", "name", "value") VALUES ("0", "category_color", "Exceptionnel", "#3DEB3D");
|
||||||
|
|
0
model/Account.cpp
Executable file → Normal file
0
model/Account.cpp
Executable file → Normal file
0
model/Account.h
Executable file → Normal file
0
model/Account.h
Executable file → Normal file
|
@ -208,6 +208,14 @@ User* Database::LoadUser(wxString name)
|
||||||
|
|
||||||
set.Finalize();
|
set.Finalize();
|
||||||
|
|
||||||
|
req = _("SELECT name, value FROM preference WHERE type='category_color' AND user='") + user->_id + _("' ORDER BY value ASC");
|
||||||
|
EXECUTE_SQL_QUERY_WITH_CODE(req, set, NULL, {delete user;}, {delete user;});
|
||||||
|
|
||||||
|
while (set.NextRow())
|
||||||
|
user->_preferences._colors[set.GetAsString(_("name"))] = wxColour(set.GetAsString(_("value")));
|
||||||
|
|
||||||
|
set.Finalize();
|
||||||
|
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
0
model/Preferences.cpp
Normal file → Executable file
0
model/Preferences.cpp
Normal file → Executable file
|
@ -1,6 +1,6 @@
|
||||||
#include "AccountPanel.h"
|
#include "AccountPanel.h"
|
||||||
|
|
||||||
static wxString colsName[] = {_("Description"), _("Date"), _("Debit"), _("Credit"), _("Category"), _("Account"), _("")};
|
static wxString colsName[] = {_("Description"), _("Date"), _("Debit"), _("Credit"), _("Category"), _("Account"), _(""), _("")};
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(AccountPanel, wxPanel)
|
BEGIN_EVENT_TABLE(AccountPanel, wxPanel)
|
||||||
EVT_GRID_CMD_CELL_CHANGE(OPS_GRID_ID, AccountPanel::OnOperationModified)
|
EVT_GRID_CMD_CELL_CHANGE(OPS_GRID_ID, AccountPanel::OnOperationModified)
|
||||||
|
@ -80,8 +80,6 @@ AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*parent)),
|
||||||
_accountsGrid->SetColLabelValue(ACCOUNT_CUR, _("Current value"));
|
_accountsGrid->SetColLabelValue(ACCOUNT_CUR, _("Current value"));
|
||||||
_accountsGrid->SetColLabelValue(ACCOUNT_FINAL, _("Final value"));
|
_accountsGrid->SetColLabelValue(ACCOUNT_FINAL, _("Final value"));
|
||||||
|
|
||||||
_accountsGrid->AutoSizeColumns(true);
|
|
||||||
|
|
||||||
_statsGrid = new wxGrid(this, -1);
|
_statsGrid = new wxGrid(this, -1);
|
||||||
_statsGrid->CreateGrid(user->GetCategoriesNumber()+6, 2);
|
_statsGrid->CreateGrid(user->GetCategoriesNumber()+6, 2);
|
||||||
_statsGrid->SetColLabelSize(0);
|
_statsGrid->SetColLabelSize(0);
|
||||||
|
@ -134,8 +132,10 @@ void AccountPanel::InitStatsGrid(User* user)
|
||||||
_statsGrid->AutoSizeColumn(0, false);
|
_statsGrid->AutoSizeColumn(0, false);
|
||||||
|
|
||||||
for(i=0; i<user->GetCategoriesNumber(); i++)
|
for(i=0; i<user->GetCategoriesNumber(); i++)
|
||||||
|
{
|
||||||
_statsGrid->SetCellValue(CATS_STATS+i, 0, _categories[i]);
|
_statsGrid->SetCellValue(CATS_STATS+i, 0, _categories[i]);
|
||||||
|
_statsGrid->SetCellAlignment(CATS_STATS+i, 1, wxALIGN_RIGHT, wxALIGN_CENTRE);
|
||||||
|
}
|
||||||
font.SetWeight(wxFONTWEIGHT_BOLD);
|
font.SetWeight(wxFONTWEIGHT_BOLD);
|
||||||
_statsGrid->SetCellFont(CUR_CREDIT, 0, font);
|
_statsGrid->SetCellFont(CUR_CREDIT, 0, font);
|
||||||
_statsGrid->SetCellFont(CUR_DEBIT, 0, font);
|
_statsGrid->SetCellFont(CUR_DEBIT, 0, font);
|
||||||
|
@ -145,6 +145,12 @@ void AccountPanel::InitStatsGrid(User* user)
|
||||||
_statsGrid->SetCellValue(CUR_CREDIT, 0, _("Cur Credit"));
|
_statsGrid->SetCellValue(CUR_CREDIT, 0, _("Cur Credit"));
|
||||||
_statsGrid->SetCellValue(CUR_DEBIT, 0, _("Cur Debit"));
|
_statsGrid->SetCellValue(CUR_DEBIT, 0, _("Cur Debit"));
|
||||||
_statsGrid->SetCellValue(REMAINS, 0, _("Remains"));
|
_statsGrid->SetCellValue(REMAINS, 0, _("Remains"));
|
||||||
|
|
||||||
|
_statsGrid->SetCellAlignment(CUR_DEBIT, 1, wxALIGN_RIGHT, wxALIGN_CENTRE);
|
||||||
|
_statsGrid->SetCellAlignment(CUR_CREDIT, 1, wxALIGN_RIGHT, wxALIGN_CENTRE);
|
||||||
|
_statsGrid->SetCellAlignment(TOTAL_DEBIT, 1, wxALIGN_RIGHT, wxALIGN_CENTRE);
|
||||||
|
_statsGrid->SetCellAlignment(TOTAL_CREDIT, 1, wxALIGN_RIGHT, wxALIGN_CENTRE);
|
||||||
|
_statsGrid->SetCellAlignment(REMAINS, 1, wxALIGN_RIGHT, wxALIGN_CENTRE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AccountPanel::ChangeUser()
|
void AccountPanel::ChangeUser()
|
||||||
|
@ -224,6 +230,7 @@ void AccountPanel::ShowMonth(int year, int month)
|
||||||
std::map<wxString, wxString>::iterator categoryIt;
|
std::map<wxString, wxString>::iterator categoryIt;
|
||||||
//wxGridCellChoiceEditor* categoryEditor, *accountEditor;
|
//wxGridCellChoiceEditor* categoryEditor, *accountEditor;
|
||||||
int i;
|
int i;
|
||||||
|
wxBitmap bitmap(_(DELETE_ICON));
|
||||||
|
|
||||||
_curMonth = month;
|
_curMonth = month;
|
||||||
_wxUI->SetTitle(user->_name + _(" - ") + months[month] + _(" ") + wxString::Format(wxT("%d"), year));
|
_wxUI->SetTitle(user->_name + _(" - ") + months[month] + _(" ") + wxString::Format(wxT("%d"), year));
|
||||||
|
@ -244,7 +251,9 @@ void AccountPanel::ShowMonth(int year, int month)
|
||||||
_grid->SetCellBackgroundColour(0, i, OWN_CYAN);
|
_grid->SetCellBackgroundColour(0, i, OWN_CYAN);
|
||||||
_grid->SetCellFont(0, i, font);
|
_grid->SetCellFont(0, i, font);
|
||||||
_grid->SetReadOnly(0, i, true);
|
_grid->SetReadOnly(0, i, true);
|
||||||
|
_grid->SetCellAlignment(0, i, wxALIGN_CENTRE, wxALIGN_CENTRE);
|
||||||
}
|
}
|
||||||
|
_grid->SetCellRenderer(0, DELETE, new wxGridCellBitmapRenderer(bitmap));
|
||||||
// SetCellBackgroundColour (int row, int col, const wxColour &colour);
|
// SetCellBackgroundColour (int row, int col, const wxColour &colour);
|
||||||
// SetCellFont (int row, int col, const wxFont &font);
|
// SetCellFont (int row, int col, const wxFont &font);
|
||||||
// SetCellValue (int row, int col, const wxString &s);
|
// SetCellValue (int row, int col, const wxString &s);
|
||||||
|
@ -266,7 +275,7 @@ struct operation {
|
||||||
wxString description;
|
wxString description;
|
||||||
wxString category;
|
wxString category;
|
||||||
bool fix_cost;
|
bool fix_cost;
|
||||||
enum {DESCRIPTION, DATE, DEBIT, CREDIT, CATEGORY, ACCOUNT, VIEW, NUMBER_COLS_OPS};
|
enum {DESCRIPTION, DATE, DEBIT, CREDIT, CATEGORY, ACCOUNT, DELETE, NUMBER_COLS_OPS};
|
||||||
} ;
|
} ;
|
||||||
*/
|
*/
|
||||||
for (;it->fix_cost && it != _curOperations->end(); it++)
|
for (;it->fix_cost && it != _curOperations->end(); it++)
|
||||||
|
@ -281,7 +290,10 @@ enum {DESCRIPTION, DATE, DEBIT, CREDIT, CATEGORY, ACCOUNT, VIEW, NUMBER_COLS_OPS
|
||||||
InsertOperation(user, NULL, ++curLine, false);
|
InsertOperation(user, NULL, ++curLine, false);
|
||||||
|
|
||||||
_grid->AutoSizeColumn(CATEGORY, false);
|
_grid->AutoSizeColumn(CATEGORY, false);
|
||||||
|
_grid->AutoSizeColumn(DATE, false);
|
||||||
_grid->AutoSizeColumn(ACCOUNT, false);
|
_grid->AutoSizeColumn(ACCOUNT, false);
|
||||||
|
_grid->AutoSizeColumn(DELETE, false);
|
||||||
|
_grid->AutoSizeColumn(VIEW, false);
|
||||||
|
|
||||||
InitAccountsGrid(user, month, year);
|
InitAccountsGrid(user, month, year);
|
||||||
|
|
||||||
|
@ -293,6 +305,9 @@ enum {DESCRIPTION, DATE, DEBIT, CREDIT, CATEGORY, ACCOUNT, VIEW, NUMBER_COLS_OPS
|
||||||
|
|
||||||
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;
|
||||||
|
int curLine, curWeek, week, i;
|
||||||
|
|
||||||
_grid->InsertRows(line, 1);
|
_grid->InsertRows(line, 1);
|
||||||
|
|
||||||
_grid->SetCellEditor(line, DEBIT, new wxGridCellFloatEditor(-1, 2));
|
_grid->SetCellEditor(line, DEBIT, new wxGridCellFloatEditor(-1, 2));
|
||||||
|
@ -306,14 +321,9 @@ void AccountPanel::InsertOperation(User* user, operation* op, int line, bool fix
|
||||||
if (fix)
|
if (fix)
|
||||||
{
|
{
|
||||||
_fixCosts++;
|
_fixCosts++;
|
||||||
SET_ROW_COLOR(line, OWN_YELLOW);
|
|
||||||
_grid->SetCellValue(line, CATEGORY, _("Fixe"));
|
_grid->SetCellValue(line, CATEGORY, _("Fixe"));
|
||||||
_grid->SetReadOnly(line, CATEGORY);
|
_grid->SetReadOnly(line, CATEGORY);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
SET_ROW_COLOR(line, OWN_GREEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (op)
|
if (op)
|
||||||
{
|
{
|
||||||
|
@ -327,10 +337,47 @@ void AccountPanel::InsertOperation(User* user, operation* op, int line, bool fix
|
||||||
_grid->SetCellValue(line, ACCOUNT, user->GetAccountName(op->account));
|
_grid->SetCellValue(line, ACCOUNT, user->GetAccountName(op->account));
|
||||||
if (!fix)
|
if (!fix)
|
||||||
_grid->SetCellValue(line, CATEGORY, user->GetCategoryName(op->category));
|
_grid->SetCellValue(line, CATEGORY, user->GetCategoryName(op->category));
|
||||||
|
_grid->SetCellRenderer(line, DELETE, new wxGridCellBoolRenderer ());
|
||||||
|
_grid->SetCellEditor(line, DELETE, new wxGridCellBoolEditor ());
|
||||||
|
_grid->SetCellRenderer(line, VIEW, new wxGridCellBoolRenderer ());
|
||||||
|
_grid->SetCellEditor(line, VIEW, new wxGridCellBoolEditor ());
|
||||||
|
|
||||||
|
SET_ROW_COLOR(line, user->_preferences._colors[user->GetCategoryName(op->category)]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_grid->SetCellEditor(line, DATE, new CalendarEditor(1, _curMonth, _curYear));
|
_grid->SetCellEditor(line, DATE, new CalendarEditor(1, _curMonth, _curYear));
|
||||||
|
if (fix)
|
||||||
|
SET_ROW_COLOR(line, OWN_YELLOW)
|
||||||
|
else
|
||||||
|
SET_ROW_COLOR(line, OWN_GREEN)
|
||||||
|
}
|
||||||
|
|
||||||
|
_grid->SetCellAlignment(line, DEBIT, wxALIGN_RIGHT, wxALIGN_CENTRE);
|
||||||
|
_grid->SetCellAlignment(line, CREDIT, wxALIGN_RIGHT, wxALIGN_CENTRE);
|
||||||
|
_grid->SetCellAlignment(line, DELETE, wxALIGN_CENTRE, wxALIGN_CENTRE);
|
||||||
|
_grid->SetCellAlignment(line, VIEW, wxALIGN_CENTRE, wxALIGN_CENTRE);
|
||||||
|
|
||||||
|
if (op)
|
||||||
|
{
|
||||||
|
for (it = _curOperations->begin(), curLine=1;
|
||||||
|
it->fix_cost && it != _curOperations->end();
|
||||||
|
it++, curLine++) ;
|
||||||
|
|
||||||
|
if (it == _curOperations->end()) return;
|
||||||
|
|
||||||
|
curLine++;
|
||||||
|
curWeek = wxDateTime(it->day+1, (wxDateTime::Month)it->month, it->year).GetWeekOfMonth();
|
||||||
|
for (i=1, it++; it != _curOperations->end(); it++, curLine++)
|
||||||
|
{
|
||||||
|
week = wxDateTime(it->day+1, (wxDateTime::Month)it->month, it->year).GetWeekOfMonth();
|
||||||
|
if (week != curWeek)
|
||||||
|
{
|
||||||
|
_grid->SetWeek(i++, curLine);
|
||||||
|
curWeek = week;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,8 +408,12 @@ void AccountPanel::InitAccountsGrid(User* user, int month, int year)
|
||||||
|
|
||||||
_accountsIndexes[it->first] = i;
|
_accountsIndexes[it->first] = i;
|
||||||
_accountsInitValues[it->first] = value;
|
_accountsInitValues[it->first] = value;
|
||||||
|
_accountsGrid->SetCellAlignment(curLine, ACCOUNT_INIT, wxALIGN_RIGHT, wxALIGN_CENTRE);
|
||||||
|
_accountsGrid->SetCellAlignment(curLine, ACCOUNT_CUR, wxALIGN_RIGHT, wxALIGN_CENTRE);
|
||||||
|
_accountsGrid->SetCellAlignment(curLine, ACCOUNT_FINAL, wxALIGN_RIGHT, wxALIGN_CENTRE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_accountsGrid->AutoSizeColumns(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AccountPanel::UpdateStats()
|
void AccountPanel::UpdateStats()
|
||||||
|
@ -443,12 +494,15 @@ 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();
|
||||||
struct operation new_op, cur_op;
|
struct operation new_op, cur_op;
|
||||||
int op_complete = 5, i;
|
int op_complete = 5, i;
|
||||||
wxString value ;
|
wxString value ;
|
||||||
wxDateTime date;
|
wxDateTime date;
|
||||||
bool need_insertion = false, fix_op=false;
|
bool need_insertion = false, fix_op=false;
|
||||||
static bool inModification = false ;
|
static bool inModification = false ;
|
||||||
|
wxColour color ;
|
||||||
|
unsigned char r, g, b;
|
||||||
|
|
||||||
// Avoid recursives calls
|
// Avoid recursives calls
|
||||||
if (inModification) return;
|
if (inModification) return;
|
||||||
|
@ -506,11 +560,47 @@ void AccountPanel::OnOperationModified(wxGridEvent& event)
|
||||||
op_complete--;
|
op_complete--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (col == VIEW || col == CATEGORY)
|
||||||
|
{
|
||||||
|
color = _grid->GetCellBackgroundColour(event.GetRow(), col);
|
||||||
|
|
||||||
|
if (_grid->GetCellValue(event.GetRow(), col) == _("1"))
|
||||||
|
{
|
||||||
|
r = ((color.Red()*1.5) >= 0xFF) ? 0xFF : color.Red()*1.5 ;
|
||||||
|
g = ((color.Green()*1.5) >= 0xFF) ? 0xFF : color.Green()*1.5 ;
|
||||||
|
b = ((color.Blue()*1.5) >= 0xFF) ? 0xFF : color.Blue()*1.5 ;
|
||||||
|
color.Set(r, g, b, color.Alpha());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
color = user->_preferences._colors[user->GetCategoryName(new_op.category)];
|
||||||
|
}
|
||||||
|
|
||||||
|
SET_ROW_COLOR(event.GetRow(), color);
|
||||||
|
|
||||||
|
inModification = false;
|
||||||
|
|
||||||
|
if (col == VIEW)
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
// Penser au fix implosif
|
// Penser au fix implosif
|
||||||
// Modify a fix operation
|
// Modify a fix operation
|
||||||
if (row < _fixCosts)
|
if (row < _fixCosts)
|
||||||
{
|
{
|
||||||
cur_op = (*_curOperations)[row] ;
|
cur_op = (*_curOperations)[row] ;
|
||||||
|
|
||||||
|
if (col == DELETE)
|
||||||
|
{
|
||||||
|
_grid->DeleteRows(event.GetRow(), 1);
|
||||||
|
_curOperations->erase(_curOperations->begin()+row);
|
||||||
|
_kiss->DeleteOperation(cur_op);
|
||||||
|
_grid->_fixCosts = _fixCosts--;
|
||||||
|
UpdateStats();
|
||||||
|
inModification = false ;
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
new_op.id = cur_op.id;
|
new_op.id = cur_op.id;
|
||||||
if (cur_op.day != new_op.day)
|
if (cur_op.day != new_op.day)
|
||||||
{
|
{
|
||||||
|
@ -539,6 +629,7 @@ void AccountPanel::OnOperationModified(wxGridEvent& event)
|
||||||
if (i == CATEGORY) continue;
|
if (i == CATEGORY) continue;
|
||||||
_grid->SetCellValue(event.GetRow(), i, _(""));
|
_grid->SetCellValue(event.GetRow(), i, _(""));
|
||||||
}
|
}
|
||||||
|
_kiss->AddOperation(new_op);
|
||||||
}
|
}
|
||||||
// Modify an operation
|
// Modify an operation
|
||||||
else if (row <= user->GetOperationsNumber(_curMonth, _curYear))
|
else if (row <= user->GetOperationsNumber(_curMonth, _curYear))
|
||||||
|
@ -546,6 +637,17 @@ void AccountPanel::OnOperationModified(wxGridEvent& event)
|
||||||
row--;
|
row--;
|
||||||
cur_op = (*_curOperations)[row] ;
|
cur_op = (*_curOperations)[row] ;
|
||||||
new_op.id = cur_op.id;
|
new_op.id = cur_op.id;
|
||||||
|
|
||||||
|
if (col == DELETE)
|
||||||
|
{
|
||||||
|
_grid->DeleteRows(event.GetRow(), 1);
|
||||||
|
_curOperations->erase(_curOperations->begin()+row);
|
||||||
|
_kiss->DeleteOperation(cur_op);
|
||||||
|
UpdateStats();
|
||||||
|
inModification = false ;
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
if (cur_op.day != new_op.day)
|
if (cur_op.day != new_op.day)
|
||||||
{
|
{
|
||||||
need_insertion = true;
|
need_insertion = true;
|
||||||
|
@ -570,6 +672,7 @@ void AccountPanel::OnOperationModified(wxGridEvent& event)
|
||||||
{
|
{
|
||||||
_grid->SetCellValue(event.GetRow(), i, _(""));
|
_grid->SetCellValue(event.GetRow(), i, _(""));
|
||||||
}
|
}
|
||||||
|
_kiss->AddOperation(new_op);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (need_insertion)
|
if (need_insertion)
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <wx/pie/pieplot.h>
|
#include <wx/pie/pieplot.h>
|
||||||
#include <wx/chartpanel.h>
|
#include <wx/chartpanel.h>
|
||||||
#include "CalendarEditor.h"
|
#include "CalendarEditor.h"
|
||||||
|
#include "wxGridCellBitmapRenderer.h"
|
||||||
|
|
||||||
#define OWN_CYAN wxColour(0x99, 0xCC, 0xFF)
|
#define OWN_CYAN wxColour(0x99, 0xCC, 0xFF)
|
||||||
#define OWN_YELLOW wxColour(0xFF, 0xFF, 0x99)
|
#define OWN_YELLOW wxColour(0xFF, 0xFF, 0x99)
|
||||||
|
@ -16,11 +17,14 @@
|
||||||
#define DEFAULT_FONT_SIZE 12
|
#define DEFAULT_FONT_SIZE 12
|
||||||
#define DEFAULT_FONT(font_name) wxFont font_name(DEFAULT_FONT_SIZE, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, DEFAULT_FONT_NAME);
|
#define DEFAULT_FONT(font_name) wxFont font_name(DEFAULT_FONT_SIZE, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, DEFAULT_FONT_NAME);
|
||||||
|
|
||||||
enum {DESCRIPTION, DATE, DEBIT, CREDIT, CATEGORY, ACCOUNT, VIEW, NUMBER_COLS_OPS};
|
enum {DESCRIPTION, DATE, DEBIT, CREDIT, CATEGORY, ACCOUNT, DELETE, VIEW, NUMBER_COLS_OPS};
|
||||||
enum {ACCOUNT_NUMBER, ACCOUNT_NAME, ACCOUNT_INIT, ACCOUNT_CUR, ACCOUNT_FINAL, NUMBER_COLS_ACCOUNTS};
|
enum {ACCOUNT_NUMBER, ACCOUNT_NAME, ACCOUNT_INIT, ACCOUNT_CUR, ACCOUNT_FINAL, NUMBER_COLS_ACCOUNTS};
|
||||||
enum {CUR_CREDIT, CUR_DEBIT, TOTAL_CREDIT, TOTAL_DEBIT, REMAINS, STATS_ROW, CATS_STATS};
|
enum {CUR_CREDIT, CUR_DEBIT, TOTAL_CREDIT, TOTAL_DEBIT, REMAINS, STATS_ROW, CATS_STATS};
|
||||||
|
|
||||||
enum {CALENDAR_TREE_ID=10, OPS_GRID_ID, ACCOUNTS_GRID_ID};
|
enum {CALENDAR_TREE_ID=10, OPS_GRID_ID, ACCOUNTS_GRID_ID};
|
||||||
|
|
||||||
|
#define DELETE_ICON "ressources/process-stop.png"
|
||||||
|
|
||||||
#include <controller/KissCount.h>
|
#include <controller/KissCount.h>
|
||||||
#include "wxUI.h"
|
#include "wxUI.h"
|
||||||
#include <model/model.h>
|
#include <model/model.h>
|
||||||
|
|
0
view/CalendarEditor.cpp
Normal file → Executable file
0
view/CalendarEditor.cpp
Normal file → Executable file
0
view/CalendarEditor.h
Normal file → Executable file
0
view/CalendarEditor.h
Normal file → Executable file
|
@ -13,9 +13,9 @@ public:
|
||||||
wxPen GetColGridLinePen (int col) {return wxPen(*wxBLACK, 1, wxSOLID);}
|
wxPen GetColGridLinePen (int col) {return wxPen(*wxBLACK, 1, wxSOLID);}
|
||||||
wxPen GetRowGridLinePen (int row) {
|
wxPen GetRowGridLinePen (int row) {
|
||||||
if (row == 0 || row == _fixCosts ||
|
if (row == 0 || row == _fixCosts ||
|
||||||
row == (_fixCosts + _week1) ||
|
row == _week1 ||
|
||||||
row == (_fixCosts + _week2) ||
|
row == _week2 ||
|
||||||
row == (_fixCosts + _week3))
|
row == _week3)
|
||||||
return wxPen(*wxBLACK, 1, wxSOLID);
|
return wxPen(*wxBLACK, 1, wxSOLID);
|
||||||
|
|
||||||
if (row <= _fixCosts)
|
if (row <= _fixCosts)
|
||||||
|
@ -24,6 +24,13 @@ public:
|
||||||
return wxPen(OWN_GREEN, 1, wxSOLID);
|
return wxPen(OWN_GREEN, 1, wxSOLID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetWeek(int week, int line) {
|
||||||
|
switch (week) {
|
||||||
|
case 1: _week1 = line; break;
|
||||||
|
case 2: _week2 = line; break;
|
||||||
|
case 3: _week3 = line; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
int _fixCosts;
|
int _fixCosts;
|
||||||
int _week1, _week2, _week3;
|
int _week1, _week2, _week3;
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user