以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 根据时间来判断当月是否有过政治生日的党员,怎么优化提示信息内容! (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=149312) |
-- 作者:李孝春 -- 发布时间:2020/4/28 17:33:00 -- 根据时间来判断当月是否有过政治生日的党员,怎么优化提示信息内容! 根据时间来判断当月是否有过政治生日的党员,怎么优化提示信息内容! 想实现根据党员信息中的身份证号来去查找党员流程表中的数据,如果有登记类别为预备党员的记录,那就提取符合条件的时间,来进行判断是否为当月过政治生日,并在文本框里面显示出来 代码如下: Dim t4 As WinForm.TextBox =Forms("政治生日").Controls("TextBox1") Dim d4 = t4.BaseControl Dim lsts As New List(Of String()) lsts= DataTables("党员信息").S QLGetValues("支部名称|姓名|身份证号") For Each lst As String() In lsts Dim lsts1 As New List(Of String) lsts1= DataTables("党员流程").S QLGetValues("时间","身份证号=\'" & lst(2) & "\' and 登记类别=\'预备党员\'") For Each lst1 As String In lsts1 Dim dt As Date = Date.Today Dim d As Date = lst1 If dt.Month= d.Month Then output.Show("本月过政治生日有{" & lst(1) & "},其入党时间为【" & Format(d, "yyyy-MM-dd") & "】,所在支部" & lst(0) & "") t4.Text= t4.Text & vbcrlf & "本月过政治生日有{" & lst(1) & "},其入党时间为【" & Format(d, "yyyy-MM-dd") & "】,所在支部" & lst(0) & "" Else output.Show("本月无人员过政治生日!") t4.Text= t4.Text & vbcrlf & "本月没有党员过政治生日!" End If Next Next t4.SelectionStart = t4.Text.Length d4.ScrollToCaret Application.DoEvents 当前代码运行后效果如图“” 当前图片是把过政治生日的已经显示出来了 同时也把不符合条件的数据显示出来了 想进一步实现, 当前有党员政治生日时,就只显示第一条,不再显示没有党员过政治生日 当本月没有任何一个党员过政治生日时,显示没有党员过政治生日的提示。
|
-- 作者:有点蓝 -- 发布时间:2020/4/28 20:15:00 -- Dim t4 As WinForm.TextBox =Forms("政治生日").Controls("TextBox1") Dim d4 = t4.BaseControl Dim lsts As New List(Of String()) lsts= DataTables("党员信息").S QLGetValues("支部名称|姓名|身份证号") Dim str As String = "" For Each lst As String() In lsts Dim lsts1 As New List(Of String) lsts1= DataTables("党员流程").S QLGetValues("时间","身份证号=\'" & lst(2) & "\' and 登记类别=\'预备党员\' and Month(时间) =" & Date.Today.Month) For Each lst1 As String In lsts1 output.Show("本月过政治生日有{" & lst(1) & "},其入党时间为【" & Format(d, "yyyy-MM-dd") & "】,所在支部" & lst(0) & "") str = str & vbcrlf & "本月过政治生日有{" & lst(1) & "},其入党时间为【" & Format(d, "yyyy-MM-dd") & "】,所在支部" & lst(0) & "" Next Next If str > "" Then t4.Text= t4.Text & str Else output.Show("本月无人员过政治生日!") t4.Text= t4.Text & vbcrlf & "本月没有党员过政治生日!" End If t4.SelectionStart = t4.Text.Length d4.ScrollToCaret Application.DoEvents |