以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 被这条规则搞的头大了,求方法! (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=62723) |
-- 作者:heying325 -- 发布时间:2015/1/7 9:37:00 -- 被这条规则搞的头大了,求方法! 汽车售后服务中,有一项是验车提醒服务。。根据上牌日期,提前对客户进行验车提醒。。。验车提醒规则如下: 验车提醒:上牌日期在2012年9月1日之后的,第一次验车是上牌日期+2年,第二次验车是上牌日期+4年,从第6年开始,每年一次。上牌日期在2010年9月1日至2012年8月31日的,上牌日期+2年一次,从2016年开始每年一次。上牌日期在2010年8月31日之前的,2025年前,每年一次。 求助,我有一个表,记录了上牌日期。。怎么在它即将到来的验车日期,进行提醒?
|
-- 作者:Bin -- 发布时间:2015/1/7 9:48:00 -- 无非是一些IF判断 dim d1 as date = "2012-09-01" dim d2 as date = "2010-09-01" if 上牌日期>= d1 then else if 上牌日期>d2 andalso 上牌日期 <d1 then else if 上牌日期<d2 then end if
|
-- 作者:heying325 -- 发布时间:2015/1/7 9:54:00 -- 不是对某一个上牌日期的判断啊。。。是对整个表。。表里面有上万的数据。。 其中有上牌日期 这一列。。。我想知道,今天应该有多少人需要进行提醒! |
-- 作者:Bin -- 发布时间:2015/1/7 9:58:00 -- 你举的例子,我就给你写的例子,不是让你盲目套用,而是让你参考这个思路中,把日套成变量即可使用 ![]() 不会的话就上例子吧
|
-- 作者:有点甜 -- 发布时间:2015/1/7 9:58:00 -- 参考例子,就是循环每一行,判断啊
http://www.foxtable.com/help/topics/2476.htm
|
-- 作者:heying325 -- 发布时间:2015/1/7 10:35:00 -- 大大们!我做了一个例子。。例子里面的数据很少,实际上数据七八万左右。。。想实现的就是,每日打开项目就会告诉我今天需要提醒的客户是多少,并提供这些客户的列表。。当我对他们进行提醒后,就会在提醒列表里消失。。。等到下次该提醒的时候又会跳出来。。 (可以帮我增加下列,谢谢!!) |
-- 作者:有点甜 -- 发布时间:2015/1/7 10:59:00 -- Dim d1 As Date = "2012-9-1" Dim d2 As Date = "2010-9-1" Dim n As Integer = 30 \'未来30天 Dim idxs As String = "" For Each dr As DataRow In DataTables("表A").Select("上牌日期 is not null") Dim dt As Date = dr("上牌日期") Dim dt1 As New Date(Date.Today.Year,dt.Month,dt.Day) Dim dt2 As New Date(Date.Today.AddDays(n).Year,dt.Month,dt.Day) If (dt1 >= Date.Today AndAlso dt1 < Date.Today.AddDays(n)) OrElse (dt2 >= Date.Today AndAlso dt2 < Date.Today.AddDays(n)) Then If dt >= d1 Then Dim y As Integer = dt.Year - d1.Year If y = 2 OrElse y = 4 OrElse y >= 6 Then idxs &= dr("_Identify") & "," End If Else If dt > d2 AndAlso dt < d1 Then Dim y As Integer = dt.Year - d1.Year If y > 0 AndAlso y Mod 2 = 0 OrElse dt2.Year >= 2016 Then idxs &= dr("_Identify") & "," End If Else If dt < d2 Then Dim y As Integer = dt.Year - d1.Year If dt2.Year >= 2016 Then idxs &= dr("_Identify") & "," End If End If End If Next Tables("表A").Filter = "_Identify in (" & idxs.trim(",") & ")" |
-- 作者:heying325 -- 发布时间:2015/1/8 11:09:00 -- 以下是引用有点甜在2015-1-7 10:59:00的发言:
Dim d1 As Date = "2012-9-1" Dim d2 As Date = "2010-9-1" Dim n As Integer = 30 \'未来30天 Dim idxs As String = "" For Each dr As DataRow In DataTables("表A").Select("上牌日期 is not null") Dim dt As Date = dr("上牌日期") Dim dt1 As New Date(Date.Today.Year,dt.Month,dt.Day) Dim dt2 As New Date(Date.Today.AddDays(n).Year,dt.Month,dt.Day) If (dt1 >= Date.Today AndAlso dt1 < Date.Today.AddDays(n)) OrElse (dt2 >= Date.Today AndAlso dt2 < Date.Today.AddDays(n)) Then If dt >= d1 Then Dim y As Integer = dt.Year - d1.Year If y = 2 OrElse y = 4 OrElse y >= 6 Then idxs &= dr("_Identify") & "," End If Else If dt > d2 AndAlso dt < d1 Then Dim y As Integer = dt.Year - d1.Year If y > 0 AndAlso y Mod 2 = 0 OrElse dt2.Year >= 2016 Then idxs &= dr("_Identify") & "," End If Else If dt < d2 Then Dim y As Integer = dt.Year - d1.Year If dt2.Year >= 2016 Then idxs &= dr("_Identify") & "," End If End If End If Next Tables("表A").Filter = "_Identify in (" & idxs.trim(",") & ")" |
-- 作者:有点甜 -- 发布时间:2015/1/8 11:11:00 -- 我测试例子没问题,你是就着例子测试的么 |
-- 作者:jialihaha -- 发布时间:2015/1/8 11:11:00 -- dr("上牌日期") 是什么样的类型? 时间类型不一样,改成datetime
[此贴子已经被作者于2015-1-8 11:12:16编辑过]
|