-- 作者:gcc123
-- 发布时间:2017/6/16 19:44:00
-- 查询
此主题相关图片如下:窗口_看图王.png
项目中 每个车表都对应以上相同的窗口,我想实现的是 另外做一个窗口 点击按钮 分别按车号 列出驾驶员剩余 公司剩余 利润合计 公司应付款 数值 不知道能不能实现?
此主题相关图片如下:形象.png
车表窗口 查询按钮 代码如下
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("車浙B8Y315").Filter = Filter20 End If
Dim sum11, sum12, sum13, sum14, sum15 As Double sum11 = Tables("車浙B8Y315").Compute("sum(支公司款)") sum12 = Tables("車浙B8Y315").Compute("sum(特殊费用)") sum13 = Tables("車浙B8Y315").Compute("sum(现金运费)") sum14 = Tables("車浙B8Y315").Compute("sum(金额)") sum15 = Tables("車浙B8Y315").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")
[此贴子已经被作者于2017/6/16 19:45:22编辑过]
|