Dim yf As WinForm.CheckBox = e.Form.Controls("CheckBox1")
Dim dw As WinForm.CheckBox = e.Form.Controls("CheckBox2")
Dim fsl As WinForm.CheckBox = e.Form.Controls("CheckBox3")
Dim sl As WinForm.CheckBox = e.Form.Controls("CheckBox4")
Dim nd As WinForm.CheckBox = e.Form.Controls("CheckBox5")
Dim r As WinForm.CheckBox = e.Form.Controls("CheckBox6")
Dim srq As WinForm.DateTimePicker = e.Form.Controls("DateTimePicker3")
Dim erq As WinForm.DateTimePicker = e.Form.Controls("DateTimePicker4")
Dim b As New SQLCrossTableBuilder("统计表1","cgrkd1")
b.C
b.AddTable("cgrkd1","单据内码","cgrkd2","单据内码") '添加统计表
Dim s As String
With srq
If .value IsNot Nothing
If s> "" Then
s = s & " AND "
End If
s = s & "采购日期 >= '" & .value & "'"
End If
End With
With erq
If .value IsNot Nothing
If s> "" Then
s = s & " AND "
End If
s = s & "采购日期 <= '" & .value & "'"
End If
End With
b.Filter= s
If nd.Checked
b.hGroups.AddDef("采购日期",DateGroupEnum.Year,"年")
End If
If yf.Checked
b.hGroups.AddDef("采购日期",DateGroupEnum.month,"月")
End If
If r.Checked
b.hGroups.AddDef("采购日期",DateGroupEnum.day,"日")
End If
If dw.Checked
b.HGroups.AddDef("供料单位") '添加客户列用于水平分组
End If
b.vGroups.AddDef("物料名称","物料名称_{0}")'添加产品列用于垂直分组,并设置了Pattern参数
If fsl.Checked
b.Totals.AddDef("辅助数量","吨数")
End If
If sl.Checked
b.Totals.AddDef("数量","立方米") '添加数量列用于统计
End If
b.Totals.AddDef("金额") '添加数量列用于统计
b.Build '生成统计表
b.VerticalTotal=True
b.HorizontalTotal=True