Calendar event fixed, but not start date
This commit is contained in:
parent
20509721cf
commit
8d2d985e2e
8
init.sql
8
init.sql
|
@ -13,9 +13,11 @@ INSERT INTO default_preference ("type", "name", "value") VALUES ("category", "na
|
|||
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_amount("id", "account", "year", "month", "amount") VALUES("0", "0", "2010", "5", "1000");
|
||||
INSERT INTO operation ("id", "user", "account", "year", "month", "day", "amount", "description", "category", "fix_cost") VALUES ("0", "0", "0", "2010", "5", "0", "1234", "Opé 1", "0", "1");
|
||||
INSERT INTO operation ("id", "user", "account", "year", "month", "day", "amount", "description", "category", "fix_cost") VALUES ("1", "0", "0", "2010", "5", "1", "-56", "Opé 2", "1", "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", "2", "0");
|
||||
-- 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");
|
||||
-- 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 ("2", "0", "0", "2010", "5", "29", "-2056", "Opé 3", "3", "0");
|
||||
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", "Loisirs");
|
||||
|
|
|
@ -35,30 +35,27 @@ AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*parent)),
|
|||
|
||||
_pie = new PiePlot();
|
||||
|
||||
_accounts = new wxString[user->_accounts.size()+1];
|
||||
_accounts[0] = _("Unknown");
|
||||
for (i=1,
|
||||
_accounts = new wxString[user->_accounts.size()];
|
||||
for (i=0,
|
||||
accountIt = user->_accounts.begin();
|
||||
accountIt != user->_accounts.end();
|
||||
accountIt++, i++)
|
||||
_accounts[i] = user->_accounts[accountIt->first].name;
|
||||
|
||||
_categories = new wxString[user->GetCategoriesNumber()+1] ;
|
||||
_categories[0] = _("Unknown");
|
||||
_categoriesIndexes[_("Unknown")] = 0;
|
||||
for(i=1, it = user->_preferences._categories.begin(); it != user->_preferences._categories.end(); it++, i++)
|
||||
_categories = new wxString[user->GetCategoriesNumber()] ;
|
||||
for(i=0, it = user->_preferences._categories.begin(); it != user->_preferences._categories.end(); it++, i++)
|
||||
{
|
||||
_categories[i] = it->second ;
|
||||
_categoriesIndexes[it->second] = i;
|
||||
}
|
||||
|
||||
_dataset = new CategorySimpleDataset(_categories, user->GetCategoriesNumber()+1);
|
||||
_dataset = new CategorySimpleDataset(_categories, user->GetCategoriesNumber());
|
||||
|
||||
_categoriesValues = new double[user->GetCategoriesNumber()+1];
|
||||
for(i=0; i<user->GetCategoriesNumber()+1; i++)
|
||||
_categoriesValues = new double[user->GetCategoriesNumber()];
|
||||
for(i=0; i<user->GetCategoriesNumber(); i++)
|
||||
_categoriesValues[i] = 0.0;
|
||||
|
||||
_dataset->AddSerie(_("Serie 1"), _categoriesValues, user->GetCategoriesNumber()+1);
|
||||
_dataset->AddSerie(_("Serie 1"), _categoriesValues, user->GetCategoriesNumber());
|
||||
_dataset->SetRenderer(new CategoryRenderer(*colorScheme));
|
||||
_pie->SetDataset(_dataset);
|
||||
_pie->SetColorScheme(colorScheme);
|
||||
|
@ -85,7 +82,7 @@ AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*parent)),
|
|||
_accountsGrid->AutoSizeColumns(true);
|
||||
|
||||
_statsGrid = new wxGrid(this, -1);
|
||||
_statsGrid->CreateGrid(user->GetCategoriesNumber()+1+6, 2);
|
||||
_statsGrid->CreateGrid(user->GetCategoriesNumber()+6, 2);
|
||||
_statsGrid->SetColLabelSize(0);
|
||||
_statsGrid->SetRowLabelSize(0);
|
||||
_statsGrid->EnableEditing(false);
|
||||
|
@ -135,7 +132,7 @@ void AccountPanel::InitStatsGrid(User* user)
|
|||
|
||||
_statsGrid->AutoSizeColumn(0, false);
|
||||
|
||||
for(i=0; i<user->GetCategoriesNumber()+1; i++)
|
||||
for(i=0; i<user->GetCategoriesNumber(); i++)
|
||||
_statsGrid->SetCellValue(CATS_STATS+i, 0, _categories[i]);
|
||||
|
||||
font.SetWeight(wxFONTWEIGHT_BOLD);
|
||||
|
@ -299,9 +296,10 @@ void AccountPanel::InsertOperation(User* user, operation* op, int line, bool fix
|
|||
|
||||
_grid->SetCellEditor(line, DEBIT, new wxGridCellFloatEditor(-1, 2));
|
||||
_grid->SetCellEditor(line, CREDIT, new wxGridCellFloatEditor(-1, 2));
|
||||
wxGridCellChoiceEditor* accountEditor = new wxGridCellChoiceEditor(user->_accounts.size()+1, _accounts, false);
|
||||
wxGridCellChoiceEditor* accountEditor = new wxGridCellChoiceEditor(user->_accounts.size(), _accounts, false);
|
||||
_grid->SetCellEditor(line, ACCOUNT, accountEditor);
|
||||
wxGridCellChoiceEditor* categoryEditor = new wxGridCellChoiceEditor(user->GetCategoriesNumber()+1, _categories, false);
|
||||
// Remove Fix category
|
||||
wxGridCellChoiceEditor* categoryEditor = new wxGridCellChoiceEditor(user->GetCategoriesNumber()-1, _categories+1, false);
|
||||
_grid->SetCellEditor(line, CATEGORY, categoryEditor);
|
||||
|
||||
if (fix)
|
||||
|
@ -326,7 +324,8 @@ void AccountPanel::InsertOperation(User* user, operation* op, int line, bool fix
|
|||
else
|
||||
_grid->SetCellValue(line, CREDIT, wxString::Format(wxT("%.2lf"), op->amount));
|
||||
_grid->SetCellValue(line, ACCOUNT, user->GetAccountName(op->account));
|
||||
_grid->SetCellValue(line, CATEGORY, user->GetCategoryName(op->category));
|
||||
if (!fix)
|
||||
_grid->SetCellValue(line, CATEGORY, user->GetCategoryName(op->category));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -380,7 +379,7 @@ void AccountPanel::UpdateStats()
|
|||
|
||||
curCredit = curDebit = totalCredit = totalDebit = 0.0;
|
||||
|
||||
for (i=0; i<user->GetCategoriesNumber()+1; i++)
|
||||
for (i=0; i<user->GetCategoriesNumber(); i++)
|
||||
_categoriesValues[i] = 0.0;
|
||||
|
||||
for (doubleIt=_accountsInitValues.begin(); doubleIt!=_accountsInitValues.end(); doubleIt++)
|
||||
|
@ -517,6 +516,7 @@ void AccountPanel::OnOperationModified(wxGridEvent& event)
|
|||
need_insertion = true;
|
||||
_grid->DeleteRows(event.GetRow(), 1);
|
||||
_curOperations->erase(_curOperations->begin()+row);
|
||||
_fixCosts--;
|
||||
}
|
||||
else
|
||||
(*_curOperations)[row] = new_op;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#include "CalendarEditor.h"
|
||||
|
||||
CalendarEditor::CalendarEditor(int day, int month, int year) : _day(day), _month(month), _year(year), _parent(NULL), _calendar(NULL)
|
||||
CalendarEditor::CalendarEditor(int day, int month, int year) : _day(day), _month(month), _year(year), _parent(NULL)
|
||||
{
|
||||
_calendar = new wxCalendarCtrl();
|
||||
}
|
||||
|
||||
CalendarEditor::~CalendarEditor()
|
||||
|
@ -16,26 +17,26 @@ void CalendarEditor::BeginEdit(int row, int col, wxGrid *grid)
|
|||
// if (!grid->GetCellValue(row, col).Len()) return;
|
||||
|
||||
// if (date.ParseFormat(grid->GetCellValue(row, col), _("%d/%m/%Y"), dateDef))
|
||||
// _calendar->SetDate(date);
|
||||
// _calendar->SetDate(wxDateTime(_day, _month, _year));
|
||||
}
|
||||
|
||||
wxGridCellEditor* CalendarEditor::Clone() const
|
||||
{
|
||||
std::cout << "Cloned\n" ;
|
||||
return new CalendarEditor(_day, _month, _year);
|
||||
}
|
||||
|
||||
void CalendarEditor::Create(wxWindow *parent, wxWindowID id, wxEvtHandler *evtHandler)
|
||||
{
|
||||
_parent = parent;
|
||||
_calendar = new wxCalendarCtrl(parent, id);
|
||||
_calendar->Create(parent, id, wxDateTime(_day, _month, _year));
|
||||
_calendar->EnableHolidayDisplay(false);
|
||||
_calendar->EnableMonthChange(false);
|
||||
_calendar->EnableYearChange(false);
|
||||
_calendar->SetDate(wxDateTime(_day, _month, _year));
|
||||
// (void (wxObject::*)(wxEvent&))
|
||||
Connect((int)id, (int)wxEVT_CALENDAR_SEL_CHANGED, wxCommandEventHandler(CalendarEditor::OnCalendarChange));
|
||||
_calendar->Connect((int)id, (int)wxEVT_CALENDAR_SEL_CHANGED, wxCommandEventHandler(CalendarEditor::OnCalendarChange), NULL, this);
|
||||
//evtHandler->Connect((int)id, (int)wxEVT_CALENDAR_DOUBLECLICKED, (void (wxObject::*)(wxEvent&))&CalendarEditor::OnCalendarChange);
|
||||
//evtHandler->Connect(wxEVT_CALENDAR_DOUBLECLICKED, (void (wxObject::*)(wxEvent&))&CalendarEditor::OnCalendarChange);
|
||||
//_calendar->Connect(wxEVT_CALENDAR_SEL_CHANGED, (void (wxObject::*)(wxEvent&))&CalendarEditor::OnCalendarChange);
|
||||
//wxGridCellEditor::Create(parent, id, evtHandler);
|
||||
}
|
||||
|
||||
|
@ -63,6 +64,7 @@ void CalendarEditor::Reset()
|
|||
|
||||
void CalendarEditor::Show (bool show, wxGridCellAttr *attr)
|
||||
{
|
||||
_calendar->SetDate(wxDateTime(_day, _month, _year));
|
||||
_calendar->Show(show);
|
||||
}
|
||||
|
||||
|
@ -74,8 +76,6 @@ void CalendarEditor::SetSize (const wxRect &rect)
|
|||
|
||||
void CalendarEditor::OnCalendarChange(wxCommandEvent& event)
|
||||
{
|
||||
std::cout << "ON CHANGE\n" ;
|
||||
//wxDateTime date = _calendar->GetDate();
|
||||
_day = _calendar->GetDate().GetDay();
|
||||
_calendar->Show(false);
|
||||
//_calendar->Show(false);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user