Foxtable(狐表)用户栏目专家坐堂 → 老师,我这个循环为啥不好用呢?都打印的是同一条记录呢?


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

主题:老师,我这个循环为啥不好用呢?都打印的是同一条记录呢?

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


加好友 发短信
等级:七尾狐 帖子:1700 积分:15926 威望:0 精华:0 注册:2017/6/1 23:12:00
老师,我这个循环为啥不好用呢?都打印的是同一条记录呢?  发帖心情 Post By:2019/4/24 15:13:00 [只看该作者]

Dim cb1 As WinForm.ComboBox = e.Form.Controls("ComboBox1")
Dim cb2 As WinForm.ComboBox = e.Form.Controls("ComboBox2")
Tables("收费").Filter="年='" & cb1.text & "' and 月='" & cb2.text &"'"
For Each r As Row In Tables("收费").Rows
Dim doc  As New PrintDoc  '定义一个报表
doc.PageSetting.Width =70
doc.PageSetting.Height=80
doc.PageSetting.TopMargin=0
doc.PageSetting.LeftMargin=1
doc.PageSetting.RightMargin=8
doc.PageSetting.BottomMargin=1
Dim rt As New prt.RenderTable()
Dim rx As New prt.RenderText
Dim CurRow As Row =  Tables("收费").Current
rx.text = "小天使幼儿园收费单"
rx.Style.FontBold = True '字体加粗
rx.Style.FontSize = 16 '大体大小为16磅
rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center  '水平居中排列
rx.Style.Spacing.Bottom = 2 '和下面的对象(表格)距离3毫米
doc.Body.Children.Add(rx) '加入到报表中
rx = new prt.RenderText
rx.text = "日期:" & CurRow("收费年月")
rx.Style.FontBold = True '字体加粗
rx.Style.FontSize = 12 '大体大小为16磅
rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center  '水平居中排列
rx.Style.Spacing.Bottom = 1 '和下面的对象(表格)距离3毫米
doc.Body.Children.Add(rx) '加入到报表中

rx = new prt.RenderText
rx.text = "园长手机(同微信):15041698484"
rx.Style.FontBold = True '字体加粗
rx.Style.FontSize = 12 '大体大小为16磅
rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center 
rx.Style.Spacing.Bottom = 1
doc.Body.Children.Add(rx)

rt.Rows.Count = 4
rt.Cols.Count = 4
rt.Height = 50

rt.CellStyle.Spacing.All = 0.5
rt.Style.GridLines.All = New prt.Linedef 
rt.Style.TextAlignVert = prt.AlignVertEnum.Center
rt.Style.FontSize = 13

rt.Cells(0,0).Text= "班级"
rt.Cells(0,1).Text = CurRow("班级")
rt.Cells(0,2).Text= "姓名"
rt.Cells(0,3).Text = CurRow("姓名")
rt.Cells(1,0).Text= "托费"
rt.Cells(1,1).Text = iif(CurRow("托费")= 0, "",CurRow("托费"))
rt.Cells(1,2).Text= "车费"
rt.Cells(1,3).Text = iif(CurRow("车费")= 0, "",CurRow("车费"))
rt.Cells(2,0).Text= "保险"
rt.Cells(2,1).Text = iif(CurRow("保险")= 0, "",CurRow("保险"))
rt.Cells(2,2).Text= "被"
rt.Cells(2,3).Text = iif(CurRow("被")= 0, "",CurRow("被"))

rt.Cells(3,0).Text= "其他"
rt.Cells(3,1).Text = iif(CurRow("其他")= 0, "",CurRow("其他"))
rt.Cells(3,2).Text= "合计"
rt.Cells(3,3).Text= CurRow("托费")+CurRow("车费")+CurRow("保险")+CurRow("被")+CurRow("其他")
doc.Body.Children.Add(rt)
Doc.Print
Next
Tables("收费").Filter=""


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2019/4/24 15:16:00 [只看该作者]

Dim CurRow As Row =  Tables("收费").Current

 

改成

 

Dim CurRow As Row =  r


 回到顶部