Foxtable(狐表)用户栏目专家坐堂 → 动态列动态更新


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

主题:动态列动态更新

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


加好友 发短信
等级:九尾狐 帖子:2234 积分:15278 威望:0 精华:0 注册:2015/7/18 10:10:00
动态列动态更新  发帖心情 Post By:2016/2/24 21:31:00 [只看该作者]

Dim tb As DataTable = DataTables("会计科目")
If e.DataCol.name = "会计年度" And e.newvalue IsNot Nothing Then
    For Each c As DataCol In e.DataTable.DataCols
        If c.name <> "会计年度" AndAlso c.name <> "审核"  Then
msgbox(c.name)
            If tb.find("资产负债表 = '" & c.name & "'").Isnull("资产负债表包含科目") = True Then
msgbox(1)
                'If c.name <> "会计年度" AndAlso c.name <> "审核" AndAlso c.name <> "应收款项" AndAlso c.name <> "应付款项" AndAlso c.name <> "固定资产原价" AndAlso c.name <> "未分配收益"  AndAlso c.name <> "货币资金" AndAlso c.name <> "存货"  Then
                e.DataRow(c.name) = DataTables("余额横表未审").Compute("sum(" & c.name & ")","会计年度 = '" & e.DataRow("会计年度") & "'")
           msgbox(2)    
            Else
                Dim lis As List(of String) =tb.find("科目名称 = '" & c.name & "'")("资产负债表包含科目")
                Dim sum As Double
                For Each li As String In lis
                    sum = sum + DataTables("余额横表未审").Compute("sum(" & li & ")","会计年度 = '" & e.DataRow("会计年度") & "'")
                Next
                e.DataRow(c.name) = sum
            End If
        End If
    Next
    e.DataRow("应收款项") = DataTables("余额横表未审").Compute("sum(应收款)","会计年度 = '" & e.DataRow("会计年度") & "'")
    e.DataRow("应付款项") = DataTables("余额横表未审").Compute("sum(应付款)","会计年度 = '" & e.DataRow("会计年度") & "'")
    e.DataRow("固定资产原价") = DataTables("余额横表未审").Compute("sum(固定资产)","会计年度 = '" & e.DataRow("会计年度") & "'")
    e.DataRow("未分配收益") = DataTables("余额横表未审").Compute("sum(本年收益)","会计年度 = '" & e.DataRow("会计年度") & "'")+DataTables("余额横表未审").Compute("sum(收益分配)","会计年度 = '" & e.DataRow("会计年度") & "'")
    e.DataRow("货币资金") = DataTables("余额横表未审").Compute("sum(库存现金)","会计年度 = '" & e.DataRow("会计年度") & "'")+DataTables("余额横表未审").Compute("sum(银行存款)","会计年度 = '" & e.DataRow("会计年度") & "'")+DataTables("余额横表未审").Compute("sum(授权支付用款额度)","会计年度 = '" & e.DataRow("会计年度") & "'")
   
End If

以上代码在黄色部分是提示错误,该怎么修改

.NET Framework 版本:2.0.50727.5485
Foxtable 版本:2015.12.22.1
错误所在事件:表,资产负债表未审,DataColChanged
详细错误信息:
调用的目标发生了异常。
未将对象引用设置到对象的实例。


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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/2/24 22:28:00 [只看该作者]

Dim fdr As DataRow = tb.find("资产负债表 = '" & c.name & "'")

If fdr IsNot Nothing AndAlso fdr.Isnull("资产负债表包含科目") Then


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


加好友 发短信
等级:九尾狐 帖子:2234 积分:15278 威望:0 精华:0 注册:2015/7/18 10:10:00
  发帖心情 Post By:2016/2/24 22:51:00 [只看该作者]

还是不行

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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/2/24 22:52:00 [只看该作者]

不可能是2楼代码那里错。


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


加好友 发短信
等级:九尾狐 帖子:2234 积分:15278 威望:0 精华:0 注册:2015/7/18 10:10:00
  发帖心情 Post By:2016/2/25 0:12:00 [只看该作者]

