def calcFeeTotal(self): months = self.text_ctrl_months.GetValue() #rintmonths if months == 12: #rint' whole year' fee = fetch.fee_yearly(self.course_id, gVar.schYr) self.text_ctrl_description.SetValue('One off payment for whole year') self.text_ctrl_fee.Hide() fee = "{:,}".format(fee) self.text_ctrl_total_fees.SetValue(fee) else: self.text_ctrl_fee.Show() monthsMax = self.text_ctrl_months.GetMax() if months > monthsMax: months = monthsMax self.text_ctrl_months.SetValue(months) if months > 1: txt = "%s till %s" % (fetch.monthName(self.monthFrom), fetch.monthName(self.monthFrom + months -1)) self.label_fee_sd.SetLabelText('months') else: txt = "%s" % fetch.monthName(self.monthFrom) self.label_fee_sd.SetLabelText('month') self.text_ctrl_description.SetValue(txt) self.panel_rereg.Show(months == monthsMax) fee = months * self.monthly_fee # bus_fee = "{:,}".format(self.bus_fee) self.text_ctrl_total_fees.SetValue(fee) self.GetTopLevelParent().Layout()
def OnAdd(self, evt): #rint'OnAdd' product_id = fetch.cmbID(self.choice_products) #rint'product_id.GetSelection():', product_id if not product_id or self.grid_product.inGrid(product_id): return description = fetch.cmbValue(self.choice_products) price = fetch.product_price(product_id) qnty = 1 total = qnty*price product_type_id = fetch.get_product_type_id(product_id) if product_type_id == 1: # school fee #rint' append fee ' month_no = fetch.month_last_paid(student_id, gVar.schYr, 9)+1 if month_no > 12: self.panel_fees.Hide() fetch.msg('month 12 already paid for') return else: self.panel_fees.Show() month = fetch.monthName(month_no) description = 'Schoolfee for %s' % month elif product_type_id == 9: # bus fee #rint' append bus ' # last paid for month # if last month == 12 : return month_no = fetch.month_last_paid(student_id, gVar.schYr, 9)+1 if month_no > 12: fetch.msg('month 12 already paid for') # what we really need to know is if all months have been paid for return else: self.panel_bus.Show() self.Layout() month = fetch.monthName(month_no) description = 'Bus fee for %s' % month data = {'product_id':product_id, 'qnty':qnty, 'description':description, 'price':price, 'total':total} self.grid_product.appendItem(data) r = self.grid_product.GetNumberRows() self.grid_product.setCellReadOnly(r, 0)
def displayData(self, student_id): #rint'panel_fees displayData' self.student_id = student_id self.course_id = fetch.courseID_forStudent(student_id) self.monthly_fee = fetch.fee_monthly(self.course_id, gVar.schYr) lastMonthPaid = fetch.month_last_paid(student_id, gVar.schYr, 1) if lastMonthPaid==12: self.monthFrom = 0 self.panel_rereg.Show() self.panel_fees.Hide() else: self.monthFrom = lastMonthPaid + 1 if lastMonthPaid: txt = "%s" % fetch.monthName(lastMonthPaid) self.text_ctrl_description.SetValue(txt) self.text_ctrl_months.SetMax(12-lastMonthPaid) fee = "{:,}".format(self.monthly_fee) self.text_ctrl_fee.SetValue(fee) self.text_ctrl_months.SetMinSize((50, -1)) self.text_ctrl_months.SetMaxSize((50, -1)) self.Layout() #rint'text_ctrl_months.Refresh()' self.text_ctrl_months.SetFocus() self.text_ctrl_months.SelectAll()
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 OnMonthsChange(self, evt): months = self.text_ctrl_months.GetValue() if months > self.text_ctrl_months.GetMax(): months = self.text_ctrl_months.GetMax() self.text_ctrl_months.SetValue(months) if months > 1: txt = "%s till %s" % (fetch.monthName(self.monthFrom), fetch.monthName(self.monthFrom + months -1)) self.label_fee_sd.SetLabelText('months') else: txt = "%s" % fetch.monthName(self.monthFrom) self.label_fee_sd.SetLabelText('month') self.text_ctrl_fee_description.SetValue(txt) total = months * self.monthly_fee self.text_ctrl_total_fees.SetValue(total) if months == self.text_ctrl_months.GetMax(): #rint'gghfd' self.panel_rereg.Show() else: #rint'jkkk' self.panel_rereg.Hide() self.Layout()