不是啊!
我需要的报表是这样的:
01日 02日 03日 04日 05日 。。。
张三 30 40 30 20
李四 20 30 50 40
但是现在确是:
01日 02日 03日 04日 。。。
张三 30 40 30 20
李四 20 30 50 40
我的代码:
Dim Filter As String = "[姓名]<>''"
Dim Y As Integer = Forms("选择月份").Controls("TextBox1").Value
Dim M As Integer = Forms("选择月份").Controls("TextBox2").Value
Dim SD As Date = New Date(Y,M,1)
Dim Days As Integer = Date.DaysInMonth(Y,M)
Dim ED As Date = New Date(Y,M,Days)
Filter = Filter & "And [日期] >= #" & SD & "# And [日期]<= #" & ED & "#"
If Forms("选择月份").Controls("CheckBox1").Checked = False Then
Filter = Filter & "And [部门]<>'C'"
End If
If Forms("选择月份").Controls("CheckBox2").Checked = False Then
Filter = Filter & "And [部门]<>'G'"
End If
If Forms("选择月份").Controls("CheckBox3").Checked = False Then
Filter = Filter & "And [部门]<>'I'"
End If
If Forms("选择月份").Controls("CheckBox4").Checked = False Then
Filter = Filter & "And [部门]<>'开后'"
End If
If Forms("选择月份").Controls("CheckBox5").Checked = False Then
Filter = Filter & "And [部门]<>'小后'"
End If
If Forms("选择月份").Controls("CheckBox6").Checked = False Then
Filter = Filter & "And [部门]<>'观澜'"
End If
If Forms("选择月份").Controls("CheckBox7").Checked = False Then
Filter = Filter & "And [部门]<>'机器房'"
End If
Dim g As New CrossTableBuilder("计件工资", DataTables("计件表"), Filter)
g.HGroups.AddDef("部门")
g.HGroups.AddDef("姓名")
g.VGroups.AddDef("日期", DateGroupEnum.Day, "{0}日")
g.Totals.AddDef("金额", "金额")
g.HorizontalTotal = True
g.VerticalTotal = True
g.Decimals = 1
g.Build()
Dim Book As New XLS.Book(ProjectPath & "Attachments\计件工资模板.xls")
Dim fl As String = ProjectPath & "Reports\计件工资" & Y & "-" & M & ".xls"
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Book.Build() '生成细节区
Book.Save(fl) '保存工作簿
Dim Proc As New Process '打开工作簿
Proc.File = fl
Proc.Start()