Dim Filter20 As String
With e.Form.Controls("驾驶员")
If .Value IsNot Nothing Then
Filter20 = "驾驶员= '" & .Value & "'"
End If
End With
With e.Form.Controls("起始时间")
If .Value IsNot Nothing Then
If Filter20 >"" Then
Filter20 = Filter20 & " And "
End If
Filter20 = Filter20 & "日期 >= #" & .Value & "#"
End If
End With
With e.Form.Controls("结束时间")
If .Value IsNot Nothing Then
If Filter20 >"" Then
Filter20 = Filter20 & " And "
End If
Filter20 = Filter20 & "日期 <= #" & .Value & "#"
End If
End With
If Filter20 > "" Then
Tables("車鲁H7A751").Filter = Filter20
End If
Dim sum11, sum12, sum13, sum14, sum15 As Double
sum11 = Tables("車鲁H7A751").Compute("sum(支公司款)")
sum12 = Tables("車鲁H7A751").Compute("sum(特殊费用)")
sum13 = Tables("車鲁H7A751").Compute("sum(现金运费)")
sum14 = Tables("車鲁H7A751").Compute("sum(金额)")
sum15 = Tables("車鲁H7A751").Compute("sum(工资)")
e.Form.Controls("合计结果1").Text = format(sum11 + sum12 + sum13 - sum14 - sum15, "#.00")
Dim Filter As String = "1=1"
Dim filter2 As String = "1=1"
Dim filter3 As String = "1=1"
Dim filter4 As String = "1=1"
Dim cname As String = ""
With e.Form.Controls("承运")
If .Value IsNot Nothing Then
Filter &= " and 承运单位 = '" & .Value & "'"
Filter2 &= " and 托运单位 = '" & .Value & "'"
Filter3 &= " and 欠款人 = '" & .Value & "'"
Filter4 &= " and 交款单位 = '" & .Value & "'"
End If
End With
With e.Form.Controls("起始时间")
If .Value IsNot Nothing Then
Filter &= " And 日期 >= #" & .Value & "#"
filter2 &= " and " & "日期 >= #" & .Value & "#"
filter3 &= " and " & "日期 >= #" & .Value & "#"
filter4 &= " and " & "日期 >= #" & .Value & "#"
End If
cname &= "(" & .Value & "-"
End With
With e.Form.Controls("结束时间")
If .Value IsNot Nothing Then
Filter &= " and 日期 <= #" & .Value & "#"
filter2 &= " and " & "日期 <= #" & .Value & "#"
filter3 &= " and " & "日期 <= #" & .Value & "#"
filter4 &= " and " & "日期 <= #" & .Value & "#"
End If
cname &= .Value & ")"
End With
DataTables("应付款明细").DataRows.Clear
DataTables("应付款明细").DataCols("金额").Caption = cname & "金额"
DataTables("应付款明细").BuildHeader
For Each cys As String In DataTables("应付").GetValues("承运单位", filter)
Dim ndr As DataRow = DataTables("应付款明细").AddNew
ndr("承运单位") = cys
Dim sum1, sum2, sum3, sum4 As Double
sum1 = DataTables("应付").Compute("sum(金额)", filter & " and 承运单位 = '" & cys & "'")
sum2 = DataTables("应收").Compute("sum(金额)", filter2 & " and 托运单位 = '" & cys & "'")
sum3 = DataTables("扣款录入").Compute("sum(金额)", filter3 & " and 欠款人 = '" & cys & "'")
sum4 = DataTables("已收款录入").Compute("sum(金额)", filter4 & " and 交款单位 = '" & cys & "'")
ndr("金额") = format(sum2 + sum3 - sum1 - sum4, "0.00")
Next
If Filter > "" Then
Tables("应付").Filter = Filter
End If
Tables("应付.扣款录入").Filter = filter3
Tables("应付.应收").Filter = filter2
Tables("应付.已收款录入").Filter = filter4
Dim sum5, sum6, sum7, sum8 As Double
sum5 = Tables("应付").Compute("sum(金额)")
sum6 = Tables("应付.应收").Compute("sum(金额)")
sum7 = Tables("应付.已收款录入").Compute("sum(金额)")
sum8 = Tables("应付.扣款录入").Compute("sum(金额)")
e.Form.Controls("合计结果2").Text = format(sum5 + sum7 - sum6 - sum8, "0.00")
e.Form.Controls("合计结果3").Text = format((sum11 + sum12 + sum13 - sum14 - sum15+sum5 + sum7 - sum6 - sum8)/2-(sum11 + sum12 + sum13 - sum14 - sum15), "#.00")
e.Form.Controls("合计结果").Text = format(sum11 + sum12 + sum13 - sum14 - sum15+sum5 + sum7 - sum6 - sum8, "#.00")
标注的代码 如果 合计数字 是 正数 希望在数字钱出现 欠公司 三个字 如果是负数 希望数字前出现 公司欠 代码如何修改?