mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-25 08:34:29 +00:00
This commit is contained in:
@@ -27,6 +27,7 @@ require_once('../../../include/zeitsperre.class.php');
|
||||
require_once('../../../include/person.class.php');
|
||||
require_once('../../../include/benutzer.class.php');
|
||||
require_once('../../../include/mitarbeiter.class.php');
|
||||
require_once('../../../include/resturlaub.class.php');
|
||||
|
||||
if(!$conn = pg_pconnect(CONN_STRING))
|
||||
die('Fehler beim Connecten zur Datenbank');
|
||||
@@ -125,6 +126,26 @@ if(isset($_GET['action']) && $_GET['action']=='freigabe')
|
||||
|
||||
}
|
||||
|
||||
//Speichern der Resturlaubstage
|
||||
if(isset($_POST['saveresturlaub']))
|
||||
{
|
||||
if(isset($_POST['resturlaubstage']) && is_numeric($_POST['resturlaubstage']))
|
||||
{
|
||||
$resturlaub = new resturlaub($conn);
|
||||
$resturlaub->load($uid);
|
||||
|
||||
$resturlaub->resturlaubstage=$_POST['resturlaubstage'];
|
||||
$resturlaub->updateamum=date('Y-m-d H:i:s');
|
||||
$resturlaub->updatevon = $user;
|
||||
if($resturlaub->save())
|
||||
echo 'Resturlaubstage wurden erfolgreich gespeichert';
|
||||
else
|
||||
echo '<span class="error">Fehler beim Speichern der Resturlaubstage: '.$resturlaub->errormsg.'</span>';
|
||||
}
|
||||
else
|
||||
echo '<span class="error">Fehler beim Speichern der Resturlaubstage: Resturlaub muss eine gueltige Zahl sein</span>';
|
||||
}
|
||||
|
||||
//Monat zeichenen
|
||||
function draw_monat($monat)
|
||||
{
|
||||
@@ -170,7 +191,71 @@ function draw_monat($monat)
|
||||
}
|
||||
|
||||
//Jahr mit Pfeilen zum blaettern anzeigen
|
||||
echo '<center>';
|
||||
|
||||
if($uid!='')
|
||||
{
|
||||
echo '<table width="100%"><tr><td style="width:33%">';
|
||||
echo "<a href='".$_SERVER['PHP_SELF']."?year=$year' class='Item'>Alle Mitarbeiter anzeigen</a><br></td>";
|
||||
echo '<td style="width:33%">';
|
||||
echo '</td><td style="width:33%">';
|
||||
|
||||
//Anzeige Resturlaubsberechnung
|
||||
|
||||
$resturlaub = new resturlaub($conn);
|
||||
|
||||
if($resturlaub->load($uid))
|
||||
{
|
||||
$resturlaubstage = $resturlaub->resturlaubstage;
|
||||
$mehrarbeitsstunden = $resturlaub->mehrarbeitsstunden;
|
||||
$anspruch = $resturlaub->urlaubstageprojahr;
|
||||
}
|
||||
|
||||
$jahr=date('Y');
|
||||
if (date('m')>8)
|
||||
{
|
||||
$datum_beginn_iso=$jahr.'-09-01';
|
||||
$datum_beginn='1.Sept.'.$jahr;
|
||||
$datum_ende_iso=($jahr+1).'-08-31';
|
||||
$datum_ende='31.Aug.'.($jahr+1);
|
||||
$geschaeftsjahr=$jahr.'/'.($jahr+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$datum_beginn_iso=($jahr-1).'-09-01';
|
||||
$datum_beginn='1.Sept.'.($jahr-1);
|
||||
$datum_ende_iso=$jahr.'-08-31';
|
||||
$datum_ende='31.Aug.'.$jahr;
|
||||
$geschaeftsjahr=($jahr-1).'/'.$jahr;
|
||||
}
|
||||
|
||||
//Urlaub berechnen
|
||||
$gebuchterurlaub=0;
|
||||
$qry = "SELECT sum(bisdatum-vondatum+1) as anzahltage FROM campus.tbl_zeitsperre
|
||||
WHERE zeitsperretyp_kurzbz='Urlaub' AND mitarbeiter_uid='$uid' AND
|
||||
(
|
||||
vondatum>='$datum_beginn_iso' AND bisdatum<='$datum_ende_iso'
|
||||
)";
|
||||
$result = pg_query($conn, $qry);
|
||||
$row = pg_fetch_object($result);
|
||||
$gebuchterurlaub = $row->anzahltage;
|
||||
if($gebuchterurlaub=='')
|
||||
$gebuchterurlaub=0;
|
||||
|
||||
echo "<table ><tr><td nowrap><h3>Urlaub im Geschäftsjahr $geschaeftsjahr</h3></td></tr>";
|
||||
echo "<tr><td nowrap>Anspruch</td><td align='right' nowrap>$anspruch Tage</td><td class='grey' nowrap>  ( jährlich )</td></tr>";
|
||||
echo "<tr><td nowrap>+ Resturlaub</td><td align='right' nowrap>";
|
||||
echo "<form action='".$_SERVER['PHP_SELF']."?uid=$uid' method='POST' style='margin:0px'>";
|
||||
echo "<input type='text' size='2' value='$resturlaubstage' name='resturlaubstage'> Tage";
|
||||
echo "<input type='submit' value='OK' name='saveresturlaub'>";
|
||||
echo "</td><td class='grey' nowrap> ( Stichtag: $datum_beginn )</td>";
|
||||
echo "<tr><td nowrap>- aktuell gebuchter Urlaub </td><td align='right' nowrap>$gebuchterurlaub Tage</td><td class='grey' nowrap> ( $datum_beginn - $datum_ende )</td></tr>";
|
||||
echo "<tr><td style='border-top: 1px solid black;' nowrap>aktueller Stand</td><td style='border-top: 1px solid black;' align='right' nowrap>".($anspruch+$resturlaubstage-$gebuchterurlaub)." Tage</td><td class='grey' nowrap> ( Stichtag: $datum_ende )</td></tr>";
|
||||
echo "</table>";
|
||||
|
||||
echo '</td></tr></table>';
|
||||
}
|
||||
|
||||
echo '<br><center>';
|
||||
echo "<a href='".$_SERVER['PHP_SELF']."?uid=$uid&year=".($year-1)."' class='Item' title='Ein Jahr zurück'><img src='../../../skin/images/left.gif'></a>";
|
||||
echo ' <font size="+1"><b>';
|
||||
echo ($year-1).'/'.$year;
|
||||
@@ -178,10 +263,6 @@ echo '</b></font> ';
|
||||
echo "<a href='".$_SERVER['PHP_SELF']."?uid=$uid&year=".($year+1)."' class='Item' title='Ein Jahr vor'><img src='../../../skin/images/right.gif'></a>";
|
||||
echo '</center>';
|
||||
|
||||
if($uid!='')
|
||||
{
|
||||
echo "<a href='".$_SERVER['PHP_SELF']."?year=$year' class='Item'>Alle Mitarbeiter anzeigen</a><br>";
|
||||
}
|
||||
echo '<br>';
|
||||
//Tabelle mit den Monaten ausgeben
|
||||
echo '<table cellspacing=0 width="100%" style="border: 1px solid black;"><tr>';
|
||||
|
||||
Reference in New Issue
Block a user