1、
Dim Value As String =e.Sender.SelectedValue
e.Form.Controls("Table1").Visible = True
vars("filter") = "1=1"
Select Case Value
Case "全部"
Dim g As New CrossTableBuilder("统计表1", DataTables("其它采购总表"))
Dim cg As fxDataSource
g.HGroups.AddDef("供应商")
g.VGroups.AddDef("日期",DateGroupEnum.Year, "{0}年")
g.VGroups.AddDef("日期", "{0}月")
g.Totals.AddDef("总金额","金额")
g.Totals.AddDef("日期",AggregateEnum.Count,"采购单数")
g.HorizontalTotal = True
g.VerticalTotal = True
g.Build()
cg=g.BuildDataSource
'Tables("供应商订货月报表_Table1").Visible = True
Tables("其它采购月汇总_Table1").DataSource = cg
Tables("其它采购月汇总_Table1").Cols("供应商").Width = 145
vars("filter") = "1=1"
Case "按条件查询"
Dim Filter As String = "1=1"
Dim g As New CrossTableBuilder("统计表1",DataTables("其它采购总表"))
With e.Form.Controls("供应商")
If .Value IsNot Nothing Then
Filter = "供应商 = '" & .Value & "'"
End If
End With
With e.Form.Controls("StartDate")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "日期 >= #" & .Value & "#"
End If
End With
With e.Form.Controls("EndDate")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "日期 <= #" & .Value & "#"
End If
End With
g.Filter = Filter
vars("filter") = Filter
Dim cg As fxDataSource
g.HGroups.AddDef("供应商")
g.VGroups.AddDef("日期",DateGroupEnum.Year, "{0}年")
g.VGroups.AddDef("日期", "{0}月")
g.Totals.AddDef("总金额","金额")
g.Totals.AddDef("日期",AggregateEnum.Count,"采购单数")
g.HorizontalTotal = True
g.VerticalTotal = True
g.Build()
cg=g.BuildDataSource
Tables("其它采购月汇总_Table1").DataSource = cg
Tables("其它采购月汇总_Table1").Cols("供应商").Width = 145
End Select
2、
If Forms("其它采购月汇总").opened
Tables("其它采购记录_Table1").Filter = "供应商 = '" & Tables("其它采购月汇总_Table1").Current("供应商") & "' and " & vars("filter")
End if