以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 怎样计算出不同性别的退休时间 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=129028) |
-- 作者:小郑 -- 发布时间:2018/12/20 11:20:00 -- 怎样计算出不同性别的退休时间 If e .DataCol . Name = "身份证号码" Then \'如果更改的是身份证号码列 If e .DataRow . IsNull( "身份证号码" ) Then \'身份证号码是否为空 e .DataRow ( "出生日期" ) = Nothing \'如果为空,则清除出生日期 e .DataRow ( "性别") = Nothing Else \'否则从身份证号码列中提取出生日期 e .DataRow ( "出生日期" ) = ReadBirthday ( e. DataRow ("身份证号码" )) e .DataRow ( "性别") = ReadSex (e .DataRow ( "身份证号码" )) End If End If If e.DataCol.name = "出生日期" Then \'如果更改的是出生日期列 If e.DataRow.IsNull("出生日期") Then \'出生日期是否为空 e.DataRow("年龄") = Nothing \'如果为空,则清除年龄 Else \'否则从出生日期列中提取出年龄 Dim n As Integer= Date.Today.Year - e.DataRow("出生日期").Year If e.DataRow("出生日期").AddMonths(n*12) > Date.Today Then n = n -1 End If e.DataRow("年龄") = n End If End If (前面的已经实现了,后面代码没有办法显示出退休时间) If e.DataCol.Name = "出生日期" Then If e.DataRow.IsNull("出生日期") Then e.DataRow("退休时间") = Nothing Else If e.DataRow("性别") ="女" Then e.DataRow("退休时间") = e.DataRow("出生日期").AddYears(50) Else If e.DataRow("性别") ="男" e.DataRow("退休时间") = e.DataRow("出生日期").AddYears(60) End If End If
|
-- 作者:有点甜 -- 发布时间:2018/12/20 11:28:00 -- If e.DataCol.Name = "出生日期" orElse e.datacol.name = "性别" Then
If e.DataRow.IsNull("出生日期") Then
e.DataRow("退休时间") = Nothing
Else If e.DataRow("性别") ="女" Then
e.DataRow("退休时间") = e.DataRow("出生日期").AddYears(50)
Else If e.DataRow("性别") ="男"
e.DataRow("退休时间") = e.DataRow("出生日期").AddYears(60)
End If
End If
|
-- 作者:小郑 -- 发布时间:2018/12/20 11:41:00 -- 还是显示不了哦 |
-- 作者:有点甜 -- 发布时间:2018/12/20 11:46:00 -- 以下是引用小郑在2018/12/20 11:41:00的发言:
还是显示不了哦
重置列
|
-- 作者:小郑 -- 发布时间:2018/12/20 11:47:00 -- If e .DataCol . Name = "身份证号码" Then \'如果更改的是身份证号码列 If e .DataRow . IsNull( "身份证号码" ) Then \'身份证号码是否为空 e .DataRow ( "出生日期" ) = Nothing \'如果为空,则清除出生日期 e .DataRow ( "性别") = Nothing Else \'否则从身份证号码列中提取出生日期 e .DataRow ( "出生日期" ) = ReadBirthday ( e. DataRow ("身份证号码" )) e .DataRow ( "性别") = ReadSex (e .DataRow ( "身份证号码" )) End If End If If e.DataCol.name = "出生日期" Then \'如果更改的是出生日期列 If e.DataRow.IsNull("出生日期") Then \'出生日期是否为空 e.DataRow("年龄") = Nothing \'如果为空,则清除年龄 Else \'否则从出生日期列中提取出年龄 Dim n As Integer= Date.Today.Year - e.DataRow("出生日期").Year If e.DataRow("出生日期").AddMonths(n*12) > Date.Today Then n = n -1 End If e.DataRow("年龄") = n End If End If If e.DataCol.Name = "出生日期" Or e.DataCol.name = "性别" Then If e.DataRow.IsNull("出生日期") Then e.DataRow("退休时间") = Nothing Else If e.DataRow("性别") ="女" Then e.DataRow("退休时间") = e.DataRow("出生日期").AddYears(50) Else If e.DataRow("性别") ="男" e.DataRow("退休时间") = e.DataRow("出生日期").AddYears(60) End If End If
|
-- 作者:小郑 -- 发布时间:2018/12/20 11:49:00 -- 行了,谢谢 |