Exemplo n.º 1
0
    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)
Exemplo n.º 2
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()
Exemplo n.º 3
0
 def displayData(self, sid):
     #rint'displayData', sid
     
     global student_id, NoInduk, student_name, form_name
     student_id = sid
     
     NoInduk      = fetch.NoInduk(student_id, gVar.schYr)
     student_name = fetch.studentFullName(student_id)
     form_name    = fetch.formName(fetch.formID_forStudent(student_id))
     
     ck_ref       = 'xxxx-xxx'
     inv_date     = '2015-12-1'
     
     self.panel_header.display_header()
     
     loadCmb.products(self.choice_products)
     self.panel_fees.displayData(student_id)
     inv_total = 0
     invoice_date  = ''
     ck_ref    = ''
     self.invoice_details = {'amount':   inv_total,
                             'ck_ref':   ck_ref,
                             'date':     inv_date,
                             'schYr':    gVar.schYr,
                             'name':     student_name,
                             'NoInduk':  NoInduk,
                             'form_name':form_name}
     
     self.invoice_items = {}
     
     product_type_id = 1 # school fee
     min_month = fetch.month_last_paid(student_id, gVar.schYr, product_type_id)
     self.load_cmb_months(min_month)
     
     self.months = 1
     self.Layout