在窗口中插入一个SQL型Table:
Dim b As New SQLGroupTableBuilder("统计表","考勤表")
b.Groups.AddDef("日期",DateGroupEnum.Year,"年")
b.Groups.AddDef("班组")
b.Groups.AddDef("班序")
b.Groups.AddDef("姓名")
b.Totals.AddDef("白班")
Dim t As Table = Tables(e.form.name & "_Table1")
t.DataSource=b.BuildDataSource()
t.StopRedraw
t.Cols.Remove("白班")
Dim s,s1,s2,Ls As String
Ls = DataTables("考勤表").GetComboListString("日期","姓名 is not null","日期")
Dim Ts As String()={"白班","二班","三班","公休","事假","婚假","病假","丧假","旷工"}
With t.DataTable.DataCols
For Each s1 In Ls.split("|")
If .Contains(format(CDate(s1),"M月_d日"))=False Then
.Add(format(CDate(s1),"M月_d日"),Gettype(String),3)
End If
Next
End With
Dim dr,dr1 As DataRow
For Each dr In t.DataTable.DataRows
s = "班组= '" & dr("班组") & "'and 班序= '" & dr("班序") & "'and 姓名= '" & dr("姓名")
For Each s1 In Ls.split("|")
dr1= DataTables("考勤表").Find(s & " 'and 日期 = #" & CDate(s1) & "#")
If dr1 IsNot Nothing Then
For Each s2 In Ts
If dr1(s2) =True Then
dr(format(CDate(s1),"M月_d日")) =Left(s2,1)
Exit For
End If
Next
End If
Next
Next
t.AutoSizeCols(10)
t.ResumeRedraw