Foxtable(狐表)用户栏目专家坐堂 → [求助]这个要怎么实现


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

主题:[求助]这个要怎么实现

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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/5/20 16:00:00 [显示全部帖子]

 上传具体例子。

 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/5/20 16:45:00 [显示全部帖子]

Dim t As Table = Tables("临时表")
For Each r As Row In t.Rows
    For i As Integer = 6 To 1 Step -1
        If r("余额_" & i) < 0 Then
            Dim ye As Double = 0
            Dim fe As Double = 0
            For j As Integer = i To 1 Step -1
                ye += r("余额_" & j)
                fe += r("余额_" & j & "hp")
                If ye >= 0 Then
                    r("余额_" & j) = ye
                    r("余额_" & j & "hp") = fe
                    For k As Integer = j+1 To i
                        r("余额_" & k) = Nothing
                        r("余额_" & k & "hp") = Nothing
                    Next
                    i = j
                    Exit For
                End If
            Next
        End If
    Next
Next

 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/5/20 17:15:00 [显示全部帖子]

什么意思。

 

Dim t As Table = Tables("临时表")
For y As Integer = t.Rows.Count - 1 To 0 Step -1
    Dim r As Row = t.Rows(y)
    Dim flag As Boolean = True
    For i As Integer = 6 To 1 Step -1
        If r("余额_" & i) < 0 Then
            flag = False
            Dim ye As Double = 0
            Dim fe As Double = 0
            For j As Integer = i To 1 Step -1
                ye += r("余额_" & j)
                fe += r("余额_" & j & "hp")
                If ye >= 0 Then
                    r("余额_" & j) = ye
                    r("余额_" & j & "hp") = fe
                    For k As Integer = j+1 To i
                        r("余额_" & k) = Nothing
                        r("余额_" & k & "hp") = Nothing
                    Next
                    i = j
                    Exit For
                End If
            Next
        End If
    Next
    If flag Then
        r.delete
    End If
Next


 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/5/20 17:22:00 [显示全部帖子]

Dim t As Table = Tables("临时表")
Dim mqj As Integer = DataTables("明细表").Compute("max(区间)")
For Each r As Row In t.Rows
    For i As Integer = mqj To 1 Step -1
        If t.Cols.Contains("余额_" & i) Then
            If r("余额_" & i) < 0 Then
                Dim ye As Double = 0
                Dim fe As Double = 0
                For j As Integer = i To 1 Step -1
                    If t.Cols.Contains("余额_" & j) Then
                        ye += r("余额_" & j)
                        fe += r("余额_" & j & "hp")
                        If ye >= 0 Then
                            r("余额_" & j) = ye
                            r("余额_" & j & "hp") = fe
                            For k As Integer = j+1 To i
                                If t.Cols.Contains("余额_" & k) Then
                                    r("余额_" & k) = Nothing
                                    r("余额_" & k & "hp") = Nothing
                                End If
                            Next
                            i = j
                            Exit For
                        End If
                    End If
                Next
            End If
        End If
    Next
Next

 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/5/20 17:55:00 [显示全部帖子]

汗,写错了

 

Dim t As Table = Tables("临时表")
Dim mqj As Integer = DataTables("明细表").Compute("max(区间)")
For Each r As Row In t.Rows
    For i As Integer = mqj+1 To 1 Step -1
        If t.Cols.Contains("余额_" & i) Then
            If r("余额_" & i) < 0 Then
                Dim ye As Double = 0
                Dim fe As Double = 0
                For j As Integer = i To 1 Step -1
                    If t.Cols.Contains("余额_" & j) Then
                        ye += r("余额_" & j)
                        fe += r("余额_" & j & "hp")
                        If ye >= 0 OrElse j = 1 Then
                            r("余额_" & j) = ye
                            r("余额_" & j & "hp") = fe
                            For k As Integer = j+1 To i
                                If t.Cols.Contains("余额_" & k) Then
                                    r("余额_" & k) = Nothing
                                    r("余额_" & k & "hp") = Nothing
                                End If
                            Next
                            i = j
                            Exit For
                        End If
                    End If
                Next
            End If
        End If
    Next
Next


 回到顶部