此主题相关图片如下:微信图片_20200623133850.png
代码如下
Dim tB As Table = Tables("对接工资分析_table1")
Dim tB2 As Table = Tables("对接工资分析_table2")
Dim tB3 As Table = Tables("对接工资分析_table3")
Dim tB4 As Table = Tables("对接工资分析_table4")
If Forms("对接工资分析").Opened()
tB.Fill("select 实际生产员工,sum(a.件数*a.工价) F rom 派发工序表 a left join 员工管理 b on a.实际生产员工=b.姓名 where 实际生产员工 is not null and month(a.扫码时间)=datename(month,getdate()) and year(a.扫码时间)=datename(year,getdate()) and a.单据状态='已完成' and a.件数*a.工价>0 group by 实际生产员工 order by 实际生产员工" , "xsc_erp",True)
tB2.Fill(" SELECT 实际生产员工,SUM(MonMoney) F ROM [ERP_JMH].dbo.Fa_Gz WHERE month(indate)=datename(month,getdate()) and year(indate)=datename(year,getdate()) and 订单号 is not null group by 实际生产员工 order by 实际生产员工 " , "dingbang",True)
tB3.Fill("select 实际生产员工,(convert(varchar(8),扫码时间,112)) AS "日期",sum(a.件数*a.工价) F rom {派发工序表} a left join {员工管理} b on a.实际生产员工=b.姓名 where month(a.扫码时间)=datename(month,getdate()) And year(a.扫码时间)=datename(year,getdate()) And (a.件数*a.工价)>0 And a.实际生产员工 Is not null group by 实际生产员工,(convert(varchar(8),扫码时间,112)) order by 实际生产员工,(convert(varchar(8),扫码时间,112))" , "xsc_erp",True)
tB4.Fill(" SELECT 实际生产员工,(convert(varchar(8),[indate],112)) AS "日期",SUM(MonMoney) F ROM {Fa_Gz} WHERE month(indate)=datename(month,getdate()) And year(indate)=datename(year,getdate()) And 订单号 Is not null group by 实际生产员工,(convert(varchar(8),[indate],112)) order by 实际生产员工,(convert(varchar(8),[indate],112))" , "dingbang",True)
End If