Dim Filter As String = "1=1" '设置筛选条件
With e.Form.Controls("DW")
If .Value IsNot Nothing Then
Filter &= " and 所属单位 = '" & .Value & "'"
End If
End With
With e.Form.Controls("YF")
If .Value IsNot Nothing Then
Filter = Filter & " and 所属日期 = #" & .Value & "#"
End If
End With
Dim bd2 As New SQLgroupTableBuilder("统计表2","部门损益总账")
Dim dt2 As fxDataSource
bd2.AddTable("部门损益总账","部门名称","部门档案","部门名称") '添加统计表
bd2.AddTable("部门损益总账","科目名称","科目档案","科目名称") '添加统计表
bd2.Groups.AddDef("所属单位")
bd2.Groups.Adddef("所属日期",DateGroupEnum.none)
bd2.Groups.AddDef("一级科目")
bd2.Totals.AddDef("借方发生")
bd2.Filter = "一级科目 = '主营业务收入' and (" & filter & ")"