rt.cells(0,2).Style.TextAlignHorz = prt.AlignHorzEnum.Center
rt.cells(0,3).Style.TextAlignHorz = prt.AlignHorzEnum.Center
rt.cells(0,4).Style.TextAlignHorz = prt.AlignHorzEnum.Center
For Each pd As String In Regions
drs = tbl.DataTable.Select("[线路] = '" & pd & "'","序号")
Dim m As Integer = drs.count '记录每条线路的行数
cnt = rt.Rows.Count+1 '报表总行数
For Each dr As DataRow In drs
For c As Integer = 1 To ColNames.Length - 1
If tbl.Cols(ColNames(c)).IsNumeric Then
If dr(ColNames(c)) <> 0 Then
rt.Cells(cnt, c).Text = Format(dr(tbl.Cols(ColNames(c)).Name),"0.0")
rt.Cols(c).Style.TextAlignHorz = prt.AlignHorzEnum.Right
End If
Else
rt.Cells(cnt, c).Text = dr(tbl.Cols(ColNames(c)).Name)
rt.Cols(c).Style.TextAlignHorz = prt.AlignHorzEnum.center
End If
Next
cnt += 1
Next
rt.Cells(cnt-m,0).SpanRows = m
rt.Cells(cnt -m , 0).Text = pd
cnt += 1
rt.Cells(cnt, 0).Text = "小计 " & pd
rt.Cells(cnt,2).Text = Format(tbl.compute("Sum(纸币)", "线路 = '" & pd & "'"),"0.0")
rt.Cells(cnt,3).Text = Format(tbl.compute("Sum(硬币)", "线路 = '" & pd & "'"),"0.0")
rt.Cells(cnt,4).Text = Format(tbl.compute("Sum(金额)", "线路 = '" & pd & "'"),"0.0")
rt.Cells(cnt,0).SpanCols = 2
Next
cnt = rt.Rows.Count
rt.Cells(cnt, 0).Text = "合计 " '打印合计