多表统计并进行填充,执行不了,请老师帮看看
Dim b As New SQLGroupTableBuilder("征情况表","S征地明细")
b.C
Dim Cols3() As String = {"项目名称","县区"}
Dim Cols4() As String = {"项目名称","县区"}
Dim Cols5() As String = {"项目名称","县区"}
Dim Cols6() As String = {"项目名称","县区"}
b.AddTable("S征地明细",Cols3," S迁房屋明细",Cols4)
b.AddTable("S征地明细",Cols3," S迁明细其它",Cols5)
b.AddTable("S征地明细",Cols3," S迁明细杆管",Cols6)
b.Groups.AddDef("{S征地明细}.项目名称") '根据订单表产品ID分组
b.Groups.AddDef("{S征地明细}.县区") '根据产品分组
b.Totals.AddExp("已交付用地数量"," Case
When {S征地明细}.支付日期 Is null Then 0 Else 征地数量 End ") '对数量进行统计
b.Totals.AddExp("业主结算补助金额"," Case
When {S征地明细}.第几期结算 = 0 Then 0 Else
Round(Round(Case When 征地数量 Is null Then 0 Else 征地数量 End * Case When 业主征地补偿标准 Is null Then 0 Else 业主征地补偿标准 * 0.85 End,0) +
Round(Case When 青苗数量 Is null
Then 0 Else 青苗数量 End *
Case When 业主青苗补偿标准 Is null
Then 0 Else 业主青苗补偿标准 * 0.85
End,0),0)/10000 End + Case When {S迁房屋明细}.第几期结算 = 0 Then 0 Else Round(Round(Case When 面积或数量 Is null Then 0 Else 面积或数量 End * Case When 业主房屋补偿标准 Is null Then 0 Else 业主房屋补偿标准 End,0) + Round(Case
When 宅基地补偿面积 Is null
Then 0 Else 宅基地补偿面积 End *
Case When 业主宅基地补偿标准 Is null
Then 0 Else 业主宅基地补偿标准/666.67*0.85
End,0) + Round(Case When 业主安置费助偿 Is null Then 0 Else 业主安置费助偿 End,0) + Round(Case When 业主安置回建点基础设施建设补助 Is null
Then 0 Else 业主安置回建点基础设施建设补助 End,0),0)/10000 End + Round(Round(Case When {S迁明细其它}.第几期结算 = 0 Then 0 Else Case
When 附着物数量 Is null
Then 0 Else 附着物数量 End *
Case When 业主附着物补偿标准 Is null
Then 0 Else 业主附着物补偿标准 End
End,0),0)/10000 + Round(Round(Case When {S迁明细杆管}.第几期结算 = 0 Then 0 Else 杆管线数量*业主补偿标准 End,0),0)/10000 ")
b.Build '生成统计表
Dim Cols1() As String = {"项目名称","县区","已交付用地数量","业主结算补助金额"}'指定数据来源列
Dim Cols2() As String = {"项目名称","县区","已交付用地数量","业主结算补助金额"}'指定数据接收表
For Each dr1 As DataRow In
DataTables("征情况表").Select("")
Dim dr2 As DataRow = DataTables("S征情况表").Find("项目名称 = '" &
dr1("项目名称")
& "' and 县区 = '" & dr1("县区") & "'")
If dr2 Is Nothing Then
dr2 = DataTables("S征情况表").AddNew()
End If
For i As Integer = 0 To Cols1.Length -1
dr2(Cols2(i)) = dr1(Cols1(i))
Next
Next