修改后还是提示如下

.NET Framework 版本:2.0.50727.5485
Foxtable 版本:2015.12.22.1
错误所在事件:表,资产负债表未审,DataColChanged
详细错误信息:
调用的目标发生了异常。
未将对象引用设置到对象的实例。


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


加好友 发短信
等级:九尾狐 帖子:2234 积分:15278 威望:0 精华:0 注册:2015/7/18 10:10:00
  发帖心情 Post By:2016/2/25 0:20:00 [只看该作者]

Dim tb As DataTable = DataTables("会计科目")
If e.DataCol.name = "会计年度" And e.newvalue IsNot Nothing Then
    For Each c As DataCol In e.DataTable.DataCols
        If c.name <> "会计年度" AndAlso c.name <> "审核"  Then
            msgbox(c.name)
            'Dim fdr As DataRow = tb.find("资产负债表 = '" & c.name & "'")
Dim fdr As DataRow = tb.find("资产负债表 = '货币资金'")
msgbox(1)
            If fdr IsNot Nothing AndAlso fdr.Isnull("资产负债表包含科目") = True Then
   msgbox(2)            
                'If tb.find("资产负债表 = '" & c.name & "'").Isnull("资产负债表包含科目") = True Then
               
                'If c.name <> "会计年度" AndAlso c.name <> "审核" AndAlso c.name <> "应收款项" AndAlso c.name <> "应付款项" AndAlso c.name <> "固定资产原价" AndAlso c.name <> "未分配收益"  AndAlso c.name <> "货币资金" AndAlso c.name <> "存货"  Then
                e.DataRow(c.name) = DataTables("余额横表未审").Compute("sum(" & c.name & ")","会计年度 = '" & e.DataRow("会计年度") & "'")
                msgbox(2)
            Else
                Dim lis As List(of String) =tb.find("科目名称 = '" & c.name & "'")("资产负债表包含科目")
                Dim sum As Double
                For Each li As String In lis
                    sum = sum + DataTables("余额横表未审").Compute("sum(" & li & ")","会计年度 = '" & e.DataRow("会计年度") & "'")
                Next
                e.DataRow(c.name) = sum
            End If
        End If
    Next
    e.DataRow("应收款项") = DataTables("余额横表未审").Compute("sum(应收款)","会计年度 = '" & e.DataRow("会计年度") & "'")
    e.DataRow("应付款项") = DataTables("余额横表未审").Compute("sum(应付款)","会计年度 = '" & e.DataRow("会计年度") & "'")
    e.DataRow("固定资产原价") = DataTables("余额横表未审").Compute("sum(固定资产)","会计年度 = '" & e.DataRow("会计年度") & "'")
    e.DataRow("未分配收益") = DataTables("余额横表未审").Compute("sum(本年收益)","会计年度 = '" & e.DataRow("会计年度") & "'")+DataTables("余额横表未审").Compute("sum(收益分配)","会计年度 = '" & e.DataRow("会计年度") & "'")
    e.DataRow("货币资金") = DataTables("余额横表未审").Compute("sum(库存现金)","会计年度 = '" & e.DataRow("会计年度") & "'")+DataTables("余额横表未审").Compute("sum(银行存款)","会计年度 = '" & e.DataRow("会计年度") & "'")+DataTables("余额横表未审").Compute("sum(授权支付用款额度)","会计年度 = '" & e.DataRow("会计年度") & "'")
   
End If

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


加好友 发短信
等级:狐神 帖子:5015 积分:25363 威望:0 精华:0 注册:2015/8/18 9:21:00
  发帖心情 Post By:2016/2/25 8:27:00 [只看该作者]

......
            Else
                Dim dr As DataRow = tb.find("科目名称 = '" & c.name & "'")
                If dr IsNot Nothing Then
                    Dim lis As List(of String) = dr("资产负债表包含科目")
                    Dim sum As Double
                    For Each li As String In lis
                        sum = sum + DataTables("余额横表未审").Compute("sum(" & li & ")","会计年度 = '" & e.DataRow("会计年度") & "'")
                    Next
                    e.DataRow(c.name) = sum
                End If
            End If
