我是用分组统计出的报表,请版主帮我改改。
Dim doc As New PrintDoc
doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight
Dim rt As New prt.RenderText
Dim Filter As String
With e.Form.Controls("ComboBox3")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "加工内容_工序 = '" & .Value & "'"
End If
End With
With e.Form.Controls("DateTimePicker1")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "[加工_加工日期]>= #" & .Value & "#"
End If
End With
With e.Form.Controls("DateTimePicker3")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "[加工_加工日期]<= #" & .Value & "#"
End If
End With
With e.Form.Controls("TextBox1")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "工艺单编号 Like '%" & .Value & "%'"
End If
End With
With e.Form.Controls("ComboBox4")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "加工状态 = '" & .Value & "'"
End If
End With
With e.Form.Controls("DropBox1")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "加工_加工人 = '" & .Value & "'"
End If
End With
If Filter > "" Then
Tables("加工统计_Table1").Filter = Filter
End If
DataTables("加工统计_Table1").LoadFilter = Filter
DataTables("加工统计_Table1").Load() '加载数据
Dim rt1 As New prt.RenderText '定义一个文本对象
rt1.Text = "加工工时统计" 这句怎么改?
rt1.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
rt1.Style.Font = New Font("宋体", 16, FontStyle.Bold) '设置字体
rt1.Style.Spacing.Bottom = 10 '设置下间隔为3毫米
doc.Body.Children.Add(rt1) '将文本对象加入到报表
Dim rt2 As New prt.RenderText
rt2 = New prt.RenderText
rt2.Style.FontSize = 10
rt2.Style.Spacing.Bottom = 2
rt2.Text = "日期: " & Today
rt2.Style.TextAlignHorz = prt.AlignHorzEnum.Right
rt2.Style.TextAlignVert = prt.AlignVertEnum.Bottom '垂直居中
doc.Body.Children.Add(rt2) '将文本对象加入到报表
Dim Agg As New prt.DataBinding.Aggregate("GroupSum") '新定义统计的名称为GroupSum,名称随意即可.
rt.DataBinding.DataSource = BindTables("加工统计_Table1") '将容器绑定到订单表
rt.DataBinding.Grouping.Expressions.Add("Fields!加工_加工人.Value") '根据产品进行分组
rt.Text= "[Fields!加工_加工人.Value]: [Aggregates!GroupSum.Value]" '设置打印内容
rt.Width = 50 '宽度53毫米
rt.Height = 8 '高度24毫米
doc.body.Children.Add(rt)
agg.DataBinding = rt.DataBinding 'Agg的DataBinding属性,应该设为打印对象的DataBinding
agg.Running = 1 '分组统计
agg.Expressi '统计字段
doc.DataSchema.Aggregates.Add(agg)'定义好的统计必须添加到报表的DataSchema中
doc.Preview()