Foxtable(狐表)用户栏目专家坐堂 → 请帮代码减肥,新手边问边学


  共有18152人关注过本帖树形打印复制链接

主题:请帮代码减肥,新手边问边学

帅哥哟,离线,有人找我吗?
don
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1812 积分:12999 威望:0 精华:14 注册:2008/10/11 18:07:00
[求助]  发帖心情 Post By:2009/5/15 23:19:00 [显示全部帖子]

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

 回到顶部