def displayData(self, student_id): loadCmb.courses_forYear(self.choice_rereg_course, gVar.schYr) self.student_id = student_id #rint'displayData', student_id lastMonthPaid = self.lastMonthPaid() if lastMonthPaid==12: self.panel_rereg.Show() self.panel_fees.Hide() else: self.monthFrom = lastMonthPaid + 1 if lastMonthPaid: txt = "%s" % fetch.monthName(self.monthFrom) self.text_ctrl_fee_description.SetValue(txt) self.text_ctrl_months.SetMax(12-lastMonthPaid) sql = "SELECT monthly_fee \ FROM students_by_form \ WHERE student_id = %d" % self.student_id self.monthly_fee = fetch.getDig(sql) fee = "{:,}".format(self.monthly_fee) self.text_ctrl_monthly_fee.SetValue(fee) self.OnMonthsChange(wx.Event) self.Layout
def __init__(self, *args, **kwds): kwds["style"] = wx.TAB_TRAVERSAL wx.Panel.__init__(self, *args, **kwds) self.monthFrom = 0 self.monthly_fee = 0 self.panel_fees = wx.Panel(self, -1) self.label_fees = wx.StaticText(self.panel_fees, -1, 'School Fee') self.chkbox_fees = wx.CheckBox(self.panel_fees, -1, '') self.panel_ctrls_fees = wx.Panel(self.panel_fees, -1) self.text_ctrl_months = masked.NumCtrl(self.panel_ctrls_fees, -1, value=1) self.label_fee_sd = wx.StaticText(self.panel_ctrls_fees, -1, 'month') self.text_ctrl_description = wx.TextCtrl(self.panel_ctrls_fees, -1) self.text_ctrl_fee = masked.NumCtrl(self.panel_ctrls_fees, -1, style = wx.ALIGN_RIGHT) self.text_ctrl_total_fees = masked.NumCtrl(self.panel_ctrls_fees, -1, value=0) # -------------------------------- self.panel_rereg = wx.Panel(self, -1) self.label_rereg = wx.StaticText(self.panel_rereg, -1, 'Re-regester') self.chkbox_rereg = wx.CheckBox(self.panel_rereg, -1, '') self.panel_ctrls_rereg = wx.Panel(self.panel_rereg, -1) self.label_course = wx.StaticText(self.panel_ctrls_rereg, -1, 'Join course:') self.choice_course = wx.Choice(self.panel_ctrls_rereg, -1) self.text_ctrl_course_fee = masked.NumCtrl(self.panel_ctrls_rereg, -1, value=0) #self.text_ctrl_rereg_total = masked.NumCtrl(self.panel_ctrls_rereg, -1, value=0) self.Bind(wx.EVT_CHECKBOX, self.OnChRereg, self.chkbox_rereg) self.Bind(wx.EVT_TEXT, self.OnMonthsChange, self.text_ctrl_months) self.Bind(wx.EVT_CHECKBOX, self.OnChFee, self.chkbox_fees) self.Bind(wx.EVT_CHOICE, self.OnCourse, self.choice_course) self.__do_settings() self.__do_layout() loadCmb.courses_forYear(self.choice_course, gVar.schYr) self.OnCourse(wx.Event)