Foxtable(狐表)用户栏目专家坐堂 → 请假


  共有3275人关注过本帖树形打印复制链接

主题:请假

帅哥哟,离线,有人找我吗?
有点甜
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/3/10 20:31:00 [显示全部帖子]

计算请假天数还是有难度的,我帮楼主写一下:

 

 

If e.DataCol.name="请假天数" Then
    If e.DataRow.IsNull("开始日期") = False AndAlso e.DataRow.IsNull("请假天数")=False Then
        Dim i As Integer=1
        Dim d As Date=e.DataRow("开始日期")
        Do While i<e.DataRow("请假天数")
            d=d.adddays(1)
            If DataTables("法定假期").Find("日期=#" & d & "#") Is Nothing Then
                If DataTables("节假日调休").Find("日期=#" & d & "#") Is Nothing Then
                    If d.DayOfWeek  <> 0 AndAlso d.DayOfWeek <> 6 Then
                        i=i+1
                    End If
                End If
            End If
        Loop
        e.DataRow("结束日期") = d
    End If
ElseIf e.DataCol.name = "结束日期" Then
    If e.DataRow.IsNull("开始日期") = False AndAlso e.DataRow.IsNull("结束日期")=False Then
        Dim cnt As Integer = (e.DataRow("结束日期") - e.DataRow("开始日期")).Totaldays
        Dim dys As Integer = 0
        For i As Integer = 0 To cnt
            Dim d As Date= e.DataRow("开始日期").Adddays(i)
            If DataTables("法定假期").Find("日期=#" & d & "#") Is Nothing Then
                If DataTables("节假日调休").Find("日期=#" & d & "#") Is Nothing Then
                    If d.DayOfWeek  <> 0 AndAlso d.DayOfWeek <> 6 Then
                        dys=dys+1
                    End If
                End If
            End If
        Next
        e.DataRow("请假天数") = dys
    End If
End If


 回到顶部