Dim dtb As New DataTableBuilder("每周菜谱")
dtb.AddDef("年级组", Gettype(String),20)
dtb.AddDef("日期", Gettype(String), 20)
dtb.AddDef("星期", Gettype(String), 6)
dtb.AddDef("菜名", Gettype(String),20)
dtb.AddDef("餐别", Gettype(String),20)
dtb.AddDef("材料数量单位", Gettype(String),255)
dtb.Build()
DataTables("每周菜谱").DataCols("日期").SetDateTimeFormat(DatetimeformatEnum.Date)
Dim dt As DataTable = DataTables("每周菜谱")
Dim d1 As Date = Date.Today
InputValue(d1, "日期筛选","请输入开始日期:")
d1 = new Date(year(d1),Month(d1),day(d1))
Dim d2 As Date = Date.Today
InputValue(d2, "日期筛选","请输入结束日期:")
d2 = new Date(year(d2),Month(d2),day(d2))
For Each cb As String() In DataTables("Sheet1").GetValues("年级组|日期|星期|菜名|餐别","日期 >= #" & d1 & "# And 日期 <= #" & d2 & "#")
Dim dr As DataRow = dt.AddNew
dr("日期") = cdate(cb(1))
dr("星期") = cb(2)
dr("年级组") = cb(0)
dr("菜名") = cb(3)
dr("餐别") = cb(4)
Dim str As String = ""
Dim s2 As String = DataTables("菜谱").SQLGetComboListString("菜品材料 & 数量 & 单位","年级组 = '" & cb(0) & "' And 日期=#" & cb(1) & "# and 星期='" & cb(2) & "' and 菜名='" & cb(3) & "' and 餐别='" & cb(4) & "'")
str = str & vbcrlf & s2.Replace("|",",")
dr("材料数量单位") = str
Next
Tables("每周菜谱").AutoSizeCols
Tables("每周菜谱").AutoSizeRows