我在窗口的“计算”按钮设代码,通过生成几个统计表最后把数据填充到“S征地计量统计表”中。在“征地报表”按钮中的代码见后面,每次点击“计算”按钮后,再点击“征地报表”按钮只能生成空表,要重新登录后才能生成有数据的报表。请问老师是什么问题。
Syscmd.Project.Save()
Dim b As New SQLGroupTableBuilder("征地统计表","S征地明细")
b.C
b.Groups.AddDef("项目名称") '根据产品分组
b.Groups.AddDef("县区") '根据产品分组
b.Groups.AddDef("第几期结算") '根据产品分组
b.Totals.AddDef("征地数量") '对数量进行统计
b.Totals.AddExp("政府征地补偿金额","Round(征地数量 * 政府征地补偿标准,0)")
b.Totals.AddExp("业主征地补助金额","Round(征地数量 * 业主征地补偿标准 * 0.85,0)")
b.Totals.AddExp("政府青苗补偿金额","Round(青苗数量 * 政府青苗补偿标准,0)")
b.Totals.AddExp("业主青苗补助费","Round(青苗数量 * 业主青苗补偿标准 * 0.85,0)")
b.Build '生成统计表
'MainTable = Tables("征地统计表") '打开生成的统计表
Dim d As New SQLGroupTableBuilder("杆管统计表","S明细杆管")
d.C
d.Groups.AddDef("项目名称") '根据产品分组
d.Groups.AddDef("县区") '根据产品分组
d.Groups.AddDef("第几期结算") '根据产品分组
d.Totals.AddExp("政府补偿金额","Round(杆管线数量 *政府补偿标准,0)") '对数量进行统计
d.Totals.AddExp("业主补助金额","Round(杆管线数量*业主补偿标准,0)")
d.Build '生成统计表
'MainTable = Tables("杆管统计表") '打开生成的统计表
Dim f As New SQLGroupTableBuilder("房屋统计表","S房屋明细")
f.C
f.Groups.AddDef("项目名称") '根据产品分组
f.Groups.AddDef("县区") '根据产品分组
f.Groups.AddDef("第几期结算") '根据产品分组
f.Totals.AddExp("政府补偿奖励金额合计","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 政府宅基地补偿标准 End,0) + Round(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 房屋奖励标准 End,0)+ Round(Case When 政府基础设施建设奖励 Is null Then 0 Else 政府基础设施建设奖励 End,0)") '对数量进行统计
f.Totals.AddExp("业主补助金额合计","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)")
f.Build '生成统计表
'MainTable = Tables("房屋统计表") '打开生成的统计表
Dim g As New SQLGroupTableBuilder("其它统计表","S明细其它")
g.C
g.Groups.AddDef("项目名称") '根据产品分组
g.Groups.AddDef("县区") '根据产品分组
g.Groups.AddDef("第几期结算") '根据产品分组
g.Totals.AddExp("政府补偿奖励金额合计","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 奖励标准 End,0)") '对数量进行统计
g.Totals.AddExp("业主补助金额合计","Round(Case When 附着物数量 Is null Then 0 Else 附着物数量 End * Case When 业主附着物补偿标准 Is null Then 0 Else 业主附着物补偿标准 End,0)")
g.Build '生成统计表
'MainTable = Tables("其它统计表") '打开生成的统计表
DataTables("S征地计量统计表").DataRows.Clear
Dim Cols1() As String = {"项目名称","县区","第几期结算","征地数量","政府征地补偿金额","业主征地补助金额","政府青苗补偿金额","业主青苗补助费"}'指定数据来源列
Dim Cols2() As String = {"项目名称","县区","第几期结算","本期结算征地数量","本期政府征地补偿金额合计","本期业主征地补助金额合计","本期政府青苗补偿费金额合计","本期业主青苗补助金额合计"}'指定数据接收表
For Each dr1 As DataRow In DataTables("征地统计表").Select("[第几期结算] > 0")
Dim dr2 As DataRow = DataTables("S征地计量统计表").Find("项目名称 = '" & dr1("项目名称") & "' and 县区 = '" & 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
Dim Cols3() As String = {"项目名称","县区","第几期结算","政府补偿金额","业主补助金额"}'指定数据来源列
Dim Cols4() As String = {"项目名称","县区","第几期结算","本期政府杆管补偿金额合计","本期业主杆管补助金额合计"}'指定数据接收表
For Each dr1 As DataRow In DataTables("杆管统计表").Select("[第几期结算] > 0")
Dim dr2 As DataRow = DataTables("S征地计量统计表").Find("项目名称 = '" & dr1("项目名称") & "' and 县区 = '" & dr1("县区") & "' and 第几期结算 = '" & dr1("第几期结算") & "'")
If dr2 Is Nothing Then
dr2 = DataTables("S征地计量统计表").AddNew()
End If
For i As Integer = 0 To Cols3.Length -1
dr2(Cols4(i)) = dr1(Cols3(i))
Next
Next
Dim Cols5() As String = {"项目名称","县区","第几期结算","政府补偿奖励金额合计","业主补助金额合计"}'指定数据来源列
Dim Cols6() As String = {"项目名称","县区","第几期结算","本期政府房屋补偿金额合计","本期业主房屋补助金额合计"}'指定数据接收表
For Each dr1 As DataRow In DataTables("房屋统计表").Select("[第几期结算] > 0")
Dim dr2 As DataRow = DataTables("S征地计量统计表").Find("项目名称 = '" & dr1("项目名称") & "' and 县区 = '" & dr1("县区") & "' and 第几期结算 = '" & dr1("第几期结算") & "'")
If dr2 Is Nothing Then
dr2 = DataTables("S征地计量统计表").AddNew()
End If
For i As Integer = 0 To Cols5.Length -1
dr2(Cols6(i)) = dr1(Cols5(i))
Next
Next
Dim Cols7() As String = {"项目名称","县区","第几期结算","政府补偿奖励金额合计","业主补助金额合计"}'指定数据来源列
Dim Cols8() As String = {"项目名称","县区","第几期结算","本期政府其它补偿金额合计","本期业主其它补助金额合计"}'指定数据接收表
For Each dr1 As DataRow In DataTables("其它统计表").Select("[第几期结算] > 0")
Dim dr2 As DataRow = DataTables("S征地计量统计表").Find("项目名称 = '" & dr1("项目名称") & "' and 县区 = '" & dr1("县区") & "' and 第几期结算 = '" & dr1("第几期结算") & "'")
If dr2 Is Nothing Then
dr2 = DataTables("S征地计量统计表").AddNew()
End If
For i As Integer = 0 To Cols7.Length -1
dr2(Cols8(i)) = dr1(Cols7(i))
Next
Next