Dim hcrk As new SQLJoinTableBuilder("入库明细查询","耗材_入库明细")
hcrk.C
hcrk.AddTable("耗材_入库明细","药品代码","门诊药房信息","代码")
hcrk.AddTable("耗材_入库明细","入库单号","耗材_入库单据","入库单号")
hcrk.AddExp("药品编号","代码")
hcrk.AddExp("名称","药品名")
hcrk.AddExp("类型","分类")
hcrk.AddCols("规格","单位","数量")
hcrk.AddExp("单价","{耗材_入库明细}.进价")
hcrk.AddExp("金额","数量*{耗材_入库明细}.进价")
hcrk.AddExp("厂家信息","{耗材_入库明细}.生产厂家")
hcrk.AddExp("单据编号","{耗材_入库明细}.入库单号")
hcrk.AddCols("入库日期","审核日期","审核人","入库方式")
hcrk.AddExp("入库仓库","仓库编号")
hcrk.AddCols("供应商")
hcrk.AddExp("备注","{耗材_入库明细}.备注")
hcrk.Build()
MainTable = Tables("入库明细查询")
\'Tables("耗材入库查询汇总_入库明细查询").Fill(hcrk.BuildSql,"zfrj",True)
Dim Filter As String
With e.Form.Controls("ComboBox1")
If .Value IsNot Nothing Then
Filter = "入库仓库 = \'" & .Value & "\'"
End If
End With
With e.Form.Controls("ComboBox2")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "入库方式 = \'" & .Value & "\'"
End If
End With
With e.Form.Controls("ComboBox3")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "供应商 = \'" & .Value & "\'"
End If
End With
With e.Form.Controls("DateTimePicker1")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "入库日期 >= #" & .Value & "#"
End If
End With
With e.Form.Controls("DateTimePicker2")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "入库日期 <= #" & .Value & "#"
End If
End With
If e.Form.Controls("RadioButton1").Checked = True \' 如果点击状态选择了"按入库单"
If Filter >"" Then
Tables("入库单").Filter = Filter
End If
End If
If e.Form.Controls("RadioButton2").Checked = True \' 如果点击状态选择了"按明细"
If Filter >"" Then
Tables("耗材入库查询汇总_入库明细查询").Filter = Filter
End If
End If
If e.Form.Controls("RadioButton3").Checked = True \' 如果点击状态选择了"按明细汇总"
If Filter >"" Then
Tables("入库明细汇总").Filter = Filter
End If
End If
If e.Form.Controls("RadioButton4").Checked = True \' 如果点击状态选择了"按供应商"
If Filter >"" Then
Tables("入库供应商").Filter = Filter
End If
End If