Foxtable(狐表)用户栏目专家坐堂 → 条件判断求和


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

主题:条件判断求和

帅哥,在线噢!
有点蓝
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:109474 积分:557032 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/7/9 16:19:00 [显示全部帖子]

麻烦以后发帖改文字的颜色,不要设置背景色,看的眼花。

dv("需求数量") = dq.SQLCompute("sum(当日数量)", "发货日期 >= '" & dw1  & "' and 发货日期 <= '" & dw2 & "' and 材料编码 = '" & e.newvalue & "'  And 申请下达 is null")

 回到顶部
帅哥,在线噢!
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:109474 积分:557032 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/7/9 20:50:00 [显示全部帖子]

这个意思?

If e.DataCol.Name  = "成品编码"
    If e.DataRow("库位") = "包装箱"   Then
        Dim d As Integer = Date.Today.Year
        Dim f As Integer = Date.Today.Month
        Dim dr1 As New Date(d, f, 1)
        Dim do2 As New Date(d, f, Date.DaysInMonth(d, f)) '获取本月的最后一天
        Dim g As Integer = Date.Today.Year
        Dim n As Integer = Date.Today.Month
        Dim dw1 As New Date(g, n, 1)
        Dim dw2 As New Date(g, n, Date.DaysInMonth(g, n)) '获取本月的最后一天
        Dim dv As DataRow = e.DataRow
        Dim dq As DataTable =DataTables("销售发货明细")
        If e.DataCol.Name = "成品编码"  Then
            dv("需求数量") = dq.SQLCompute("sum(当日数量)", "发货日期 >= '" & dw1  & "' and 发货日期 <= '" & dw2 & "' and 材料编码 = '" & e.newvalue & "'  And 申请下达 is null")
        End If
    Else
        Dim Filter As String = "[材料编码] = '" & e.DataRow("成品编码") & "'"
        e.DataRow("需求数量") = DataTables("材料需求明细").SQLCompute("Sum(未发数量)", Filter)
    End If
End If

 回到顶部
帅哥,在线噢!
有点蓝
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:109474 积分:557032 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/7/9 21:23:00 [显示全部帖子]

If e.DataCol.Name  = "成品编码" orelse e.DataCol.Name  = "库位"
    If e.DataRow("库位") = "包装箱"   Then
        Dim d As Integer = Date.Today.Year
        Dim f As Integer = Date.Today.Month
        Dim dr1 As New Date(d, f, 1)
        Dim do2 As New Date(d, f, Date.DaysInMonth(d, f)) '获取本月的最后一天
        Dim g As Integer = Date.Today.Year
        Dim n As Integer = Date.Today.Month
        Dim dw1 As New Date(g, n, 1)
        Dim dw2 As New Date(g, n, Date.DaysInMonth(g, n)) '获取本月的最后一天
        Dim dv As DataRow = e.DataRow
        Dim dq As DataTable =DataTables("销售发货明细")
        If e.DataCol.Name = "成品编码"  Then
            dv("需求数量") = dq.SQLCompute("sum(当日数量)", "发货日期 >= '" & dw1  & "' and 发货日期 <= '" & dw2 & "' and 材料编码 = '" & e.DataRow("成品编码") & "'  And 申请下达 is null")
        End If
    Else
        Dim Filter As String = "[材料编码] = '" & e.DataRow("成品编码") & "'"
        e.DataRow("需求数量") = DataTables("材料需求明细").SQLCompute("Sum(未发数量)", Filter)
    End If
End If

 回到顶部
帅哥,在线噢!
有点蓝
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:109474 积分:557032 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/7/9 22:39:00 [显示全部帖子]

点击全部这个按钮有结果呀?或者说什么样的结果才是对的?

 回到顶部
帅哥,在线噢!
有点蓝
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:109474 积分:557032 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/7/10 9:50:00 [显示全部帖子]

If e.DataCol.Name  = "成品编码" OrElse e.DataCol.Name  = "库位"
    If e.DataRow.IsNull("库位") = False AndAlso e.DataRow.IsNull("成品编码") = False
        If e.DataRow("库位") = "包装箱"   Then
            Dim d As Integer = Date.Today.Year
            Dim f As Integer = Date.Today.Month
            Dim dr1 As New Date(d, f, 1)
            Dim do2 As New Date(d, f, Date.DaysInMonth(d, f)) '获取本月的最后一天
            Dim g As Integer = Date.Today.Year
            Dim n As Integer = Date.Today.Month
            Dim dw1 As New Date(g, n, 1)
            Dim dw2 As New Date(g, n, Date.DaysInMonth(g, n)) '获取本月的最后一天
            Dim dv As DataRow = e.DataRow
            Dim dq As DataTable =DataTables("销售发货明细")
            dv("需求数量") = dq.Compute("sum(当日数量)", "发货日期 >= '" & dw1  & "' and 发货日期 <= '" & dw2 & "' and 材料编码 = '" & e.DataRow("成品编码") & "'  And 发箱人员 is null")
        Else
            Dim Filter As String = "[材料编码] = '" & e.DataRow("成品编码") & "'"
            e.DataRow("需求数量") = DataTables("材料需求明细").Compute("Sum(需求数量)", Filter)
        End If
    End If
End If

 回到顶部