Case "磅码单"
Dim Doc As new PrintDoc
Dim rt As New prt.RenderTable '定义一个新表格
doc.PageSetting.PaperKind = 9
Doc.PageSetting.LeftMargin = 10 '设置左边距
Doc.PageSetting.RightMargin = 10 '设置右边距
Doc.PageSetting.TopMargin = 15 '设置上边距
Doc.PageSetting.BottomMargin = 20 '设置下边距
rt.Style.GridLines.All = New prt.Linedef
For i As Integer = 0 To Tables("库存表主表.库存表").Rows.Count - 1
Dim jb As New SQLJoinTableBuilder("磅码单查询","磅码单")
jb.C
jb.AddCols( "{磅码单}.*")
jb.Build()
Tables("磅码单查询").Filter = "编号= '"& Tables("库存表主表.库存表").Rows(I)("_Identify")& "'"
Dim DT As DataTable = DataTables("磅码单查询")
Dim rx3 As New prt.RenderTable
rx3.Cells(0,0).Text = "产品名称: " & Tables("库存表主表.库存表").Rows(I)("产品名称")
rx3.Cells(1,0).Text = "生产批号: " & Tables("库存表主表.库存表").Rows(I)("生产单号")
rX3.Cells(0,0).Style.Font = New Font("宋体", 12, FontStyle.Bold) '设置主标题字体
rX3.Cells(1,0).Style.Font = New Font("宋体", 12, FontStyle.Bold) '设置主标题字体
doc.Body.Children.Add(rx3) '加入到报表中
Dim ColNames As String() = New String(){"序号","数量"}
Dim idx As Integer = 0
rt.Style.FontSize = 12
For r As Integer = 0 To DT.DATARows.Count -1 Step 10 '开始填入该列内容
rt.Cells(idx,0).Text = "序号"
rt.Cells(idx,0).Style.FontSize = 14
rt.Cells(idx+1,0).Text = "数量"
rt.Cells(idx+1,0).Style.FontSize = 14
Dim k As Integer = 1
For j As Integer = r To Math.Min(r+9,DT.DATARows.Count -1)
rt.Cells(idx,k).Text = DT.DATARows(j)("序号")
rt.Cells(idx,k).Style.FontSize = 12
rt.Cells(idx,k).Style.TextAlignHorz = prt.AlignHorzEnum.Center
rt.Cells(idx+1,k).Text = DT.DATARows(j)("数量")
rt.Cells(idx+1,k).Style.FontSize = 14
k = k + 1
Next
idx = idx + 2
Next
rt.SplitVertBehavior = prt.SplitBehaviorEnum.Never '禁止被垂直分割
Dim k1 As Integer = rt.rows.count
rt.Cells(k1, 0).Text = "合计"
rt.Cells(k1, 8).Text = DT.compute("sum(数量)") & Tables("库存表主表.库存表").Current("单位")
rt.Cells(k1, 9).Text = DT.compute("sum(件数)") &"件"
doc.Body.Children.Add(rt)
Next
Dim rx4 As New prt.RenderTable
rx4.Cells(0,0).Text = "制单:" & Tables("库存表主表.库存表").Current("创建人") & " 复核: 承运人: " & "制单日期:" & Date.Today
rX4.Cells(0,0).Style.Font = New Font("宋体", 12, FontStyle.Bold) '设置主标题字体
Doc.PageFooter = rx4 '作为页眉使用
Dim rx1 As New prt.RenderTable
rx1.Cells(0,0).Text = "汕头市雅图包装印刷有限公司磅码单"
rx1.Cells(0,0).Style.TextAlignHorz = prt.AlignHorzEnum.Center
rX1.Cells(0,0).Style.Font = New Font("宋体", 16, FontStyle.Bold) '设置主标题字体
Doc.PageHeader = rx1 '作为页眉使用
doc.Preview() '预览