Rss & SiteMap
Foxtable(狐表) http://www.foxtable.com
在“支出”表的DataColChanged事件中
Dim dr As DataRow = e.DataRow
Select Case e.DataCol.Name
case "开支日期"
if dr.IsNull("开支日期") Then
dr("年度")=nothing
dr("月份")=nothing
else
dr("年度")=dr("开支日期").year
dr("月份")=dr("开支日期").Month
End If
Case "待摊","实报金额"
If dr("待摊") = false Then
dr("月1")=nothing
dr("月2")=nothing
dr("月3")=nothing
dr("月4")=nothing
dr("月5")=nothing
dr("月6")=nothing
dr("月7")=nothing
dr("月8")=nothing
dr("月9")=nothing
dr("月10")=nothing
dr("月11")=nothing
dr("月12")=nothing
else
Dim d1 As Integer = DataTables("收入").Compute("Sum(实收费额)","[年度] = "& dr("年度") & "And [月份] =1"& "And [业务分块]='公有部分'" )
Dim d2 As Integer = DataTables("收入").Compute("Sum(实收费额)","[年度] = "& dr("年度") & "And [月份] =2"& "And [业务分块]='公有部分'" )
Dim d3 As Integer = DataTables("收入").Compute("Sum(实收费额)","[年度] = "& dr("年度") & "And [月份] =3"& "And [业务分块]='公有部分'" )
Dim d4 As Integer = DataTables("收入").Compute("Sum(实收费额)","[年度] = "& dr("年度") & "And [月份] =4"& "And [业务分块]='公有部分'" )
Dim d5 As Integer = DataTables("收入").Compute("Sum(实收费额)","[年度] = "& dr("年度") & "And [月份] =5"& "And [业务分块]='公有部分'" )
Dim d6 As Integer = DataTables("收入").Compute("Sum(实收费额)","[年度] = "& dr("年度") & "And [月份] =6"& "And [业务分块]='公有部分'" )
Dim d7 As Integer = DataTables("收入").Compute("Sum(实收费额)","[年度] = "& dr("年度") & "And [月份] =7"& "And [业务分块]='公有部分'" )
Dim d8 As Integer = DataTables("收入").Compute("Sum(实收费额)","[年度] = "& dr("年度") & "And [月份] =8"& "And [业务分块]='公有部分'" )
Dim d9 As Integer = DataTables("收入").Compute("Sum(实收费额)","[年度] = "& dr("年度") & "And [月份] =9"& "And [业务分块]='公有部分'" )
Dim d10 As Integer = DataTables("收入").Compute("Sum(实收费额)","[年度] = "& dr("年度") & "And [月份] =10"& "And [业务分块]='公有部分'" )
Dim d11 As Integer = DataTables("收入").Compute("Sum(实收费额)","[年度] = "& dr("年度") & "And [月份] =11"& "And [业务分块]='公有部分'" )
Dim t1 As Integer = DataTables("收入").Compute("Sum(实收费额)","[年度] = "& dr("年度") & "And [月份] <1"& "And [业务分块]='公有部分'" )
Dim t2 As Integer = DataTables("收入").Compute("Sum(实收费额)","[年度] = "& dr("年度") & "And [月份] <2"& "And [业务分块]='公有部分'" )
Dim t3 As Integer = DataTables("收入").Compute("Sum(实收费额)","[年度] = "& dr("年度") & "And [月份] <3"& "And [业务分块]='公有部分'" )
Dim t4 As Integer = DataTables("收入").Compute("Sum(实收费额)","[年度] = "& dr("年度") & "And [月份] <4"& "And [业务分块]='公有部分'" )
Dim t5 As Integer = DataTables("收入").Compute("Sum(实收费额)","[年度] = "& dr("年度") & "And [月份] <5"& "And [业务分块]='公有部分'" )
Dim t6 As Integer = DataTables("收入").Compute("Sum(实收费额)","[年度] = "& dr("年度") & "And [月份] <6"& "And [业务分块]='公有部分'" )
Dim t7 As Integer = DataTables("收入").Compute("Sum(实收费额)","[年度] = "& dr("年度") & "And [月份] <7"& "And [业务分块]='公有部分'" )
Dim t8 As Integer = DataTables("收入").Compute("Sum(实收费额)","[年度] = "& dr("年度") & "And [月份] <8"& "And [业务分块]='公有部分'" )
Dim t9 As Integer = DataTables("收入").Compute("Sum(实收费额)","[年度] = "& dr("年度") & "And [月份] <9"& "And [业务分块]='公有部分'" )
Dim t10 As Integer = DataTables("收入").Compute("Sum(实收费额)","[年度] = "& dr("年度") & "And [月份] <10"& "And [业务分块]='公有部分'" )
Dim t11 As Integer = DataTables("收入").Compute("Sum(实收费额)","[年度] = "& dr("年度") & "And [月份] <11"& "And [业务分块]='公有部分'" )
Dim dm As Integer = 250000
dr("月1") = dr("实报金额")*d1/(dm-t1)
dr("月2") = dr("实报金额")*d2/(dm-t2)
dr("月3") = dr("实报金额")*d3/(dm-t3)
dr("月4") = dr("实报金额")*d4/(dm-t4)
dr("月5") = dr("实报金额")*d5/(dm-t5)
dr("月6") = dr("实报金额")*d6/(dm-t6)
dr("月7") = dr("实报金额")*d7/(dm-t7)
dr("月8") = dr("实报金额")*d8/(dm-t8)
dr("月9") = dr("实报金额")*d9/(dm-t9)
dr("月10") = dr("实报金额")*d10/(dm-t10)
dr("月11") = dr("实报金额")*d11/(dm-t11)
dr("月12")=dr("实报金额")-dr("月1")-dr("月2")-dr("月3")-dr("月4")-dr("月5")-dr("月6")-dr("月7")-dr("月8")-dr("月9")-dr("月10")-dr("月11")
End if
End select