def updateData(self):
        sql ="SELECT courses FROM courses_by_year WHERE schYr = %s" % 2015
        
        sql ="SELECT course_level, course_name FROM courses ORDER BY course_level, course_name"
        results = fetch.getAll_dict(sql)
        #rint'courses', results
        
        #for 
        
        
        sql = "SELECT cSiswa.Kode , courses.course_name, cSiswa.Nama , cSiswa.Status \
                FROM cSiswa INNER JOIN courses ON cSiswa.Kelas = courses.id \
               WHERE cSiswa.TahunAjaran = %s" % gVar.schYr

        schoolKode = 0
        if gVar.school == "CG":            schoolKode = 1
        if gVar.school == "SD":            schoolKode = 2    
        if gVar.school == "SMP":           schoolKode = 3    
        if gVar.school == "SMA":           schoolKode = 4     
  
        #rintgVar.school, schoolKode
        if schoolKode:
            #rint"School"
            #sqlSch = " AND courses.school_id = %d" % schoolKode
            #sql = "%s%s" % (sql, sqlSch)
  
        sql = "%s%s" % (sql, " ORDER BY courses.course_level, cSiswa.Nama"  )

        #sql = "SELECT Kode, Nama, Status FROM cSiswa \
        #      WHERE TahunAjaran = %s" % gVar.schYr
        
        #sql = "SELECT course_name \
        #        FROM courses "
        
        #rintsql
        results = fetch.getAll_dict(sql)
        #rintlen(results), "Results "
        print

        results = fetch.DATA(sql)
        ##rint"DATA = " , results
        self.list.PopulateList(results)

    def __do_layout(self):
        sizer_main = wx.BoxSizer( wx.VERTICAL)
        sizer_main.Add(self.list, 1, wx.EXPAND | wx.ALL, 0)
        self.SetSizer(sizer_main)
Beispiel #2
0
def appendRes(cmb, sql):
    index=1
    dict ={}
    res=fetch.getAll_dict(sql)
    for row in res:
        id = row['addrItem_id']
        title = row['name']
        next_id = fetch.nextItemID(id)
        nextItem = fetch.addrItemName(next_id)
        cmb.Append(title, id)
        dict[index] = id
        index += 1
    return dict
    def populateSelectionList(self):
	selection_list =[]
        sql = "SELECT courses.id, courses.course_name, courses.course_level \
	         FROM courses \
	   INNER JOIN courses_by_year \
	           ON (int(courses.id) = int(courses_by_year.course_id)) \
		WHERE courses_by_year.schYr = %s" % gVar.schYr
        results = fetch.getAll_dict(sql)
	
        if results:
            self.update = True
            for row  in results:
                course_id, course_name, x    = row
                course_level = "%02d" % row[2]
                selection_list.append((course_id, course_name, course_level))
            
        else:
            self.update = False
	return 	selection_list
Beispiel #4
0
def teachers(cmb, firsttitle=''):
    genAdd(cmb," SELECT id, first_name \
              FROM employees \
             WHERE status = TRUE AND teacher=1", 'New employee')
    return
    ###rint sql
    
    dataSet = fetch.getAll_dict(sql)
    ###rint dataSet
    originalIndex = int(cmb.GetSelection())
    select = 0
    
    if originalIndex > -1:  origional_id = cmb.GetClientData(originalIndex) 
    else:                   origional_id = 0
        
    
    cmb.Freeze()  # locks the combo so that other events are not called
    cmb.Clear()
    if firsttitle:
        cmb.Append(firsttitle, 0) # add a blank
        
    
    if schid > 0:
        index = 1
        for row in dataSet:
            schIDs = row['schools'].split(',')
            if schid in schIDs:
                id    = row['id']
                title = row['first_name']
                cmb.Append(title, id)
                if id == origional_id: select = index
                index += 1
    else:
        index = 1
        for row in dataSet:
            id = row[0]
            title = str(row[1])
            cmb.Append(title, id)
            if id == origional_id:select = index
            index += 1
    cmb.Select(0)
    if originalIndex > -1: cmb.Select(select) 
    cmb.Thaw()
Beispiel #5
0
def schFees(cmb):
    origionalItem = cmb.GetSelection()
    if origionalItem > -1:  origional_id = cmb.GetClientData(origionalItem)
        
    cmb.Freeze()
    cmb.Clear()
    
    sql = " SELECT fee_id, feeType, feeAmount, description \
              FROM schoolfees \
             WHERE validTillYr >= 2010"
    ###rint sql
    res = fetch.getAll_dict(sql)
    if res:
        cmb.Append('',0)
        for row in res:
            id = row['fee_id']
            title = "%s : %s" % (row['feeType'], row['feeAmount'])
            cmb.Append(title, id)
            
        cmb.Select(0)
    cmb.Thaw()
    
    if origionalItem > 0: cmb.Select(origional_id)