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