Exemplo n.º 1
0
        echo "<tr>";
    }
    echo "<td>" . $row['week'] . "</td>";
    echo "<td>" . $row['day'] . "</td>";
    echo "<td>" . $row['date'] . "</td>";
    echo "<td>" . $row['checkin'] . "</td>";
    if ($row['checkout'] == "00:00:00") {
        $row['checkout'] = "-";
    }
    echo "<td>" . $row['checkout'] . "</td>";
    echo "<td>" . $row['pause'] . " min</td>";
    if ($row['worktime'] == "00:00:00") {
        $worktime = "-";
    } else {
        $worktime = hoursToSeconds($row['worktime']) - $row['pause'] * 60;
        $worktime = secondsToHours($worktime);
    }
    echo "<td>" . $worktime . "</td>";
    echo "<td>" . $row['comment'] . "</td>";
    echo "</tr>";
}
?>
		</table><br><br>
	<form action="deleteEntry.php" method="POST">
	<input type="hidden" name="deleteID" value="<?php 
echo $id;
?>
">
	<input type="submit" name="ja" value="Ja" />
	<a href="overview.php"><input type="submit" name="nej" value="Nej" /></a>
	</form>
Exemplo n.º 2
0
    // Hent nye data fra db
    $sql = mysql_query("SELECT * FROM users WHERE username = '******'");
    $settings = mysql_fetch_assoc($sql);
}
// Udregn totale antal forventede timer.
$totalExpectedTime = hoursToSeconds($settings['expMondayTo']) - hoursToSeconds($settings['expMondayFrom']) + (hoursToSeconds($settings['expTuesdayTo']) - hoursToSeconds($settings['expTuesdayFrom'])) + (hoursToSeconds($settings['expWednesdayTo']) - hoursToSeconds($settings['expWednesdayFrom'])) + (hoursToSeconds($settings['expThursdayTo']) - hoursToSeconds($settings['expThursdayFrom'])) + (hoursToSeconds($settings['expFridayTo']) - hoursToSeconds($settings['expFridayFrom']));
$totalExpectedTime = $totalExpectedTime - ($settings['expMondayPause'] + $settings['expTuesdayPause'] + $settings['expWednesdayPause'] + $settings['expThursdayPause'] + $settings['expFridayPause']) * 60;
if ($totalExpectedTime < 133200) {
    $diff = secondsToHours(133200 - $totalExpectedTime);
    $totalExpectedTime = "<font color='red'>" . secondsToHours($totalExpectedTime) . " ( -" . $diff . " )</font>";
} else {
    if ($totalExpectedTime == 133200) {
        $totalExpectedTime = "<font color='green'>" . secondsToHours($totalExpectedTime) . "</font>";
    } else {
        $diff = secondsToHours($totalExpectedTime - 133200);
        $totalExpectedTime = "<font color='green'>" . secondsToHours($totalExpectedTime) . " ( +" . $diff . " )</font>";
    }
}
// Udskriv indstillinger.
echo "<form method='POST' action='settings.php'>";
echo "<tr><th colspan='2' class='title'>Forventede arbejdstider</th></tr>";
echo "<tr><th>Mandag</th><td><input type='text' name='expMondayFrom' size='7' value='" . $settings['expMondayFrom'] . "' /> - <input type='text' name='expMondayTo' size='7' value='" . $settings['expMondayTo'] . "' /> inkl. <input type='text' name='expMondayPause' size='2' value='" . $settings['expMondayPause'] . "' /> min. pause</td></tr>";
echo "<tr><th>Tirsdag</th><td><input type='text' name='expTuesdayFrom' size='7' value='" . $settings['expTuesdayFrom'] . "' /> - <input type='text' name='expTuesdayTo' size='7' value='" . $settings['expTuesdayTo'] . "' /> inkl. <input type='text' name='expTuesdayPause' size='2' value='" . $settings['expTuesdayPause'] . "' /> min. pause</td></tr>";
echo "<tr><th>Onsdag</th><td><input type='text' name='expWednesdayFrom' size='7' value='" . $settings['expWednesdayFrom'] . "' /> - <input type='text' name='expWednesdayTo' size='7' value='" . $settings['expWednesdayTo'] . "' /> inkl. <input type='text' name='expWednesdayPause' size='2' value='" . $settings['expWednesdayPause'] . "' /> min. pause</td></tr>";
echo "<tr><th>Torsdag</th><td><input type='text' name='expThursdayFrom' size='7' value='" . $settings['expThursdayFrom'] . "' /> - <input type='text' name='expThursdayTo' size='7' value='" . $settings['expThursdayTo'] . "' /> inkl. <input type='text' name='expThursdayPause' size='2' value='" . $settings['expThursdayPause'] . "' /> min. pause</td></tr>";
echo "<tr><th>Fredag</th><td><input type='text' name='expFridayFrom' size='7' value='" . $settings['expFridayFrom'] . "' /> - <input type='text' name='expFridayTo' size='7' value='" . $settings['expFridayTo'] . "' /> inkl. <input type='text' name='expFridayPause' size='2' value='" . $settings['expFridayPause'] . "' /> min. pause</td></tr>";
echo "<tr><th>I alt</th><td><center>" . $totalExpectedTime . "</center></td></tr>";
echo "<tr><th colspan='2'><center><input type='submit' class='submit' name='save' value='Gem ændringer' /><center></th></tr>";
closedb();
?>
</table>
Exemplo n.º 3
0
$sql_worktime = mysql_query("SELECT * FROM checks WHERE user = '******' AND week = '" . uge() . "' AND YEAR(date) = '" . date('Y') . "' ORDER BY date desc");
$WorktimeThisWeek = 0;
while ($row = mysql_fetch_assoc($sql_worktime)) {
    if ($row['worktime'] == date('00:00:00') & $status == 1) {
        $WorktimeThisWeek = hoursToSeconds(tid()) - hoursToSeconds($row['checkin']) - $row['pause'] * 60;
    } else {
        $WorktimeThisWeek = $WorktimeThisWeek + (hoursToSeconds($row['worktime']) - $row['pause'] * 60);
    }
}
// Hvis mere end 37 timer, vises teksten med grøn for at signalere overskud.
if ($WorktimeThisWeek >= 133200) {
    $diff = secondsToHours($WorktimeThisWeek - 133200);
    echo "Arbejdstid i denne uge: " . secondsToHours($WorktimeThisWeek) . " (<font color='green'>+" . $diff . "</font>)<br>";
} else {
    $diff = secondsToHours(133200 - $WorktimeThisWeek);
    echo "Arbejdstid i denne uge: " . secondsToHours($WorktimeThisWeek) . " (-" . $diff . ")<br>";
}
// Calculate balance
$DatesCalculated = array();
$startbalance = mysql_fetch_assoc(mysql_query("SELECT balance FROM users WHERE username = '******'"));
$balance = $startbalance['balance'];
$sql = mysql_query("SELECT date,day,checkin,worktime,pause,comment FROM checks WHERE user = '******'");
while ($result = mysql_fetch_assoc($sql)) {
    $worktimeThisDay = 0;
    // Reset variable
    $entriesThisDay = mysql_num_rows(mysql_query("SELECT date FROM checks WHERE user = '******' AND date = '" . $result['date'] . "'"));
    // Sorter efter kommentar. Spring disse dage over da de ikke påvirker balancen.
    if ($result['comment'] == "Skole" || $result['comment'] == "Fri" || $result['comment'] == "Ferie" || $result['comment'] == "Syg" || $result['comment'] == "Udstationering") {
        continue;
    } else {
        if ($result['comment'] == "Afspadsering") {