是写在项目事件的AfterOpenProject中:
'制作值班表
Dim dr6 As DataRow = DataTables("值班表").Find("", "日期 desc")
Dim ary6() As String = {"张三","李四","王五","陈六","赵七","刘八"}
Dim sidx6 As Integer = 0
Dim sd6 As Date
If dr6 Is Nothing Then
sidx6 = 0
sd6 = Date.Today
Else
sidx6 = array.Indexof(ary6, dr6("姓名"))
sidx6 = iif(sidx6 = ary6.Length-1, 0, sidx6+1)
sd6 = Cdate(dr6("日期")).AddDays(1)
End If
Dim ed6 As Date = Date.today.Adddays(7)
Dim d As Date = sd6
Do While d <= ed6
Dim nr As Row = Tables("值班表").AddNew
nr("日期") = d
nr("姓名") = ary6(((d-sd6).Days+sidx6) Mod 6)
d = d.AddDays(1)
Loop
Dim dt7 As DataTable = DataTables("值班表")
Dim fdr6 As DataRow = dt7.Find("日期 = #" & Date.today.adddays(-1) & "#")
Dim str7 As String = ""
If fdr6 IsNot Nothing Then
str7 &= " 值班人员:昨天:" & fdr6("姓名")
Else
str7 &= " 值班人员:昨天:没人"
End If
fdr6 = dt7.Find("日期 = #" & Date.today & "#")
If fdr6 IsNot Nothing Then
str7 &= " ,今天:" & fdr6("姓名")
Else
str7 &= " ,今天:没人"
End If
fdr6 = dt7.Find("日期 = #" & Date.today.adddays(1) & "#")
If fdr6 IsNot Nothing Then
str7 &= " ,明天:" & fdr6("姓名")
Else
str7 &= " ,明天:没人"
End If
fdr6 = dt7.Find("日期 = #" & Date.today.adddays(2) & "#")
If fdr6 IsNot Nothing Then
str7 &= " ,后天:" & fdr6("姓名")
Else
str7 &= " ,后天:没人"
End If
StatusBar.Message1 = str7