Пример #1
0
def genNoId(cmb, sql , first_item = '') : #sql should be designed to return two items 'id' and 'title'
    try:
        origional_str = fetch.cmbValue(cmb)
    except: origional_str = ''
    
    ##rint'origional_str', origional_str
    dataSet      = fetch.getList(sql)
    #rint dataSet
    cmb.Freeze()  # locks the combo so that other processes are not called
    cmb.Clear()
    try:
        if first_item: 
            cmb.Append(first_item, 0)
        x = 1    
        for item in dataSet:
            #rint row
            cmb.Append(str(item), x)
            x += 1
            #if x%10==0: rint x 
        #restored = restore_str(cmb, origional_str)
        
        cmb.Thaw()    
        if restored: return origional_str
        else:        return 0
    except:
        #rint 'load cmb error'
        return 0   
    cmb.Thaw()
Пример #2
0
 def OnAddDebit(self, evt):
     #rint'OnAddDebit'
     account_id = fetch.cmbID(self.choice_debits)
     #rintaccount_id
     if self.id_inListCtrl(account_id, self.list_ctrl_debits): return
     
     account    = fetch.cmbValue(self.choice_debits)
     #rint  account
     addedDebits.append((account_id, 0))
     self.list_ctrl_debits.Append((account_id, account, '0'))
Пример #3
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)
Пример #4
0
 def bus_details_changed(self):
     #rint'bus_details_changed'
 
     month_from = fetch.cmbID(self.choice_bus_from)
     month_to   = fetch.cmbID(self.choice_bus_to)
     #rint'month_from=', month_from, '    month_to=', month_to
     
     self.months = months = month_to - month_from +1
 
     #rint'months=', months
     
     if months == 1:
         month = fetch.cmbValue(self.choice_bus_from)
         txt = 'Transport for %s' % month
         
     else:
         month_from = fetch.cmbValue(self.choice_bus_from)
         month_to   = fetch.cmbValue(self.choice_bus_to)
         txt = 'Transport for %s to %s' % (month_from, month_to)
         
     self.text_ctrl_bus_details.SetValue(txt)
     self.grid_product.update_bus_details(months,txt)
Пример #5
0
    def displayData(self):
        self.Hide()
        self.Show()
        self.Refresh()
        gVar.semester = int(fetch.cmbValue(self.choice_semester))
       
        if fetch.cmbValue(self.choice_school)=="SD":
              gVar.school_id = 2
        else: gVar.school_id = 3
            
        self.list_of_lists={}
        self.purgeSizer(self.sizer_lower_left)

        res = fetch.exculSchedule_forSchSemYr(gVar.school_id, gVar.semester, gVar.schYr)

        for chkbox in self.checkboxs:
            chkbox.Freeze()
            chkbox.SetValue(False)
            chkbox.Thaw()
            
        for row in res:
            schedule_id, day = row['id'], row['day']
            self.checkboxs[day-1].SetValue(True)
            
            # create panel with heading & listCtrl
            newListCtrl = VirtualList(self.panel_lower_left, -1)
            columns=((str(schedule_id),50),(str(schedule_id),50),('c',50),('d',50),('e',50),('f',50))
            newListCtrl.SetColumns(columns)
           
            #self.list_of_lists[day-1] = newListCtrl
            self.sizer_lower_left.Add(newListCtrl, 0, wx.BOTTOM, 10)
            
            data = self.getScheduleData(schedule_id)
            data = {0: (schedule_id, str(schedule_id), 'yyyyy', 'zz', 'aaaa')}
            newListCtrl.SetItemMap(data)
            
        self.Layout()
Пример #6
0
   def OnAddCredit(self, evt):
       #rint'Add credit'
       gVar.listCtrl = 'c'
       account_id=fetch.cmbID(self.choice_credits)
 
       if self.id_in_grid(account_id, self.grid_credits): return
       
       if self.id_in_grid(account_id, self.grid_debits):
           fetch.msg('can add this account, already in debits')
       
       account = fetch.cmbValue(self.choice_credits)
       #rint'OnAddCredit', account
       
       self.grid_credits.appendItem((account_id, account, 0))
       self.grid_credits.calcTotal()
Пример #7
0
 def OnSchool(self, evt):
     if fetch.cmbValue(self.choice_school)=="SD":
         gVar.school_id = 2
     else:
         gVar.school_id = 3
     self.updateDisplay()
Пример #8
0
 def OnSemester(self, evt):
     gVar.semester = int(fetch.cmbValue(self.choice_semester))
     self.updateDisplay()