以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 按周汇总工资为何这个小计显示的还是每天的? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=157440) |
-- 作者:yetle -- 发布时间:2020/10/16 9:25:00 -- 按周汇总工资为何这个小计显示的还是每天的? 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()
|
-- 作者:qingyang -- 发布时间:2020/10/16 9:31:00 -- 你TB2表的"日期"字段转换成字符串类型了,导致后面g.DateGroup = DateGroupEnum.Week没有生效(感觉这个方法有点傻,要求日期类型但是文档没有说明) 把convert(varchar(8),[扫码时间],112) 改成 convert(date,[扫码时间]) 试试
[此贴子已经被作者于2020/10/16 11:17:45编辑过]
|
-- 作者:有点蓝 -- 发布时间:2020/10/16 9:44:00 -- 请上传实例说明 |