以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  统计未打卡次数  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=89068)

--  作者:zhangning
--  发布时间:2016/8/15 11:34:00
--  统计未打卡次数
有 两个列“签到时间”和“签退时间”,
如这两列任意一个空值,就算未打卡一次,
请问老师如何写代码,谢谢!

--  作者:Hyphen
--  发布时间:2016/8/15 11:42:00
--  
具体问题代码或者例子说明
--  作者:zhangning
--  发布时间:2016/8/15 12:46:00
--  
Dim Count1 As Integer
Dim Count2 As Integer
If e.DataCol.Name = "签到时间" Then
    If e.NewValue Is Nothing Then
        count1 = 1
    Else
        Count1 = nothing
    End If
End If
If e.DataCol.Name = "签退时间" Then
    If e.NewValue Is Nothing Then
        count2 = 1
    Else
        Count2 = nothing
        End If
        End If
e.DataRow("未打卡回") = count1 + count2

老师帮看看以上代码,错在哪儿


--  作者:Hyphen
--  发布时间:2016/8/15 15:02:00
--  
Select Case e.DataCol.Name
    Case "签到时间","签退时间"
        Dim count As Integer
        If e.DataRow.IsNull("签到时间") = False Then count += 1
        If e.DataRow.IsNull("签退时间") = False Then count += 1
        e.DataRow("未打卡回") =count
End Select

--  作者:大红袍
--  发布时间:2016/8/15 15:40:00
--  
If e.DataCol.Name = "签到时间" OrElse e.DataCol.Name =  "签退时间" Then
    Dim count As Integer = 0
    If e.DataRow.isNull("签到时间") Then
        count += 1
    End If
    If e.DataRow.isNull("签退时间") Then
        count += 1
    End If
    e.DataRow("未打卡回") = count
End If

--  作者:zhangning
--  发布时间:2016/8/15 17:20:00
--  
大红袍老师,如果再加上一个条件,未打卡理由认可”列(逻辑)选中的话,那么“未打卡回”等于0,否则就空值就算未打卡,
以下代码:
if e.DataRow("未打卡理由认可") = true then
    e.DataRow("未打卡回") = 0
    else
If e.DataCol.Name = "签到时间" OrElse e.DataCol.Name =  "签退时间" Then
    Dim count As Integer = 0    
    If e.DataRow.isNull("签到时间") Then
        count += 1
    End If
    If e.DataRow.isNull("签退时间") Then
        count += 1
    End If
    e.DataRow("未打卡回") = count
End If
end if


测试结果,感觉逻辑列不起作用,麻烦老师帮看看,谢谢!

--  作者:大红袍
--  发布时间:2016/8/15 17:24:00
--  
If e.DataCol.Name = "签到时间" OrElse e.DataCol.Name =  "签退时间" OrElse e.DataCol.Name = "未打卡理由认可" Then
    If e.DataRow("未打卡理由认可") = True Then
        e.DataRow("未打卡回") = 0
    Else
        Dim count As Integer = 0
        If e.DataRow.isNull("签到时间") Then
            count += 1
        End If
        If e.DataRow.isNull("签退时间") Then
            count += 1
        End If
        e.DataRow("未打卡回") = count
    End If
End If