0,Year(time_in),Year(time_in)-1) as Year, IF(Week(time_in) DIV 2 <>0,Week(time_in) DIV 2,26 ) as PayPeriod, contacts.contact_id as ContactID, CONCAT(last_name, ', ', first_name, ' ',middle_initial) AS Name, COUNT(shop_hours.contact_id) as Shifts, ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60)) AS Hours FROM shop_hours LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id WHERE shop_hours.shop_user_role = 'Paid Mechanic' GROUP BY Year, PayPeriod, ContactID ORDER BY Year, PayPeriod, last_name, first_name) AS total_hours;"; $Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error()); //$row_Recordset1 = mysql_fetch_assoc($Recordset1); //Wait to fetch until do loop $totalRows_Recordset1 = mysql_num_rows($Recordset1); ?>
Hours by User
Year PayPeriod Name
Hours