Dim Filter As String = "1=1"
With e.Form.Controls("khname")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "供应商名称 = '" & .Value & "'"
End If
End With
With e.Form.Controls("ckname")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "仓库 = '" & .Value & "'"
End If
End With
With e.Form.Controls("StartDate")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "日期 >='" & .Value & "'"
End If
End With
With e.Form.Controls("EndDate")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "日期 <='" & .Value & "'"
End If
End With
If e.Form.Controls("rdo1").Checked = True
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "单据状态='已审核'"
End If
If e.Form.Controls("rdo2").Checked = True
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "单据状态<>'已审核' or 单据状态 is null"
End If
With DataTables("进货单")
.LoadFilter = ""
.LoadFilter = filter
.LoadPage = 0 '加载第一页
.LoadOver="_Identify"
.LoadOrder = "单据号"
.LoadTop =60 '每页60行
.Load()
e.Form.Controls("TextBox1").Value = 1 & "/" & .TotalPages
End With
Tables("进货单").sort="单据号"
Dim hjsl,hjje As Double
hjsl=DataTables("进货单").sqlcompute("sum(数量)",filter)
hjje=DataTables("进货单").sqlcompute("sum(金额)",filter)
'hjsl=DataTables("销售单").sqlcompute("count([_Identify])",filter)
e.Form.Controls("NumericComboBox1").value=hjsl
e.Form.Controls("NumericComboBox2").value=hjje
If Tables("进货单").rows.count=0
Tables("进货单").GrandTotal = False
Else
Tables("进货单").Cols("金额").GrandTotal = True
Tables("进货单").GrandTotal = True '显示合计模式
End If