Foxtable(狐表)用户栏目专家坐堂 → 提示错误,请教怎么解决?


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

主题:提示错误,请教怎么解决?

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


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

For Each ary() As String In DataTables("包装车间工资表").GetValues("日期|生产形式", "日期 is not null and 生产形式 <> '个人'")
    Dim drs As List(Of DataRow) = DataTables("包装车间工资表").Select("日期=#" & ary(0) & "# and 生产形式='" & ary(1) & "'")
    Dim smoney As Double = DataTables("包装车间工资表").compute("sum(计件金额)", "日期=#" & ary(0) & "# and 生产形式='" & ary(1) & "'")
    Dim stime As Double = DataTables("包装车间工资表").compute("sum(计件时间)", "日期=#" & ary(0) & "# and 生产形式='" & ary(1) & "'")
    Dim dj As Double = smoney / stime
    For Each dr As DataRow In drs
        dr("分配单价") = dj
        dr("分配后金额") = format(dj * dr("计件时间"),"0.00")
    Next
Next
For Each dr As DataRow In DataTables("包装车间工资表").Select("生产形式 = '个人'")
    dr("分配单价") = Nothing
    dr("分配后金额") = format(dr("数量") * dr("单价"),"0.00")
Next

For Each ary As String In DataTables("包装车间工资表").GetValues("日期", "日期 is not null")
    Dim drs1 As List(Of DataRow) = DataTables("包装车间工资表").Select("日期=#" & ary & "#")
    Dim sum As Double = DataTables("包装车间工资表").compute("sum(上班工时)", "日期=#" & ary & "#")
    Dim count As Integer = 0
    Dim ls As new List(Of String)
    For Each dr As DataRow In drs1
        Dim str As String = dr("姓名")
        If ls.Contains(str) = False Then
            count += 1
            ls.add(str)
            dr("备注") = dr("备注").replace("重复", Nothing)
        Else
            dr("备注") = "重复" & dr("备注").replace("重复", Nothing)
        End If
    Next
    For Each dr As DataRow In drs1
        If dr("备注") Like "*重复*" Then
            dr("上班天数") = Nothing
        End If
        If sum > = 8
            dr("上班天数") = 1
        Else
            dr("上班天数") = format(sum/8, "0.00")
        End If
    Next
Next

'Tables("包装车间工资表").Filter = ""
Tables("包装车间工资表").Filter = "日期 is not null and (备注 is null or 备注 not like '%重复%')"
Tables("包装车间工资表").Sort = "日期,生产形式"


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


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

试用版,可以使用三个月左右。重装系统,或者换一台电脑,可以继续使用。


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


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

中间的代码改一下

 

    For Each dr As DataRow In drs1
        If dr("备注") Like "*重复*" Then
            dr("上班天数") = Nothing
        Else
            If sum > = 8
                dr("上班天数") = 1
            Else
                dr("上班天数") = format(sum/8, "0.00")
            End If
        End If
    Next


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


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

我测试,没问题。哪个数据什么问题啊?逻辑是什么啊?

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


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

For Each ary() As String In DataTables("包装车间工资表").GetValues("日期|生产形式", "日期 is not null and 生产形式 <> '个人'")
    Dim drs As List(Of DataRow) = DataTables("包装车间工资表").Select("日期=#" & ary(0) & "# and 生产形式='" & ary(1) & "'")
    Dim smoney As Double = DataTables("包装车间工资表").compute("sum(计件金额)", "日期=#" & ary(0) & "# and 生产形式='" & ary(1) & "'")
    Dim stime As Double = DataTables("包装车间工资表").compute("sum(计件时间)", "日期=#" & ary(0) & "# and 生产形式='" & ary(1) & "'")
    Dim dj As Double = smoney / stime
    For Each dr As DataRow In drs
        dr("分配单价") = dj
        dr("分配后金额") = format(dj * dr("计件时间"),"0.00")
    Next
Next
For Each dr As DataRow In DataTables("包装车间工资表").Select("生产形式 = '个人'")
    dr("分配单价") = Nothing
    dr("分配后金额") = format(dr("数量") * dr("单价"),"0.00")
Next

For Each ary As String In DataTables("包装车间工资表").GetValues("日期", "日期 is not null")
    Dim drs1 As List(Of DataRow) = DataTables("包装车间工资表").Select("日期=#" & ary & "#")
    Dim ls As new List(Of String)
    For Each dr As DataRow In drs1
        Dim str As String = dr("姓名")
        If ls.Contains(str) = False Then
            ls.add(str)
            dr("备注") = dr("备注").replace("重复", Nothing)
        Else
            dr("备注") = "重复" & dr("备注").replace("重复", Nothing)
        End If
    Next
    For Each dr As DataRow In drs1
        If dr("备注") Like "*重复*" Then
            dr("上班天数") = Nothing
        ElseIf dr("上班工时") > = 8
            dr("上班天数") = 1
        Else
            dr("上班天数") = format(dr("上班工时")/8, "0.00")
        End If
    Next
Next

'Tables("包装车间工资表").Filter = ""
Tables("包装车间工资表").Filter = "日期 is not null and (备注 is null or 备注 not like '%重复%')"
Tables("包装车间工资表").Sort = "日期,生产形式"


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


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

从一开始,你就应该把你的逻辑说明白啊

 

For Each ary() As String In DataTables("包装车间工资表").GetValues("日期|生产形式", "日期 is not null and 生产形式 <> '个人'")
    Dim drs As List(Of DataRow) = DataTables("包装车间工资表").Select("日期=#" & ary(0) & "# and 生产形式='" & ary(1) & "'")
    Dim smoney As Double = DataTables("包装车间工资表").compute("sum(计件金额)", "日期=#" & ary(0) & "# and 生产形式='" & ary(1) & "'")
    Dim stime As Double = DataTables("包装车间工资表").compute("sum(计件时间)", "日期=#" & ary(0) & "# and 生产形式='" & ary(1) & "'")
    Dim dj As Double = smoney / stime
    For Each dr As DataRow In drs
        dr("分配单价") = dj
        dr("分配后金额") = format(dj * dr("计件时间"),"0.00")
    Next
Next
For Each dr As DataRow In DataTables("包装车间工资表").Select("生产形式 = '个人'")
    dr("分配单价") = Nothing
    dr("分配后金额") = format(dr("数量") * dr("单价"),"0.00")
Next

For Each ary As String() In DataTables("包装车间工资表").GetValues("日期|姓名", "日期 is not null")
    Dim sum As Double = DataTables("包装车间工资表").compute("sum(上班工时)", "日期=#" & ary(0) & "# and 姓名='" & ary(1) & "'")
    Dim drs1 As List(Of DataRow) = DataTables("包装车间工资表").Select("日期=#" & ary(0) & "# and 姓名='" & ary(1) & "'")
    Dim ls As new List(Of String)
    For i As Integer = 0 To drs1.count-1
        Dim dr = drs1(i)
        If i = 0 Then
            dr("备注") = dr("备注").replace("重复", Nothing)
            If sum > = 8
                dr("上班天数") = 1
            Else
                dr("上班天数") = format(sum/8, "0.00")
            End If
        Else
            dr("备注") = "重复" & dr("备注").replace("重复", Nothing)
        End If
    Next
Next

'Tables("包装车间工资表").Filter = ""
'Tables("包装车间工资表").Filter = "日期 is not null and (备注 is null or 备注 not like '%重复%')"
Tables("包装车间工资表").Sort = "日期,生产形式"


 回到顶部