def createListCtrl(self, excul_id, itemNo):#posit, excul_id): list_ctrl_id = 1000 + int(excul_id) list_ctrl_name = 'exculid:%d' % excul_id list_ctrl = wx.ListCtrl(self.panel_list_ctrls, list_ctrl_id, size = (200,200), style=wx.LC_REPORT |wx.BORDER_SUNKEN) title = fetch.excul_activityTitle_forExcul(excul_id) self.initListCtrl(list_ctrl, title) r, c = round(itemNo/4), itemNo%4 self.sizer_excul.Add(list_ctrl, (r,c)) sql = "SELECT s.id, s.first_name, b.name \ FROM students s \ JOIN batch_students bs ON s.id = bs.student_id \ JOIN batches b ON b.id = bs.batch_id \ JOIN excul_students es ON s.id = es.student_id \ WHERE es.excul_id =%d" % excul_id lv.populate(list_ctrl, sql) return list_ctrl
def loadStudentPool(self): school_id = fetch.schoolID_forExculSet(self.exculset_id) return self.exculList = fetch.excul_groups_forExculSet(self.exculset_id) exculID_list = ','.join([str(x[0]) for x in self.exculList]) sql = "SELECT student_id FROM excul_students WHERE FIND_IN_SET(excul_id , '%s') " % exculID_list res = fetch.getAll_col(sql) in_excul_list = ','.join([str(x[0]) for x in res]) sql ="SELECT s.id, s.first_name, b.name \ FROM students s \ LEFT JOIN nis n ON s.id = n.student_id \ JOIN batch_students bs ON s.id = bs.student_id \ JOIN batches b ON b.id = bs.batch_id \ WHERE %d BETWEEN n.admission_year AND n.withdrew_year\ AND n.school_id = %d \ AND NOT FIND_IN_SET(s.id, '%s') \ GROUP BY s.id \ ORDER BY s.id \ LIMIT 90" % (gVar.schYr, school_id, in_excul_list) lv.populate(self.list_ctrl_pool, sql)