Select Case e. DataCol .name
Case "入职日期"
Select Case e. DataRow("员工状态")
case "在职"
If e .DataRow . IsNull( "入职日期" ) Then
e .DataRow ( "在职时间" ) = Nothing
e .DataRow ( "在职月数" ) = Nothing
Else
Dim y,m,d As Integer
Dim dt1 As Date = e .DataRow ( "入职日期" )
Dim dt2 As Date = Date .Today ()
DateYMD(e.DataRow("入职日期"),Date.Today,y,m,d)
e.DataRow("在职时间") = y & "年" & m & "月" & d & "日"
e .DataRow ( "在职月数" ) = ( dt2 . Year - dt1 . Year ) * 12 + dt2 . Month - dt1 . Month
End If
case "离职"
If e .DataRow . IsNull( "入职日期" ) Then
e .DataRow ( "在职时间" ) = Nothing
e .DataRow ( "在职月数" ) = Nothing
Else
Dim y,m,d As Integer
Dim dt1 As Date = e .DataRow ( "入职日期" )
Dim dt2 As Date = Date .Today ()
这部分就不用我写了吧?
End If
End Select
End Select