-- 作者:czy
-- 发布时间:2012/11/11 23:53:00
--
Dim d As Date = Forms("窗口1").Controls("DateTimePicker1").value Dim d1 As Date = Forms("窗口1").Controls("DateTimePicker2").value If d = Nothing Or d1 = Nothing MessageBox.Show("请选择起始时间") Return End If
Dim nt As New DataTableBuilder("统计表") nt.AddDef("序号", Gettype(String),255) nt.AddDef("姓名", Gettype(String),255) nt.AddDef("值班时间", Gettype(String),256) nt.AddDef("值班种类", Gettype(String),255) nt.AddDef("金额", Gettype(Double),255) nt.AddDef("领款人", Gettype(String),255) nt.AddDef("备注", Gettype(String),255) nt.Build() Tables("统计表").Cols("值班时间").OpenWindow()
Dim f As New Filler f.SourceTable = DataTables("机关值班记录表") f.SourceCols = "值班员" f.DataTable = DataTables("统计表") f.DataCols = "姓名" f.Filter = "[值班时间] >= #" & d & "# And [值班时间] <= #" & d1 & "#" f.Fill()
Dim s,s1,s2,s3 As String For Each dr As DataRow In DataTables("统计表").DataRows s = "" s1 = "" s2 = "" s3 = "值班员 = \'" & dr("姓名") & "\' And [值班时间] >= #" & d & "# And [值班时间] <= #" & d1 & "#" s = DataTables("机关值班记录表").GetComboListString("值班时间",s3 & " And 值班种类 = \'白班\'") If s <> "" s = "白班" & vbcrlf & s.Replace(" 0:00:00|",vbcrlf).Replace(" 0:00:00","") End If s1 = DataTables("机关值班记录表").GetComboListString("值班时间",s3 & " And 值班种类 = \'夜班\'") If s1 <> "" s1 = "夜班" & vbcrlf & s1.Replace(" 0:00:00|",vbcrlf).Replace(" 0:00:00","") End If s2 = DataTables("机关值班记录表").GetComboListString("值班时间",s3 & " And 值班种类 = \'节假日\'") If s2 <> "" s2 = "节假日" & vbcrlf & s2.Replace(" 0:00:00|",vbcrlf).Replace(" 0:00:00","") End If dr("值班时间") = s & iif(s <> "" , vbcrlf & s1 ,s1) & iif(s1 <> "" , vbcrlf & s2 ,s2) dr("值班种类") = Iif(s <> "" ,"白班","") & iif(s1 <> "" , ",夜班" ,"") & iif(s2 <> "" , ",节假日" ,"").Trim(",") dr("金额") = DataTables("机关值班记录表").Compute("sum(价格)",s3) Next MainTable = Tables("统计表")
|