Month generation in progress
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
enum {DESCRIPTION, DATE, DEBIT, CREDIT, CATEGORY, ACCOUNT, DELETE, CHECKED, NUMBER_COLS_OPS};
|
||||
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 {CALENDAR_TREE_ID=10, OPS_GRID_ID, ACCOUNTS_GRID_ID};
|
||||
enum {CALENDAR_TREE_ID=10, OPS_GRID_ID, ACCOUNTS_GRID_ID, MENU_GENERATE_ID, MENU_DELETE_ID};
|
||||
|
||||
static wxString colsName[] = {_("Description"), _("Date"), _("Debit"), _("Credit"), _("Category"), _("Account"), _(""), _("")};
|
||||
|
||||
@@ -13,6 +13,8 @@ BEGIN_EVENT_TABLE(AccountPanel, wxPanel)
|
||||
EVT_TREE_ITEM_RIGHT_CLICK(CALENDAR_TREE_ID, AccountPanel::OnTreeRightClick)
|
||||
EVT_TREE_SEL_CHANGED(CALENDAR_TREE_ID, AccountPanel::OnTreeChange)
|
||||
EVT_TREE_KEY_DOWN(CALENDAR_TREE_ID, AccountPanel::OnTreeChange)
|
||||
EVT_MENU(MENU_GENERATE_ID, AccountPanel::OnMenuGenerate)
|
||||
EVT_MENU(MENU_DELETE_ID, AccountPanel::OnMenuDelete)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*parent)), _kiss(kiss), _wxUI(parent), _tree(this, CALENDAR_TREE_ID, wxDefaultPosition, wxDefaultSize, wxTR_HIDE_ROOT)
|
||||
@@ -781,6 +783,14 @@ void AccountPanel::OnAccountModified(wxGridEvent& event)
|
||||
void AccountPanel::OnTreeRightClick(wxTreeEvent& event)
|
||||
{
|
||||
// ShowMonth(2010,4);
|
||||
wxMenu menu(0);
|
||||
|
||||
menu.Append(MENU_GENERATE_ID, _("Generate month"));
|
||||
menu.AppendSeparator();
|
||||
if (_tree.GetCount() > 1)
|
||||
menu.Append(MENU_DELETE_ID, _("Delete"));
|
||||
|
||||
PopupMenu(&menu, event.GetPoint());
|
||||
}
|
||||
|
||||
void AccountPanel::OnTreeChange(wxTreeEvent& event)
|
||||
@@ -842,3 +852,44 @@ void AccountPanel::OnTreeChange(wxTreeEvent& event)
|
||||
|
||||
inModification = false;
|
||||
}
|
||||
|
||||
void AccountPanel::OnMenuGenerate(wxCommandEvent& event)
|
||||
{
|
||||
wxString monthString;
|
||||
int month, year, i;
|
||||
|
||||
month = year = -1;
|
||||
|
||||
monthString = _tree.GetItemText(_tree.GetSelection());
|
||||
for (i=0; i<12; i++)
|
||||
if (monthString == months[i])
|
||||
{
|
||||
month = i;
|
||||
break;
|
||||
}
|
||||
|
||||
if (month == -1)
|
||||
{
|
||||
year = wxAtoi(monthString);
|
||||
|
||||
// Error
|
||||
if (year == 0)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
year = wxAtoi(_tree.GetItemText(_tree.GetItemParent(_tree.GetSelection())));
|
||||
|
||||
// Error
|
||||
if (year == 0)
|
||||
return;
|
||||
}
|
||||
|
||||
GenerateDialog g(_kiss, _wxUI, month, year);
|
||||
g.ShowModal();
|
||||
}
|
||||
|
||||
void AccountPanel::OnMenuDelete(wxCommandEvent& event)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -41,6 +41,8 @@ public:
|
||||
void OnAccountModified(wxGridEvent& event);
|
||||
void OnTreeRightClick(wxTreeEvent& event);
|
||||
void OnTreeChange(wxTreeEvent& event);
|
||||
void OnMenuGenerate(wxCommandEvent& event);
|
||||
void OnMenuDelete(wxCommandEvent& event);
|
||||
|
||||
private:
|
||||
KissCount* _kiss;
|
||||
|
||||
@@ -268,8 +268,7 @@ void PreferencesPanel::OnAccountModified(wxGridEvent& event)
|
||||
|
||||
if (user->GetAccountId(new_account.name) != _("0"))
|
||||
{
|
||||
wxMessageDialog dialog(_wxUI, _("Account ")+new_account.name+_(" already exists"), _("Error"), wxOK);
|
||||
dialog.ShowModal();
|
||||
wxMessageBox(_("Account ")+new_account.name+_(" already exists"), _("Error"), wxICON_ERROR | wxOK );
|
||||
inModification = false;
|
||||
return ;
|
||||
}
|
||||
@@ -363,6 +362,13 @@ void PreferencesPanel::OnCategoryModified(wxGridEvent& event)
|
||||
return ;
|
||||
}
|
||||
|
||||
if (user->GetCategoryId(new_cat.name) != _("0"))
|
||||
{
|
||||
wxMessageBox(_("Category ")+new_cat.name+_(" already exists"), _("Error"), wxICON_ERROR | wxOK );
|
||||
inModification = false;
|
||||
return ;
|
||||
}
|
||||
|
||||
_kiss->AddCategory(new_cat);
|
||||
_categoriesGrid->SetReadOnly(row, CATEGORY_COLOR, false);
|
||||
_categoriesGrid->SetReadOnly(row, CATEGORY_FONT, false);
|
||||
|
||||
@@ -44,11 +44,11 @@ UsersDialog::UsersDialog(KissCount* kiss, wxUI *parent) : wxDialog(&(*parent), -
|
||||
vbox->Add(-1, 40);
|
||||
vbox->Add(hbox1, 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM, 10);
|
||||
|
||||
Center();
|
||||
SetSizer(vbox);
|
||||
|
||||
_users->SetFocus();
|
||||
Layout();
|
||||
Center();
|
||||
}
|
||||
|
||||
void UsersDialog::OnOK(wxCommandEvent& event)
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "ButtonPanel.h"
|
||||
#include "PreferencesPanel.h"
|
||||
#include "UsersDialog.h"
|
||||
#include "GenerateDialog.h"
|
||||
#include <controller/KissCount.h>
|
||||
|
||||
class KissCount;
|
||||
|
||||
Reference in New Issue
Block a user