Dim Filter As String
With e.Form.Controls("s产品料号")
If .Value IsNot Nothing Then
Filter = "F177 like '%" & .Value & "%'"
End If
End With
With e.Form.Controls("s名称")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "F178 like '%" & .Value & "%'"
End If
End With
If filter > "" Then
Dim cmd As New SQLCommand
Dim dt As DataTable
cmd.C
cmd.CommandText = "SELECT * Fro m {tabDIYTable31} where " & filter
dt = cmd.ExecuteReader()
filter = ""
If dt.DataRows.Count = 1 Then
filter = "ID = " & dt.DataRows(0)("ID")
Else If dt.DataRows.Count > 1 Then
filter = "ID in (" & dt.DataRows(0)("ID")
For i As Integer = 1 To dt.DataRows.Count - 1
filter = filter & "," & dt.DataRows(i)("ID")
Next
filter = filter & ")"
End If
End If
With e.Form.Controls("s单号")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "F172 like '%" & .Value & "%'"
End If
End With
If filter > "" Then
filter = filter & "and F4169 <> '盘点平账入库' and F4169 <> '盘点平账出库'"
Else
filter = "F4169 <> '盘点平账入库' and F4169 <> '盘点平账出库'"
End If
Dim yz As WinForm.TextBox = e.Form.Controls("页")
If e.Sender.Checked = False Then
With DataTables(e.Form.Name & "_Table1")
.LoadFilter = filter '一定要清除加载条件
.LoadTop = 5
.LoadPage = 0
.LoadOver = "ID"
.LoadReverse = True
.Load()
yz.Value = 1 & "/" & .TotalPages
End With
Else
DataTables(e.Form.Name & "_Table1").LoadFilter = filter '一定要清除加载条件
DataTables(e.Form.Name & "_Table1").FillLoadTime.Out = 100
DataTables(e.Form.Name & "_Table1").Load
yz.Value = 1
End If
With Tables(e.Form.Name & "_Table1")
.ExtendLastCol = True
.AutoSizeRows()
If .Rows.Count > 0 Then
.Select(0,0)
End If
End With
Tables("入库单").ExtendLastCol = True
Tables("入库单").AutoSizeRows()