Dim tB As Table = Tables("月工资表_table1")
Dim tB2 As Table = Tables("月工资表_table2")
If Forms("月工资表").Opened()
Dim yf As String = e.Form.Controls("TextBox1").text
Dim nf As String = e.Form.Controls("TextBox2").text
Dim xm As String = e.Form.Controls("TextBox3").text
tB.Fill(" Select b.组别 As 班组 ,a.实际生产员工,sum(a.件数*a.工价) As 工资 f rom 派发工序表 a left join 员工管理 b on a.实际生产员工=b.姓名 where MONTH(a.扫码时间) = convert(int, " & yf & ") And year(a.扫码时间)=convert(int, " & nf & ") and 实际生产员工='" & xm & "' and 单据状态='已完成' GROUP BY b.组别,a.实际生产员工 order by 班组 " , "xsc_erp",True)
tB2.Fill(" select (convert(varchar(8),[扫码时间],112)) as 日期,订单号,款号,工价,实际生产员工,工序号,工序名,sum(件数*工价) As 工资,sum(件数) as 件数 f rom [BD-ERP].[dbo].[派发工序表] a where MONTH(扫码时间) = convert(int, " & yf & ") And year(扫码时间)=convert(int, " & nf & ") and 实际生产员工='" & xm & "' and 单据状态='已完成' group by 订单号,款号,工价,实际生产员工,工序号,工序名,扫码时间 order by 实际生产员工,工序号,(convert(varchar(8),[扫码时间],112)) " , "xsc_erp",True)
End If
Dim g As Subtotalgroup
tB2.SubtotalGroups.Clear()
g = New Subtotalgroup
g.GroupOn = "日期"
g.TotalOn = "工资"
g.DateGroup = DateGroupEnum.day '按年分组
tB2.SubtotalGroups.Add(g)
g = New Subtotalgroup
g.GroupOn = "日期"
g.TotalOn = "工资"
g.DateGroup = DateGroupEnum.week '按年分组
tB2.SubtotalGroups.Add(g)
g = New Subtotalgroup
g.GroupOn = "*"
g.TotalOn = "工资"
tB2.SubtotalGroups.Add(g)
tB2.Subtotal()