Foxtable(狐表)用户栏目专家坐堂 → 【求助】按月生成数据已经初步实现,怎么实现按月生成定金,首付款,尾款数据呢?


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

主题:【求助】按月生成数据已经初步实现,怎么实现按月生成定金,首付款,尾款数据呢?

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


加好友 发短信
等级:九尾狐 帖子:2472 积分:17346 威望:0 精华:0 注册:2013/1/31 0:03:00
【求助】按月生成数据已经初步实现,怎么实现按月生成定金,首付款,尾款数据呢?  发帖心情 Post By:2017/12/1 3:43:00 [只看该作者]


图片点击可在新窗口打开查看此主题相关图片如下:2017-12-01_033934.jpg
图片点击可在新窗口打开查看

下面的代码实现了上图效果
If e.DataCol.Name = "年份" Then
    Dim cns() As String = {"一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"}
    If e.DataRow.IsNull(e.DataCol.name) Then
        For Each cn As String In cns
            e.DataRow(cn) = Nothing
        Next
    Else
        Dim filter = "(订单门店 = '"  & e.DataRow("门店名称") & "')"
        For i As Integer = 0 To cns.Length - 1
            Dim d As Date = new Date(cint(e.newValue), i+1, 1)
            e.DataRow(cns(i)) = DataTables("订单主表").compute("sum(订单总额)", filter & " and 订单日期 >= #" & d & "# and 订单日期 < #" & d.AddMonths(1) & "#")
        Next
    End If
End If



图片点击可在新窗口打开查看此主题相关图片如下:1.jpg
图片点击可在新窗口打开查看
怎么实现这个图中的月份下面的四个小栏目有相应的数据呢?
DataTables("订单主表").compute("sum(订单总额)", filter & " and 订单日期 >= #" & d & "# and 订单日期 < #" & d.AddMonths(1) & "#")
DataTables("订单主表").compute("sum(定金)", filter & " and 订单日期 >= #" & d & "# and 订单日期 < #" & d.AddMonths(1) & "#")
DataTables("订单主表").compute("sum(首付款)", filter & " and 订单日期 >= #" & d & "# and 订单日期 < #" & d.AddMonths(1) & "#")
DataTables("订单主表").compute("sum(尾款)", filter & " and 订单日期 >= #" & d & "# and 订单日期 < #" & d.AddMonths(1) & "#")
[此贴子已经被作者于2017/12/1 3:47:56编辑过]

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/12/1 8:59:00 [只看该作者]

If e.DataCol.Name = "年份" orelse e.datacol.name = "门店名称" Then
    Dim cns() As String = {"一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"}
    If e.DataRow.IsNull(e.DataCol.name) Then
        For Each cn As String In cns
            e.DataRow(cn) = Nothing
        Next
    Else
        Dim filter = "(订单门店 = '"  & e.DataRow("门店名称") & "')"
        For i As Integer = 0 To cns.Length - 1
            Dim d As Date = new Date(cint(e.newValue), i+1, 1)
            e.DataRow(cns(i) & "_订单总额") = DataTables("订单主表").compute("sum(订单总额)", filter & " and 订单日期 >= #" & d & "# and 订单日期 < #" & d.AddMonths(1) & "#")
            e.DataRow(cns(i) & "_定金") = DataTables("订单主表").compute("sum(定金)", filter & " and 订单日期 >= #" & d & "# and 订单日期 < #" & d.AddMonths(1) & "#")
            e.DataRow(cns(i) & "_首付款") = DataTables("订单主表").compute("sum(首付款)", filter & " and 订单日期 >= #" & d & "# and 订单日期 < #" & d.AddMonths(1) & "#")
            e.DataRow(cns(i) & "_尾款") = DataTables("订单主表").compute("sum(尾款)", filter & " and 订单日期 >= #" & d & "# and 订单日期 < #" & d.AddMonths(1) & "#")
        Next
    End If
End If

 回到顶部