'''
Dim dr1,dr2 As DataRow
Dim Cb1,Cb2,mk As String
Cb1 = e.form.Controls("ComboBox1").value
Cb2 = e.form.Controls("ComboBox2").value
dim h As integer= date.now.hour
Dim Da As DataTable = DataTables("固定")
Dim ls As List(of DataRow) = da.Select("停止时间 Is null")
if cb1 Is Nothing then
MessageBox.Show("请输入客户ID!", "提示")
Else
if Cb2 > "" then
mk = "[客户ID] = '" & Cb1 & "'and [开始时间] = #"& Cb2 & "#"
Else
mk = "[客户ID] = '" & Cb1 & "'"
End if
dr1 = Da.Find(mk)
dr2 = DataTables("临时").Find(mk.Replace("开始","使用"))
If dr1 Is Nothing OrElse dr2 Is Nothing Then
MessageBox.Show("不存在此记录!", "提示")
Else
For Each dr1 in Ls
Dim d As Date = dr1("开始时间")
dr1("日期差") = (date.Today-d).days+iif(h >11,1,0)
Next
Dim dtb As New DataTableBuilder("查询")
dtb.AddDef("客户ID", GetType(String),10)
dtb.AddDef("项目", GetType(String), 32)
dtb.AddDef("单价", GetType(Integer))
dtb.AddDef("数量", GetType(Integer))
dtb.AddDef("小计", GetType(Integer))
dtb.AddDef("开始时间", GetType(Date))
dtb.AddDef("停止时间", GetType(Date))
dtb.AddDef("金额", GetType(Integer))
dtb.AddDef("类型", GetType(String),2)
dtb.Build()
dim f As New Filler
f.SourceTable = Da '指定数据来源
f.SourceCols = "客户ID,项目,单价,数量,小计,开始时间,停止时间,金额,类型"
f.DataTable = DataTables("查询") '指定数据接收表
f.DataCols = "客户ID,项目,单价,数量,小计,开始时间,停止时间,金额,类型"
f.Filter = mk
f.Fill() '填充数据
f.SourceTable = DataTables("临时")
f.SourceCols = "客户ID,项目,单价,数量,小计,使用时间,小计,类型"
f.DataTable = DataTables("查询")
f.DataCols = "客户ID,项目,单价,数量,小计,开始时间,金额,类型"
f.Filter = mk.Replace("开始","使用")
f.Fill() '填充数据
MainTable = Tables("查询")
end if
end if