Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
timerec3public/filterliste.php
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
93 lines (84 sloc)
4.29 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php session_start(); ?> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>timerec | Saldo Extrema</title> | |
<link rel="stylesheet" type="text/css" href="style.css"> | |
<link rel="stylesheet" type="text/css" href="print.css" media="print"> | |
</head> | |
<body> | |
<?php | |
if(!$_SESSION['userid']){ | |
session_destroy(); | |
include('login.php'); | |
exit; | |
} | |
$infoarray = $_SESSION['infoarray']; | |
include("dbconnect.php"); | |
if(!$_SESSION['userarray']['admin']){ | |
echo "<h3>keine Rechte, diese Seite einzusehen!</h3>"; | |
exit; | |
} | |
setlocale(LC_TIME, 'de_DE.UTF8'); | |
include('dbconnect.php'); | |
if(isset($_GET['m'], $_GET['y'])){ | |
$y = $_GET['y']; | |
$m = $_GET['m']; | |
$date = new DateTime("$y-$m-01"); | |
}else{ | |
$date = new DateTime('first day of this month'); //am 29.3. würde ansonsten weiter unten modify(-1 month) auf den 1.3. anstatt auf den februar zeigen | |
$y = $date->format('Y'); | |
$m = $date->format('m'); | |
} | |
$tagdavor = $date->modify('-1 month'); | |
$tagdavor = $tagdavor->format('\y\=Y\&\m\=m'); | |
$tagdanach = $date->modify('+2 month'); | |
$tagdanach = $tagdanach->format('\y\=Y\&\m\=m'); | |
$date->modify('-1 month'); //date wieder auf den ursprünglichen Wert zurücksetzen | |
if(isset($_POST['suchen'])){ | |
$min = $_POST['minsaldo']*60; | |
$max = $_POST['maxsaldo']*60; | |
}else{ | |
$min = -600; | |
$max = 1200; | |
} | |
echo "<div id='headline' style='height: 80px;'> | |
<div id='home'> | |
<a href='index.php?ma=".$infoarray['maID']."'><button><< Menü</button></a> | |
</div> | |
<div id='back'><a href='filterliste.php?$tagdavor'><button><<<</button></a></div> | |
Saldo Extrema für Anfang <b>".strftime('%B', $date->getTimestamp())." $y</b> | |
<div id='forward'><a href='filterliste.php?$tagdanach'><button>>>></button></a></div> | |
<div class='scroll down' onclick='window.scrollTo(0,document.documentElement.scrollHeight)'>runter ↓</div> | |
<div class='scroll up' onclick='window.scrollTo(0,0)'>↑ rauf</div> | |
<br> | |
<br> | |
<form id='extremsaldo' action='' method='post'> | |
außerhalb <input class='narrow' type='number' name='minsaldo' value='".($min/60)."'> und <input class='narrow' type='number' name='maxsaldo' value='".($max/60)."'> Std. ⟶ <button name='suchen' value='suchen' class='topline'>suchen</button> | |
</form> | |
</div> | |
<h2 id='ueberschrift' style='display: none'>Saldo Extrema für Anfang <strong>".strftime('%B', $date->getTimestamp())." $y</strong></h2>"; | |
echo "<div id='azmodell' style='margin-top: 20px;'><table> | |
<tr><th>Name</th><th>Saldo</th></tr><tr class='topline'><td colspan='2'></td></tr>"; | |
$getma = $dbc->query("select concat(nachname, ', ', vorname) as name, maID from mitarbeiter where gleitzeit = 1 order by name;"); | |
$switch = false; | |
foreach($getma as $ma){ | |
$getsaldo = $dbc->query("select * from (select sum(saldomin) as saldo from saldo where maID = '$ma[maID]' and datum <= '$y-$m-01') pre where pre.saldo <= $min or pre.saldo >= $max;"); | |
foreach($getsaldo as $saldo){ | |
if($saldo['saldo']){ | |
$switch ? $farbe = "line2" : $farbe = "line1"; | |
$switch = !$switch; | |
$saldoh = intval($saldo['saldo']/60); | |
$saldom = round(abs($saldo['saldo']%60)); | |
$saldostr = $saldoh . ":" . $saldom; | |
echo "<tr class='$farbe'>"; | |
echo "<td><a href='index.php?ma=$ma[maID]'>$ma[name]</a></td><td>$saldostr</td>"; | |
echo "</tr>"; | |
} | |
} | |
} | |
echo "</table></div>"; | |
?> | |
</body> | |
</html> |