Foxtable(狐表)用户栏目专家坐堂 → 两个日期间天数的计算


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

主题:两个日期间天数的计算

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


加好友 发短信
等级:幼狐 帖子:194 积分:1168 威望:0 精华:0 注册:2015/6/8 21:38:00
  发帖心情 Post By:2015/7/31 11:30:00 [显示全部帖子]

If DrawGannt Then
    Dim r As Row  = Tables("任务_Table1").Rows(e.Row.Index)
    Dim dt1 As Date = r("开始日期")
    Dim dt2 As Date = r("结束日期")
    Dim dt As Date = e.Col.Name.Replace("年","-").Replace("月_","-")
    If dt>=dt1 AndAlso dt<=dt2 Then
        e.StartDraw()
        If dt < Date.Today Then
            e.Graphics.FillRectangle(Brushes.Green,e.x ,e.y + 5, e.Width, e.Height - 10)
        Else
            e.Graphics.FillRectangle(Brushes.Red,e.x ,e.y + 3, e.Width, e.Height - 7)
        End If
        If r.IsNull("计划任务") = False Then
            Dim tp As TimeSpan
            Dim dr As Date
            tp = dr("开始日期") - dr("结束日期")        
            Dim day As Double = tp.TotalDays() / r("计划任务") * r("累计完成")
            If dt <= dt1.AddHours(24 * day) Then
                Dim d As Integer = math.Floor(day)
                If (dt-dt1).Days < d Then '满格
                    e.Graphics.FillRectangle(Brushes.Yellow,e.x ,e.y + 8, e.Width, e.Height - 16)
                Else
                    Dim width As Integer = (day - d) * e.width
                    e.Graphics.FillRectangle(Brushes.Yellow,e.x ,e.y + 8, width, e.Height - 16)
                End If
            End If
        End If
        e.EndDraw()
    End If
End If


 回到顶部