以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]代码错误  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=138001)

--  作者:ljf
--  发布时间:2019/7/20 9:48:00
--  [求助]代码错误
Select Case e.DataCol.name
    Case "入职日期","离职日期"
        If e.DataRow.IsNull("入职日期") Then
            e.DataRow("工龄_年") = Nothing
            e.DataRow("工龄_月") = Nothing
            e.DataRow("工龄_日") = Nothing
        Else
            Dim y,m,d As Integer
            DateYMD(e.DataRow("入职日期"),Date.Today,y,m,d)
            e.DataRow("工龄_年") = y
            e.DataRow("工龄_月") = m
            e.DataRow("工龄_日") = d
        End If
End Select
            If e.DataRow.IsNull("离职日期") Then
            e.DataRow("工龄_年") = Nothing
            e.DataRow("工龄_月") = Nothing
            e.DataRow("工龄_日") = Nothing
        Else
            Dim y,m,d As Integer
            DateYMD(e.DataRow("入职日期"),Date.Today,y,m,d)
            e.DataRow("工龄_年") = y
            e.DataRow("工龄_月") = m
            e.DataRow("工龄_日") = d
        End If
End Select

                e.DataRow("状态") = "在职"
            Else
            e.DataRow("工龄_年") = Nothing
            e.DataRow("工龄_月") = Nothing
            e.DataRow("工龄_日") = Nothing
        Else
            Dim y,m,d As Integer
            DateYMD(e.DataRow("入职日期"),Date.Today,y,m,d)
            e.DataRow("工龄_年") = y
            e.DataRow("工龄_月") = m
            e.DataRow("工龄_日") = d
        End If
End Select

                e.DataRow("状态") = "离职"
            End If
        End If
End Select

If e.DataCol.Name = "离职日期" Then
    If e.DataRow.isnull("离职日期") = False Then
        e.DataRow("状态") = "离职"
    Else
        e.DataRow("状态") = "在职"
    End If
End If

--  作者:有点蓝
--  发布时间:2019/7/20 10:41:00
--  
Select Case e.DataCol.name
    Case "入职日期","离职日期"
        If e.DataRow.IsNull("入职日期")  Then
            e.DataRow("工龄_年") = Nothing
            e.DataRow("工龄_月") = Nothing
            e.DataRow("工龄_日") = Nothing
        Else
            Dim y,m,d As Integer
            If e.DataRow.IsNull("离职日期")
                DateYMD(e.DataRow("入职日期"),Date.Today,y,m,d)
            Else
                DateYMD(e.DataRow("入职日期"),e.DataRow("离职日期"),y,m,d)
            End If
            e.DataRow("工龄_年") = y
            e.DataRow("工龄_月") = m
            e.DataRow("工龄_日") = d
        End If
End Select
If e.DataCol.Name = "离职日期" Then
    If e.DataRow.isnull("离职日期") = False Then
        e.DataRow("状态") = "离职"
    Else
        e.DataRow("状态") = "在职"
    End If
End If

--  作者:ljf
--  发布时间:2019/7/20 11:31:00
--  
在职状态没有显示
--  作者:ljf
--  发布时间:2019/7/20 11:38:00
--  
解决了谢谢