以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  到期提醒  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=89072)

--  作者:约翰舒
--  发布时间:2016/8/15 13:58:00
--  到期提醒
在进行到期提醒设置的时候,有生产日期列、保质天数列、到期日期列,
设置过后,打开项目会自动跳出到期提醒的messagebox窗口

我想实现的是:在10天内即将到期产品提醒的MessageBox提示,用户知晓后就不再显示MessageBox,即提示之后关闭提示窗口

--  作者:大红袍
--  发布时间:2016/8/15 15:26:00
--  

你是参考这个例子做的吗?http://www.foxtable.com/webhelp/scr/2471.htm

 

改一下提醒的代码

 

Dim dt As Date = Date.Today.AddDays(10)
Dim dr As DataRow = DataTables("库存表").Find("到期日期 <= #" & dt & "# and 到期日期 >= #" & Date.Today & "#")
If dr IsNot Nothing Then
    MessageBox.Show("有产品即将到期!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    Tables("库存表").Filter = "到期日期 <= #" & dt & "# and 到期日期 >= #" & Date.Today & "#"
    MainTable = Tables("库存表")
End If


--  作者:大红袍
--  发布时间:2016/8/15 15:29:00
--  

 或者加一列,【不再提醒】,做个按钮

 

DataTables("库存表").ReplaceFor("不再提醒", true, "到期日期 <= #" & dt & "#")

 


--  作者:约翰舒
--  发布时间:2016/8/15 17:19:00
--  
已经到期的,怎么把红底白字的标记自动取消不再提醒?
就是到期了就不在提醒了,不显示红底白字,要不然那些已经到期的下一次打开项目的时候还会显示不是吗?

--  作者:大红袍
--  发布时间:2016/8/15 17:26:00
--  

改一下代码

 

If e.col.Name = "到期日期" Then
    If e.Row.IsNull("到期日期") = False
        If e.Row("到期日期") < Date.Today.AddDays(10) andAlso e.Row("到期日期") >= Date.Today Then
            e.Style = "到期"
        End If
    End If
End If


--  作者:约翰舒
--  发布时间:2016/8/15 17:34:00
--  
这是在表的DrawCell事件代码中写吗?
--  作者:大红袍
--  发布时间:2016/8/15 17:42:00
--  
以下是引用约翰舒在2016/8/15 17:34:00的发言:
这是在表的DrawCell事件代码中写吗?

 

是的。


--  作者:约翰舒
--  发布时间:2016/8/15 17:44:00
--  
嗯,谢谢,刚已经实现了!
--  作者:约翰舒
--  发布时间:2016/8/15 17:51:00
--  
那已经到期的那一行怎么设置颜色,就是到期后自动变色?能实现吗?
--  作者:大红袍
--  发布时间:2016/8/15 17:57:00
--  

If e.col.Name = "到期日期" Then
    If e.Row.IsNull("到期日期") = False
        If e.Row("到期日期") < Date.Today Then
            e.Style = "过期"
        End If

    End If
End If