SELECT 
	uat.user_id userId, uat.yearmonth yearmonth, uat.pid pjtId, uat.departid deptId,uat.pmId pmId,
	overtime_total_time overtimeDuration,
	datum_attendance_date  datumWorkDuration,
	CONVERT(overtimeFee ,decimal(10,2)) overtimeFee
 from 
(
	SELECT uat.id,bos.multiple,uat.user_id ,uat.pid,uat.departid ,uat.yearmonth,d.dept_proj_managerid pmId,
	IFNULL(uat.overtime_total_time,0) overtime_total_time,IFNULL(uat.datum_attendance_date,0) datum_attendance_date, 
	(IFNULL(uw.overtimepay_fixed, 0) + IFNULL(uw.overtimepay_timeout, 0) + IFNULL(uw.special_overtime,0)) overtimeFee
	from t_bus_user_attendance_total  uat
	LEFT JOIN t_bus_user_wage uw 
	ON uat.user_id = uw.userid and uat.yearmonth = uw.monthly
	LEFT JOIN t_bus_user_wagestrategy uws
	ON uat.user_id = uws.userid
	LEFT JOIN t_bus_overtimepay_strategy bos
	ON uws.overtimepay_strategyid = bos.id
	LEFT JOIN t_s_depart d
	ON uat.pid = d.ID
) uat
WHERE uat.yearmonth  =:params.yearmonth  AND uat.pid != ''  and overtime_total_time != 0  order by overtimeDuration desc