以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  法律有效性计算  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=194824)

--  作者:timber83
--  发布时间:2025/1/17 14:19:00
--  法律有效性计算
举例:
表A
法律名称          发布日期          实施日期          废止日期         时效
食品法      2021-01-05     2022-01-05       2023-01-05        废止

需要实现,时效列自动计算,
计算规则,
【法律名称】列为空时, 【时效】列为空,
【法律名称】列非空时,【废止日期】列为空,【实施日期】列大于当前日期, 时效为“即将生效”
                                                             【实施日期】列小于等于当前日期,时效为“生效”
                                【废止日期】列非空,【废止日期】列小于等于当前日期,时效为“失效”
                                                              【废止日期】列大于当前日期,时效为“生效”

--  作者:有点蓝
--  发布时间:2025/1/17 14:44:00
--  
http://www.foxtable.com/webhelp/topics/0625.htm

Select Case e.DataCol.Name
    Case "法律名称", "实施日期", "废止日期"
        If e.DataRow.isnull("法律名称") Then
            e.DataRow("时效") = Nothing
        Else
            If e.DataRow.isnull("废止日期") Then
                If e.DataRow("实施日期") > Date.today Then
                    e.DataRow("时效") = "即将生效"
                Else
                    e.DataRow("时效") = "生效" 
                End If 
            Else
……剩下自己参考做
            End If
        End If
End Select

--  作者:timber83
--  发布时间:2025/1/17 15:11:00
--  
以下是引用有点蓝在2025/1/17 14:44:00的发言:
http://www.foxtable.com/webhelp/topics/0625.htm

Select Case e.DataCol.Name
    Case "法律名称", "实施日期", "废止日期"
        If e.DataRow.isnull("法律名称") Then
            e.DataRow("时效") = Nothing
        Else
            If e.DataRow.isnull("废止日期") Then
                If e.DataRow("实施日期") > Date.today Then
                    e.DataRow("时效") = "即将生效"
                Else
                    e.DataRow("时效") = "生效" 
                End If 
            Else
……剩下自己参考做
            End If
        End If
End Select

感谢