......

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


加好友 发短信
等级:九尾狐 帖子:2234 积分:15278 威望:0 精华:0 注册:2015/7/18 10:10:00
  发帖心情 Post By:2016/2/25 10:27:00 [只看该作者]

Dim tb As DataTable = DataTables("会计科目")
If e.DataCol.name = "会计年度" And e.newvalue IsNot Nothing Then
    For Each c As DataCol In e.DataTable.DataCols
        If c.name <> "会计年度" AndAlso c.name <> "审核"  Then
            msgbox(c.name)
            'Dim fdr As DataRow = tb.find("资产负债表 = '" & c.name & "'")

msgbox(1)
            If tb.find("资产负债表 = '" & c.name & "'")("表包含科目") Is Nothing Then
   msgbox(2)            
                'If tb.find("资产负债表 = '" & c.name & "'").Isnull("资产负债表包含科目") = True Then
               
                'If c.name <> "会计年度" AndAlso c.name <> "审核" AndAlso c.name <> "应收款项" AndAlso c.name <> "应付款项" AndAlso c.name <> "固定资产原价" AndAlso c.name <> "未分配收益"  AndAlso c.name <> "货币资金" AndAlso c.name <> "存货"  Then
                e.DataRow(c.name) = DataTables("余额横表未审").Compute("sum(" & c.name & ")","会计年度 = '" & e.DataRow("会计年度") & "'")
                msgbox(2)
            Else
                Dim lis As List(of String) =tb.find("科目名称 = '" & c.name & "'")("表包含科目")
                Dim sum As Double
                For Each li As String In lis
                    sum = sum + DataTables("余额横表未审").Compute("sum(" & li & ")","会计年度 = '" & e.DataRow("会计年度") & "'")
                Next
                e.DataRow(c.name) = sum
            End If
        End If
    Next
    e.DataRow("应收款项") = DataTables("余额横表未审").Compute("sum(应收款)","会计年度 = '" & e.DataRow("会计年度") & "'")
    e.DataRow("应付款项") = DataTables("余额横表未审").Compute("sum(应付款)","会计年度 = '" & e.DataRow("会计年度") & "'")
    e.DataRow("固定资产原价") = DataTables("余额横表未审").Compute("sum(固定资产)","会计年度 = '" & e.DataRow("会计年度") & "'")
    e.DataRow("未分配收益") = DataTables("余额横表未审").Compute("sum(本年收益)","会计年度 = '" & e.DataRow("会计年度") & "'")+DataTables("余额横表未审").Compute("sum(收益分配)","会计年度 = '" & e.DataRow("会计年度") & "'")
    e.DataRow("货币资金") = DataTables("余额横表未审").Compute("sum(库存现金)","会计年度 = '" & e.DataRow("会计年度") & "'")+DataTables("余额横表未审").Compute("sum(银行存款)","会计年度 = '" & e.DataRow("会计年度") & "'")+DataTables("余额横表未审").Compute("sum(授权支付用款额度)","会计年度 = '" & e.DataRow("会计年度") & "'")
   
End If

提示错误的是红色部分


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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/2/25 10:39:00 [只看该作者]

 无语,看楼上已经给你答案了啊,要判断是否找到对应的行啊

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


加好友 发短信
等级:九尾狐 帖子:2234 积分:15278 威望:0 精华:0 注册:2015/7/18 10:10:00
  发帖心情 Post By:2016/2/25 10:59:00 [只看该作者]

.NET Framework 版本:2.0.50727.5485
Foxtable 版本:2015.12.22.1
错误所在事件:表,资产负债表未审,DataColChanged
详细错误信息:
调用的目标发生了异常。
无法将类型为“System.String”的对象强制转换为类型“System.Collections.Generic.List`1[System.String]”。

可能是以下代码的原因,资产负债表包含科目列包含的内容为  银行存款,库存现金,其他货币资金 怎么修改
  Dim lis As List(of String) = dr("资产负债表包含科目")


 回到顶部
总数 12 1 2 下一页