以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 请教专业报表:控制每页9行 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=42984) |
||||
-- 作者:飞天 -- 发布时间:2013/11/27 15:22:00 -- 请教专业报表:控制每页9行 Dim doc As New Printdoc
For i As Integer = tbl.TopRow To tbl.BottomRow rt = New prt.RenderTable Rows = Tables("订单").Rows(i).DataRow.GetChildRows("订单明细") doc.Body.Children.Add(rt)
以上代码,希望再控制单据每页只打印9行,超过9行的,则另起一页,并且都能显示标题! 我看了许久帮助文件,仍然模不透怎样处理.麻烦各们前辈帮忙处理一下!万分感谢!!! |
||||
-- 作者:Bin -- 发布时间:2013/11/27 15:48:00 -- http://www.foxtable.com/help/topics/2241.htm |
||||
-- 作者:飞天 -- 发布时间:2013/11/27 19:17:00 -- 谢谢您的帮助, 但我仍然不懂如何在订单明细表里面加上换页的代码,请指教!!!
|
||||
-- 作者:有点甜 -- 发布时间:2013/11/27 20:00:00 -- 如下代码,测试有效 Dim doc As New Printdoc Dim rx As prt.RenderText Dim rt As prt.RenderTable Dim Rows As List(Of DataRow) Dim tbl As Table = Tables("订单") doc.PageSetting.Width = 240 \'纸张宽度为100毫米 doc.PageSetting.Height = 140 \'纸张高度为120毫米 Doc.PageSetting.LeftMargin = 8 \'设置左边距 Doc.PageSetting.RightMargin = 8 \'设置右边距 Doc.PageSetting.TopMargin = 15 \'设置上边距 Doc.PageSetting.BottomMargin = 8 \'设置下边距 For i As Integer = tbl.TopRow To tbl.BottomRow Rows = Tables("订单").Rows(i).DataRow.GetChildRows("订单明细") For j As Integer = 0 To math.Ceiling(Rows.Count / 9) - 1 rx = New prt.RenderText rx.BreakBefore = prt.BreakEnum.Page \'另起一页再打印 rx.Style.FontSize = 14 rx.Style.FontBold = True rx.Style.Spacing.Bottom = 5 rx.Text = "订单编号: " & Tables("订单").Rows(i)("订单编号") doc.Body.Children.Add(rx) rt = New prt.RenderTable rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center rt.Style.TextAlignVert = prt.AlignVertEnum.Center rt.Style.Borders.Bottom = New prt.LineDef(0.3,Color.LightGray) rt.CellStyle.Spacing.All = 1 rt.Cols.Count = 4 rt.Cells(0,0).Text = "商品名称" rt.Cells(0,1).Text = "规格型号" rt.Cells(0,2).Text = "计量单位" rt.Cells(0,3).Text = "数量" rt.Cells(0,4).Text = "单价" rt.Cells(0,5).Text = "金额" rt.rows(0).Style.Borders.Top = New prt.LineDef(0.1,Color.LightGray) rt.rows(0).Style.Borders.Bottom = New prt.LineDef(0.1,Color.LightGray) For r As Integer = j*9 To (j+1)*9-1 If r < Rows.count rt.Cells(r+1,0).Text = rows(r)("商品名称") rt.Cells(r+1,1).Text = rows(r)("规格型号") rt.Cells(r+1,2).Text = rows(r)("计量单位") rt.Cells(r+1,3).Text = rows(r)("数量") rt.Cells(r+1,4).Text = rows(r)("单价") rt.Cells(r+1,5).Text = rows(r)("金额") End If Next doc.Body.Children.Add(rt) rx = New prt.RenderText rx.Style.FontBold = True rx.Style.Spacing.Top = 3 rx.Text = "产品数目: " & Rows.Count rx.Style.TextAlignHorz = prt.AlignHorzEnum.Right doc.Body.Children.Add(rx) Next Next doc.Preview |
||||
-- 作者:fb201011 -- 发布时间:2013/11/30 11:20:00 -- 根据此指导,可以很好的打印入库单格式,好 |
||||
-- 作者:程兴刚 -- 发布时间:2013/11/30 17:48:00 -- 如果我是您,我不会采用这个方法,因为您的这个方法有很大的弱点:打印出两份订单编号一样而订单明细却是截然不一样的两份纸版报表。 我建议您这样: 1、在订单编号上想办法,以您的DR1311-0003为例,可以给订单再增加一个“子订单”关联表(按下面设置子订单号),也可以直接订单表的编号改为这样的模式: DR1311-0003-01 DR1311-0003-02 3、在明细表的新增行之前事件中用代码判断,该订单明细记录大于9时,禁止再添加明细,并提示新增订单(或子订单)。
这样,您打印的纸版报表的订单编号或子订单编号永远是唯一的,不至于出现重复,一旦某种情况下需要核对账目,方便查找! |