以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  时间逻辑i计算  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=121829)

--  作者:yifan3429
--  发布时间:2018/7/13 15:28:00
--  时间逻辑i计算
增加一个条件
如果  验收日期  为空值
计算  剩余时间  交期时长
如果  验收日期  为不空值 不做任何计算

If e.DataCol.Name = "交货日期" Then
    If e.DataRow.IsNull("交货日期") Then
        e.DataRow("剩余时间") = Nothing
    Else
        Dim ts As TimeSpan = cdate(e.DataRow("交货日期")) - Date.Today
        Dim t1s As TimeSpan = cdate(e.DataRow("交货日期")) - cdate(e.DataRow("下单日期"))
        e.DataRow("剩余时间") = ts.TotalDays & "天"
        e.DataRow("交期时长") = t1s.TotalDays  & "天"
    End If
End If

--  作者:有点甜
--  发布时间:2018/7/13 15:36:00
--  

If e.DataCol.Name = "交货日期" OrElse e.DataCol.Name = "下单日期" OrElse e.DataCol.name = "验收日期" Then
    If e.DataRow.IsNull("验收日期") = False Then
        e.DataRow("剩余时间") = Nothing
        e.DataRow("交期时长") = Nothing
    Else
        Dim ts As TimeSpan = cdate(e.DataRow("交货日期")) - Date.Today
        Dim t1s As TimeSpan = cdate(e.DataRow("交货日期")) - cdate(e.DataRow("下单日期"))
        e.DataRow("剩余时间") = ts.TotalDays & "天"
        e.DataRow("交期时长") = t1s.TotalDays  & "天"
    End If
End If

--  作者:ideaplayer
--  发布时间:2019/7/15 23:57:00
--  
请问这段代码放在哪个地方?


--  作者:李孝春
--  发布时间:2019/7/16 8:30:00
--  回复:(ideaplayer)请问这段代码放在哪个地方?
放表事件中的 当列值发生变化时候执行
--  作者:有点蓝
--  发布时间:2019/7/16 8:54:00
--  
表属性,datacolchanged事件:http://www.foxtable.com/webhelp/topics/1445.htm