Dim sd As WinForm.DateTimePicker = e.Form.Controls("sd")
Dim ed As WinForm.DateTimePicker = e.Form.Controls("ed")
Dim filter As String
If sd.Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "日期 >= #" & sd.Value & "#"
End If
If ed.Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "日期 <= #" & ed.Value & "#"
End If
Dim bd1 As New GroupTableBuilder("统计表1",DataTables("回款明细"))
Dim dt1 As fxDataSource
bd1.Groups.AddDef("分公司") '根据型号分组
bd1.Totals.AddDef("金额","回款金额") '对金额进行统计
bd1.Filter=filter
dt1 = bd1.BuildDataSource()
'Dim bd2 As New GroupTableBuilder("统计表2",DataTables("摊销应收明细"))
'Dim dt2 As fxDataSource
'bd2.Groups.AddDef("分公司") '根据型号分组
'bd2.Totals.AddDef("金额","摊销金额") '对金额进行统计
'bd2.Filter=filter
'dt2 = bd2.BuildDataSource()
Dim bd3 As New GroupTableBuilder("统计表3",DataTables("进度应收明细"))
Dim dt3 As fxDataSource
bd3.Groups.AddDef("分公司") '根据型号分组
bd3.Totals.AddDef("金额","进度应收") '对金额进行统计
bd3.Filter=filter
dt3 = bd3.BuildDataSource()
Dim bd4 As New GroupTableBuilder("统计表4",DataTables("开piao"))
Dim dt4 As fxDataSource
bd4.Groups.AddDef("分公司") '根据合同编号分组
bd4.Totals.AddDef("金额","开piao金额") '对金额进行统计
dt4 = bd4.BuildDataSource()
'dt1.Combine("分公司",dt2,"分公司") '将回款统计数据组合到摊销统计数据
dt1.Combine("分公司",dt3,"分公司") '将进度应收统计数据组合到回款统计数据
dt1.Combine("分公司",dt4,"分公司") '将开piao统计数据组合到回款统计数据
Tables("综合统计_Table1").DataSource = dt1 '将统计结果绑定到Table
With DataTables("综合统计_Table1").DataCols '用表达式列计算剩余数据
'.Add("摊销应收未收",Gettype(Double), "[摊销金额] - [回款金额]")
.Add("进度应收未收",Gettype(Double), "[进度应收] - [回款金额]")
.Add("未开piao金额",Gettype(Double), "[开piao金额] - [回款金额]")
End With