Dim dr As DataRow = e.DataRow Dim m,md,mx,dj as Double 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 for m = 1 to 12 dr("月" & m) = nothing Next else Dim td,tx as String dj = dr("实报金额") for m = 1 to 11 td = "[年度] = "& dr("年度") & And [业务分块]='公有部分'And [月份] = " & m tx = "[年度] = "& dr("年度") & And [业务分块]='公有部分'And [月份] < " & m md = DataTables("收入").Compute("Sum(实收费额)",td) mx = DataTables("收入").Compute("Sum(实收费额)",tx) dr("月" & m) = dr("实报金额")*md/(250000-mx) dj = dj - dr("月" & m) Next dr("月12") = dj End if End select
|