'''
Dim tbl As Table = Tables("查询报告")
For i As Integer = tbl.TopRow To tbl.BottomRow
Dim doc As New Printdoc
Dim rx As prt.RenderText
Dim rx1 As prt.RenderText
Dim rt As prt.RenderTable
Dim Rows As List(Of DataRow)
Dim s As String
doc.PageSetting.Landscape = True '横向打印
Doc.PageSetting.LeftMargin = 10 '设置左边距
Doc.PageSetting.RightMargin = 10 '设置右边距
Doc.PageSetting.TopMargin = 20 '设置上边距
Doc.PageSetting.BottomMargin = 20 '设置下边距
rx1 = New prt.RenderText
rx1.BreakBefore = prt.BreakEnum.Page '另起一页再打印
rx1.Style.FontSize = 14
rx1.Style.FontBold = True
rx1.Style.Spacing.Bottom = 5
rx1.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
rx1.Text = tbl.Rows(i)("序号") & "、" & tbl.Rows(i)("查询人") & "损失资金确认表"
doc.Body.Children.Add(rx1)
rx = New prt.RenderText
rx.Style.FontSize = 12
rx.Style.FontBold = True
rx.Style.Spacing.Bottom = 5
rx.Style.TextIndent = 9 '首行缩进9毫米
rx.Style.LineSpacing = 200 '设置双倍行距
rx.Text = "对账人基本情况: " & tbl.Rows(i)("基本情况") & "查询金额: " & tbl.Rows(i)("查询情况_查询金额")&"万元,"& "查询依据: " & tbl.Rows(i)("查询情况_查询依据")& ",借方理由: " & Tbl.Rows(i)("查询情况_借款理由") & "。查询详细情况如下表:"
doc.Body.Children.Add(rx)
rt = New prt.RenderTable
rt.RowGroups(0,1).Header = prt.TableHeaderEnum.All '将第一行作为表头
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center
rt.Style.TextAlignVert = prt.AlignVertEnum.Center
rt.Style.Borders.Bottom = New prt.LineDef(0.2,Color.LightGray)
rt.Style.GridLines.All = New prt.Linedef
rt.CellStyle.Spacing.All = 1
rt.Cols.Count = 9
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.Cells(0,6).Text = "贷方金额"
rt.Cells(0,7).Text = "余额"
rt.Cells(0,8).Text = "对方户名"
rt.Cells(0,9).Text = "对方账号"
rt.rows(0).Style.Borders.Top = New prt.LineDef(0.5,Color.black)
rt.rows(0).Style.Borders.Bottom = New prt.LineDef(0.5,Color.LightGray)
Rows =DataTables("查询明细表").SQLSelect("涉及人1= '" & Tables("查询报告").DataTable.dataRows(i)("查询人") & "'")
For r As Integer = 0 To Rows.Count - 1
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)("借方金额")
rt.Cells(r+1,6).Text = rows(r)("贷方金额")
rt.Cells(r+1,7).Text = rows(r)("余额")
rt.Cells(r+1,8).Text = rows(r)("对方户名")
rt.Cells(r+1,9).Text = rows(r)("对方账号")
rt.rows(r+1).Style.Borders.Top = New prt.LineDef(0.3,Color.black)
Next
rt.Cells(Rows.Count+2,0).SpanCols = 10
rt.Cells(Rows.Count+2,0).Text ="可以查询的损失金额为" & Tables("查询明细表").DataTable.sqlCompute("sum(借方金额)","涉及人1='" & tbl.Rows(i)("查询人") & "'") - Tables("查询明细表").DataTable.sqlCompute("sum(贷方金额)","涉及人1='" & tbl.Rows(i)("查询人") & "'") +Tbl.Rows(i)("查询情况_收到利息") & "元。" & "其中:借款金额为" &Tables("查询明细表").DataTable.sqlCompute("sum(借方金额)","涉及人1='" & tbl.Rows(i)("查询人") & "'") & "元,回款金额为" & Tables("查询明细表").DataTable.sqlCompute("sum(贷方金额)","涉及人1='" & tbl.Rows(i)("查询人") & "'") & "元,收到利息" & Tbl.Rows(i)("查询情况_收到利息") & "元。"
rt.Cells(Rows.Count+2,0).Style.TextAlignHorz = prt.AlignHorzEnum.left
rt.Cells(Rows.Count+1,3).Text ="合计"
rt.Cells(Rows.Count+1,5).Text =Tables("查询明细表").DataTable.sqlCompute("sum(借方金额)","涉及人1='" & tbl.Rows(i)("查询人") & "'")
rt.Cells(Rows.Count+1,6).Text =Tables("查询明细表").DataTable.sqlCompute("sum(贷方金额)","涉及人1='" & tbl.Rows(i)("查询人") & "'")
doc.Body.Children.Add(rt)
rx = New prt.RenderText
rx.Style.FontBold = True
rx.Style.Spacing.Top = 3
rx.Style.TextIndent = 9 '首行缩进9毫米
rx.Style.LineSpacing = 200 '设置双倍行距
rx.Style.FontSize = 12
rx.Text = "如果对以上表格中的往来明细无疑议,请写"“以上表格往来明细我已看过,对此无疑议,可以确认。”"" & vblf & vblf & " 对账人(签字): 年 月 日"
rx.Style.TextAlignHorz = prt.AlignHorzEnum.left
doc.Body.Children.Add(rx)
'rx = New prt.RenderText '设置文本对象的内容
'rx.Text = "第[PageNo]页,共[PageCount]页" '设置文本内容
'rx.Style.TextAlignHorz = prt.AlignHorzEnum.Right '靠右对齐
'rx.Style.Borders.Bottom = New prt.LineDef(0.3, Color.Green) '设置底边框
'rx.Style.Padding.Bottom = 0.5 '底端内容缩进0.5毫米
'rx.Style.FontSize = 8 '字体大小为8磅
'Doc.PageHeader = rx '作为页眉使用
'doc.Preview() '预览
Dim rx3 As New prt.RenderTable
rx3.Cells(0,0).Text = tbl.Rows(i)("序号") & "、" & tbl.Rows(i)("查询人") & "损失资金确认表"
rx3.Cells(0,1).Text = "第[PageNo]页,共[PageCount]页"
rx3.Cols(0).Style.TextAlignHorz = prt.AlignHorzEnum.Left
rx3.Cols(1).Style.TextAlignHorz = prt.AlignHorzEnum.right
rx3.Style.Borders.Bottom = New prt.LineDef '设置底边框
rx3.CellStyle.Spacing.Bottom = 0.5 '底端内容缩进0.5毫米
rx3.Style.FontSize = 8 '字体大小为8磅
Doc.PageHeader = rx3 '作为页眉使用
doc.Preview() '预览
Next