参考
Dim n1 As WinForm.NumericComboBox = e.Form.Controls("NumericComboBox1")
Dim n2 As WinForm.NumericComboBox = e.Form.Controls("NumericComboBox2")
Dim filter As String = "1=1"
If n1.value <> Nothing Then
filter &= " and 进入本单位时间 >= #" & new Date(n1.value, 1, 1) & "#"
End If
If n2.value <> Nothing Then
filter &= " and 进入本单位时间 < #" & new Date(n2.value+1, 1, 1) & "#"
End If
Dim ck As WinForm.CheckedListBox = e.Form.Controls("CheckedListBox1")
Dim groupcols As new List(of String)
For i As Integer = 0 To ck.Items.count - 1 '获取已经勾选的列
If ck.GetItemChecked(i) Then
Select Case ck.Items(i)
Case "按职务统计"
groupcols.add("现任职务")
Case "按级别统计"
groupcols.add("级别")
Case "按专业技术职务统计"
groupcols.add("专业技术职务")
Case "按学历统计"
groupcols.add("学历")
Case "按政治面貌务统计"
groupcols.add("政治面貌")
End Select
End If
Next
Dim g As New CrossTableBuilder("统计表1", DataTables("人事档案基础信息"))
g.HGroups.AddDef("进入本单位时间", DateGroupEnum.Year, "加入本单位年度")
g.HGroups.AddDef("所在部门")
For Each c As String In groupcols
g.HGroups.AddDef(c)
Next
g.VGroups.AddDef("性别")
g.Totals.AddDef("姓名", AggregateEnum.Count, "人数")
g.HorizontalTotal = True
g.VerticalTotal = True
g.filter = filter
Tables("统计_Table1").DataSource = g.BuildDataSource