Foxtable(狐表)用户栏目专家坐堂 → 多表汇总统计咨询


  共有3071人关注过本帖树形打印复制链接

主题:多表汇总统计咨询

帅哥,在线噢!
有点蓝
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110647 积分:563143 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/7/24 15:35:00 [显示全部帖子]


 回到顶部
帅哥,在线噢!
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110647 积分:563143 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/7/24 16:04:00 [显示全部帖子]


 回到顶部
帅哥,在线噢!
有点蓝
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110647 积分:563143 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/7/25 14:41:00 [显示全部帖子]

Dim d As Date = Date.Today
Dim d1 As Date = New Date(d.Year,d.Month,1)
Dim d2 As Date = New Date(d.Year,d.Month,d.DaysInMonth(d.Year,d.Month))

Dim cnt As Integer
cnt = DataTables("rz").Compute("Count([date])", "date >= # " & d1 & " # And date < # " & d2 & " #")
'msgbox( cnt )

Dim tm As String  = ProjectPath & "Attachments\yxj.doc" '指定模板文件
Dim fl As String = ProjectPath & "Reports\yxj.doc" '指定目标文件
Dim wrt As New WordReport(Tables("rz"),tm,fl) '定义一个WordReport
wrt.Replace("[rzrs]",cnt) '统计当月入职人员总数



Dim rzs As String
Dim drs As List(Of DataRow)
drs = DataTables("rz").Select("[date] >= # " & d1 & " # And [date] < # " & d2 & " #","name DESC")
For Each dr As DataRow In drs
     rzs =  (dr("dep") & " : " & dr("name"))  & "  ||  " &  rzs
''      rzs =  (dr("dep") & " : " & dr("name"))  & rzs
''msgbox(rzs)
Next
wrt.Replace("[rzs]",rzs)  

Dim cnt1 As Integer
cnt1 = DataTables("lz").Compute("Count([date])", "date >= # " & d1 & " # And date < # " & d2 & " #")
'msgbox( cnt )

wrt.Replace("[lzrs]",cnt1) 

Dim lzs As String
Dim drs1 As List(Of DataRow)
drs1 = DataTables("lz").Select("[date] >= # " & d1 & " # And [date] < # " & d2 & " #","name DESC")
For Each dr1 As DataRow In drs1
     lzs =  (dr1("dep") & " : " & dr1("name"))  & "  ||  " &  lzs
'      rzs =  (dr("dep") & " : " & dr("name"))  & rzs
'msgbox(rzs)
Next
wrt.Replace("[lzs]",lzs)  
wrt.Build() '生成报表
wrt.show()

 回到顶部