以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]到期提醒计算出错  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=76882)

--  作者:xianzheng
--  发布时间:2015/11/6 18:59:00
--  [求助]到期提醒计算出错

在项目启动做了到期提醒,但发现提未出错了,有个营业执照是2022-11-14到期,但今天登陆竞然提示还有8天到期"(2022-11-14)-(2015-11-6)",年份难道没有进行计算?

 

 For Each dr As DataRow In DataTables("企业资料").DataRows
    Dim dt As Date = dr("证件期限_营业执照")
    dt =  New Date(Date.Today.Year,dt.Month,dt.Day)
    If Date.Today.AddDays(0) < = dt And dt < = Date.Today.AddDays(30) Then
         cnt = cnt + 1
        Dim sp As TimeSpan = dt - Date.Today
        nms =  nms & "     " & cnt &"." & dr("中文简称") & ":  营业执照还有" & sp.TotalDays & "天到期" & vbcrlf
    End If
Next


--  作者:xianzheng
--  发布时间:2015/11/6 18:59:00
--  
 发现提示出错了
--  作者:xianzheng
--  发布时间:2015/11/6 19:00:00
--  

在项目启动做了到期提醒,但发现提示出错了,有个营业执照是2022-11-14到期,但今天登陆竞然提示还有8天到期"(2022-11-14)-(2015-11-6)",年份难道没有进行计算?

 

Dim ids As String
Dim cnt As Integer
Dim nms As String
For Each dr As DataRow In DataTables("企业资料").DataRows
    Dim dt As Date = dr("证件期限_营业执照")
    dt =  New Date(Date.Today.Year,dt.Month,dt.Day)
    If Date.Today.AddDays(0) < = dt And dt < = Date.Today.AddDays(30) Then
        \' If dr1("证件期限_停止提示2") = False Then
        cnt = cnt + 1
        Dim sp As TimeSpan = dt - Date.Today
        nms =  nms & "     " & cnt &"." & dr("中文简称") & ":  营业执照还有" & sp.TotalDays & "天到期" & vbcrlf
        \'  End If
    End If
Next

[此贴子已经被作者于2015/11/6 19:10:12编辑过]

--  作者:xianzheng
--  发布时间:2015/11/6 20:05:00
--  

求助,高手帮看下


--  作者:Hyphen
--  发布时间:2015/11/7 8:39:00
--  

 

[此贴子已经被作者于2015/11/7 8:41:38编辑过]

--  作者:Hyphen
--  发布时间:2015/11/7 8:48:00
--  

Dim ids As String
Dim cnt As Integer
Dim nms As String
For Each dr As DataRow In DataTables("企业资料").DataRows
    Dim dt As Date = dr("证件期限_营业执照")
    Dim dtend =  New Date(Date.Today.Year,Date.Today.AddMonths(1).Month,1).AddDays(-1)

    If Date.Today <= dt AndAlso dt <= dtend  Then
        \' If dr1("证件期限_停止提示2") = False Then
        cnt = cnt + 1
        Dim sp As TimeSpan = dt - Date.Today
        nms =  nms & "     " & cnt &"." & dr("中文简称") & ":  营业执照还有" & sp.TotalDays & "天到期" & vbcrlf
        \'  End If
    End If
Next


--  作者:荟美绘姿
--  发布时间:2015/11/7 21:40:00
--  
我顶一下,学习一下下