You are not logged in!!!"; } else { //********** BEGIN CONTENT **********// echo "
Below is your company punch history. The below drop-down can be used to select pre-configured reports. Other reports are currently being written.
"; echo ""; if (isset($_POST['reporttype'])) { if ($_POST['reporttype'] == "Hours per week per user") { $query = "SELECT YEAR(punches.intime) AS g_year, WEEK(punches.intime) AS g_week, SUM(TIME_TO_SEC(TIMEDIFF(punches.outtime, punches.intime))/3600) AS punchhours, punches.id as punchid, users.id as user, users.username as username, users.firstname as firstname, users.lastname as lastname, punches.intime as intime, punches.outtime as outtime, punches.notes as notes, punches.modified as modified FROM punches INNER JOIN users ON punches.userid = users.id GROUP BY g_year, g_week, users.username;"; $stmt = $sql->prepare($query); $stmt->execute(); $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); //set up table header and open table echo 'Year | '; echo 'Week# | '; echo 'Username | '; echo 'Hours | '; echo '
---|---|---|---|
" . $row['g_year'] . " | "; echo "" . $row['g_week'] . " | "; echo "" . $row['username'] . " | "; echo "" . $row['punchhours'] . " | "; echo "
Year | '; echo 'Month | '; echo 'Username | '; echo 'Hours | '; echo '
---|---|---|---|
" . $row['g_year'] . " | "; echo "" . $row['g_month'] . " | "; echo "" . $row['username'] . " | "; echo "" . $row['punchhours'] . " | "; echo "