Foxtable(狐表)用户栏目专家坐堂 → 自动复制行表A复制到三个表,代码能简化吗?


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

主题:自动复制行表A复制到三个表,代码能简化吗?

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


加好友 发短信
等级:三尾狐 帖子:603 积分:4392 威望:0 精华:0 注册:2018/1/3 16:03:00
自动复制行表A复制到三个表,代码能简化吗?  发帖心情 Post By:2022/9/29 10:35:00 [只看该作者]

请教老师,自动复制行表A复制到三个表,代码能简化在一起吗?

'自动复制行, 审核后记账原材料

If e.DataCol.Name = "审核" AndAlso e.DataRow("审核") = True Then

    Dim nma() As String = {"入库ID", "供应商名称", "金额", "部门ID"} 'A表数据来源列

    Dim nmb() As String = {"凭证ID", "供应商名称", "余额", "部门ID"} '原材料数据接收列

    Dim dr As DataRow = DataTables("原材料").AddNew

    For i As Integer = 0 To nma.Length - 1

        dr(nmb(i)) = e.DataRow(nma(i))

    Next

End If

'自动复制行, 审核后记账应付账款

If e.DataCol.Name = "审核" AndAlso e.DataRow("审核") = True Then

    Dim nma() As String = {"入库ID", "供应商名称", "价税合计", "部门ID"} 'A表数据来源列

    Dim nmb() As String = {"凭证ID", "供应商名称", "贷方金额", "部门ID"} '原材料数据接收列

    Dim dr As DataRow = DataTables("应付账款").AddNew

    For i As Integer = 0 To nma.Length - 1

        dr(nmb(i)) = e.DataRow(nma(i))

    Next

End If

'自动复制行, 审核后记账应付税金

If e.DataCol.Name = "审核" AndAlso e.DataRow("审核") = True Then

    Dim nma() As String = {"入库ID", "供应商名称", "税额", "部门ID"} 'A表数据来源列

    Dim nmb() As String = {"凭证ID", "供应商名称", "借方金额", "部门ID"} '原材料数据接收列

    Dim dr As DataRow = DataTables("应交税费").AddNew

    For i As Integer = 0 To nma.Length - 1

        dr(nmb(i)) = e.DataRow(nma(i))

    Next

End If



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


加好友 发短信
等级:超级版主 帖子:111427 积分:567211 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2022/9/29 10:40:00 [只看该作者]

If e.DataCol.Name = "审核" AndAlso e.DataRow("审核") = True Then
    Dim nma() As String = {"入库ID", "供应商名称", "金额", "部门ID"} 'A表数据来源列
    Dim nmb() As String = {"凭证ID", "供应商名称", "余额", "部门ID"} '原材料数据接收列
    Dim nmc() As String = {"凭证ID", "供应商名称", "贷方金额", "部门ID"} '原材料数据接收列
    Dim nmd() As String = {"凭证ID", "供应商名称", "借方金额", "部门ID"} '原材料数据接收列

    Dim dr As DataRow = DataTables("原材料").AddNew
    Dim dr1 As DataRow = DataTables("应付账款").AddNew
    Dim dr2 As DataRow = DataTables("应交税费").AddNew

    For i As Integer = 0 To nma.Length - 1
        dr(nmb(i)) = e.DataRow(nma(i))
        dr1(nmc(i)) = e.DataRow(nma(i))
        dr2(nmd(i)) = e.DataRow(nma(i))
    Next
End If

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


加好友 发短信
等级:三尾狐 帖子:603 积分:4392 威望:0 精华:0 注册:2018/1/3 16:03:00
  发帖心情 Post By:2022/9/29 11:44:00 [只看该作者]

谢谢蓝老师!

 回到顶部