If e.PostValues("统计分组")="学校"
gp.Groups.AddDef("学校")
End If
If e.PostValues("统计分组")="年级"
gp.Groups.AddDef("学校")
gp.Groups.AddDef("年级")
End If
If e.PostValues("统计分组")="班级"
gp.Groups.AddDef("学校")
gp.Groups.AddDef("年级")
gp.Groups.AddDef("班级")
End If
gp.Groups.AddDef("审核锁定","是否审核")
If e.PostValues("bjrs")="on"
gp.Totals.AddDef("姓名",AggregateEnum.Count,"学生人数")
End If
If e.PostValues("xsxb")="on"
gp.Totals.AddExp("性别_男","case when 性别='男' then 1 else 0 end")
gp.Totals.AddExp("性别_女","case when 性别='女' then 1 else 0 end")
End If
If e.PostValues("lsqk")="on"
gp.Totals.AddExp("留守情况_非留守","case when 留守情况='非留守' then 1 else 0 end")
gp.Totals.AddExp("留守情况_单亲留守","case when 留守情况='单亲留守' then 1 else 0 end")
gp.Totals.AddExp("留守情况_双亲留守","case when 留守情况='双亲留守' then 1 else 0 end")
End If
If e.PostValues("jdfs")="on"
gp.Totals.AddExp("就读方式_住校","case when 就读方式='住校' then 1 else 0 end")
gp.Totals.AddExp("就读方式_走校","case when 就读方式='走校' then 1 else 0 end")
End If
If e.PostValues("jcqk")="on"
gp.Totals.AddExp("就餐情况_早餐","case when 就餐情况='早餐' then 1 else 0 end")
gp.Totals.AddExp("就餐情况_午餐","case when 就餐情况='午餐' then 1 else 0 end")
gp.Totals.AddExp("就餐情况_晚餐","case when 就餐情况='晚餐' then 1 else 0 end")
gp.Totals.AddExp("就餐情况_早午餐","case when 就餐情况='早午餐' then 1 else 0 end")
gp.Totals.AddExp("就餐情况_早晚餐","case when 就餐情况='早晚餐' then 1 else 0 end")
gp.Totals.AddExp("就餐情况_午晚餐","case when 就餐情况='午晚餐' then 1 else 0 end")
gp.Totals.AddExp("就餐情况_早午晚餐","case when 就餐情况='早午晚餐' then 1 else 0 end")
End If
If e.PostValues("jkzk")="on"
gp.Totals.AddExp("残疾人数","case when 健康状况<>'健康或良好' then 1 else 0 end")
End If
If e.PostValues("jdlk")="on"
gp.Totals.AddExp("建档立卡","case when 贫困建档='是' then 1 else 0 end")
End If
If e.PostValues("mzqk")="on"
gp.Totals.AddExp("少数民族","case when 民族<>'汉族' then 1 else 0 end")
End If
If e.PostValues("zzmm")="on"
gp.Totals.AddExp("政治面貌_群众","case when 政治面貌='群众' then 1 else 0 end")
gp.Totals.AddExp("政治面貌_团员","case when 政治面貌='共且青团员'then 1 else 0 end")
End If
If e.PostValues("fkxz")="on"
gp.Totals.AddExp("户口性质_农村","case when 户口性质='农村' then 1 else 0 end")
gp.Totals.AddExp("户口性质_城镇","case when 户口性质='城镇'then 1 else 0 end")
End If
gp.VerticalTotal=True
Dim dt1 As DataTable = gp.Build(True)
For Each r As DataRow In dt1.DataRows
For Each c As DataCol In dt1.DataCols
If c.IsNumeric AndAlso r(c.Name)=0
r(c.name)=Nothing
End If
Next
Next
Dim Book As New XLS.Book '定义一个Excel工作簿
Dim Sheet As XLS.Sheet = Book.Sheets(0) '引用工作簿的第一个工作表
For c As Integer = 0 To dt1.DataCols.Count-1
Sheet(0, c).Value = dt1.DataCols(c).name
Next
For r As Integer = 0 To dt1.DataRows.Count - 1 '填入数据
For c As Integer = 0 To dt1.DataCols.Count-1
If dt1.DataCols(c).IsNumeric AndAlso dt1.datarows(r)(dt1.DataCols(c).name)=0
Sheet(r +1, c).Value=Nothing
Else
Sheet(r +1, c).Value = dt1.datarows(r)(dt1.DataCols(c).name)
End If
Next
Next
Dim fl As String ="C:\web\tb\tb" & e.Cookies("userid") & "人数统表.xls"
Book.Save(fl)
With wb.AddActionSheet("","menu") '设计菜单
.Add("mnuload", "下载表格").Attribute=" & e.Cookies("userid") & "人数统表.xls'"""
.Add("mnuCancel","取消","",True)
End With