mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
Zeitaufzeichnung alle Tage werden angezeigt, Fehler und Feiertage angezeigt
This commit is contained in:
Regular → Executable
+115
-73
@@ -28,6 +28,7 @@ require_once('../../../include/benutzer.class.php');
|
||||
require_once('../../../include/studiengang.class.php');
|
||||
require_once('../../../include/fachbereich.class.php');
|
||||
require_once('../../../include/zeitaufzeichnung.class.php');
|
||||
require_once('../../../include/zeitsperre.class.php');
|
||||
require_once('../../../include/datum.class.php');
|
||||
require_once('../../../include/projekt.class.php');
|
||||
require_once('../../../include/phrasen.class.php');
|
||||
@@ -35,6 +36,7 @@ require_once('../../../include/organisationseinheit.class.php');
|
||||
require_once('../../../include/service.class.php');
|
||||
require_once('../../../include/mitarbeiter.class.php');
|
||||
require_once('../../../include/betriebsmittelperson.class.php');
|
||||
require_once('../../../include/globals.inc.php');
|
||||
|
||||
$sprache = getSprache();
|
||||
$p=new phrasen($sprache);
|
||||
@@ -64,6 +66,10 @@ $filter = (isset($_GET['filter'])?$_GET['filter']:'foo');
|
||||
$alle = (isset($_POST['alle'])?(isset($_POST['normal'])?false:true):false);
|
||||
$angezeigte_tage = '50';
|
||||
|
||||
$zs = new zeitsperre();
|
||||
$zs->getZeitsperrenForZeitaufzeichnung('raab',$angezeigte_tage);
|
||||
$zeitsperren = $zs->result;
|
||||
|
||||
echo '<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
@@ -660,9 +666,9 @@ if($projekt->getProjekteMitarbeiter($user))
|
||||
else
|
||||
{
|
||||
if ($alle==true)
|
||||
$za->getListeUser($user, '');
|
||||
$za->getListeUserFull($user, '');
|
||||
else
|
||||
$za->getListeUser($user, $angezeigte_tage);
|
||||
$za->getListeUserFull($user, $angezeigte_tage);
|
||||
}
|
||||
|
||||
$summe=0;
|
||||
@@ -672,24 +678,24 @@ if($projekt->getProjekteMitarbeiter($user))
|
||||
//Uebersichtstabelle
|
||||
$woche=date('W');
|
||||
echo '
|
||||
<table id="t1" class="tablesorter">
|
||||
<table id="t1" class="" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="background-color: #8DBDD8;" align="center" class="{sorter: false}" colspan="13">'.$p->t("eventkalender/kw").' '.$woche.'</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>'.$p->t("zeitaufzeichnung/id").'</th>
|
||||
<th>'.$p->t("zeitaufzeichnung/user").'</th>
|
||||
<th>'.$p->t("zeitaufzeichnung/projekt").'</th>
|
||||
<th>'.$p->t("zeitaufzeichnung/oe").' 1</th>
|
||||
<th>'.$p->t("zeitaufzeichnung/oe").' 2</th>
|
||||
<th>'.$p->t("zeitaufzeichnung/aktivitaet").'</th>
|
||||
<th>'.$p->t("zeitaufzeichnung/service").'</th>
|
||||
<th>'.$p->t("zeitaufzeichnung/start").'</th>
|
||||
<th>'.$p->t("zeitaufzeichnung/ende").'</th>
|
||||
<th>'.$p->t("zeitaufzeichnung/dauer").'</th>
|
||||
<th>'.$p->t("global/beschreibung").'</th>
|
||||
<th colspan="2">'.$p->t("global/aktion").'</th>
|
||||
<th style="background-color:#DCE4EF" align="center">'.$p->t("zeitaufzeichnung/id").'</th>
|
||||
<th style="background-color:#DCE4EF" align="center">'.$p->t("zeitaufzeichnung/user").'</th>
|
||||
<th style="background-color:#DCE4EF" align="center">'.$p->t("zeitaufzeichnung/projekt").'</th>
|
||||
<th style="background-color:#DCE4EF" align="center">'.$p->t("zeitaufzeichnung/oe").' 1</th>
|
||||
<th style="background-color:#DCE4EF" align="center">'.$p->t("zeitaufzeichnung/oe").' 2</th>
|
||||
<th style="background-color:#DCE4EF" align="center">'.$p->t("zeitaufzeichnung/aktivitaet").'</th>
|
||||
<th style="background-color:#DCE4EF" align="center">'.$p->t("zeitaufzeichnung/service").'</th>
|
||||
<th style="background-color:#DCE4EF" align="center">'.$p->t("zeitaufzeichnung/start").'</th>
|
||||
<th style="background-color:#DCE4EF" align="center">'.$p->t("zeitaufzeichnung/ende").'</th>
|
||||
<th style="background-color:#DCE4EF" align="center">'.$p->t("zeitaufzeichnung/dauer").'</th>
|
||||
<th style="background-color:#DCE4EF" align="center">'.$p->t("global/beschreibung").'</th>
|
||||
<th style="background-color:#DCE4EF" align="center" colspan="2">'.$p->t("global/aktion").'</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>';
|
||||
@@ -704,52 +710,79 @@ if($projekt->getProjekteMitarbeiter($user))
|
||||
$tagesende = '';
|
||||
$wochensaldo = '00:00';
|
||||
$pflichtpause = false;
|
||||
|
||||
|
||||
foreach($za->result as $row)
|
||||
{
|
||||
$datumtag = $datum_obj->formatDatum($row->start, 'Y-m-d');
|
||||
$datumtag = $datum_obj->formatDatum($row->datum, 'Y-m-d');
|
||||
|
||||
//echo '<tr><th colspan="13">foo<th></tr>';
|
||||
|
||||
// Nach jedem Tag eine Summenzeile einfuegen
|
||||
if(is_null($tag))
|
||||
$tag = $datumtag;
|
||||
if($tag!=$datumtag)
|
||||
{
|
||||
$style = '';
|
||||
$style = 'style="background-color:#DCE4EF; font-size: 8pt;"';
|
||||
list($h1, $m1) = explode(':', $pausesumme);
|
||||
$pausesumme = $h1*3600+$m1*60;
|
||||
$tagessaldo = $datum->mktime_fromtimestamp($datum->formatDatum($tagesende, $format='Y-m-d H:i:s'))-$datum->mktime_fromtimestamp($datum->formatDatum($tagesbeginn, $format='Y-m-d H:i:s'))-3600;
|
||||
if ($tagessaldo>18000 && $pflichtpause==false)
|
||||
{
|
||||
$pausesumme = $pausesumme+1800;
|
||||
}
|
||||
|
||||
$tagessaldo = $tagessaldo-$pausesumme;
|
||||
$tagessaldo = date('H:i', ($tagessaldo));
|
||||
echo '<tr>
|
||||
<td '.$style.' colspan="7">';
|
||||
|
||||
// Zusaetzlicher span fuer Addon Informationen
|
||||
echo '<span id="tag_'.$datum->formatDatum($tagesbeginn,'d_m_Y').'"></span>';
|
||||
|
||||
echo '</td>
|
||||
<td align="right" colspan="2" '.$style.'>
|
||||
<b>'.$p->t("zeitaufzeichnung/arbeitszeit").': '.$datum->formatDatum($tagesbeginn, $format='H:i').'-'.$datum->formatDatum($tagesende, $format='H:i').' '.$p->t("eventkalender/uhr").'</b><br>
|
||||
'.$p->t("zeitaufzeichnung/pause").' '.($pflichtpause==false?$p->t("zeitaufzeichnung/inklusivePflichtpause"):'').':
|
||||
</td>
|
||||
<td '.$style.' align="right"><b>'.$tagessaldo.'</b><br>'.date('H:i', ($pausesumme-3600)).'</td>
|
||||
<td '.$style.' colspan="3"></td>';
|
||||
|
||||
$tag=$datumtag;
|
||||
$tagessumme='00:00';
|
||||
$pausesumme='00:00';
|
||||
$tagesbeginn = '';
|
||||
$tagesende = '';
|
||||
$pflichtpause = false;
|
||||
$wochensaldo = $datum_obj->sumZeit($wochensaldo,$tagessaldo );
|
||||
//if ($row->uid)
|
||||
//{
|
||||
if ($datum->formatDatum($tag,'N') == '6' || $datum->formatDatum($tag,'N') == '7')
|
||||
$style = 'style="background-color:#eeeeee; font-size: 8pt;"';
|
||||
else
|
||||
$style = 'style="background-color:#DCE4EF; font-size: 8pt;"';
|
||||
|
||||
// zeitsperren anzeigen
|
||||
if (array_key_exists($datum->formatDatum($tag,'Y-m-d'), $zeitsperren))
|
||||
{
|
||||
$zeitsperre_text = " -- ".$zeitsperren[$datum->formatDatum($tag,'Y-m-d')]." -- ";
|
||||
$style = 'style="background-color:#cccccc; font-size: 8pt;"';
|
||||
}
|
||||
else
|
||||
$zeitsperre_text = '';
|
||||
//var_dump($zs->result);
|
||||
|
||||
list($h1, $m1) = explode(':', $pausesumme);
|
||||
$pausesumme = $h1*3600+$m1*60;
|
||||
$tagessaldo = $datum->mktime_fromtimestamp($datum->formatDatum($tagesende, $format='Y-m-d H:i:s'))-$datum->mktime_fromtimestamp($datum->formatDatum($tagesbeginn, $format='Y-m-d H:i:s'))-3600;
|
||||
if ($tagessaldo>18000 && $pflichtpause==false)
|
||||
{
|
||||
$pausesumme = $pausesumme+1800;
|
||||
}
|
||||
|
||||
$tagessaldo = $tagessaldo-$pausesumme;
|
||||
$tagessaldo = date('H:i', ($tagessaldo));
|
||||
echo '<tr id="tag_row_'.$datum->formatDatum($tag,'d_m_Y').'"><td '.$style.' colspan="7">';
|
||||
|
||||
// Zusaetzlicher span fuer Addon Informationen
|
||||
|
||||
$lang = getSprache();
|
||||
if ($lang == 'German')
|
||||
$langindex = 1;
|
||||
else
|
||||
$langindex = 2;
|
||||
echo '<b>'.$tagbez[$langindex][$datum->formatDatum($tag,'N')].' '.$datum->formatDatum($tag,'d.m.Y').'</b> <span id="tag_'.$datum->formatDatum($tag,'d_m_Y').'">'.$zeitsperre_text.'</span>';
|
||||
|
||||
echo '</td>
|
||||
<td align="right" colspan="2" '.$style.'>
|
||||
<b>'.$p->t("zeitaufzeichnung/arbeitszeit").': '.$datum->formatDatum($tagesbeginn, $format='H:i').'-'.$datum->formatDatum($tagesende, $format='H:i').' '.$p->t("eventkalender/uhr").'</b><br>
|
||||
'.$p->t("zeitaufzeichnung/pause").' '.($pflichtpause==false?$p->t("zeitaufzeichnung/inklusivePflichtpause"):'').':
|
||||
</td>
|
||||
<td '.$style.' align="right"><b>'.$tagessaldo.'</b><br>'.date('H:i', ($pausesumme-3600)).'</td>
|
||||
<td '.$style.' colspan="3"></td>';
|
||||
|
||||
$tag=$datumtag;
|
||||
$tagessumme='00:00';
|
||||
$pausesumme='00:00';
|
||||
$tagesbeginn = '';
|
||||
$tagesende = '';
|
||||
$pflichtpause = false;
|
||||
$wochensaldo = $datum_obj->sumZeit($wochensaldo,$tagessaldo );
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// echo '<tr><td style="background-color:#DCE4EF; font-size: 8pt;" colspan="13"><b>'.$datum->formatDatum($row->datum,'D d.m.Y').'</b></b> <span id="tag_'.$datum->formatDatum($row->datum,'d_m_Y').'"></span></td></tr>';
|
||||
//}
|
||||
}
|
||||
// Nach jeder Woche eine Summenzeile einfuegen und eine neue Tabelle beginnen
|
||||
$datumwoche = $datum_obj->formatDatum($row->start, 'W');
|
||||
$datumwoche = $datum_obj->formatDatum($row->datum, 'W');
|
||||
if(is_null($woche))
|
||||
$woche = $datumwoche;
|
||||
if($woche!=$datumwoche)
|
||||
@@ -758,33 +791,35 @@ if($projekt->getProjekteMitarbeiter($user))
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th colspan="7"></th>
|
||||
<th align="right" colspan="2" style="font-weight: normal;"><b>'.$p->t("zeitaufzeichnung/wochensummeArbeitszeit").':</b></th>
|
||||
<th align="right" style="font-weight: normal;"><b>'.$wochensaldo.'</b></th>
|
||||
<th colspan="3"></th>
|
||||
<th colspan="7" style="background-color: #8DBDD8;"></th>
|
||||
<th style="background-color: #8DBDD8;" align="right" colspan="2" style="font-weight: normal;"><b>'.$p->t("zeitaufzeichnung/wochensummeArbeitszeit").':</b></th>
|
||||
<th style="background-color: #8DBDD8;" align="right" style="font-weight: normal;"><b>'.$wochensaldo.'</b></th>
|
||||
<th style="background-color: #8DBDD8;" colspan="3"></th>
|
||||
</tr>
|
||||
|
||||
</tfoot>
|
||||
</table>';
|
||||
<!--</table>-->';
|
||||
|
||||
echo '
|
||||
<table id="t'.$datumwoche.'" class="tablesorter">
|
||||
<!--<table id="t'.$datumwoche.'" class="tablesorter">-->
|
||||
<tr><th colspan="13"> </th></tr>
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="background-color: #8DBDD8;" align="center" class="{sorter: false}" colspan="13">'.$p->t("eventkalender/kw").' '.$datumwoche.'</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>'.$p->t("zeitaufzeichnung/id").'</th>
|
||||
<th>'.$p->t("zeitaufzeichnung/user").'</th>
|
||||
<th>'.$p->t("zeitaufzeichnung/projekt").'</th>
|
||||
<th>'.$p->t("zeitaufzeichnung/oe").' 1</th>
|
||||
<th>'.$p->t("zeitaufzeichnung/oe").' 2</th>
|
||||
<th>'.$p->t("zeitaufzeichnung/aktivitaet").'</th>
|
||||
<th>'.$p->t("zeitaufzeichnung/service").'</th>
|
||||
<th>'.$p->t("zeitaufzeichnung/start").'</th>
|
||||
<th>'.$p->t("zeitaufzeichnung/ende").'</th>
|
||||
<th>'.$p->t("zeitaufzeichnung/dauer").'</th>
|
||||
<th>'.$p->t("global/beschreibung").'</th>
|
||||
<th colspan="2">'.$p->t("global/aktion").'</th>
|
||||
<th style="background-color:#DCE4EF" align="center">'.$p->t("zeitaufzeichnung/id").'</th>
|
||||
<th style="background-color:#DCE4EF" align="center">'.$p->t("zeitaufzeichnung/user").'</th>
|
||||
<th style="background-color:#DCE4EF" align="center">'.$p->t("zeitaufzeichnung/projekt").'</th>
|
||||
<th style="background-color:#DCE4EF" align="center">'.$p->t("zeitaufzeichnung/oe").' 1</th>
|
||||
<th style="background-color:#DCE4EF" align="center">'.$p->t("zeitaufzeichnung/oe").' 2</th>
|
||||
<th style="background-color:#DCE4EF" align="center">'.$p->t("zeitaufzeichnung/aktivitaet").'</th>
|
||||
<th style="background-color:#DCE4EF" align="center">'.$p->t("zeitaufzeichnung/service").'</th>
|
||||
<th style="background-color:#DCE4EF" align="center">'.$p->t("zeitaufzeichnung/start").'</th>
|
||||
<th style="background-color:#DCE4EF" align="center">'.$p->t("zeitaufzeichnung/ende").'</th>
|
||||
<th style="background-color:#DCE4EF" align="center">'.$p->t("zeitaufzeichnung/dauer").'</th>
|
||||
<th style="background-color:#DCE4EF" align="center">'.$p->t("global/beschreibung").'</th>
|
||||
<th style="background-color:#DCE4EF" align="center" colspan="2">'.$p->t("global/aktion").'</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>';
|
||||
@@ -796,7 +831,8 @@ if($projekt->getProjekteMitarbeiter($user))
|
||||
$pausesumme='00:00';
|
||||
$wochensaldo = '00:00';
|
||||
}
|
||||
|
||||
if ($row->uid)
|
||||
{
|
||||
$wochensumme = $datum_obj->sumZeit($wochensumme, $row->diff);
|
||||
if ($row->aktivitaet_kurzbz=='Pause')
|
||||
{
|
||||
@@ -825,8 +861,8 @@ if($projekt->getProjekteMitarbeiter($user))
|
||||
<td '.$style.'>'.$db->convert_html_chars($row->oe_kurzbz_2).'</td>
|
||||
<td '.$style.'>'.$db->convert_html_chars($row->aktivitaet_kurzbz).'</td>
|
||||
<td '.$style.' title="'.$service->bezeichnung.'">'.StringCut($db->convert_html_chars($service->bezeichnung),20,null,'...').'</td>
|
||||
<td '.$style.' nowrap>'.date('d.m.Y H:i', $datum->mktime_fromtimestamp($row->start)).'</td>
|
||||
<td '.$style.' nowrap>'.date('d.m.Y H:i', $datum->mktime_fromtimestamp($row->ende)).'</td>
|
||||
<td '.$style.' nowrap>'.date('H:i', $datum->mktime_fromtimestamp($row->start)).'</td>
|
||||
<td '.$style.' nowrap>'.date('H:i', $datum->mktime_fromtimestamp($row->ende)).'</td>
|
||||
<td '.$style.' align="right">'.$db->convert_html_chars($row->diff).'</td>
|
||||
<td '.$style.' title="'.$db->convert_html_chars(mb_eregi_replace("\r\n",' ',$row->beschreibung)).'">'.StringCut($db->convert_html_chars($row->beschreibung),20,null,'...').'</td>
|
||||
<td '.$style.'>';
|
||||
@@ -844,18 +880,22 @@ if($projekt->getProjekteMitarbeiter($user))
|
||||
|
||||
if ($tagesende=='' || $datum->mktime_fromtimestamp($datum->formatDatum($tagesende, $format='Y-m-d H:i:s')) < $datum->mktime_fromtimestamp($datum->formatDatum($row->ende, $format='Y-m-d H:i:s')))
|
||||
$tagesende = $row->ende;
|
||||
}
|
||||
}
|
||||
echo '</tbody>';
|
||||
if ($alle===false)
|
||||
{
|
||||
echo '<tfoot>
|
||||
<tr>
|
||||
<th align="center" colspan="13">'.$p->t('zeitaufzeichnung/endeXTageAnsicht', array($angezeigte_tage)).'</th>
|
||||
</tr>
|
||||
</tfoot>';
|
||||
echo '</table>';
|
||||
}
|
||||
//echo '</table>';
|
||||
|
||||
//echo $p->t("zeitaufzeichnung/gesamtdauer").": ".$db->convert_html_chars($summe); Aukommentiert. Irrelevant
|
||||
}
|
||||
echo '</table>';
|
||||
/*
|
||||
}
|
||||
else
|
||||
@@ -869,6 +909,8 @@ else
|
||||
echo $p->t("zeitaufzeichnung/fehlerBeimErmittelnDerProjekte");
|
||||
}
|
||||
|
||||
|
||||
|
||||
echo '
|
||||
<span id="globalmessages"></span>
|
||||
</body>
|
||||
|
||||
Regular → Executable
+68
-3
@@ -309,9 +309,9 @@ class zeitaufzeichnung extends basis_db
|
||||
{
|
||||
$where = "uid=".$this->db_add_param($user);
|
||||
if ($days!='')
|
||||
$where.= " AND ende>(now() - INTERVAL '".$days." days')";
|
||||
$where.= " AND ende>(now() - INTERVAL '".$days." days')";
|
||||
|
||||
$qry = "SELECT
|
||||
$qry = "SELECT
|
||||
*, to_char ((ende-start),'HH24:MI') as diff,
|
||||
(SELECT (to_char(sum(ende-start),'DD')::integer)*24+to_char(sum(ende-start),'HH24')::integer || ':' || to_char(sum(ende-start),'MI')
|
||||
FROM campus.tbl_zeitaufzeichnung
|
||||
@@ -342,7 +342,72 @@ class zeitaufzeichnung extends basis_db
|
||||
$obj->service_id = $row->service_id;
|
||||
$obj->kunde_uid = $row->kunde_uid;
|
||||
$obj->summe = $row->summe;
|
||||
$obj->diff = $row->diff;
|
||||
$obj->diff = $row->diff;
|
||||
$obj->datum = $row->start;
|
||||
|
||||
$this->result[] = $obj;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt die Zeitaufzeichnungen eines Users aufgefüllt mit lehren Tagen.
|
||||
* Default: Die letzten 40 Tage
|
||||
* @param string $user
|
||||
* @param integer $days deafult: 40 Tage
|
||||
*/
|
||||
public function getListeUserFull($user, $days='40')
|
||||
{
|
||||
$where = "uid=".$this->db_add_param($user);
|
||||
if ($days!='')
|
||||
$where.= " AND ende>(now() - INTERVAL '".$days." days')";
|
||||
$where_join = "and z.uid=".$this->db_add_param($user);
|
||||
if ($days!='')
|
||||
$where_join.= " AND z.ende>(now() - INTERVAL '".$days." days')";
|
||||
if ($days=='')
|
||||
$max_anz = 180;
|
||||
else
|
||||
$max_anz = $days;
|
||||
$qry = "SELECT
|
||||
d.dates, z.*, to_char ((z.ende-z.start),'HH24:MI') as diff,
|
||||
(SELECT (to_char(sum(ende-start),'DD')::integer)*24+to_char(sum(ende-start),'HH24')::integer || ':' || to_char(sum(ende-start),'MI')
|
||||
FROM campus.tbl_zeitaufzeichnung
|
||||
WHERE $where ) as summe
|
||||
FROM campus.tbl_zeitaufzeichnung z
|
||||
right join (select current_date - s.a as dates from generate_series(0,$max_anz,1) as s(a)) d on date(z.ende) = d.dates $where_join order by d.dates desc
|
||||
";
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object($result))
|
||||
{
|
||||
$obj = new zeitaufzeichnung();
|
||||
|
||||
$obj->zeitaufzeichnung_id = $row->zeitaufzeichnung_id;
|
||||
$obj->uid = $row->uid;
|
||||
$obj->aktivitaet_kurzbz = $row->aktivitaet_kurzbz;
|
||||
$obj->start = $row->start;
|
||||
$obj->ende = $row->ende;
|
||||
$obj->beschreibung = $row->beschreibung;
|
||||
$obj->oe_kurzbz_1 = $row->oe_kurzbz_1;
|
||||
$obj->oe_kurzbz_2 = $row->oe_kurzbz_2;
|
||||
$obj->insertamum = $row->insertamum;
|
||||
$obj->insertvon = $row->insertvon;
|
||||
$obj->updateamum = $row->updateamum;
|
||||
$obj->updatevon = $row->updatevon;
|
||||
$obj->projekt_kurzbz = $row->projekt_kurzbz;
|
||||
$obj->ext_id = $row->ext_id;
|
||||
$obj->service_id = $row->service_id;
|
||||
$obj->kunde_uid = $row->kunde_uid;
|
||||
$obj->summe = $row->summe;
|
||||
$obj->diff = $row->diff;
|
||||
$obj->datum = $row->dates;
|
||||
|
||||
$this->result[] = $obj;
|
||||
}
|
||||
|
||||
Regular → Executable
+44
@@ -467,5 +467,49 @@ class zeitsperre extends basis_db
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Liefert die Zeitsperren eines Users für die Zeitaufzeichnung
|
||||
*
|
||||
* @param $uid
|
||||
* @param $anz_tage
|
||||
* @return array 'datum'->'zeitsperre_kurzbz'
|
||||
*/
|
||||
public function getZeitsperrenForZeitaufzeichnung($uid, $anz_tage=50)
|
||||
{
|
||||
unset($this->result);
|
||||
$this->result=array();
|
||||
|
||||
$qry = "select datum::date, freigabevon, zeitsperretyp_kurzbz
|
||||
from (SELECT generate_series(vondatum::timestamp, bisdatum::timestamp, '1 day') as datum, freigabevon, mitarbeiter_uid, zeitsperretyp_kurzbz FROM campus.tbl_zeitsperre ) a
|
||||
where a.mitarbeiter_uid = ".$this->db_add_param($uid)." and datum>(now() - interval '50 Days') and zeitsperretyp_kurzbz in ('Krank','Urlaub')";
|
||||
|
||||
|
||||
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
|
||||
while($row = $this->db_fetch_object())
|
||||
{
|
||||
|
||||
if ($row->zeitsperretyp_kurzbz == 'Urlaub' && $row->freigabevon == NULL)
|
||||
$result[$row->datum] = "Urlaubsantrag (Freigabe fehlt)";
|
||||
else
|
||||
$result[$row->datum] = $row->zeitsperretyp_kurzbz;
|
||||
|
||||
$this->result = $result;
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Zeitsperren';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user