Blame | Last modification | View Log | RSS feed
<?php
require_once('version.inc');
require_once('dbaccess.inc');
require_once('language.inc');
require_once('header.inc');
require_once('crypt.inc');
require_once('settings.inc');
require_once('helper.inc');
$drm = array(true, false, false, false, true, true, true, true);
$headline = 33;
require_once('menu.inc');
function ShowEJournal() {
global $rstufe;
global $menu;
global $headline;
if ($rstufe != 0 && $rstufe != 1) {
Error("Berechtigungsfehler!");
return;
}
$nav = "mitarbeiter='+document.journal.mitarbeiter.value+'&aktion='+document.journal.aktion.value+'&von='+document.journal.von.value+'&bis='+document.journal.bis.value+'&menu=$menu&headline=$headline";
$mitarbeiter = $_REQUEST['mitarbeiter'];
$aktion = $_REQUEST['aktion'];
$von = $_REQUEST['von'];
$bis = $_REQUEST['bis'];
if (!isset($von) || !isset($bis)) {
$zeite = time();
$zeits = $zeite - 30 * 86400;
$day = gmdate("j", $zeits);
$mon = gmdate("n", $zeits);
$year = gmdate("Y", $zeits);
$dvon = gmmktime(0, 0, 0, $mon, $day, $year);
$von = "$day.$mon.$year";
$day = gmdate("j", $zeite);
$mon = gmdate("n", $zeite);
$year = gmdate("Y", $zeite);
$dbis = gmmktime(23, 59, 59, $mon, $day, $year);
$bis = "$day.$mon.$year";
} else {
$ds = explode(".", $von);
$de = explode(".", $bis);
$dvon = gmmktime(0, 0, 0, $ds[1], $ds[0], $ds[2]);
$dbis = gmmktime(23, 59, 59, $de[1], $de[0], $de[2]);
}
$db = OpenDB();
?>
<form name="journal" action="ejournal.php" method="post">
<input type="hidden" name="menu" value="<? echo "$menu"; ?>">
<input type="hidden" name="headline" value="<? echo "$headline"; ?>">
<table class="input">
<tr>
<td>Mitarbeiter:</td>
<td><select name="mitarbeiter" onChange="javascript:MoveTo('ejournal.php','<? echo "$nav"; ?>')">
<option value="0">Alle</option>
<?
$query = "select distinct ej_uid, mi_nname, mi_vname from ejournal, mitarbeiter where ";
$query .= "mi_num = ej_uid order by mi_nname, mi_vname";
if (!($result = QueryDB($db, $query))) {
closeDB($db);
return;
}
$anz = numrowsDB($result);
$i = 0;
$flag = false;
while ($i < $anz) {
$data = fetchDB($result, $i);
$ej_uid = $data[0];
$mi_nname = $data[1];
$mi_vname = $data[2];
if (isset($mitarbeiter) && $mitarbeiter == $ej_uid) {
echo " <option value=\"$ej_uid\" selected>$mi_nname $mi_vname</option>\n";
$flag = true;
} else
echo " <option value=\"$ej_uid\">$mi_nname $mi_vname</option>\n";
$i++;
}
if (!$flag)
$mitarbeiter = 0;
?>
</select>
</td>
</tr>
<tr>
<td>Aktion:</td>
<td><select name="aktion" onChange="javascript:MoveTo('ejournal.php','<? echo "$nav"; ?>')">
<option value="0">Alle</option>
<?
$query = "select distinct kj_num, kj_text from ejournal, key_jtype where ";
$query .= "kj_num = ej_type and ej_date between $dvon and $dbis ";
if (isset($mitarbeiter) && $mitarbeiter > 0)
$query .= "and ej_uid = $mitarbeiter ";
$query .= "order by kj_num";
if (!($result = QueryDB($db, $query))) {
closeDB($db);
return;
}
$anz = numrowsDB($result);
$i = 0;
$flag = false;
while ($i < $anz) {
$data = fetchDB($result, $i);
$kj_num = $data[0];
$kj_text = $data[1];
if (isset($aktion) && $aktion == $kj_num) {
echo " <option value=\"$kj_num\" selected>$kj_text</option>\n";
$flag = true;
} else
echo " <option value=\"$kj_num\">$kj_text</option>\n";
$i++;
}
if (!$flag)
$aktion = 0;
?>
</select>
</td>
</tr>
<tr>
<td>Zeitraum von:</td>
<td><input type="text" name="von" value="<? echo "$von"; ?>" onChange="javascript:CheckDate(this, false)" size=10 maxlength=10></td>
</tr>
<tr>
<td>Zeitraum bis:</td>
<td><input type="text" name="bis" value="<? echo "$bis"; ?>" onChange="javascript:CheckDate(this, false)" size=10 maxlength=10></td>
</tr>
<tr>
<td colspan=2>
<?
Button("Zeitraum setzen", "journal");
?>
</td>
</tr>
</table>
</form>
<?
$query = "select ej_num, ej_date, ej_text, kj_text, mi_nname, mi_vname from ";
$query .= "ejournal, key_jtype, mitarbeiter where kj_num = ej_type and ";
$query .= "mi_num = ej_uid and ej_date between $dvon and $dbis ";
if (isset($mitarbeiter) && $mitarbeiter > 0)
$query .= "and ej_uid = $mitarbeiter ";
if (isset($aktion) && $aktion > 0)
$query .= "and ej_type = $aktion ";
$query .= "order by ej_date desc, mi_nname, mi_vname";
if (!($result = QueryDB($db, $query))) {
closeDB($db);
return;
}
$anz = numrowsDB($result);
if ($anz <= 0)
return;
$i = 0;
?>
<br>
<table class="sel">
<tr>
<th class="sel">Datum</th>
<th class="sel">Ausgeführt von</th>
<th class="sel">Aktion</th>
<th class="sel">Anmerkung</th>
</tr>
<?
while ($i < $anz) {
$data = fetchDB($result, $i);
$ej_num = $data[0];
$ej_date = $data[1];
$ej_text = $data[2];
$kj_text = $data[3];
$mi_nname = $data[4];
$mi_vname = $data[5];
echo "<tr><td class=\"sel\">" . date("d.m.Y H:i:s", $ej_date) . "</td>\n";
echo "<td class=\"sel\">$mi_nname $mi_vname</td>\n";
echo "<td class=\"sel\">$kj_text</td>\n";
echo "<td class=\"sel\">$ej_text</td></tr>\n";
$i++;
}
echo "</table>\n";
closeDB($db);
}
ShowEJournal();
require_once('footer.inc');
?>