Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共6 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:工龄计算

1楼
longyanlin 发表于:2024/2/27 21:37: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("入职日期"),("离职日期"),y,m,d)
            e.DataRow("工龄_年") = y
            e.DataRow("工龄_月") = m
            e.DataRow("工龄_天") = d
        End If
End Select
2楼
有点蓝 发表于:2024/2/27 21:56:00
DateYMD(e.DataRow("入职日期"),e.DataRow("离职日期"),y,m,d)
3楼
longyanlin 发表于:2024/3/2 14:40:00
可以了,谢谢蓝老师,另外如果反过来呢,输入“开始日期”和“期限_年,期限_月,期限_日”,怎样计算出“结束日期”,这样的精准计算请问怎样写代码,谢谢老师。
4楼
有点蓝 发表于:2024/3/2 14:50:00
http://www.foxtable.com/webhelp/topics/1337.htm

dim d as date = e.DataRow("开始日期")

dim 结束日期 as date = d.AddYears(e.DataRow("期限_年")).AddMonths(e.DataRow("期限_")).......
5楼
longyanlin 发表于:2024/3/2 16:10:00
写了好久都不成功,蓝老师可以把代码放出来吗,谢谢



6楼
有点蓝 发表于:2024/3/2 17:27:00
Select Case e.DataCol.name
    Case "开始日期","期限_年","期限_月","期限_日"
        If e.DataRow.IsNull("开始日期") then
            e.DataRow("结束日期") = Nothing
        Else
dim d as date = e.DataRow("开始日期")
            if e.DataRow.IsNull("期限_年")=false
d =d.AddYears(e.DataRow("期限_年"))
end if
            if e.DataRow.IsNull("期限_月")=false
d =d.Addmonths(e.DataRow("期限_月"))
end if
            if e.DataRow.IsNull("期限_日")=false
d =d.Adddays(e.DataRow("期限_日"))
end if
e.DataRow("结束日期") = d
        End If
End Select
共6 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .01563 s, 2 queries.