예제 #1
0
 def dispalyDataForLastYearsKelases (self, level, row):
     # last years classes
     grid = self.grid
     sql ="SELECT Kode, Nama, Sekolah FROM Kelas WHERE course_level=%d AND TahunAjaran =%d" % (level, gVar.schYr-1)
     classes = fetch.getAllDict(sql)
     
     if classes:
         self.labelRowKelas(row)
         
         grid.AppendRows(1); row += 1
         #rintrow, 'D rows=', grid.GetNumberRows()        
         tot_now, tot_out, tot_cont, tot_retake, sub_tot, tot_tot = (0, 0, 0, 0, 0, 0) 
         for myClass in classes:
             KKode   = myClass['Kode']
             class_name = myClass['Nama']
             
             now  = fetch.batchPopulation(KKode) #GetClassPopulation
             tot_now    +=now
             cont = fetch.numberOfStudents_reregistering(KKode)
             tot_cont   +=cont
             out  = fetch.numberOfStudents_leaving(KKode)
             tot_out    += out
             retake = fetch.numberOfStudents_retaking(KKode)
             
             tot_retake += retake
             sub_tot = cont + retake
             tot_tot += sub_tot
             
             grid.SetRowAttr(row, self.attrDetailsKelas)
             grid.SetCellValue( row, 0, "Kelas")
             grid.SetCellValue( row, 1, str(KKode))
             grid.SetCellValue( row, 2, class_name)
             grid.SetCellValue( row, 3, str(now))
             grid.SetCellValue( row, 4, str(out))
             grid.SetCellValue( row, 5, str(cont))
             grid.SetCellValue( row, 6, str(retake))
             grid.SetCellValue( row, 7, str(sub_tot))
             
             grid.AppendRows(1); row += 1
             #rintrow, 'E rows=', grid.GetNumberRows()
         
         # display totals
         grid.SetRowAttr(row, self.attrTotalsKelas)
         grid.SetCellValue( row, 0, "totals")
         grid.SetCellValue( row, 3, str(tot_now))
         grid.SetCellValue( row, 4, str(tot_out))
         grid.SetCellValue( row, 5, str(tot_cont))
         grid.SetCellValue( row, 6, str(tot_retake))
         grid.SetCellValue( row, 7, str(tot_tot))
         
         grid.AppendRows(1); row += 1
         #rintrow, 'F rows=', grid.GetNumberRows()
     return row