Dim dt As DataTable = DataTables("应付款项")
Dim p As WinForm.ProgressBar
p = e.Form.Controls("ProgressBar1")
Dim filter As String = Tables("应付款项").Filter
filter = iif(filter>"", filter, "1=1")
Dim arys As List(of String()) = dt.GetValues( "司机|车牌|出车日期", "出车日期 is not null and 运费 is null and 点费 is null and " & filter)
If arys.count > 0 Then
p.Visible = True
p.Maximum = arys.Count - 1 '设置最大值
p.Minimum = 0 '设置最小值
p.Value = 0 '设置当前值
End If
Dim idx As Integer = 0
DataTables("应付款项").StopRedraw
For Each ary() As String In arys
idx += 1
p.Value = idx '加在这里
Dim fil As String = "司机 = '" & ary(0) & "' and 车牌 = '" & ary(1) & "' and 出车日期 = #" & ary(2) & "#"
Dim drs As List(of DataRow) = dt.Select(fil)
For Each dr As DataRow In drs
If DataTables("价目表").DataCols.Contains("车型_" & dr("车型")) Then
Dim jdrs As List(of DataRow) = DataTables("价目表").Select("项目 like '%" & dr("项目") & "%' and 城市 like '%" & dr("城市") & "%'")
For Each jdr As DataRow In jdrs
If dr("地点") Like "*" & jdr("地点") & "*" Then
dr("运费") = jdr("车型_" & dr("车型"))
Exit For
End If
Next
End If
Next
drs = dt.Select(fil, "运费 desc")
For i As Integer = 0 To drs.Count - 1
Select Case drs(i)("车型")
Case "9M6"
drs(i)("点费") = 80
Case "6M2","6M8","7M6"
drs(i)("点费") = 60
Case "4M5","4M2"
drs(i)("点费") = 30
End Select
If i = 0 Then
drs(i)("点费") = Nothing
Else
drs(i)("运费") = Nothing
End If
Next
For Each str As String In dt.GetValues("送货地址", fil )
drs = dt.Select(fil & " and 送货地址 = '" & str & "'")
For i As Integer = 0 To drs.Count - 1
If i > 0 Then
drs(i)("点费") = Nothing
End If
Next
Next
Next
DataTables("应付款项").ResumeRedraw
p.Visible = False