#!/usr/bin/env python # -*- coding: utf-8 -*- # generated by wxGlade 0.6.3 on Sun Dec 5 21:08:21 2010 import wx # begin wxGlade: extracode # end wxGlade class AlertDialog(wx.Dialog): def __init__(self, *args, **kwds): # begin wxGlade: AlertDialog.__init__ kwds["style"] = wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER|wx.THICK_FRAME|wx.STAY_ON_TOP wx.Dialog.__init__(self, *args, **kwds) self.static_line_7 = wx.StaticLine(self, -1) self.alert_label = wx.StaticText(self, -1, "\nAlert Text") self.button_11 = wx.Button(self, -1, "OK") self.__set_properties() self.__do_layout() self.Bind(wx.EVT_BUTTON, self.alert_ok_gui, self.button_11) # end wxGlade #self.Bind(wx.EVT_CLOSE, self.close_windows_gui) def __set_properties(self): # begin wxGlade: AlertDialog.__set_properties self.SetTitle("Alert") self.SetSize((488, 285)) self.SetFocus() # end wxGlade def __do_layout(self): # begin wxGlade: AlertDialog.__do_layout grid_sizer_14 = wx.FlexGridSizer(3, 1, 10, 0) grid_sizer_14.Add(self.static_line_7, 0, wx.EXPAND, 0) grid_sizer_14.Add(self.alert_label, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_14.Add(self.button_11, 0, wx.ALIGN_CENTER_HORIZONTAL, 0) self.SetSizer(grid_sizer_14) grid_sizer_14.AddGrowableRow(1) grid_sizer_14.AddGrowableCol(0) self.Layout() # end wxGlade def alert_ok_gui(self, event): # wxGlade: AlertDialog. alert_ok(self, event) def close_windows_gui(self, event): close_windows(self, event) # end of class AlertDialog class MainWindow(wx.Frame): def __init__(self, *args, **kwds): # begin wxGlade: MainWindow.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.notebook_1 = wx.Notebook(self, -1, style=0) self.notebook_createloan = wx.Panel(self.notebook_1, -1) self.notebook_launch = wx.Panel(self.notebook_1, -1) self.notebook_info = wx.Panel(self.notebook_1, -1) self.notebook_about = wx.Panel(self.notebook_1, -1) self.notebook_transaction = wx.Panel(self.notebook_1, -1) self.notebook_viewloan = wx.Panel(self.notebook_1, -1) self.notebook_payment = wx.Panel(self.notebook_1, -1) self.notebook_client = wx.Panel(self.notebook_1, -1) self.notebook_general = wx.Panel(self.notebook_1, -1) self.notebook_2 = wx.Notebook(self.notebook_general, -1, style=wx.NB_LEFT) self.notebook_2_pane_3 = wx.Panel(self.notebook_2, -1, style=wx.NO_BORDER|wx.TAB_TRAVERSAL) self.notebook_2_pane_2 = wx.Panel(self.notebook_2, -1) self.notebook_2_pane_1 = wx.Panel(self.notebook_2, -1) # Menu Bar self.main_frame_menubar = wx.MenuBar() wxglade_tmp_menu = wx.Menu() wxglade_tmp_menu.Append(wx.NewId(), "Save", "", wx.ITEM_NORMAL) wxglade_tmp_menu.Append(wx.NewId(), "Revert", "", wx.ITEM_NORMAL) wxglade_tmp_menu.Append(wx.NewId(), "Exit", "", wx.ITEM_NORMAL) self.main_frame_menubar.Append(wxglade_tmp_menu, "File") wxglade_tmp_menu = wx.Menu() wxglade_tmp_menu.Append(wx.NewId(), "SQL Terminal", "", wx.ITEM_CHECK) wxglade_tmp_menu.Append(wx.NewId(), "Terminal", "", wx.ITEM_CHECK) self.main_frame_menubar.Append(wxglade_tmp_menu, "View") wxglade_tmp_menu = wx.Menu() wxglade_tmp_menu.Append(wx.NewId(), "User", "", wx.ITEM_NORMAL) wxglade_tmp_menu.Append(wx.NewId(), "Properties", "", wx.ITEM_NORMAL) self.main_frame_menubar.Append(wxglade_tmp_menu, "Database") wxglade_tmp_menu = wx.Menu() wxglade_tmp_menu.Append(wx.NewId(), "Getting Started", "", wx.ITEM_NORMAL) wxglade_tmp_menu.Append(wx.NewId(), "Manual", "", wx.ITEM_NORMAL) wxglade_tmp_menu.AppendSeparator() wxglade_tmp_menu.Append(wx.NewId(), "About", "", wx.ITEM_NORMAL) self.main_frame_menubar.Append(wxglade_tmp_menu, "Help") self.SetMenuBar(self.main_frame_menubar) # Menu Bar end self.main_frame_statusbar = self.CreateStatusBar(2, 0) self.general_find_ctrl = wx.TextCtrl(self.notebook_2_pane_1, -1, "") self.label_75 = wx.StaticText(self.notebook_2_pane_1, -1, "in table") self.general_find_combo_table = wx.ComboBox(self.notebook_2_pane_1, -1, choices=["", "table2", "table3"], style=wx.CB_DROPDOWN|wx.CB_DROPDOWN|wx.CB_READONLY|wx.CB_SORT) self.label_1 = wx.StaticText(self.notebook_2_pane_1, -1, " in column ", style=wx.ALIGN_CENTRE) self.general_find_combo_column = wx.ComboBox(self.notebook_2_pane_1, -1, choices=["Line A", "Line B"], style=wx.CB_DROPDOWN|wx.CB_READONLY|wx.CB_SORT) self.general_find_button = wx.Button(self.notebook_2_pane_1, -1, "Search") self.general_find_list = wx.ListCtrl(self.notebook_2_pane_1, -1, style=wx.LC_REPORT|wx.SUNKEN_BORDER) self.label_2 = wx.StaticText(self.notebook_2_pane_2, -1, " Create new entry in table ") self.general_create_combo = wx.ComboBox(self.notebook_2_pane_2, -1, choices=["n", "m"], style=wx.CB_DROPDOWN) self.general_create_label_0 = wx.StaticText(self.notebook_2_pane_2, -1, "Table Attribute") self.general_create_ctrl_0 = wx.TextCtrl(self.notebook_2_pane_2, -1, "") self.general_create_label_1 = wx.StaticText(self.notebook_2_pane_2, -1, "Table Attribute") self.general_create_ctrl_1 = wx.TextCtrl(self.notebook_2_pane_2, -1, "") self.general_create_label_2 = wx.StaticText(self.notebook_2_pane_2, -1, "Table Attribute") self.general_create_ctrl_2 = wx.TextCtrl(self.notebook_2_pane_2, -1, "") self.general_create_label_3 = wx.StaticText(self.notebook_2_pane_2, -1, "Table Attribute") self.general_create_ctrl_3 = wx.TextCtrl(self.notebook_2_pane_2, -1, "") self.general_create_label_4 = wx.StaticText(self.notebook_2_pane_2, -1, "Table Attribute") self.general_create_ctrl_4 = wx.TextCtrl(self.notebook_2_pane_2, -1, "") self.general_create_label_5 = wx.StaticText(self.notebook_2_pane_2, -1, "Table Attribute") self.general_create_ctrl_5 = wx.TextCtrl(self.notebook_2_pane_2, -1, "") self.general_create_label_6 = wx.StaticText(self.notebook_2_pane_2, -1, "Table Attribute") self.general_create_ctrl_6 = wx.TextCtrl(self.notebook_2_pane_2, -1, "") self.general_create_label_7 = wx.StaticText(self.notebook_2_pane_2, -1, "Table Attribute") self.general_create_ctrl_7 = wx.TextCtrl(self.notebook_2_pane_2, -1, "") self.general_create_label_8 = wx.StaticText(self.notebook_2_pane_2, -1, "Table Attribute") self.general_create_ctrl_8 = wx.TextCtrl(self.notebook_2_pane_2, -1, "") self.general_create_label_9 = wx.StaticText(self.notebook_2_pane_2, -1, "Table Attribute") self.general_create_ctrl_9 = wx.TextCtrl(self.notebook_2_pane_2, -1, "") self.general_create_button = wx.Button(self.notebook_2_pane_2, -1, "Create Record") self.label_3 = wx.StaticText(self.notebook_2_pane_3, -1, "Delete records in table") self.general_delete_combo_table = wx.ComboBox(self.notebook_2_pane_3, -1, choices=["m", "n"], style=wx.CB_DROPDOWN) self.label_4 = wx.StaticText(self.notebook_2_pane_3, -1, "such that ") self.general_delete_combo_column = wx.ComboBox(self.notebook_2_pane_3, -1, choices=[], style=wx.CB_DROPDOWN) self.general_delete_radio = wx.RadioBox(self.notebook_2_pane_3, -1, "is", choices=["=", "<", ">"], majorDimension=0, style=wx.RA_SPECIFY_ROWS) self.general_delete_ctrl = wx.TextCtrl(self.notebook_2_pane_3, -1, "some value") self.button_2 = wx.Button(self.notebook_2_pane_3, -1, "Delete All") self.client_ctrl = wx.TextCtrl(self.notebook_client, -1, "") self.label_5 = wx.StaticText(self.notebook_client, -1, "in") self.client_combo = wx.ComboBox(self.notebook_client, -1, choices=[], style=wx.CB_DROPDOWN) self.button_3 = wx.Button(self.notebook_client, -1, "View") self.client_label = wx.StaticText(self.notebook_client, -1, "Client Information:\nName\nAddress\nPhone") self.client_list = wx.ListCtrl(self.notebook_client, -1, style=wx.LC_REPORT|wx.SUNKEN_BORDER) self.payment_ctrl_loan = wx.TextCtrl(self.notebook_payment, -1, "Loan Number") self.button_8 = wx.Button(self.notebook_payment, -1, "Find") self.payment_label_0 = wx.StaticText(self.notebook_payment, -1, "Loan ID") self.payment_label_loan = wx.StaticText(self.notebook_payment, -1, "#00000000") self.payment_label_1 = wx.StaticText(self.notebook_payment, -1, "Remaining Balance") self.payment_label_balance = wx.StaticText(self.notebook_payment, -1, "$0000000") self.payment_label_2 = wx.StaticText(self.notebook_payment, -1, "Payment Number") self.payment_ctrl_number = wx.TextCtrl(self.notebook_payment, -1, "") self.payment_label_3 = wx.StaticText(self.notebook_payment, -1, "Money Order") self.payment_ctrl_order = wx.TextCtrl(self.notebook_payment, -1, "") self.payment_label_4 = wx.StaticText(self.notebook_payment, -1, "Amount") self.payment_ctrl_amount = wx.TextCtrl(self.notebook_payment, -1, "") self.payment_label_5 = wx.StaticText(self.notebook_payment, -1, "Date Issued") self.payment_ctrl_date = wx.TextCtrl(self.notebook_payment, -1, "") self.button_9 = wx.Button(self.notebook_payment, -1, "Submit Payment") self.label_7 = wx.StaticText(self.notebook_viewloan, -1, "Inspector:") self.viewloan_combo = wx.ComboBox(self.notebook_viewloan, -1, choices=[], style=wx.CB_DROPDOWN) self.button_4 = wx.Button(self.notebook_viewloan, -1, "View") self.viewloan_list = wx.ListCtrl(self.notebook_viewloan, -1, style=wx.LC_REPORT|wx.SUNKEN_BORDER) self.label_32 = wx.StaticText(self.notebook_transaction, -1, "Transaction") self.transaction_transaction_ctrl_amount = wx.TextCtrl(self.notebook_transaction, -1, "") self.label_31 = wx.StaticText(self.notebook_transaction, -1, "Amount") self.transaction_ctrl_account = wx.TextCtrl(self.notebook_transaction, -1, "") self.label_37_copy_1 = wx.StaticText(self.notebook_transaction, -1, "Account Number") self.transaction_radio = wx.RadioBox(self.notebook_transaction, -1, "", choices=["credit", "debit"], majorDimension=0, style=wx.RA_SPECIFY_ROWS) self.button_7 = wx.Button(self.notebook_transaction, -1, "Commit") self.static_line_4 = wx.StaticLine(self.notebook_transaction, -1) self.label_34 = wx.StaticText(self.notebook_transaction, -1, "Transfer") self.transaction_transfer_ctrl_amount = wx.TextCtrl(self.notebook_transaction, -1, "") self.label_6 = wx.StaticText(self.notebook_transaction, -1, "Amount") self.label_35 = wx.StaticText(self.notebook_transaction, -1, "from") self.transaction_ctrl_from = wx.TextCtrl(self.notebook_transaction, -1, "") self.label_37 = wx.StaticText(self.notebook_transaction, -1, "Account Number") self.label_36 = wx.StaticText(self.notebook_transaction, -1, "to") self.transaction_ctrl_to = wx.TextCtrl(self.notebook_transaction, -1, "") self.label_37_copy = wx.StaticText(self.notebook_transaction, -1, "Account Number") self.button_7_copy = wx.Button(self.notebook_transaction, -1, "Commit") self.about_label_name = wx.StaticText(self.notebook_about, -1, "Employee Name") self.static_line_6 = wx.StaticLine(self.notebook_about, -1) self.label_52 = wx.StaticText(self.notebook_about, -1, "Employee ID") self.about_label_id = wx.StaticText(self.notebook_about, -1, "#00000") self.label_53 = wx.StaticText(self.notebook_about, -1, "Salary /hr") self.about_label_salary = wx.StaticText(self.notebook_about, -1, "$0.00") self.label_54 = wx.StaticText(self.notebook_about, -1, "Hours this month") self.about_label_hours = wx.StaticText(self.notebook_about, -1, "#00000") self.label_55 = wx.StaticText(self.notebook_about, -1, "Current paycheck") self.about_label_paycheck = wx.StaticText(self.notebook_about, -1, "$0.00") self.static_line_5 = wx.StaticLine(self.notebook_about, -1) self.label_9_copy = wx.StaticText(self.notebook_about, -1, "Last updated on") self.about_label_update = wx.StaticText(self.notebook_about, -1, "never ") self.button_6_copy = wx.Button(self.notebook_about, -1, "Refresh") self.label_29 = wx.StaticText(self.notebook_info, -1, "Bank Teller") self.label_30 = wx.StaticText(self.notebook_info, -1, "Average Salary") self.info_label_avgsalary = wx.StaticText(self.notebook_info, -1, "$0.00") self.label_30_copy = wx.StaticText(self.notebook_info, -1, "Minimum Salary") self.info_label_minsalaryamount = wx.StaticText(self.notebook_info, -1, "$0.00") self.info_label_minsalaryname = wx.StaticText(self.notebook_info, -1, "Employee Name") self.label_30_copy_1 = wx.StaticText(self.notebook_info, -1, "Maximum Salary") self.info_label_maxsalaryamount = wx.StaticText(self.notebook_info, -1, "$0.00") self.info_label_maxsalaryname = wx.StaticText(self.notebook_info, -1, "Employee Name") self.label_30_copy_2 = wx.StaticText(self.notebook_info, -1, "Most Productive") self.info_label_numaccount = wx.StaticText(self.notebook_info, -1, "Number of Accounts") self.info_label_numaccountname = wx.StaticText(self.notebook_info, -1, "Employee Name") self.static_line_3 = wx.StaticLine(self.notebook_info, -1) self.label_22 = wx.StaticText(self.notebook_info, -1, "General") self.label_23 = wx.StaticText(self.notebook_info, -1, "Most Hours") self.info_label_mosthour = wx.StaticText(self.notebook_info, -1, "Number Hours") self.info_label_mosthourname = wx.StaticText(self.notebook_info, -1, "Employee Name") self.label_24 = wx.StaticText(self.notebook_info, -1, "Least Hours") self.info_label_leasthour = wx.StaticText(self.notebook_info, -1, "Number Hours") self.info_label_leasthourname = wx.StaticText(self.notebook_info, -1, "Employee Name") self.static_line_2 = wx.StaticLine(self.notebook_info, -1) self.label_11 = wx.StaticText(self.notebook_info, -1, "Accounts") self.label_12 = wx.StaticText(self.notebook_info, -1, "Total") self.label_13 = wx.StaticText(self.notebook_info, -1, "Issued Last Month") self.label_16 = wx.StaticText(self.notebook_info, -1, "Savings") self.info_label_savingtotal = wx.StaticText(self.notebook_info, -1, "$0.00") self.info_label_savingissued = wx.StaticText(self.notebook_info, -1, "None") self.label_17 = wx.StaticText(self.notebook_info, -1, "Checking") self.info_label_checkingtotal = wx.StaticText(self.notebook_info, -1, "$0.00") self.info_label_checkingissued = wx.StaticText(self.notebook_info, -1, "None") self.static_line_1 = wx.StaticLine(self.notebook_info, -1) self.label_9 = wx.StaticText(self.notebook_info, -1, "Last updated on") self.info_label_updated = wx.StaticText(self.notebook_info, -1, "never ") self.button_6 = wx.Button(self.notebook_info, -1, "Refresh") self.label_8 = wx.StaticText(self.notebook_launch, -1, "Launch Automated System:") self.launch_combo = wx.ComboBox(self.notebook_launch, -1, choices=[], style=wx.CB_DROPDOWN) self.button_5 = wx.Button(self.notebook_launch, -1, "Go!") self.launch_list = wx.ListCtrl(self.notebook_launch, -1, style=wx.LC_REPORT|wx.SUNKEN_BORDER) self.label_66 = wx.StaticText(self.notebook_createloan, -1, "Customer") self.createloan_ctrl_customer = wx.TextCtrl(self.notebook_createloan, -1, "") self.label_68 = wx.StaticText(self.notebook_createloan, -1, "ID") self.label_67 = wx.StaticText(self.notebook_createloan, -1, "Inspector") self.createloan_combo = wx.ComboBox(self.notebook_createloan, -1, choices=[], style=wx.CB_DROPDOWN) self.label_68_copy = wx.StaticText(self.notebook_createloan, -1, "ID") self.createloan_radio = wx.RadioBox(self.notebook_createloan, -1, "Type", choices=["Mortgage", "Quick"], majorDimension=0, style=wx.RA_SPECIFY_ROWS) self.createloan_label_0 = wx.StaticText(self.notebook_createloan, -1, "Street Address") self.createloan_ctrl_street = wx.TextCtrl(self.notebook_createloan, -1, "") self.label_73 = wx.StaticText(self.notebook_createloan, -1, "Amount") self.createloan_ctrl_amount = wx.TextCtrl(self.notebook_createloan, -1, "") self.createloan_label_1 = wx.StaticText(self.notebook_createloan, -1, "City") self.createloan_label_2 = wx.StaticText(self.notebook_createloan, -1, "State") self.createloan_label_3 = wx.StaticText(self.notebook_createloan, -1, "ZIP") self.createloan_ctrl_city = wx.TextCtrl(self.notebook_createloan, -1, "") self.createloan_ctrl_state = wx.TextCtrl(self.notebook_createloan, -1, "") self.createloan_ctrl_zip = wx.TextCtrl(self.notebook_createloan, -1, "") self.label_74 = wx.StaticText(self.notebook_createloan, -1, "Description") self.createloan_ctrl_description = wx.TextCtrl(self.notebook_createloan, -1, "", style=wx.TE_MULTILINE|wx.TE_LINEWRAP) self.button_10 = wx.Button(self.notebook_createloan, -1, "Create Loan") self.__set_properties() self.__do_layout() self.Bind(wx.EVT_MENU, self.file_save_gui, id=-1) self.Bind(wx.EVT_MENU, self.file_revert_gui, id=-1) self.Bind(wx.EVT_MENU, self.file_exit_gui, id=-1) self.Bind(wx.EVT_MENU, self.view_sqlterminal_gui, id=-1) self.Bind(wx.EVT_MENU, self.view_terminal_gui, id=-1) self.Bind(wx.EVT_MENU, self.database_user_gui, id=-1) self.Bind(wx.EVT_MENU, self.database_properties_gui, id=-1) self.Bind(wx.EVT_MENU, self.help_start_gui, id=-1) self.Bind(wx.EVT_MENU, self.help_manual_gui, id=-1) self.Bind(wx.EVT_MENU, self.help_about_gui, id=-1) self.Bind(wx.EVT_COMBOBOX, self.general_find_updatetable_gui, self.general_find_combo_table) self.Bind(wx.EVT_COMBOBOX, self.general_find_updatecolumn_gui, self.general_find_combo_column) self.Bind(wx.EVT_BUTTON, self.general_find_search_gui, self.general_find_button) self.Bind(wx.EVT_COMBOBOX, self.general_create_updatetable_gui, self.general_create_combo) self.Bind(wx.EVT_BUTTON, self.general_create_create_gui, self.general_create_button) self.Bind(wx.EVT_COMBOBOX, self.general_delete_updatetable_gui, self.general_delete_combo_table) self.Bind(wx.EVT_BUTTON, self.general_delete_delete_gui, self.button_2) self.Bind(wx.EVT_BUTTON, self.client_view_gui, self.button_3) self.Bind(wx.EVT_BUTTON, self.payment_find_gui, self.button_8) self.Bind(wx.EVT_BUTTON, self.payment_submit_gui, self.button_9) self.Bind(wx.EVT_COMBOBOX, self.loan_inspector_view_select_gui, self.viewloan_combo) self.Bind(wx.EVT_BUTTON, self.loan_inspector_view_gui, self.button_4) self.Bind(wx.EVT_BUTTON, self.transaction_commit_gui, self.button_7) self.Bind(wx.EVT_BUTTON, self.transfer_commit_gui, self.button_7_copy) self.Bind(wx.EVT_BUTTON, self.about_refresh_gui, self.button_6_copy) self.Bind(wx.EVT_BUTTON, self.bank_info_refresh_gui, self.button_6) self.Bind(wx.EVT_BUTTON, self.launch_go_gui, self.button_5) self.Bind(wx.EVT_RADIOBOX, self.loan_create_type_gui, self.createloan_radio) self.Bind(wx.EVT_BUTTON, self.loan_create_create_gui, self.button_10) # end wxGlade #self.Bind(wx.EVT_CLOSE, self.close_windows_gui) def __set_properties(self): # begin wxGlade: MainWindow.__set_properties self.SetTitle("Bank") self.SetSize((1119, 858)) self.SetBackgroundColour(wx.Colour(62, 191, 255)) self.main_frame_statusbar.SetStatusWidths([-1, 150]) # statusbar fields main_frame_statusbar_fields = ["Bank", "Status"] for i in range(len(main_frame_statusbar_fields)): self.main_frame_statusbar.SetStatusText(main_frame_statusbar_fields[i], i) self.general_find_ctrl.SetFocus() self.general_find_combo_table.SetSelection(0) self.general_find_combo_column.SetSelection(-1) self.general_create_combo.SetSelection(-1) self.general_delete_combo_table.SetSelection(-1) self.general_delete_radio.SetSelection(0) self.general_delete_ctrl.SetMinSize((150, 27)) self.label_32.SetFont(wx.Font(16, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, "")) self.transaction_radio.SetSelection(0) self.label_34.SetFont(wx.Font(16, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, "")) self.about_label_name.SetFont(wx.Font(16, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, "")) self.label_9_copy.SetFont(wx.Font(10, wx.DEFAULT, wx.ITALIC, wx.NORMAL, 0, "")) self.about_label_update.SetFont(wx.Font(10, wx.DEFAULT, wx.ITALIC, wx.BOLD, 0, "")) self.label_29.SetFont(wx.Font(16, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, "")) self.label_22.SetFont(wx.Font(16, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, "")) self.label_11.SetFont(wx.Font(16, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, "")) self.label_9.SetFont(wx.Font(10, wx.DEFAULT, wx.ITALIC, wx.NORMAL, 0, "")) self.info_label_updated.SetFont(wx.Font(10, wx.DEFAULT, wx.ITALIC, wx.BOLD, 0, "")) self.createloan_radio.SetSelection(0) # end wxGlade def __do_layout(self): # begin wxGlade: MainWindow.__do_layout sizer_1 = wx.BoxSizer(wx.VERTICAL) grid_sizer_27 = wx.FlexGridSizer(5, 1, 10, 0) grid_sizer_29 = wx.FlexGridSizer(2, 2, 10, 10) createloan_grid_1 = wx.FlexGridSizer(2, 3, 10, 10) grid_sizer_30 = wx.FlexGridSizer(1, 2, 0, 10) createloan_grid_0 = wx.FlexGridSizer(2, 1, 10, 0) grid_sizer_28 = wx.FlexGridSizer(2, 3, 10, 10) grid_sizer_11 = wx.FlexGridSizer(2, 1, 10, 0) grid_sizer_12 = wx.FlexGridSizer(1, 3, 0, 10) grid_sizer_15 = wx.FlexGridSizer(7, 1, 10, 0) grid_sizer_16 = wx.FlexGridSizer(1, 3, 0, 10) grid_sizer_17 = wx.FlexGridSizer(3, 3, 10, 10) grid_sizer_18 = wx.FlexGridSizer(3, 3, 10, 10) grid_sizer_19 = wx.FlexGridSizer(5, 3, 10, 10) grid_sizer_22 = wx.FlexGridSizer(5, 1, 10, 0) grid_sizer_16_copy = wx.FlexGridSizer(1, 3, 0, 10) grid_sizer_25 = wx.FlexGridSizer(4, 2, 10, 10) grid_sizer_13 = wx.FlexGridSizer(5, 1, 10, 0) grid_sizer_21 = wx.FlexGridSizer(5, 3, 10, 10) grid_sizer_20 = wx.FlexGridSizer(3, 3, 10, 10) grid_sizer_9 = wx.FlexGridSizer(2, 1, 10, 0) grid_sizer_10 = wx.FlexGridSizer(1, 3, 0, 10) grid_sizer_26 = wx.FlexGridSizer(8, 2, 10, 10) grid_sizer_7 = wx.FlexGridSizer(3, 1, 10, 0) grid_sizer_8 = wx.FlexGridSizer(1, 4, 0, 10) sizer_3 = wx.BoxSizer(wx.HORIZONTAL) grid_sizer_6 = wx.FlexGridSizer(3, 3, 10, 10) grid_sizer_3 = wx.FlexGridSizer(3, 1, 0, 0) grid_sizer_5 = wx.GridSizer(11, 2, 5, 10) grid_sizer_4 = wx.FlexGridSizer(1, 2, 0, 0) grid_sizer_1 = wx.FlexGridSizer(2, 1, 10, 0) grid_sizer_33 = wx.FlexGridSizer(1, 6, 0, 10) grid_sizer_33.Add(self.general_find_ctrl, 0, wx.EXPAND, 0) grid_sizer_33.Add(self.label_75, 0, wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_33.Add(self.general_find_combo_table, 0, 0, 0) grid_sizer_33.Add(self.label_1, 0, wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_33.Add(self.general_find_combo_column, 0, 0, 0) grid_sizer_33.Add(self.general_find_button, 0, 0, 0) grid_sizer_33.AddGrowableCol(0) grid_sizer_1.Add(grid_sizer_33, 1, wx.EXPAND, 0) grid_sizer_1.Add(self.general_find_list, 1, wx.EXPAND, 0) self.notebook_2_pane_1.SetSizer(grid_sizer_1) grid_sizer_1.AddGrowableRow(1) grid_sizer_1.AddGrowableCol(0) grid_sizer_4.Add(self.label_2, 0, 0, 0) grid_sizer_4.Add(self.general_create_combo, 0, wx.EXPAND, 0) grid_sizer_4.AddGrowableCol(1) grid_sizer_3.Add(grid_sizer_4, 1, wx.EXPAND, 0) grid_sizer_5.Add(self.general_create_label_0, 0, wx.ALIGN_RIGHT, 0) grid_sizer_5.Add(self.general_create_ctrl_0, 0, wx.EXPAND, 0) grid_sizer_5.Add(self.general_create_label_1, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_5.Add(self.general_create_ctrl_1, 0, wx.EXPAND, 0) grid_sizer_5.Add(self.general_create_label_2, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_5.Add(self.general_create_ctrl_2, 0, wx.EXPAND, 0) grid_sizer_5.Add(self.general_create_label_3, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_5.Add(self.general_create_ctrl_3, 0, wx.EXPAND, 0) grid_sizer_5.Add(self.general_create_label_4, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_5.Add(self.general_create_ctrl_4, 0, wx.EXPAND, 0) grid_sizer_5.Add(self.general_create_label_5, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_5.Add(self.general_create_ctrl_5, 0, wx.EXPAND, 0) grid_sizer_5.Add(self.general_create_label_6, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_5.Add(self.general_create_ctrl_6, 0, wx.EXPAND, 0) grid_sizer_5.Add(self.general_create_label_7, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_5.Add(self.general_create_ctrl_7, 0, wx.EXPAND, 0) grid_sizer_5.Add(self.general_create_label_8, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_5.Add(self.general_create_ctrl_8, 0, wx.EXPAND, 0) grid_sizer_5.Add(self.general_create_label_9, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_5.Add(self.general_create_ctrl_9, 0, wx.EXPAND, 0) grid_sizer_5.Add((20, 20), 0, 0, 0) grid_sizer_5.Add((20, 20), 0, 0, 0) grid_sizer_3.Add(grid_sizer_5, 1, wx.EXPAND, 0) grid_sizer_3.Add(self.general_create_button, 0, wx.ALIGN_RIGHT, 0) self.notebook_2_pane_2.SetSizer(grid_sizer_3) grid_sizer_3.AddGrowableCol(0) grid_sizer_6.Add(self.label_3, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_6.Add(self.general_delete_combo_table, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_6.Add(self.label_4, 0, wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_6.Add(self.general_delete_combo_column, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_6.Add(self.general_delete_radio, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_6.Add(self.general_delete_ctrl, 0, wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_6.Add((20, 20), 0, 0, 0) grid_sizer_6.Add((20, 20), 0, 0, 0) grid_sizer_6.Add(self.button_2, 0, 0, 0) self.notebook_2_pane_3.SetSizer(grid_sizer_6) grid_sizer_6.AddGrowableCol(2) self.notebook_2.AddPage(self.notebook_2_pane_1, "Find") self.notebook_2.AddPage(self.notebook_2_pane_2, "Create") self.notebook_2.AddPage(self.notebook_2_pane_3, "Delete") sizer_3.Add(self.notebook_2, 1, wx.EXPAND, 0) self.notebook_general.SetSizer(sizer_3) grid_sizer_8.Add(self.client_ctrl, 0, wx.EXPAND, 0) grid_sizer_8.Add(self.label_5, 0, wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_8.Add(self.client_combo, 0, 0, 0) grid_sizer_8.Add(self.button_3, 0, 0, 0) grid_sizer_8.AddGrowableCol(0) grid_sizer_7.Add(grid_sizer_8, 1, wx.EXPAND, 0) grid_sizer_7.Add(self.client_label, 0, 0, 0) grid_sizer_7.Add(self.client_list, 1, wx.EXPAND, 0) self.notebook_client.SetSizer(grid_sizer_7) grid_sizer_7.AddGrowableRow(2) grid_sizer_7.AddGrowableCol(0) grid_sizer_26.Add(self.payment_ctrl_loan, 0, wx.EXPAND, 0) grid_sizer_26.Add(self.button_8, 0, 0, 0) grid_sizer_26.Add(self.payment_label_0, 0, 0, 0) grid_sizer_26.Add(self.payment_label_loan, 0, 0, 0) grid_sizer_26.Add(self.payment_label_1, 0, 0, 0) grid_sizer_26.Add(self.payment_label_balance, 0, 0, 0) grid_sizer_26.Add(self.payment_label_2, 0, 0, 0) grid_sizer_26.Add(self.payment_ctrl_number, 0, 0, 0) grid_sizer_26.Add(self.payment_label_3, 0, 0, 0) grid_sizer_26.Add(self.payment_ctrl_order, 0, 0, 0) grid_sizer_26.Add(self.payment_label_4, 0, 0, 0) grid_sizer_26.Add(self.payment_ctrl_amount, 0, 0, 0) grid_sizer_26.Add(self.payment_label_5, 0, 0, 0) grid_sizer_26.Add(self.payment_ctrl_date, 0, 0, 0) grid_sizer_26.Add(self.button_9, 0, 0, 0) grid_sizer_26.Add((20, 20), 0, 0, 0) self.notebook_payment.SetSizer(grid_sizer_26) grid_sizer_10.Add(self.label_7, 0, wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_10.Add(self.viewloan_combo, 0, wx.EXPAND, 0) grid_sizer_10.Add(self.button_4, 0, 0, 0) grid_sizer_10.AddGrowableCol(1) grid_sizer_9.Add(grid_sizer_10, 1, wx.EXPAND, 0) grid_sizer_9.Add(self.viewloan_list, 1, wx.EXPAND, 0) self.notebook_viewloan.SetSizer(grid_sizer_9) grid_sizer_9.AddGrowableRow(1) grid_sizer_9.AddGrowableCol(0) grid_sizer_13.Add(self.label_32, 0, 0, 0) grid_sizer_20.Add((20, 20), 0, 0, 0) grid_sizer_20.Add(self.transaction_transaction_ctrl_amount, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_20.Add(self.label_31, 0, wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_20.Add((20, 20), 0, 0, 0) grid_sizer_20.Add(self.transaction_ctrl_account, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_20.Add(self.label_37_copy_1, 0, wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_20.Add((20, 20), 0, 0, 0) grid_sizer_20.Add(self.transaction_radio, 0, 0, 0) grid_sizer_20.Add(self.button_7, 0, wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_20.AddGrowableCol(2) grid_sizer_13.Add(grid_sizer_20, 1, wx.EXPAND, 0) grid_sizer_13.Add(self.static_line_4, 0, wx.EXPAND, 0) grid_sizer_13.Add(self.label_34, 0, 0, 0) grid_sizer_21.Add((20, 20), 0, 0, 0) grid_sizer_21.Add(self.transaction_transfer_ctrl_amount, 0, wx.ALIGN_CENTER_HORIZONTAL, 0) grid_sizer_21.Add(self.label_6, 0, wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_21.Add(self.label_35, 0, wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_21.Add(self.transaction_ctrl_from, 0, wx.ALIGN_CENTER_HORIZONTAL, 0) grid_sizer_21.Add(self.label_37, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_21.Add(self.label_36, 0, wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_21.Add(self.transaction_ctrl_to, 0, wx.ALIGN_CENTER_HORIZONTAL, 0) grid_sizer_21.Add(self.label_37_copy, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_21.Add((20, 20), 0, 0, 0) grid_sizer_21.Add((20, 20), 0, 0, 0) grid_sizer_21.Add(self.button_7_copy, 0, 0, 0) grid_sizer_21.AddGrowableCol(1) grid_sizer_13.Add(grid_sizer_21, 1, wx.EXPAND, 0) self.notebook_transaction.SetSizer(grid_sizer_13) grid_sizer_22.Add(self.about_label_name, 0, 0, 0) grid_sizer_22.Add(self.static_line_6, 0, wx.EXPAND, 0) grid_sizer_25.Add(self.label_52, 0, 0, 0) grid_sizer_25.Add(self.about_label_id, 0, 0, 0) grid_sizer_25.Add(self.label_53, 0, 0, 0) grid_sizer_25.Add(self.about_label_salary, 0, 0, 0) grid_sizer_25.Add(self.label_54, 0, 0, 0) grid_sizer_25.Add(self.about_label_hours, 0, 0, 0) grid_sizer_25.Add(self.label_55, 0, 0, 0) grid_sizer_25.Add(self.about_label_paycheck, 0, 0, 0) grid_sizer_22.Add(grid_sizer_25, 1, wx.EXPAND, 0) grid_sizer_22.Add(self.static_line_5, 0, wx.EXPAND, 0) grid_sizer_16_copy.Add(self.label_9_copy, 0, wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_16_copy.Add(self.about_label_update, 0, wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_16_copy.Add(self.button_6_copy, 0, 0, 0) grid_sizer_16_copy.AddGrowableCol(0) grid_sizer_16_copy.AddGrowableCol(1) grid_sizer_16_copy.AddGrowableCol(2) grid_sizer_22.Add(grid_sizer_16_copy, 1, wx.EXPAND, 0) self.notebook_about.SetSizer(grid_sizer_22) grid_sizer_19.Add(self.label_29, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_19.Add((20, 20), 0, 0, 0) grid_sizer_19.Add((20, 20), 0, 0, 0) grid_sizer_19.Add(self.label_30, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_19.Add(self.info_label_avgsalary, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_19.Add((20, 20), 0, 0, 0) grid_sizer_19.Add(self.label_30_copy, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_19.Add(self.info_label_minsalaryamount, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_19.Add(self.info_label_minsalaryname, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_19.Add(self.label_30_copy_1, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_19.Add(self.info_label_maxsalaryamount, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_19.Add(self.info_label_maxsalaryname, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_19.Add(self.label_30_copy_2, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_19.Add(self.info_label_numaccount, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_19.Add(self.info_label_numaccountname, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_19.AddGrowableCol(0) grid_sizer_19.AddGrowableCol(1) grid_sizer_19.AddGrowableCol(2) grid_sizer_15.Add(grid_sizer_19, 1, wx.EXPAND, 0) grid_sizer_15.Add(self.static_line_3, 0, wx.EXPAND, 0) grid_sizer_18.Add(self.label_22, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_18.Add((20, 20), 0, 0, 0) grid_sizer_18.Add((20, 20), 0, 0, 0) grid_sizer_18.Add(self.label_23, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_18.Add(self.info_label_mosthour, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_18.Add(self.info_label_mosthourname, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_18.Add(self.label_24, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_18.Add(self.info_label_leasthour, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_18.Add(self.info_label_leasthourname, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_18.AddGrowableCol(0) grid_sizer_18.AddGrowableCol(1) grid_sizer_18.AddGrowableCol(2) grid_sizer_15.Add(grid_sizer_18, 1, wx.EXPAND, 0) grid_sizer_15.Add(self.static_line_2, 0, wx.EXPAND, 0) grid_sizer_17.Add(self.label_11, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_17.Add(self.label_12, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_17.Add(self.label_13, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_17.Add(self.label_16, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_17.Add(self.info_label_savingtotal, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_17.Add(self.info_label_savingissued, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_17.Add(self.label_17, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_17.Add(self.info_label_checkingtotal, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_17.Add(self.info_label_checkingissued, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_17.AddGrowableCol(0) grid_sizer_17.AddGrowableCol(1) grid_sizer_17.AddGrowableCol(2) grid_sizer_15.Add(grid_sizer_17, 1, wx.EXPAND, 0) grid_sizer_15.Add(self.static_line_1, 0, wx.EXPAND, 0) grid_sizer_16.Add(self.label_9, 0, wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_16.Add(self.info_label_updated, 0, wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_16.Add(self.button_6, 0, 0, 0) grid_sizer_16.AddGrowableCol(0) grid_sizer_16.AddGrowableCol(1) grid_sizer_16.AddGrowableCol(2) grid_sizer_15.Add(grid_sizer_16, 1, wx.EXPAND, 0) self.notebook_info.SetSizer(grid_sizer_15) grid_sizer_15.AddGrowableRow(1) grid_sizer_15.AddGrowableRow(3) grid_sizer_15.AddGrowableRow(5) grid_sizer_15.AddGrowableCol(0) grid_sizer_12.Add(self.label_8, 0, 0, 0) grid_sizer_12.Add(self.launch_combo, 0, wx.EXPAND, 0) grid_sizer_12.Add(self.button_5, 0, 0, 0) grid_sizer_12.AddGrowableCol(1) grid_sizer_11.Add(grid_sizer_12, 1, wx.EXPAND, 0) grid_sizer_11.Add(self.launch_list, 1, wx.EXPAND, 0) self.notebook_launch.SetSizer(grid_sizer_11) grid_sizer_11.AddGrowableRow(1) grid_sizer_11.AddGrowableCol(0) grid_sizer_28.Add(self.label_66, 0, wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_28.Add(self.createloan_ctrl_customer, 0, wx.EXPAND, 0) grid_sizer_28.Add(self.label_68, 0, wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_28.Add(self.label_67, 0, wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_28.Add(self.createloan_combo, 0, wx.EXPAND, 0) grid_sizer_28.Add(self.label_68_copy, 0, wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_28.AddGrowableCol(1) grid_sizer_27.Add(grid_sizer_28, 1, wx.EXPAND, 0) grid_sizer_29.Add(self.createloan_radio, 0, 0, 0) createloan_grid_0.Add(self.createloan_label_0, 0, 0, 0) createloan_grid_0.Add(self.createloan_ctrl_street, 0, wx.EXPAND, 0) createloan_grid_0.AddGrowableCol(0) grid_sizer_29.Add(createloan_grid_0, 1, wx.EXPAND, 0) grid_sizer_30.Add(self.label_73, 0, wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_30.Add(self.createloan_ctrl_amount, 0, wx.EXPAND, 0) grid_sizer_29.Add(grid_sizer_30, 1, wx.EXPAND, 0) createloan_grid_1.Add(self.createloan_label_1, 0, 0, 0) createloan_grid_1.Add(self.createloan_label_2, 0, 0, 0) createloan_grid_1.Add(self.createloan_label_3, 0, 0, 0) createloan_grid_1.Add(self.createloan_ctrl_city, 0, 0, 0) createloan_grid_1.Add(self.createloan_ctrl_state, 0, 0, 0) createloan_grid_1.Add(self.createloan_ctrl_zip, 0, 0, 0) grid_sizer_29.Add(createloan_grid_1, 1, wx.EXPAND, 0) grid_sizer_29.AddGrowableCol(0) grid_sizer_27.Add(grid_sizer_29, 1, wx.EXPAND, 0) grid_sizer_27.Add(self.label_74, 0, 0, 0) grid_sizer_27.Add(self.createloan_ctrl_description, 0, wx.EXPAND, 0) grid_sizer_27.Add(self.button_10, 0, wx.ALIGN_RIGHT, 0) self.notebook_createloan.SetSizer(grid_sizer_27) grid_sizer_27.AddGrowableRow(3) grid_sizer_27.AddGrowableCol(0) self.notebook_1.AddPage(self.notebook_general, "General") self.notebook_1.AddPage(self.notebook_client, "Client") self.notebook_1.AddPage(self.notebook_payment, "Loan Payment") self.notebook_1.AddPage(self.notebook_viewloan, "View Loan") self.notebook_1.AddPage(self.notebook_transaction, "Transactions") self.notebook_1.AddPage(self.notebook_about, "About Me") self.notebook_1.AddPage(self.notebook_info, "Bank Info") self.notebook_1.AddPage(self.notebook_launch, "Launch") self.notebook_1.AddPage(self.notebook_createloan, "Create Loan") sizer_1.Add(self.notebook_1, 1, wx.EXPAND, 0) self.SetSizer(sizer_1) self.Layout() # end wxGlade def file_save_gui(self, event): # wxGlade: MainWindow. print "Event handler `file_save_gui' not implemented!" event.Skip() def file_revert_gui(self, event): # wxGlade: MainWindow. print "Event handler `file_revert_gui' not implemented!" event.Skip() def file_exit_gui(self, event): # wxGlade: MainWindow. print "Event handler `file_exit_gui' not implemented!" event.Skip() def view_sqlterminal_gui(self, event): # wxGlade: MainWindow. print "Event handler `view_sqlterminal_gui' not implemented!" event.Skip() def view_terminal_gui(self, event): # wxGlade: MainWindow. print "Event handler `view_terminal_gui' not implemented!" event.Skip() def database_user_gui(self, event): # wxGlade: MainWindow. print "Event handler `database_user_gui' not implemented!" event.Skip() def database_properties_gui(self, event): # wxGlade: MainWindow. print "Event handler `database_properties_gui' not implemented!" event.Skip() def help_start_gui(self, event): # wxGlade: MainWindow. print "Event handler `help_start_gui' not implemented!" event.Skip() def help_manual_gui(self, event): # wxGlade: MainWindow. print "Event handler `help_manual_gui' not implemented!" event.Skip() def help_about_gui(self, event): # wxGlade: MainWindow. print "Event handler `help_about_gui' not implemented!" event.Skip() #---------------------- def general_find_updatetable_gui(self, event): # wxGlade: MainWindow. general_find_updatetable(self, event) def general_find_updatecolumn_gui(self, event): # wxGlade: MainWindow. general_find_updatecolumn(self, event) def general_find_search_gui(self, event): # wxGlade: MainWindow. general_find_search(self, event) def general_create_updatetable_gui(self, event): # wxGlade: MainWindow. general_create_updatetable(self, event) def general_create_create_gui(self, event): # wxGlade: MainWindow. general_create_create(self, event) def general_delete_updatetable_gui(self, event): # wxGlade: MainWindow. general_delete_updatetable(self, event) def general_delete_delete_gui(self, event): # wxGlade: MainWindow. general_delete_delete(self, event) def client_view_gui(self, event): # wxGlade: MainWindow. client_view(self, event) def payment_find_gui(self, event): # wxGlade: MainWindow. payment_find(self, event) def payment_submit_gui(self, event): # wxGlade: MainWindow. payment_submit(self, event) def loan_inspector_view_select_gui(self, event): # wxGlade: MainWindow. loan_inspector_view_select(self, event) def loan_inspector_view_gui(self, event): # wxGlade: MainWindow. loan_inspector_view(self, event) def transaction_commit_gui(self, event): # wxGlade: MainWindow. transaction_commit(self, event) def transfer_commit_gui(self, event): # wxGlade: MainWindow. transfer_commit(self, event) def about_refresh_gui(self, event): # wxGlade: MainWindow. about_refresh(self, event) def bank_info_refresh_gui(self, event): # wxGlade: MainWindow. bank_info_refresh(self, event) def launch_go_gui(self, event): # wxGlade: MainWindow. launch_go(self, event) def loan_create_type_gui(self, event): # wxGlade: MainWindow. loan_create_type(self, event) def loan_create_create_gui(self, event): # wxGlade: MainWindow. loan_create_create(self, event) def close_windows_gui(self, event): close_windows(self, event) # end of class MainWindow class LoginDialog(wx.Dialog): def __init__(self, *args, **kwds): # begin wxGlade: LoginDialog.__init__ kwds["style"] = wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER|wx.THICK_FRAME wx.Dialog.__init__(self, *args, **kwds) self.label_14 = wx.StaticText(self, -1, "Username ") self.ctrl_username = wx.TextCtrl(self, -1, "") self.label_15 = wx.StaticText(self, -1, "Password ") self.ctrl_password = wx.TextCtrl(self, -1, "", style=wx.TE_PASSWORD) self.button_1 = wx.Button(self, -1, "Login") self.__set_properties() self.__do_layout() self.Bind(wx.EVT_BUTTON, self.check_login_gui, self.button_1) # end wxGlade #self.Bind(wx.EVT_CLOSE, self.close_windows_gui) def __set_properties(self): # begin wxGlade: LoginDialog.__set_properties self.SetTitle("Bank Login") self.SetSize((312, 131)) self.ctrl_username.SetFocus() # end wxGlade def __do_layout(self): # begin wxGlade: LoginDialog.__do_layout sizer_5 = wx.BoxSizer(wx.VERTICAL) grid_sizer_2 = wx.FlexGridSizer(3, 2, 10, 0) grid_sizer_2.Add(self.label_14, 0, wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_2.Add(self.ctrl_username, 0, wx.EXPAND, 0) grid_sizer_2.Add(self.label_15, 0, wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_2.Add(self.ctrl_password, 0, wx.EXPAND, 0) grid_sizer_2.Add((20, 20), 0, 0, 0) grid_sizer_2.Add(self.button_1, 0, wx.ALIGN_RIGHT, 0) grid_sizer_2.AddGrowableCol(1) sizer_5.Add(grid_sizer_2, 1, wx.EXPAND, 0) self.SetSizer(sizer_5) self.Layout() # end wxGlade def check_login_gui(self, event): # wxGlade: LoginDialog. check_login(self, event) def close_windows_gui(self, event): close_windows(self, event) # end of class LoginDialog #include database_gui is included (pasted) here ### ### feature/bug: make the general_create labels and ctrls dynamically show/hide ### problem only shows when user resizes window ### tried self.Layout(), self.Update(), self.Refresh() ### Semisolution: hide in that method, then show in same method ###SOLVED!!! ### ###bug: general_find_delete, select table, then delete something ### then select a different table, first table column still selected ### ( and hence can be used ) import psycopg2 import psycopg2.extras import datetime ### ### possible bug: sql_list_tables gets *all* tables that don't start with pg and sql ### may include tables not in the correct database ### sql_list_tables = "select tablename from pg_tables where tablename !~ '^pg_+' AND tablename !~ '^sql_+'" system_functions = ("system_overdraft_alert()- Send alerts to customers with outstanding overdrafts", "system_payroll_log()- Generate this month's payroll") #user type access user_permissions = { '' : (''), 'global': ('address', 'office', 'customer', 'department', 'interest_table'), 'loan_inspector' : None, 'loan_officer' : ('loan', 'payment', 'quick', 'mortgage', 'customer_loan'), 'teller' : ('account', 'checking', 'history', 'saving', 'transfer', 'transaction', 'customer_account'), 'manager' : ('empl_status', 'employee', 'hourly_based', 'contract_based', 'attendance', 'payroll_log'), 'superuser': ('users') } username = '' usertype = '' userid = '' #the employeeid of the current user prefetch = False dbconn = psycopg2.connect('user=clewis port=8523 dbname=bank') dbconn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT) #--------------------------------------------------------------- #support functions #--------------------------------------------------------------- def database_query(sql): #sql is a string containing the sql statement, possibly with python %s stuff #variables is a dictionary that can be used to replace with try: curs = dbconn.cursor(cursor_factory=psycopg2.extras.DictCursor) curs.execute(sql) result = curs.fetchall() curs.close() return result except psycopg2.ProgrammingError, e: print 'Error Caught!' print e return dict() except psycopg2.IntegrityError, e: print 'Error Caught!' print 'That action is not allowed. It might make the database inconsistent' print e message = 'Error Caught!\nThat action is not allowed. It\nmight make the database inconsistent' alert_frame.alert_label.SetLabel(message) alert_frame.Show() return dict() except psycopg2.InternalError, e: print 'Error Caught!' print 'It probably has to do with transactions...' print e #print 'Restarting transaction...' return dict() def get_column_labels(table): #returns a list of the columns #old way (works on tables with at least one element) """ column_list = database_query("SELECT * FROM %(table)s LIMIT 1", {'table' : table}) if(len(column_list) == 0): print "get_column_labels(): Can not retrieve columns for table %s. Table must have at least one entry" % table column_list = column_list[0].keys() """ temp = database_query("SELECT column_name FROM information_schema.columns WHERE table_name = '%s';" % table) column_list = list() for row in temp: column_list.append(row[0]) return column_list def get_column_type(table): #returns a dictionary of the column types temp = database_query("SELECT column_name, data_type FROM information_schema.columns WHERE table_name = '%s';" % table) columns = dict() for row in temp: columns[row[0]] = row[1] return columns def convert(type, data): #converts and returns data to fit the type #uses postgresql datatypes in type if(type == 'integer'): try: ret = int(data) return ret except ValueError: #could not convert to int pass elif(type == 'numeric'): try: ret = float(data) return ret except ValueError: #could not convert to float pass elif(type == 'text'): try: #put it in to quotes ret = "'%s'" % data return ret except ValueError: #could not convert to string pass elif(type == 'character'): try: ret = "'%s'" % data return ret except ValueError: #could not convert to int pass elif(type == 'date'): #currently assumes input of MDY try: date = data.split('/') if(len(date) == 1): date = data.split('-') if(len(date) == 3): ret = "cast('%s %s %s' AS date)" % (date[0], date[1], date[2]) return ret except: pass else: print "Could not determine datatype %s for data %s" % (type, data) return data def create_insert_statement(table, data): #creates a "safer" insert statement (with the columns being explicitly labeled) if(len(data) == 0): #no data to insert return #get the column datatypes column_type = get_column_type(table) #print "Column types:" #for key in column_type: # print "column %s is %s" % (key, column_type[key]) sql = 'INSERT INTO %s(' % table for key in data: sql += "%s," % key sql = sql[:(len(sql)-1)] #slice off the last comma sql += ") VALUES (" for key in data: sql += "%s," % convert(column_type[key], data[key]) sql = sql[:(len(sql)-1)] #slice off the last comma sql += ");" return sql def alert(message): #message = "general_find_search(): must have a valid table" print message alert_frame.alert_label.SetLabel(message) alert_frame.Show() #--------------------------------------------------------------- #bank database support functions #--------------------------------------------------------------- def system_overdraft_alert(self): sql = """SELECT account.account_no, balance, name, surname, email, road, city, state, zip FROM account, address, customer_account, customer WHERE customer.customerid = customer_account.customerid AND customer_account.account_no = account.account_no AND customer.addressid = address.addressid AND type = 'C' AND balance < 0;""" result = database_query(sql) if(len(result) == 0): print "system_ovordraft_alert(): no results for query" message = "system_ovordraft_alert(): no results for query" alert(message) return column_list = result[0].keys() self.launch_list.ClearAll() for col in column_list: self.launch_list.InsertColumn(-1, col) for data in result: temp = list() for col in column_list: temp.append(data[col]) self.launch_list.Append(temp) def system_payroll_log(self): pass #--------------------------------------------------------------- #event handlers #--------------------------------------------------------------- def general_find_updatetable(self, event): #print "Event handler `general_find_updatetable' not implemented!" #load general_find_combo_column with the attribute list table = self.general_find_combo_table.GetValue() column_list = get_column_labels(table) self.general_find_combo_column.Clear() self.general_find_combo_column.SetValue('') for col in column_list: self.general_find_combo_column.Append(col) event.Skip() def general_find_updatecolumn(self, event): print "Event handler `general_find_updatecolumn' not implemented!" event.Skip() def general_find_search(self, event): query = self.general_find_ctrl.GetValue() table = self.general_find_combo_table.GetValue() column = self.general_find_combo_column.GetValue() sql_var = dict() sql_var['query'] = query sql_var['table'] = table sql_var['column'] = column sql = "" if(len(table) == 0): message = "general_find_search(): must have a valid table" alert(message) return if(len(query) == 0): sql = "SELECT * FROM %(table)s" else: if(len(column) == 0): message = "general_find_search(): must have a valid column" alert(message) return sql = "SELECT * FROM %(table)s WHERE %(column)s = '%(query)s'" results = database_query(sql % sql_var) if(len(results) == 0): message = "general_find_search(): no results for query" alert(message) return column_list = results[0].keys() self.general_find_list.ClearAll() for col in column_list: self.general_find_list.InsertColumn(-1, col) for data in results: temp = list() for col in column_list: temp.append(data[col]) self.general_find_list.Append(temp) event.Skip() def general_create_updatetable(self, event): #need to look up the table's attributes and # --- unhide enought labels and ctrls for each # --- reword the labels to match #?implement database table = self.general_create_combo.GetValue() column_list = get_column_labels(table) count = len(column_list) print 'general create table column count = %s' % count #We can now show the create button self.general_create_button.Show() #Hide the create stuff self.general_create_label_0.Hide() self.general_create_label_1.Hide() self.general_create_label_2.Hide() self.general_create_label_3.Hide() self.general_create_label_4.Hide() self.general_create_label_5.Hide() self.general_create_label_6.Hide() self.general_create_label_7.Hide() self.general_create_label_8.Hide() self.general_create_label_9.Hide() self.general_create_ctrl_0.Hide() self.general_create_ctrl_1.Hide() self.general_create_ctrl_2.Hide() self.general_create_ctrl_3.Hide() self.general_create_ctrl_4.Hide() self.general_create_ctrl_5.Hide() self.general_create_ctrl_6.Hide() self.general_create_ctrl_7.Hide() self.general_create_ctrl_8.Hide() self.general_create_ctrl_9.Hide() #show the used labels and ctrls if(count > 0): self.general_create_label_0.SetLabel(column_list[0]) self.general_create_label_0.Show() self.general_create_ctrl_0.Clear() self.general_create_ctrl_0.Show() if(count > 1): self.general_create_label_1.SetLabel(column_list[1]) self.general_create_label_1.Show() self.general_create_ctrl_1.Clear() self.general_create_ctrl_1.Show() if(count > 2): self.general_create_label_2.SetLabel(column_list[2]) self.general_create_label_2.Show() self.general_create_ctrl_2.Clear() self.general_create_ctrl_2.Show() if(count > 3): self.general_create_label_3.SetLabel(column_list[3]) self.general_create_label_3.Show() self.general_create_ctrl_3.Clear() self.general_create_ctrl_3.Show() if(count > 4): self.general_create_label_4.SetLabel(column_list[4]) self.general_create_label_4.Show() self.general_create_ctrl_4.Clear() self.general_create_ctrl_4.Show() if(count > 5): self.general_create_label_5.SetLabel(column_list[5]) self.general_create_label_5.Show() self.general_create_ctrl_5.Clear() self.general_create_ctrl_5.Show() if(count > 6): self.general_create_label_6.SetLabel(column_list[6]) self.general_create_label_6.Show() self.general_create_ctrl_6.Clear() self.general_create_ctrl_6.Show() if(count > 7): self.general_create_label_7.SetLabel(column_list[7]) self.general_create_label_7.Show() self.general_create_ctrl_7.Clear() self.general_create_ctrl_7.Show() if(count > 8): self.general_create_label_8.SetLabel(column_list[8]) self.general_create_label_8.Show() self.general_create_ctrl_8.Clear() self.general_create_ctrl_8.Show() if(count > 9): self.general_create_label_9.SetLabel(column_list[9]) self.general_create_label_9.Show() self.general_create_ctrl_9.Clear() self.general_create_ctrl_9.Show() if(count > 10): print "Error: table %s has too many columns to fit in general_create" % table event.Skip() def general_create_create(self, event): #?implement database table = self.general_create_combo.GetValue() column_list = get_column_labels(table) count = len(column_list) data = dict() if(count > 0): if(len(self.general_create_ctrl_0.GetValue()) <> 0): data[self.general_create_label_0.GetLabel()] = self.general_create_ctrl_0.GetValue() if(count > 1): if(len(self.general_create_ctrl_1.GetValue()) <> 0): data[self.general_create_label_1.GetLabel()] = self.general_create_ctrl_1.GetValue() if(count > 2): if(len(self.general_create_ctrl_2.GetValue()) <> 0): data[self.general_create_label_2.GetLabel()] = self.general_create_ctrl_2.GetValue() if(count > 3): if(len(self.general_create_ctrl_3.GetValue()) <> 0): data[self.general_create_label_3.GetLabel()] = self.general_create_ctrl_3.GetValue() if(count > 4): if(len(self.general_create_ctrl_4.GetValue()) <> 0): data[self.general_create_label_4.GetLabel()] = self.general_create_ctrl_4.GetValue() if(count > 5): if(len(self.general_create_ctrl_5.GetValue()) <> 0): data[self.general_create_label_5.GetLabel()] = self.general_create_ctrl_5.GetValue() if(count > 6): if(len(self.general_create_ctrl_6.GetValue()) <> 0): data[self.general_create_label_6.GetLabel()] = self.general_create_ctrl_6.GetValue() if(count > 7): if(len(self.general_create_ctrl_7.GetValue()) <> 0): data[self.general_create_label_7.GetLabel()] = self.general_create_ctrl_7.GetValue() if(count > 8): if(len(self.general_create_ctrl_8.GetValue()) <> 0): data[self.general_create_label_8.GetLabel()] = self.general_create_ctrl_8.GetValue() if(count > 9): if(len(self.general_create_ctrl_9.GetValue()) <> 0): data[self.general_create_label_9.GetLabel()] = self.general_create_ctrl_9.GetValue() message = "New entry in table %s:\n" % table for i in data: message += '---%s == %s\n' % (i, data[i]) alert(message) sql = create_insert_statement(table, data) print sql; database_query(sql) event.Skip() def general_delete_updatetable(self, event): #print "Event handler `general_delete_updatetable' not implemented!" #very similar to general_find_updatetable #load general_delete_combo_column with the attribute list table = self.general_delete_combo_table.GetValue() column_list = get_column_labels(table) self.general_delete_combo_column.Clear() self.general_delete_combo_column.SetValue('') for col in column_list: self.general_delete_combo_column.Append(col) event.Skip() def general_delete_delete(self, event): #print "Event handler `general_delete_delete' not implemented!" #?implement database table = self.general_delete_combo_table.GetValue() column = self.general_delete_combo_column.GetValue() comparison = self.general_delete_radio.GetStringSelection() value = self.general_delete_ctrl.GetValue() #print "If table %s column %s is %s '%s' then delete" % (table, column, comparison, value) column_type = get_column_type(table) sql = "DELETE FROM %s WHERE %s %s %s;" % (table, column, comparison, convert(column_type[column], value)) print sql database_query(sql) event.Skip() def client_view(self, event): #print "Event handler `client_view' not implemented!" column = self.client_combo.GetValue() value = self.client_ctrl.GetValue() #get the client information sql = """SELECT customer.customerid, name, surname, phone, email, road, city, state, zip FROM customer, address WHERE customer.addressid = address.addressid AND customer.%s = %s""" sql = sql % (column, value) result = database_query(sql) self.client_list.ClearAll() if(len(result) == 0): alert("No results found...") self.client_label.SetLabel("No Results found...") return if(len(result) > 1): alert("Multiple results found... Please refine your search.") self.client_label.SetLabel("Multiple results found... Please refine your search.") return #Only one line of result customer_data_output = """%(name)s %(surname)s (ID: %(customerid)s) Address: %(road)s, %(city)s, %(state)s %(zip)s Phone: %(phone)s * Email: %(email)s""" customer_data_output = customer_data_output % result[0] #print customer_data_output self.client_label.SetLabel(customer_data_output) sql = """SELECT history_id, history.account_no AS account_no, amount, on_date, duration FROM customer_account, history WHERE customerid = %(customerid)s AND customer_account.account_no = history.account_no;""" sql = sql % result[0] result = database_query(sql) if(len(result) == 0): alert("client_history(): no history for client") return column_list = result[0].keys() self.client_list.ClearAll() for col in column_list: self.client_list.InsertColumn(-1, col) for data in result: temp = list() for col in column_list: temp.append(data[col]) self.client_list.Append(temp) event.Skip() def payment_find(self, event): #print "Event handler `payment_find' not implemented!" loan_no = self.payment_ctrl_loan.GetValue() result = database_query("SELECT amount FROM loan WHERE loan_no = %s" % loan_no) self.payment_label_loan.SetLabel(loan_no) if(len(result) == 0): alert('Cannot find matching loan') self.payment_label_balance.SetLabel("Not Found") event.Skip() return #found a valid loan #guarenteed to be only one (loan_no primary key) self.payment_label_balance.SetLabel("$%s" % result[0]['amount']) event.Skip() def payment_submit(self, event): data = dict() data['payment_no'] = self.payment_ctrl_number.GetValue() data['money_order'] = self.payment_ctrl_order.GetValue() data['amount'] = self.payment_ctrl_amount.GetValue() data['date_issued'] = self.payment_ctrl_date.GetValue() data['loan_no'] = self.payment_label_loan.GetLabel() sql = create_insert_statement('payment', data) print sql #create payment record database_query(sql) #debit the amount from the loan amount = float(self.payment_label_balance.GetLabel().strip('$')) amount = amount - float(data['amount']) sql = "UPDATE loan SET amount = %s WHERE loan_no = %s;" % (amount, data['loan_no']) print sql database_query(sql) event.Skip() def loan_inspector_view_select(self, event): print "Event handler `loan_inspector_view_select' not implemented!" event.Skip() def loan_inspector_view(self, event): #print "Event handler `loan_inspector_view' not implemented!" id = self.viewloan_combo.GetValue().split('-')[1] #Get the loans inspected by an inspector sql = """SELECT loan.loan_no, approved, amount, date_created, office_no, employeeid, customerid FROM loan, customer_loan WHERE loan.loan_no = customer_loan.loan_no AND supervisorid = %s;""" sql = sql % id result = database_query(sql) if(len(result) == 0): print "loan_inspector_view(): no loans under control" return column_list = result[0].keys() self.viewloan_list.ClearAll() for col in column_list: self.viewloan_list.InsertColumn(-1, col) for data in result: temp = list() for col in column_list: temp.append(data[col]) self.viewloan_list.Append(temp) event.Skip() def transaction_commit(self, event): #print "Event handler `transaction_commit' not implemented!" amount = self.transaction_transaction_ctrl_amount.GetValue() account = self.transaction_ctrl_account.GetValue() sign = '' type = '' if(self.transaction_radio.GetStringSelection() == "credit"): sign = '+' type = 'C' else: sign = '-' type = 'D' sql = "UPDATE account SET balance = balance %s %s WHERE account_no = %s" % (sign, amount, account) database_query(sql) print sql now = datetime.datetime.now() data = dict() data['account_no'] = account data['amount'] = amount data['type'] = type data['date_created'] = "%s-%s-%s" % (now.month, now.day, now.year) sql = create_insert_statement("transaction", data) print sql database_query(sql) event.Skip() def transfer_commit(self, event): amount = self.transaction_transfer_ctrl_amount.GetValue() account_to = self.transaction_ctrl_to.GetValue() account_from = self.transaction_ctrl_from.GetValue() print 'I should do a transaction here...' print 'aka...database_query("BEGIN") #begin sql transaction' sql = "UPDATE account SET balance = balance - %s WHERE account_no = %s" % (amount, account_from) database_query(sql) sql = "UPDATE account SET balance = balance + %s WHERE account_no = %s" % (amount, account_to) database_query(sql) now = datetime.datetime.now() data = dict() data['account_to'] = account_to data['account_from'] = account_from data['amount'] = amount data['date_created'] = "%s-%s-%s" % (now.month, now.day, now.year) data['employeeid'] = userid sql = create_insert_statement("transfer", data) print sql database_query(sql) #database_query('COMMIT') event.Skip() def about_refresh(self, event): sql = "SELECT name, surname FROM employee WHERE employeeid = %s" % userid result = database_query(sql) if(len(result) == 0): alert("Current User %s is not in employee table" % userid) return self.about_label_name.SetLabel("%(name)s %(surname)s" % result[0]) self.about_label_id.SetLabel(userid) sql = """SELECT payment_rate FROM empl_status, employee WHERE empl_status.emp_statusid = employee.emp_statusid AND employeeid = %s""" sql = sql % userid result = database_query(sql) if(len(result) == 0): alert("Current User %s is not a hourly based employee" % userid) return salary = result[0]['payment_rate'] self.about_label_salary.SetLabel("$%s" % salary) sql = """SELECT sum(extract (epoch from check_out) - extract (epoch from check_in))/(60 * 60) ,employeeid FROM attendance WHERE extract(month FROM localtimestamp) = extract(month FROM check_out) AND extract(year FROM localtimestamp) = extract(year FROM check_out) AND employeeid = %s GROUP BY employeeid;""" sql = sql % userid result = database_query(sql) hours = 0 paycheck = 0 if(len(result) == 1): hours = result[0][0] paycheck = hours * salary self.about_label_hours.SetLabel("%s" % hours) self.about_label_paycheck.SetLabel("%s" % paycheck) now = datetime.datetime.now() self.about_label_update.SetLabel("%s-%s-%s" % (now.month, now.day, now.year)) event.Skip() def bank_info_refresh(self, event): print "Event handler `bank_info_refresh' not fully implemented!" #Get the average salary average = database_query("SELECT avg(payment_rate) FROM empl_status, employee, hourly_based WHERE empl_status.emp_statusid = employee.emp_statusid AND employee.employeeid = hourly_based.employeeid;") if(len(average) <> 0): self.info_label_avgsalary.SetLabel("%s" % average[0][0]) else: self.info_label_avgsalary.SetLabel('0') #Get the maximum salary max_sal = database_query("SELECT max(payment_rate) FROM empl_status, employee, hourly_based WHERE empl_status.emp_statusid = employee.emp_statusid AND employee.employeeid = hourly_based.employeeid;") max_sal_name = database_query("SELECT name, surname FROM empl_status, employee, hourly_based WHERE empl_status.emp_statusid = employee.emp_statusid AND employee.employeeid = hourly_based.employeeid AND payment_rate = %s;" % max_sal[0][0]) if(len(max_sal) <> 0): self.info_label_maxsalaryamount.SetLabel("$%s" % max_sal[0][0]) else: self.info_label_maxsalaryamount.SetLabel("---") if(len(max_sal_name) == 1): self.info_label_maxsalaryname.SetLabel("%(name)s %(surname)s" % max_sal_name[1]) else: self.info_label_maxsalaryname.SetLabel("---") #Get the minimum salary min_sal = database_query("SELECT min(payment_rate) FROM empl_status, employee, hourly_based WHERE empl_status.emp_statusid = employee.emp_statusid AND employee.employeeid = hourly_based.employeeid;") min_sal_name = database_query("SELECT name, surname FROM empl_status, employee, hourly_based WHERE empl_status.emp_statusid = employee.emp_statusid AND employee.employeeid = hourly_based.employeeid AND payment_rate = %s;" % min_sal[0][0]) if(len(min_sal) <> 0): self.info_label_minsalaryamount.SetLabel("$%s" % min_sal[0][0]) else: self.info_label_minsalaryamount.SetLabel("---") if(len(min_sal_name) == 1): self.info_label_minsalaryname.SetLabel("%(name)s %(surname)s" % min_sal_name[1]) else: self.info_label_minsalaryname.SetLabel("---") #Get the most productive max_productive_list = database_query("SELECT count(*) AS total ,employeeid FROM account WHERE extract(month FROM localtimestamp) = extract(month FROM date_created) GROUP BY employeeid ORDER BY total DESC;") max_productive = max_productive_list[0]['total'] max_productive_id = max_productive_list[0]['employeeid'] self.info_label_numaccount.SetLabel("%s" % max_productive) self.info_label_numaccountname.SetLabel("%s" % max_productive_id) #Get the general number of hours most_hours_list = database_query("SELECT sum(extract (epoch from check_out) - extract (epoch from check_in))/(60 * 60) AS total_hours ,employeeid FROM attendance WHERE extract(month FROM localtimestamp) = extract(month FROM check_out) AND extract(year FROM check_out) = extract(year FROM localtimestamp) GROUP BY employeeid ORDER BY employeeid DESC;") if(len(most_hours_list) <> 0): self.info_label_mosthour.SetLabel("$%s" % most_hours_list[0][0]) else: self.info_label_mosthour.SetLabel("---") if(len(most_hours_list) == 1): self.info_label_mosthourname.SetLabel("%(employeeid)s" % most_hours_list[0]) else: self.info_label_mosthourname.SetLabel("---") #Get the general number of hours least least_hours_list = database_query("SELECT sum(extract (epoch from check_out) - extract (epoch from check_in))/(60 * 60) AS total_hours ,employeeid FROM attendance WHERE extract(month FROM localtimestamp) = extract(month FROM check_out) AND extract(year FROM check_out) = extract(year FROM localtimestamp) GROUP BY employeeid ORDER BY employeeid ASC;") if(len(least_hours_list) <> 0): self.info_label_leasthour.SetLabel("$%s" % least_hours_list[0][0]) else: self.info_label_leasthour.SetLabel("---") if(len(least_hours_list) == 1): self.info_label_leasthourname.SetLabel("%(employeeid)s" % least_hours_list[0]) else: self.info_label_leasthourname.SetLabel("---") event.Skip() def launch_go(self, event): selection = self.launch_combo.GetValue().split('-')[0] if(selection == "system_overdraft_alert()"): system_overdraft_alert(self) else: alert("Function %s is not supported!" % selection) event.Skip() def loan_create_type(self, event): #print "Event handler `loan_create_type' not implemented!" type = self.createloan_radio.GetStringSelection() if(type == "Mortgage"): self.createloan_ctrl_street.Show() self.createloan_ctrl_city.Show() self.createloan_ctrl_state.Show() self.createloan_ctrl_zip.Show() self.createloan_label_0.Show() self.createloan_label_1.Show() self.createloan_label_2.Show() self.createloan_label_3.Show() else: self.createloan_ctrl_street.Hide() self.createloan_ctrl_city.Hide() self.createloan_ctrl_state.Hide() self.createloan_ctrl_zip.Hide() self.createloan_label_0.Hide() self.createloan_label_1.Hide() self.createloan_label_2.Hide() self.createloan_label_3.Hide() event.Skip() def loan_create_create(self, event): #print "Event handler `loan_create_create' not implemented!" #---update the loan table now = datetime.datetime.now() data = dict() data['date_created'] = "%s-%s-%s" % (now.month, now.day, now.year) data['office_no'] = database_query("SELECT office_no FROM employee WHERE employeeid = %s" % userid)[0]['office_no'] data['supervisorid'] = self.createloan_combo.GetValue().split('-')[1] data['employeeid'] = userid data['amount'] = self.createloan_ctrl_amount.GetValue() data['approved'] = "true" sql = create_insert_statement("loan", data) print sql database_query(sql) #---update the customer_loan table data = dict() data['customerid'] = self.createloan_ctrl_customer.GetValue() loan_no = database_query("SELECT loan_no FROM loan ORDER BY loan_no DESC LIMIT 1;")[0]['loan_no'] data['loan_no'] = loan_no sql = create_insert_statement("customer_loan", data) print sql database_query(sql) #---update either the quick or mortgage tables data = dict() data['loan_no'] = loan_no data['description'] = self.createloan_ctrl_description.GetValue() type = self.createloan_radio.GetStringSelection() if(type == "Mortgage"): #---update the address table addrdata = dict() addrdata['road'] = self.createloan_ctrl_street.GetValue() addrdata['city'] = self.createloan_ctrl_city.GetValue() addrdata['state'] = self.createloan_ctrl_state.GetValue() addrdata['zip'] = self.createloan_ctrl_zip.GetValue() sql = create_insert_statement("address", addrdata) print sql database_query(sql) addressid = database_query("SELECT addressid FROM address ORDER BY addressid DESC LIMIT 1;")[0]['addressid'] data['description'] += "\nAddress ID: %s" % addressid sql = create_insert_statement("mortgage", data) print sql database_query(sql) else: #type == quick sql = create_insert_statement("quick", data) print sql database_query(sql) event.Skip() def check_login(self, event): global username global usertype global userid username = self.ctrl_username.GetValue() password = self.ctrl_password.GetValue() result = database_query("SELECT * FROM users WHERE name = '%s' AND password = '%s'" % (username, password)) if(len(result) == 0): self.ctrl_password.Clear() alert("Invalid Login.") return usertype = result[0]['usertype'] print "Usertype: %s" % usertype userid = result[0]['employeeid'] login_frame.Close() setup_user(main_frame) main_frame.Show() event.Skip() def alert_ok(self, event): self.Hide() event.Skip() def close_windows(self, event): alert_frame.Destroy() login_frame.Destroy() #main_frame.Destroy() #--------------------------------------------------------------- def setup_user(self): tables = list() if(usertype == 'superuser'): for key in user_permissions: if(user_permissions[key] <> None): tables += user_permissions[key] else: if(user_permissions[usertype]): tables = user_permissions['global'] + user_permissions[usertype] tables = list(tables) tables.sort() self.general_find_combo_table.Clear() self.general_create_combo.Clear() self.general_delete_combo_table.Clear() for table in tables: self.general_find_combo_table.Append(table) self.general_create_combo.Append(table) self.general_delete_combo_table.Append(table) #Hide/Show tabs self.notebook_client.Hide() self.notebook_payment.Hide() self.notebook_viewloan.Hide() self.notebook_createloan.Hide() self.notebook_transaction.Hide() self.notebook_about.Hide() self.notebook_info.Hide() self.notebook_launch.Hide() print "Usertype: %s" % usertype if(usertype == 'teller'): #self.notebook_general.Show() self.notebook_transaction.Show() self.notebook_about.Show() if(usertype == 'loan_officer'): self.notebook_client.Show() self.notebook_payment.Show() #self.notebook_viewloan.Show() self.notebook_createloan.Show() if(usertype == 'loan_inspector'): self.notebook_client.Show() self.notebook_payment.Show() self.notebook_viewloan.Show() self.notebook_createloan.Show() if(usertype == 'manager'): self.notebook_info.Show() self.notebook_launch.Show() if(usertype == 'superuser'): self.notebook_client.Show() self.notebook_payment.Show() self.notebook_viewloan.Show() self.notebook_createloan.Show() self.notebook_transaction.Show() self.notebook_about.Show() self.notebook_info.Show() self.notebook_launch.Show() def setup_general(self): self.launch_combo.Clear() for sys in system_functions: self.launch_combo.Append(sys) self.general_find_combo_column.Clear() #Hide the create stuff self.general_create_label_0.Hide() self.general_create_label_1.Hide() self.general_create_label_2.Hide() self.general_create_label_3.Hide() self.general_create_label_4.Hide() self.general_create_label_5.Hide() self.general_create_label_6.Hide() self.general_create_label_7.Hide() self.general_create_label_8.Hide() self.general_create_label_9.Hide() self.general_create_ctrl_0.Hide() self.general_create_ctrl_1.Hide() self.general_create_ctrl_2.Hide() self.general_create_ctrl_3.Hide() self.general_create_ctrl_4.Hide() self.general_create_ctrl_5.Hide() self.general_create_ctrl_6.Hide() self.general_create_ctrl_7.Hide() self.general_create_ctrl_8.Hide() self.general_create_ctrl_9.Hide() self.general_create_button.Hide() self.client_combo.Clear() customer_columns = get_column_labels('customer') for col in customer_columns: self.client_combo.Append(col) #Get the names of the loan inspectors sql = """SELECT name, surname, employeeid FROM (SELECT DISTINCT supervisorid FROM loan) AS inspector, employee WHERE employeeid = supervisorid;""" inspectors = database_query(sql) #note: the '-' (dash) in the append is important! It's a delimeter to split on... self.viewloan_combo.Clear() self.createloan_combo.Clear() for row in inspectors: self.viewloan_combo.Append("%(name)s %(surname)s -%(employeeid)s" % row) self.createloan_combo.Append("%(name)s %(surname)s -%(employeeid)s" % row) def main(): app = wx.PySimpleApp(0) wx.InitAllImageHandlers() global main_frame global login_frame global alert_frame main_frame = MainWindow(None, -1, "") app.SetTopWindow(main_frame) login_frame = LoginDialog(None, -1, "") login_frame.Center(wx.CENTER_ON_SCREEN) alert_frame = AlertDialog(None, -1, "") alert_frame.Center(wx.CENTER_ON_SCREEN) setup_general(main_frame) #setup_user(main_frame) login_frame.Show() #main_frame.Show() app.MainLoop() if __name__ == "__main__": print "in main..." main()