1 /*******************************************************
2 Copyright (C) 2006 Madhan Kanagavel
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 ********************************************************/
18
19 #include "accountdialog.h"
20 #include "attachmentdialog.h"
21 #include "constants.h"
22 #include "images_list.h"
23 #include "maincurrencydialog.h"
24 #include "mmSimpleDialogs.h"
25 #include "mmOption.h"
26 #include "paths.h"
27 #include "util.h"
28 #include "validators.h"
29 #include "webapp.h"
30
31 #include "model/Model_Infotable.h"
32 #include "model/Model_Currency.h"
33 #include "model/Model_Attachment.h"
34
35 #include "../resources/attachment.xpm"
36
37 #include <wx/valnum.h>
38
39 enum {
40 ID_DIALOG_NEWACCT_BUTTON_CURRENCY = wxID_HIGHEST + 1000,
41 ID_DIALOG_NEWACCT_TEXTCTRL_ACCTNAME,
42 ID_ACCTNUMBER,
43 ID_DIALOG_NEWACCT_TEXTCTRL_HELDAT,
44 ID_DIALOG_NEWACCT_TEXTCTRL_WEBSITE,
45 ID_DIALOG_NEWACCT_TEXTCTRL_CONTACT,
46 ID_DIALOG_NEWACCT_TEXTCTRL_ACCESSINFO,
47 ID_DIALOG_NEWACCT_TEXTCTRL_NOTES,
48 ID_DIALOG_NEWACCT_TEXTCTRL_INITBALANCE,
49 ID_DIALOG_NEWACCT_COMBO_ACCTSTATUS,
50 ID_DIALOG_NEWACCT_CHKBOX_FAVACCOUNT,
51 ID_DIALOG_NEWACCT_COMBO_ACCTTYPE
52 };
53
54 wxIMPLEMENT_DYNAMIC_CLASS(mmNewAcctDialog, wxDialog);
55
wxBEGIN_EVENT_TABLE(mmNewAcctDialog,wxDialog)56 wxBEGIN_EVENT_TABLE( mmNewAcctDialog, wxDialog )
57 EVT_BUTTON(wxID_OK, mmNewAcctDialog::OnOk)
58 EVT_BUTTON(wxID_CANCEL, mmNewAcctDialog::OnCancel)
59 EVT_BUTTON(ID_DIALOG_NEWACCT_BUTTON_CURRENCY, mmNewAcctDialog::OnCurrency)
60 EVT_BUTTON(wxID_FILE, mmNewAcctDialog::OnAttachments)
61 EVT_MENU_RANGE(wxID_HIGHEST, wxID_HIGHEST + 99, mmNewAcctDialog::OnCustonImage)
62 wxEND_EVENT_TABLE()
63
64 mmNewAcctDialog::mmNewAcctDialog( )
65 {
66 }
67
mmNewAcctDialog(Model_Account::Data * account,wxWindow * parent)68 mmNewAcctDialog::mmNewAcctDialog(Model_Account::Data* account, wxWindow* parent)
69 : m_account(account)
70 , m_currencyID(-1)
71 , m_textAccountName()
72 , m_notesCtrl()
73 , m_itemInitValue()
74 , m_imageList()
75 , m_bitmapButtons()
76 {
77 m_imageList = navtree_images_list();
78 long style = wxCAPTION | wxSYSTEM_MENU | wxCLOSE_BOX;
79 Create(parent, wxID_ANY, _("New Account"), wxDefaultPosition, wxSize(550, 300), style);
80
81 fillControls();
82 this->Connect(wxID_ANY, wxEVT_CHILD_FOCUS, wxChildFocusEventHandler(mmNewAcctDialog::changeFocus), nullptr, this);
83 }
84
~mmNewAcctDialog()85 mmNewAcctDialog::~mmNewAcctDialog()
86 {
87 if (m_imageList)
88 delete m_imageList;
89 }
90
Create(wxWindow * parent,wxWindowID id,const wxString & caption,const wxPoint & pos,const wxSize & size,long style)91 bool mmNewAcctDialog::Create(wxWindow* parent
92 , wxWindowID id
93 , const wxString& caption
94 , const wxPoint& pos
95 , const wxSize& size
96 , long style)
97 {
98 SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS);
99 wxDialog::Create(parent, id, caption, pos, size, style);
100
101 CreateControls();
102 m_accessChanged = false;
103 GetSizer()->Fit(this);
104 GetSizer()->SetSizeHints(this);
105 this->SetInitialSize();
106 SetIcon(mmex::getProgramIcon());
107 Centre();
108
109 return TRUE;
110 }
111
fillControls()112 void mmNewAcctDialog::fillControls()
113 {
114
115 this->SetTitle(_("Edit Account"));
116
117 if (!this->m_account) return;
118
119 m_textAccountName->SetValue(m_account->ACCOUNTNAME);
120
121 wxTextCtrl* textCtrl = (wxTextCtrl*)FindWindow(ID_ACCTNUMBER);
122 textCtrl->SetValue(m_account->ACCOUNTNUM);
123
124 textCtrl = (wxTextCtrl*)FindWindow(ID_DIALOG_NEWACCT_TEXTCTRL_HELDAT);
125 textCtrl->SetValue(m_account->HELDAT);
126
127 textCtrl = (wxTextCtrl*)FindWindow(ID_DIALOG_NEWACCT_TEXTCTRL_WEBSITE);
128 textCtrl->SetValue(m_account->WEBSITE);
129
130 textCtrl = (wxTextCtrl*)FindWindow(ID_DIALOG_NEWACCT_TEXTCTRL_CONTACT);
131 textCtrl->SetValue(m_account->CONTACTINFO);
132
133 textCtrl = (wxTextCtrl*)FindWindow(ID_DIALOG_NEWACCT_TEXTCTRL_NOTES);
134 textCtrl->SetValue(m_account->NOTES);
135
136 wxChoice* itemAcctType = (wxChoice*)FindWindow(ID_DIALOG_NEWACCT_COMBO_ACCTTYPE);
137 const auto t = m_account->ACCOUNTTYPE;
138 itemAcctType->SetStringSelection(wxGetTranslation(m_account->ACCOUNTTYPE));
139 itemAcctType->Enable(false);
140
141 wxChoice* choice = (wxChoice*)FindWindow(ID_DIALOG_NEWACCT_COMBO_ACCTSTATUS);
142 choice->SetSelection(Model_Account::status(m_account));
143
144 wxCheckBox* itemCheckBox = (wxCheckBox*)FindWindow(ID_DIALOG_NEWACCT_CHKBOX_FAVACCOUNT);
145 itemCheckBox->SetValue(Model_Account::FAVORITEACCT(m_account));
146
147 Model_Account::currency(m_account);
148 wxButton* bn = (wxButton*)FindWindow(ID_DIALOG_NEWACCT_BUTTON_CURRENCY);
149 bn->SetLabelText(Model_Account::currency(m_account)->CURRENCYNAME);
150 m_currencyID = m_account->CURRENCYID;
151
152 double initBal = m_account->INITIALBAL;
153 m_itemInitValue->SetValue(Model_Currency::toString(initBal, Model_Account::currency(m_account)));
154
155 int selectedImage = mmIniOptions::instance().account_image_id(m_account->ACCOUNTID);
156 m_bitmapButtons->SetBitmapLabel(m_imageList->GetBitmap(selectedImage));
157
158 m_accessInfo = m_account->ACCESSINFO;
159 }
160
CreateControls()161 void mmNewAcctDialog::CreateControls()
162 {
163 wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
164 this->SetSizer(itemBoxSizer2);
165
166 wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL);
167 itemBoxSizer2->Add(itemBoxSizer3, g_flagsExpand);
168
169 wxFlexGridSizer* grid_sizer = new wxFlexGridSizer(0, 2, 0, 0);
170 grid_sizer->AddGrowableCol(1, 1);
171 itemBoxSizer3->Add(grid_sizer, g_flagsExpand);
172
173 grid_sizer->Add(new wxStaticText( this, wxID_STATIC, _("Account Name:")), g_flags);
174
175 m_textAccountName = new wxTextCtrl( this, wxID_ANY, "");
176 grid_sizer->Add(m_textAccountName, g_flagsExpand);
177
178 grid_sizer->Add(new wxStaticText( this, wxID_STATIC, _("Account Type:")), g_flags);
179
180 wxChoice* itemChoice61 = new wxChoice( this, ID_DIALOG_NEWACCT_COMBO_ACCTTYPE);
181 for (const auto& type : Model_Account::all_type())
182 itemChoice61->Append(wxGetTranslation(type), new wxStringClientData(type));
183
184 if (Model_Account::all_type().Index(m_account->ACCOUNTTYPE) == wxNOT_FOUND)
185 itemChoice61->Append(m_account->ACCOUNTTYPE);
186
187 grid_sizer->Add(itemChoice61, g_flagsExpand);
188 itemChoice61->SetSelection(0);
189
190 grid_sizer->Add(new wxStaticText( this, wxID_STATIC, _("Account Status:")), g_flags);
191
192 wxChoice* itemChoice6 = new wxChoice( this, ID_DIALOG_NEWACCT_COMBO_ACCTSTATUS);
193 for(const auto& status: Model_Account::all_status())
194 itemChoice6->Append(wxGetTranslation(status), new wxStringClientData(status));
195 grid_sizer->Add(itemChoice6, g_flagsExpand);
196 itemChoice6->SetSelection(0);
197
198 grid_sizer->Add(new wxStaticText( this, wxID_STATIC
199 , wxString::Format(_("Initial Balance: %s"),"")), g_flags);
200
201 m_itemInitValue = new mmTextCtrl(this
202 , ID_DIALOG_NEWACCT_TEXTCTRL_INITBALANCE
203 , "", wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER, mmCalcValidator());
204 grid_sizer->Add(m_itemInitValue, g_flagsExpand);
205 m_itemInitValue->Connect(ID_DIALOG_NEWACCT_TEXTCTRL_INITBALANCE, wxEVT_COMMAND_TEXT_ENTER,
206 wxCommandEventHandler(mmNewAcctDialog::OnTextEntered), nullptr, this);
207
208 grid_sizer->Add(new wxStaticText( this, wxID_STATIC, _("Currency:")), g_flags);
209
210 wxString currName = _("Select Currency");
211 Model_Currency::Data* base_currency = Model_Currency::GetBaseCurrency();
212 if (base_currency)
213 currName = base_currency->CURRENCYNAME;
214
215 wxButton* itemButton71 = new wxButton( this,
216 ID_DIALOG_NEWACCT_BUTTON_CURRENCY, currName );
217 grid_sizer->Add(itemButton71, g_flagsExpand);
218
219 wxCheckBox* itemCheckBox10 = new wxCheckBox( this
220 , ID_DIALOG_NEWACCT_CHKBOX_FAVACCOUNT
221 , _("Favorite Account"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
222 itemCheckBox10->SetValue(TRUE);
223 grid_sizer->AddSpacer(1);
224 grid_sizer->Add(itemCheckBox10, g_flags);
225
226 // Notes ---------------------------------------------
227
228 wxNotebook* acc_notebook = new wxNotebook(this
229 , wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_MULTILINE );
230 wxPanel* notes_tab = new wxPanel(acc_notebook, wxID_ANY);
231 acc_notebook->AddPage(notes_tab, _("Notes"));
232 wxBoxSizer *notes_sizer = new wxBoxSizer(wxVERTICAL);
233 notes_tab->SetSizer(notes_sizer);
234
235 m_notesCtrl = new wxTextCtrl(notes_tab, ID_DIALOG_NEWACCT_TEXTCTRL_NOTES, ""
236 , wxDefaultPosition, wxSize(270,180), wxTE_MULTILINE);
237 notes_sizer->Add(m_notesCtrl, g_flagsExpand);
238 //
239
240 wxPanel* others_tab = new wxPanel(acc_notebook, wxID_ANY);
241 acc_notebook->AddPage(others_tab, _("Others"));
242 wxBoxSizer *others_sizer = new wxBoxSizer(wxVERTICAL);
243 others_tab->SetSizer(others_sizer);
244
245 wxFlexGridSizer* grid_sizer2 = new wxFlexGridSizer(0, 2, 0, 0);
246 grid_sizer2->AddGrowableCol(1, 1);
247 others_sizer->Add(grid_sizer2, g_flagsExpand);
248
249 grid_sizer2->Add(new wxStaticText(others_tab, wxID_STATIC,
250 (Model_Account::type(m_account) == Model_Account::CREDIT_CARD ? _("Card Number:"):_("Account Number:"))), g_flags);
251
252 wxTextCtrl* itemTextCtrl6 = new wxTextCtrl(others_tab
253 , ID_ACCTNUMBER, "", wxDefaultPosition, wxDefaultSize);
254 grid_sizer2->Add(itemTextCtrl6, g_flagsExpand);
255
256 grid_sizer2->Add(new wxStaticText(others_tab, wxID_STATIC, _("Held At:")), g_flags);
257
258 wxTextCtrl* itemTextCtrl8 = new wxTextCtrl(others_tab
259 , ID_DIALOG_NEWACCT_TEXTCTRL_HELDAT, "" );
260 grid_sizer2->Add(itemTextCtrl8, g_flagsExpand);
261
262 grid_sizer2->Add(new wxStaticText(others_tab, wxID_STATIC, _("Website:")), g_flags);
263 wxTextCtrl* itemTextCtrl10 = new wxTextCtrl(others_tab
264 , ID_DIALOG_NEWACCT_TEXTCTRL_WEBSITE, "" );
265 grid_sizer2->Add(itemTextCtrl10, g_flagsExpand);
266
267 grid_sizer2->Add(new wxStaticText(others_tab
268 , wxID_STATIC, _("Contact:")), g_flags);
269 wxTextCtrl* itemTextCtrl12 = new wxTextCtrl(others_tab
270 , ID_DIALOG_NEWACCT_TEXTCTRL_CONTACT, "" );
271 grid_sizer2->Add(itemTextCtrl12, g_flagsExpand);
272
273 grid_sizer2->Add(new wxStaticText(others_tab
274 , wxID_STATIC, _("Access Info:")), g_flags);
275 wxTextCtrl* itemTextCtrl14 = new wxTextCtrl(others_tab
276 , ID_DIALOG_NEWACCT_TEXTCTRL_ACCESSINFO, "*********");
277 grid_sizer2->Add(itemTextCtrl14, g_flagsExpand);
278
279 itemBoxSizer3->Add(acc_notebook);
280
281 //Buttons
282 wxPanel* itemPanel27 = new wxPanel( this, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
283 itemBoxSizer3->Add(itemPanel27, g_flags);
284
285 wxBoxSizer* itemBoxSizer28 = new wxBoxSizer(wxHORIZONTAL);
286 itemPanel27->SetSizer(itemBoxSizer28);
287
288 m_bitmapButtons = new wxBitmapButton( itemPanel27
289 , wxID_STATIC, wxNullBitmap, wxDefaultPosition
290 , wxSize(m_textAccountName->GetSize().GetHeight(), m_textAccountName->GetSize().GetHeight()));
291 m_bitmapButtons->Connect(wxID_STATIC, wxEVT_COMMAND_BUTTON_CLICKED
292 , wxCommandEventHandler(mmNewAcctDialog::OnImageButton), nullptr, this);
293 itemBoxSizer28->Add(m_bitmapButtons, g_flags);
294
295 bAttachments_ = new wxBitmapButton(itemPanel27, wxID_FILE
296 , wxBitmap(attachment_xpm), wxDefaultPosition
297 , wxSize(m_textAccountName->GetSize().GetHeight(), m_textAccountName->GetSize().GetHeight()));
298 bAttachments_->SetToolTip(_("Organize attachments of this account"));
299 itemBoxSizer28->Add(bAttachments_, g_flags);
300
301 itemBoxSizer28->AddSpacer(20);
302
303 wxButton* itemButton29 = new wxButton(itemPanel27, wxID_OK, _("&OK "));
304 itemBoxSizer28->Add(itemButton29, g_flags);
305
306 wxButton* itemButton30 = new wxButton(itemPanel27, wxID_CANCEL, wxGetTranslation(g_CancelLabel));
307 itemBoxSizer28->Add(itemButton30, g_flags);
308
309 Fit();
310
311 if (true)
312 {
313 m_textAccountName->SetToolTip(_("Enter the Name of the Account. This name can be renamed at any time."));
314 itemChoice61->SetToolTip(_("Specify the type of account to be created."));
315 itemChoice6->SetToolTip(_("Specify if this account has been closed. Closed accounts are inactive in most calculations, reporting etc."));
316 m_itemInitValue->SetToolTip(_("Enter the initial balance in this account."));
317 itemButton71->SetToolTip(_("Specify the currency to be used by this account."));
318 itemCheckBox10->SetToolTip(_("Select whether this is an account that is used often. This is used to filter accounts display view."));
319 m_notesCtrl->SetToolTip(_("Enter user notes and details about this account."));
320 itemTextCtrl6->SetToolTip(_("Enter the Account Number associated with this account."));
321 itemTextCtrl8->SetToolTip(_("Enter the name of the financial institution in which the account is held."));
322 itemTextCtrl10->SetToolTip(_("Enter the URL of the website for the financial institution."));
323 itemTextCtrl12->SetToolTip(_("Enter any contact information for the financial institution."));
324 itemTextCtrl14->SetToolTip(_("Enter any login/access information for the financial institution. This is not secure as anyone with access to the mmb file can access it."));
325 }
326 }
327
OnCancel(wxCommandEvent &)328 void mmNewAcctDialog::OnCancel(wxCommandEvent& /*event*/)
329 {
330 EndModal(wxID_CANCEL);
331 }
332
OnCurrency(wxCommandEvent &)333 void mmNewAcctDialog::OnCurrency(wxCommandEvent& /*event*/)
334 {
335 if (mmMainCurrencyDialog::Execute(this, m_currencyID))
336 {
337 Model_Currency::Data* currency = Model_Currency::instance().get(m_currencyID);
338 wxButton* bn = (wxButton*)FindWindow(ID_DIALOG_NEWACCT_BUTTON_CURRENCY);
339 bn->SetLabelText(currency->CURRENCYNAME);
340
341 if (this->m_account) m_account->CURRENCYID = currency->CURRENCYID;
342 }
343 }
344
OnAttachments(wxCommandEvent &)345 void mmNewAcctDialog::OnAttachments(wxCommandEvent& /*event*/)
346 {
347 wxString RefType = Model_Attachment::reftype_desc(Model_Attachment::BANKACCOUNT);
348 mmAttachmentDialog dlg(this, RefType, m_account->ACCOUNTID);
349 dlg.ShowModal();
350 }
351
OnOk(wxCommandEvent &)352 void mmNewAcctDialog::OnOk(wxCommandEvent& /*event*/)
353 {
354 wxString acctName = m_textAccountName->GetValue().Trim();
355 if (acctName.IsEmpty())
356 return mmErrorDialogs::MessageInvalid(this, _("Account Name "));
357
358
359 if (m_currencyID == -1)
360 return mmErrorDialogs::MessageInvalid(this, _("Currency"));
361
362 if (!m_itemInitValue->checkValue(m_account->INITIALBAL, Model_Account::currency(m_account), false))
363 return;
364
365 if (!this->m_account) this->m_account = Model_Account::instance().create();
366
367 m_account->ACCOUNTNAME = acctName;
368
369 wxTextCtrl* textCtrlAcctNumber = (wxTextCtrl*)FindWindow(ID_ACCTNUMBER);
370 wxTextCtrl* textCtrlHeldAt = (wxTextCtrl*)FindWindow(ID_DIALOG_NEWACCT_TEXTCTRL_HELDAT);
371 wxTextCtrl* textCtrlWebsite = (wxTextCtrl*)FindWindow(ID_DIALOG_NEWACCT_TEXTCTRL_WEBSITE);
372 wxTextCtrl* textCtrlContact = (wxTextCtrl*)FindWindow(ID_DIALOG_NEWACCT_TEXTCTRL_CONTACT);
373 wxTextCtrl* textCtrlAccess = (wxTextCtrl*)FindWindow(ID_DIALOG_NEWACCT_TEXTCTRL_ACCESSINFO);
374
375 wxChoice* choice = (wxChoice*)FindWindow(ID_DIALOG_NEWACCT_COMBO_ACCTSTATUS);
376 m_account->STATUS = Model_Account::all_status()[choice->GetSelection()];
377
378 wxCheckBox* itemCheckBox = (wxCheckBox*)FindWindow(ID_DIALOG_NEWACCT_CHKBOX_FAVACCOUNT);
379 m_account->FAVORITEACCT = itemCheckBox->IsChecked() ? "TRUE" : "FALSE";
380
381 m_account->ACCOUNTNUM = textCtrlAcctNumber->GetValue();
382 m_account->NOTES = m_notesCtrl->GetValue();
383 m_account->HELDAT = textCtrlHeldAt->GetValue();
384 m_account->WEBSITE = textCtrlWebsite->GetValue();
385 m_account->CONTACTINFO = textCtrlContact->GetValue();
386 m_account->CURRENCYID = m_currencyID;
387 if (m_accessChanged)
388 m_account->ACCESSINFO = textCtrlAccess->GetValue();
389
390 Model_Account::instance().save(m_account);
391
392 EndModal(wxID_OK);
393 mmWebApp::MMEX_WebApp_UpdateAccount();
394 }
395
OnImageButton(wxCommandEvent &)396 void mmNewAcctDialog::OnImageButton(wxCommandEvent& /*event*/)
397 {
398 wxCommandEvent ev(wxEVT_COMMAND_MENU_SELECTED, wxID_ANY);
399 ev.SetEventObject( this );
400
401 //Skip all images before custom images
402 int k = 21;
403 wxMenu* mainMenu = new wxMenu;
404 wxMenuItem* menuItem = new wxMenuItem(mainMenu, wxID_HIGHEST, _("Default Image"));
405 menuItem->SetBitmap(m_imageList->GetBitmap(mmIniOptions::instance().account_image_id(this->m_account->ACCOUNTID)));
406 mainMenu->Append(menuItem);
407
408 for (int i = k; i < m_imageList->GetImageCount(); ++i)
409 {
410 menuItem = new wxMenuItem(mainMenu, wxID_HIGHEST + i
411 , wxString::Format(_("Image #%i"), i - k + 1));
412 menuItem->SetBitmap(m_imageList->GetBitmap(i));
413 mainMenu->Append(menuItem);
414 }
415
416 PopupMenu(mainMenu);
417 delete mainMenu;
418 }
419
OnCustonImage(wxCommandEvent & event)420 void mmNewAcctDialog::OnCustonImage(wxCommandEvent& event)
421 {
422 int selectedImage = event.GetId() - wxID_HIGHEST;
423
424 Model_Infotable::instance().Set(wxString::Format("ACC_IMAGE_ID_%i", this->m_account->ACCOUNTID), selectedImage);
425 if (selectedImage == 0)
426 selectedImage = mmIniOptions::instance().account_image_id(this->m_account->ACCOUNTID);
427
428 m_bitmapButtons->SetBitmapLabel(m_imageList->GetBitmap(selectedImage));
429
430 }
431
changeFocus(wxChildFocusEvent & event)432 void mmNewAcctDialog::changeFocus(wxChildFocusEvent& event)
433 {
434 wxWindow *w = event.GetWindow();
435 int oject_in_focus = 0;
436 if ( w )
437 oject_in_focus = w->GetId();
438
439 if (oject_in_focus == ID_DIALOG_NEWACCT_TEXTCTRL_ACCESSINFO)
440 {
441 wxTextCtrl* textCtrl = (wxTextCtrl*)FindWindow(ID_DIALOG_NEWACCT_TEXTCTRL_ACCESSINFO);
442 textCtrl->SetValue(m_accessInfo);
443 m_accessChanged = true;
444 }
445
446 if (m_notesCtrl->GetValue() == m_notesLabel)
447 {
448 m_notesCtrl->SetValue("");
449 }
450 }
451
OnTextEntered(wxCommandEvent & event)452 void mmNewAcctDialog::OnTextEntered(wxCommandEvent& event)
453 {
454 if (event.GetId() == m_itemInitValue->GetId())
455 {
456
457 m_itemInitValue->Calculate(Model_Account::currency(m_account));
458 if (!m_itemInitValue->checkValue(m_account->INITIALBAL, Model_Account::currency(m_account)))
459 return;
460 }
461 }
462