此主题相关图片如下:130223.jpg
按钮代码如下:
DataTables("生产进度").load()
DataTables("生产进度").DataCols("产品编号").RaiseDataColChanged()
DataTables("生产进度").DataCols("领取数量").RaiseDataColChanged()
Dim dt_jc As DataTable = DataTables("生产进度")
Dim dt_tj As DataTable = DataTables("统计表")
dt_tj.DataRows.Clear
For Each name As String In dt_jc.GetUniqueValues("完成数量 > 0", "员工")
Dim dr As DataRow = DataTables("生产进度").Find("员工 = '" & name & "'")
Dim ndr As DataRow = dt_tj.AddNew
ndr("部门") = dr("部门")
ndr("员工") = name
Dim filter As String = "员工 = '" & name & "'"
ndr("支数") = dt_jc.Compute("Sum(完成数量)", filter & " And 日期 = #" & Date.Today & "#")
ndr("点数") = dt_jc.Compute("Sum(大桨点数)", filter & " And 日期 = #" & Date.Today & "#")
ndr("返工") = dt_jc.Compute("Sum(返工数量)", filter & " And 日期 = #" & Date.Today & "#")
ndr("废品") = dt_jc.Compute("Sum(废品数量)", filter & " And 日期 = #" & Date.Today & "#")
ndr("累计点值") = dt_jc.Compute("Sum(大桨点数)", filter)
Next
Tables("统计表").Sort = "部门,员工"
Tables("统计表").AutoSizeCols()
Tables("统计表").Cols("部门").TextAlign = TextAlignEnum.Center
Tables("统计表").Cols("员工").TextAlign = TextAlignEnum.Center
Tables("统计表").Cols("支数").TextAlign = TextAlignEnum.Center
Tables("统计表").Cols("点数").TextAlign = TextAlignEnum.Center
Tables("统计表").Cols("返工").TextAlign = TextAlignEnum.Center
Tables("统计表").Cols("废品").TextAlign = TextAlignEnum.Center
Tables("统计表").Cols("累计点值").TextAlign = TextAlignEnum.Center
Tables("统计表").SaveExcel("d:\JXF\" & Format(Date.Now, "yyyyMMddHHmmss") & ".xls","统计表")
MainTable = Tables("统计表")
[此贴子已经被作者于2013-2-25 15:27:51编辑过]