Foxtable(狐表)用户栏目专家坐堂 → 注明


  共有2093人关注过本帖树形打印复制链接

主题:注明

帅哥哟,离线,有人找我吗?
gcc123
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:一尾狐 帖子:407 积分:3087 威望:0 精华:0 注册:2014/6/10 11:31:00
注明  发帖心情 Post By:2017/6/11 12:00:00 [只看该作者]

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")

标注的代码  如果 合计数字 是 正数  希望在数字钱出现  欠公司  三个字   如果是负数 希望数字前出现  公司欠   代码如何修改?

 回到顶部
帅哥哟,离线,有人找我吗?
新福星
  2楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1964 积分:15604 威望:0 精华:0 注册:2011/7/16 20:59:00
  发帖心情 Post By:2017/6/11 12:25:00 [只看该作者]

dim sum as double=sum11 + sum12 + sum13  - sum14 - sum15
if sum=0 then
e.Form.Controls("合计结果1").Text ="0.00"
else
if sum >0 then
e.Form.Controls("合计结果1").Text = "欠公司" & format(sum11 + sum12 + sum13  - sum14 - sum15, "#.00")  
else
e.Form.Controls("合计结果1").Text = "公司欠" & format(sum11 + sum12 + sum13  - sum14 - sum15, "#.00")  
end if
end if

 回到顶部
帅哥哟,离线,有人找我吗?
gcc123
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:一尾狐 帖子:407 积分:3087 威望:0 精华:0 注册:2014/6/10 11:31:00
回复:(新福星)dim sum as double=sum11 + sum12 + ...  发帖心情 Post By:2017/6/11 14:35:00 [只看该作者]

谢谢   

 回到顶部