以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  如何计算合同到期后超期天数  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=65796)

--  作者:ess110
--  发布时间:2015/3/23 11:45:00
--  如何计算合同到期后超期天数
如何计算合同到期后超期的天数?
--  作者:Bin
--  发布时间:2015/3/23 11:49:00
--  
参考http://www.foxtable.com/help/topics/2647.htm
--  作者:ess110
--  发布时间:2015/3/23 12:00:00
--  
怎么计算出来的数值都是零?
Select Case e.DataCol.name 
    Case "终止日期"
        If e.DataRow.IsNull("终止日期") Then
            e.DataRow("超期天数") = Nothing
        Else
            Dim tp As TimeSpan = Date.today - CDate(e.DataRow("终止日期"))
            e.DataRow("超期天数") = Math.Round(tp.TotalDays / 365)
        End If
End Select

--  作者:ess110
--  发布时间:2015/3/23 12:01:00
--  
终止日期等于当天日期计算数值为1?
--  作者:Bin
--  发布时间:2015/3/23 12:02:00
--  
Math.Round(tp.TotalDays / 365)  你了解过这句代码的意思吗?
--  作者:Bin
--  发布时间:2015/3/23 12:03:00
--  
不要盲目复制

e.DataRow("超期天数") = tp.TotalDays

--  作者:狐狸爸爸
--  发布时间:2015/3/23 15:54:00
--  

看看:

http://www.foxtable.com/help/topics/0287.htm