以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 【求助】按月生成数据已经初步实现,怎么实现按月生成定金,首付款,尾款数据呢? (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=110330) |
-- 作者:李孝春 -- 发布时间:2017/12/1 3:43:00 -- 【求助】按月生成数据已经初步实现,怎么实现按月生成定金,首付款,尾款数据呢? 下面的代码实现了上图效果 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 怎么实现这个图中的月份下面的四个小栏目有相应的数据呢? 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编辑过]
|
-- 作者:有点甜 -- 发布时间: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
|