代码如下
Dim d1 As Date = new Date(2014,5,29)
Dim d2 As Date = new Date(2014,6,28)
Dim sql As String = "Select a.姓名 as 置业顾问, b.佣金, b.结佣日, b.类型, b.套数, a.门店, a.上岗日期, a.离职日期 from {员工管理} a left join {佣金明细} b on (a.姓名 = b.置业顾问) where (离职日期 >= #" & d1 & "# or 离职日期 is null)"
Dim g As New CrossTableBuilder("佣金业绩表",sql)
g.HGroups.AddDef("门店")
g.HGroups.AddDef("置业顾问")
g.VGroups.AddDef("类型")
g.Totals.AddDef("佣金", "佣金")
g.Totals.AddDef("套数", "套数")
g.OrderByTotal = True
g.HorizontalTotal = True
g.VerticalTotal = True
g.Decimals = 2
g.Subtotal = True
g.filter = "结佣日 >= #" & d1 & "# and 结佣日 <= #" & d2 & "#"
g.Build()