Dim tb5 As Table=Tables("学生信息A_table5")
Dim tb10 As Table=Tables("学生信息A_table10")
Dim text1 As WinForm.TextBox= e.Form.Controls("textbox1")
Dim cb3 As WinForm.ComboBox= e.Form.Controls("combobox3")
Dim cb4 As WinForm.ComboBox= e.Form.Controls("combobox4")
Dim nj As String= e.Sender.text
tb5.F ill("Sel ect _identify ,学生姓名,身份证件号,联系电话,班级,性别,分班成绩,指定分班,预分班,备注 From {学生信息} where 学校名称=\'" & _usergroup & "\' and 年级=\'" & nj & "\' and 状态 Like \'%在读%\' order by 学生姓名","user",False)
tb5.AllowEdit=True
DataTables("学生信息A_table5").GlobalHandler.DataColChanged = True
Dim njdm As String = "\'%" & nj & "%\'"
tb10.Fill("Se lect _identify ,单位,部门 as 班级,角色,密码,是否可用,姓名 as 班主任,分班人数 From {单位用户} where 单位=\'" & _usergroup & "\' and 部门 like " & njdm & " order by 部门","user",False)
Dim bs As Integer= DataTables("单位用户").SQLCompute("count(部门)"," 部门 like " & njdm & " And 单位= \'" & _usergroup &"\'" )
tb10.SetColVisibleWidth("班级|20|班主任|20|分班人数|20")
tb10.AutoSizeCols
tb10.AllowEdit=True
Dim bslist As String
For i As Integer=1 To bs
bslist=bslist & i & "|"
Next
bslist = "| |" & bslist
bslist=bslist.trim("|")
For Each c As Col In tb5.Cols
If c.Name="指定分班"
c.AllowDirectType=False
c.ComboList = bslist
End If
Next
For Each c As Col In tb10.Cols
If c.Name="班级"
c.AllowEdit=False
End If
Next
cb3.text=bs
tb5.sort="性别,学生姓名"
text1.Enabled=True
cb4.ComboList=bslist
If tb10.DataTable.DataCols.Contains("男生")=False
tb10.DataTable.DataCols.Add("男生",Gettype(Integer))
End If
If tb10.DataTable.DataCols.Contains("女生")=False
tb10.DataTable.DataCols.Add("女生",Gettype(Integer))
End If
If tb10.DataTable.DataCols.Contains("平均成绩")=False
tb10.DataTable.DataCols.Add("平均成绩",Gettype(Decimal))
tb10.DataTable.DataCols("平均成绩").SetFormat("0.00")
End If
For Each r As Row In tb10
Dim Sum1 As Integer = tb5.Compute("count(学生姓名)","预分班=\'" & r("班级") & "\'")
Dim Sum2 As Integer = tb5.Compute("count(学生姓名)","性别=\'男\'and 预分班=\'" & r("班级") & "\'")
Dim Sum3 As Integer = tb5.Compute("count(学生姓名)","性别=\'女\' and 预分班=\'" & r("班级") & "\'")
Dim avg1 As Integer = tb5.Compute("avg(分班成绩)","预分班=\'" & r("班级") & "\'")
r("分班人数")=sum1
r("男生")=sum2
r("女生")=sum3
r("平均成绩")=avg1
Next
tb5.AutoSizeCols()
tb10.AutoSizeCols()