Dim doc As New PrintDoc '定义一个报表
Dim rt As New prt.RenderTable() '定义一个表格对象
doc.Body.Children.Add(rt) '将表格对象加入到报表中
rt.Style.GridLines.All = New prt.Linedef
rt.CellStyle.Spacing.All = 1
rt.RepeatGridLinesVert = True
rt.Cells(0,0).text = "安全科月度安全生产责任制考核表"
rt.Cells(0,0).SpanCols = 11
rt.Cells(0,0).Style.TextAlignHorz = prt.AlignHorzEnum.Center
rt.Cells(0,0).Style.Font = New Font("黑体", 18, FontStyle.Bold)
rt.Rows(0).Style.Borders.All = New prt.LineDef("0mm", Color.white)
rt.Cells(1,0).text = "姓名:" '& _UserName
rt.Cells(1,0).SpanCols = 3 '合并地二行全部单元格,用于显示副标题
rt.Cells(1,3).text = "职务:" '通过左边空格数量来调整副标题位置
rt.Cells(1,3).SpanCols = 2 '合并地二行全部单元格,用于显示副标题
rt.Cells(1,5).text = "包保单位:" '通过左边空格数量来调整副标题位置
rt.Cells(1,5).SpanCols = 3 '合并地二行全部单元格,用于显示副标题
rt.Cells(1,8).text = Format(Date.Today(), "yyyy年MM月dd日")
rt.Cells(1,8).SpanCols = 3 '合并地二行全部单元格,用于显示副标题
rt.Cells(1,0).Style.TextAlignHorz = prt.AlignHorzEnum.left
rt.Cells(1,3).Style.TextAlignHorz = prt.AlignHorzEnum.left
rt.Cells(1,5).Style.TextAlignHorz = prt.AlignHorzEnum.left
rt.Cells(1,8).Style.TextAlignHorz = prt.AlignHorzEnum.right
rt.cells(1,0).Style.Borders.All = New prt.LineDef("0mm", Color.white) '去掉第二行的网格线
rt.cells(1,3).Style.Borders.All = New prt.LineDef("0mm", Color.white) '去掉第二行的网格线
rt.cells(1,5).Style.Borders.All = New prt.LineDef("0mm", Color.white) '去掉第二行的网格线
rt.cells(1,8).Style.Borders.All = New prt.LineDef("0mm", Color.white) '去掉第二行的网格线
rt.cells(1,0).Style.Borders.Bottom = New prt.Linedef '恢复第二行底端的网格线
rt.cells(1,3).Style.Borders.Bottom = New prt.Linedef '恢复第二行底端的网格线
rt.cells(1,5).Style.Borders.Bottom = New prt.Linedef '恢复第二行底端的网格线
rt.cells(1,8).Style.Borders.Bottom = New prt.Linedef '恢复第二行底端的网格线
rt.Cells(1,0).Style.Font = New Font("宋体", 12)
rt.Cells(1,3).Style.Font = New Font("宋体", 12)
rt.Cells(1,5).Style.Font = New Font("宋体", 12)
rt.Cells(1,8).Style.Font = New Font("宋体", 12)
rt.Rows(1).Height = 8 '设置第二行的高度,拉开和表格主体的距离.
'设置列标题
rt.Cols(0).Width = 15
rt.Cols(1).Width = 15
rt.Cols(2).Width = 15
rt.Cols(8).Width = 30
rt.Cols(9).Width = 15
Doc.PageSetting.LeftMargin = 20 '设置左边距
Doc.PageSetting.RightMargin = 20 '设置右边距
Doc.PageSetting.TopMargin = 20 '设置上边距
Doc.PageSetting.BottomMargin = 20 '设置下边距
rt.cells(2,2).SpanCols = 6
rt.cells(2,0).Text = "考核项目" '设置第一行第一个单元格的内容
rt.Cells(2,1).Text = "序号" '设置第一行第四个单元格的内容
rt.Cells(2,2).Text= "量化考核内容"
rt.Cells(2,8).Text = "扣分标准"
rt.Cells(2,9).Text = "完成情况"
rt.cells(2,9).SpanCols = 2
rt.cells(3,9).SpanCols = 2
rt.cells(4,9).SpanCols = 2
rt.cells(5,9).SpanCols = 2
rt.cells(6,9).SpanCols = 2
rt.cells(7,9).SpanCols = 2
rt.cells(8,9).SpanCols = 2
rt.cells(9,9).SpanCols = 2
rt.cells(10,9).SpanCols = 2
rt.cells(11,9).SpanCols = 2
rt.cells(12,9).SpanCols = 2
rt.cells(13,9).SpanCols = 2
rt.cells(14,9).SpanCols = 2
rt.cells(15,9).SpanCols = 2
rt.cells(16,9).SpanCols = 2
rt.cells(17,9).SpanCols = 2
rt.cells(18,9).SpanCols = 2
rt.cells(19,9).SpanCols = 2
rt.cells(20,9).SpanCols = 2
rt.cells(21,9).SpanCols = 2
rt.cells(22,9).SpanCols = 2
rt.cells(23,9).SpanCols = 2
rt.Cells(3,0).SpanRows = 16 '第1行第5个单元格向下合并6行
rt.Cells(3,0).Text= "履行职责"
rt.Cells(3,1).Text = "1"
rt.cells(3,2).SpanCols = 6
rt.Cells(3,2).Text = "日常要深入车间(中间站),加强对职工的业务指导,解决生产中的技术难题 ,提高全站安全管理水平。每2月对管内各站、车间覆盖检查一遍,南三小站每月最少到1站。"
rt.Cells(3,8).Text = "未落实扣5分"
rt.Cells(4,1).Text = "2"
rt.cells(4,2).SpanCols = 6
rt.Cells(4,2).Text = "每月下现场,对行车主要岗位巡视检查不得少于13天,其中:"
rt.Cells(4,8).Text = "每少1天扣5分"
rt.Cells(5,1).Text = "3"
rt.cells(5,2).SpanCols = 6
rt.Cells(5,2).Text = "前夜巡视不少于2天;"
rt.Cells(5,8).Text = "每少1天扣5分"
rt.Cells(6,1).Text = "4"
rt.cells(6,2).SpanCols = 6
rt.Cells(6,2).Text = "后半夜巡视不少于6天(0至2点、2至4点、4至6点各不少于2次);"
rt.Cells(6,8).Text = "每少1天扣5分"
rt.Cells(7,1).Text = "5"
rt.cells(7,2).SpanCols = 6
rt.Cells(7,2).Text = "每月到包保单位不少于4天(其中星期五、双休日不少于2天,);节假日到包 保单位,小长假不少于1天,大长假不少于2天。"
rt.Cells(7,8).Text = "每少1天扣5分"
rt.Cells(8,1).Text = "6"
rt.cells(8,2).SpanCols = 6
rt.Cells(8,2).Text = "发现违章、违纪,不少于6件。其中:"
rt.Cells(8,8).SpanRows = 3
rt.Cells(8,8).Text = "每少1件扣15分,少2件,扣30分,少3件,扣40分,"
rt.Cells(9,1).Text = "7"
rt.cells(9,2).SpanCols = 6
rt.Cells(9,2).Text = "现场违章、违纪,不少于4件;"
rt.Cells(10,1).Text = "8"
rt.cells(10,2).SpanCols = 6
rt.Cells(10,2).Text = "调车作业违章、违纪,不少于2件;"
rt.Cells(11,1).Text = "9"
rt.cells(11,2).SpanCols = 6
rt.Cells(11,2).Text = "每月发现包保单位违章不少于1件。"
rt.Cells(11,8).Text = "每少1件扣5分"
rt.Cells(12,1).Text = "10"
rt.cells(12,2).SpanCols = 6
rt.Cells(12,2).Text = "每月检查管内车站调车作业,不少于6批,其中监控切割正线调车,不少于2批 ;"
rt.Cells(12,8).Text = "每少1次扣2分"
rt.Cells(13,1).Text = "11"
rt.cells(13,2).SpanCols = 6
rt.Cells(13,2).Text = "每月利用监控设备、调听录音或现场接发列车标准执行情况不少于3次,每次 不少于5列(其中旅客列车2列);"
rt.Cells(13,8).Text = "每少1次扣2分"
rt.Cells(14,1).Text = "12"
rt.cells(14,2).SpanCols = 6
rt.Cells(14,2).Text = "每月对车辆防溜检查,不少于8次;"
rt.Cells(14,8).Text = "每少1次扣2分"
rt.Cells(15,1).Text = "13"
rt.cells(15,2).SpanCols = 6
rt.Cells(15,2).Text = "每月对专用线检查,不少于3次;"
rt.Cells(15,8).Text = "每少1次扣2分"
rt.Cells(16,1).Text = "14"
rt.cells(16,2).SpanCols = 6
rt.Cells(16,2).Text = "每月对装卸作业检查,不少于1次;"
rt.Cells(16,8).Text = "每少1次扣2分"
rt.Cells(17,1).Text = "15"
rt.cells(17,2).SpanCols = 6
rt.Cells(17,2).Text = "每月检查车机联控工作,不少于6次;"
rt.Cells(17,8).Text = "每少1次扣2分"
rt.Cells(18,1).Text = "16"
rt.cells(18,2).SpanCols = 6
rt.Cells(18,2).Text = "每月添乘机车检查接发列车情况不少于1次;"
rt.Cells(18,8).Text = "未落实,扣5分"
rt.Cells(19,0).SpanRows = 5 '第1行第5个单元格向下合并6行
rt.Cells(19,0).Text= "安全考核"
rt.Cells(19,1).Text = "17"
rt.cells(19,2).SpanCols = 6
rt.Cells(19,2).Text = "当月包保单位被路局下发的《安全预警通知书》"
rt.Cells(19,8).Text = "每件扣15分"
rt.Cells(20,1).Text = "18"
rt.cells(20,2).SpanCols = 6
rt.Cells(20,2).Text = "当月包保单位被路局对话会通报批评"
rt.Cells(20,8).Text = "每次扣10分"
rt.Cells(21,1).Text = "19"
rt.cells(21,2).SpanCols = 6
rt.Cells(21,2).Text = "当月包保单位被路局下发的《安全监察通知书》"
rt.Cells(21,8).Text = "每次扣5分"
rt.Cells(22,1).Text = "20"
rt.cells(22,2).SpanCols = 6
rt.Cells(22,2).Text = "当月包保单位被车站安全预警,督办通报"
rt.Cells(22,8).Text = "每次扣5分"
rt.Cells(23,1).Text = "21"
rt.cells(23,2).SpanCols = 6
rt.Cells(23,2).Text = "当月包保单位安全评估小组最后一名"
rt.Cells(23,8).Text = "每次扣5分"
Dim rx As New prt.RenderText
rt.Style.GridLines.All = New prt.Linedef(Color.Gray)
rt.CellStyle.Spacing.All = 1
rt.Cells(24,0).Text= "工作写实"
rt.Cells(24,0).VertSplitBehavior = prt.CellSplitBehaviorEnum.Copy
rt.Cells(24,1).Text = "序号"
rt.Cells(24,2).Text = "日期"
rt.cells(24,3).SpanCols = 8
rt.Cells(24,3).Text = "时间,地点,检查内容"
rt.Style.TextAlignHorz = prt.AlignHorzEnum.center '所有文本内容靠右对齐
rt.cols(2).Style.TextAlignHorz = prt.AlignHorzEnum.left '唯独第一列内容居中
rt.cells(2,2).Style.TextAlignHorz = prt.AlignHorzEnum.center '唯独第一列内容居中
rt.Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居中
Dim name As String = "窦东东"
Dim dt As DataTable = DataTables("机关干部履职情况")
Dim i As Integer = 25
For Each rq As Date In dt.GetValues("日期", "(检查人1 like '%" & name & "%' or 检查人3 like '%" & name & "%') and 日期 is not null")
Dim arys As List(Of String()) = dt.GetValues("检查地点|开始时间|结束时间", "日期 = #" & rq & "# and 检查人1 like '%" & name & "%'")
Dim str As String = ""
For Each ary As String() In arys
str &= format(cDate(ary(1)), "HH:mm") & "-" & format(cDate(ary(2)), "HH:mm") & ary(0) & ";"
Next
rt.cells(i, 3).SpanCols = 8
rt.Cells(i, 1).text = i - 24
rt.Cells(i, 2).text = format(rq,"MM-dd")
rt.Cells(i, 3).text = str
i += 1
Next
rt.Cells(i,1).Text = "当月发现违章违纪件数"
rt.cells(i,1).SpanCols = 5
rt.Cells(i,6).Text = ""
rt.cells(i,6).SpanCols = 5
i+=1
rt.Cells(i,1).Text = "日期"
rt.Cells(i,2).Text = "发现两违内容"
rt.cells(i,2).SpanCols = 3
rt.Cells(i,5).Text = "性质"
rt.Cells(i,6).Text = "日期"
rt.Cells(i,7).Text = "发现两违内容"
rt.cells(i,7).SpanCols = 3
rt.Cells(i,10).Text = "性质"
Dim drs As List(Of DataRow) = DataTables("机关干部履职情况").Select("(检查人1 like '%" & name & "%' or 检查人3 like '%" & name & "%') and 违章违纪概况 Is not Null", "日期")
Dim right As Boolean = True
For j As Integer = 0 To drs.Count - 1
If right Then
i += 1
rt.Cells(i,1).Text = format(drs(j)("日期"), "MM-dd")
rt.Cells(i,2).Text = drs(j)("违章违纪概况")
rt.cells(i,2).SpanCols = 3
rt.Cells(i,5).Text = drs(j)("违章性质")
right = False
Else
rt.Cells(i,6).Text = format(drs(j)("日期"), "MM-dd")
rt.Cells(i,7).Text = drs(j)("违章违纪概况")
rt.cells(i,7).SpanCols = 3
rt.Cells(i,10).Text = drs(j)("违章性质")
right = True
End If
Next
rt.Cells(24,0).SpanRows = i - 23
i += 1
rt.Cells(i,0).Text = "考核情况"
rt.Cells(i,0).SpanRows = 2
rt.Cells(i,1).Text = "自评得分"
rt.cells(i,1).SpanCols = 2
rt.Cells(i,3).Text = "本人签字"
rt.cells(i,3).SpanCols = 3
rt.Cells(i,6).Text = "考核意见"
rt.cells(i,6).SpanCols = 3
rt.Cells(i,9).Text = "考核得分"
rt.cells(i,9).SpanCols = 2
rt.cells(i+1,1).SpanCols = 2
rt.cells(i+1,3).SpanCols = 3
rt.cells(i+1,6).SpanCols = 3
rt.cells(i+1,9).SpanCols = 2
Doc.Preview() '预览报表