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(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60),1) 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_user_roles`.`paid` = 1
GROUP BY Year, PayPeriod, ContactID
ORDER BY Year DESC, PayPeriod DESC, 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);
$query_Recordset2 = "SELECT d.Date, IF(Week(d.date) DIV 2 <>0,Year(d.date),Year(d.date)-1) as Year,
IF(Week(d.date) DIV 2 <>0,Week(d.date) DIV 2,26 ) as PayPeriod
FROM (SELECT curdate() as Date) as d;";
$Recordset2 = mysql_query($query_Recordset2, $YBDB) or die(mysql_error());
//$row_Recordset1 = mysql_fetch_assoc($Recordset1); //Wait to fetch until do loop
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
?>
Staff Hours by Pay Period |
View Hours by: PayPeriod, Week, Month |
Current Date: | Pay Period Year: | Pay Period: |
Year |
Pay Period |
Name
| Hours
|
|
|
"> |
|
|