以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  老师,我这个循环为啥不好用呢?都打印的是同一条记录呢?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=133976)

--  作者:xxfoxtable
--  发布时间: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=""


--  作者:有点甜
--  发布时间:2019/4/24 15:16:00
--  

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

 

改成

 

Dim CurRow As Row =  r