|
1 <?php |
|
2 |
|
3 /** |
|
4 * @author Bettina Schwarzer, Fritz-Haber-Institut |
|
5 * @copyright 10/2013 |
|
6 * |
|
7 * Report Laser |
|
8 * |
|
9 */ |
|
10 error_reporting(E_ALL ^ E_NOTICE); |
|
11 |
|
12 if (!isset($_GET['s']) || $_GET['s'] != 2 ) |
|
13 { |
|
14 session_start(); |
|
15 if (! isset($_SESSION["userid"])) |
|
16 { |
|
17 include_once ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php"); |
|
18 login($_SERVER["PHP_SELF"]); |
|
19 exit; |
|
20 } |
|
21 |
|
22 if (is_null($_SESSION["recht"]) || (!is_null($_SESSION["recht"]) && !in_array("lr",$_SESSION["recht"]) && !in_array("le",$_SESSION["recht"]))) |
|
23 { |
|
24 header("Location: start.php"); |
|
25 exit; |
|
26 } |
|
27 } |
|
28 include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php"); |
|
29 if (!isset($dbc) || !$dbc) $dbc = new dbconnection(); |
|
30 |
|
31 ?> |
|
32 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
33 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
|
34 |
|
35 <head> |
|
36 <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> |
|
37 <link href="/fhiiqm/css/db.css" rel="STYLESHEET" type="TEXT/CSS" media="screen"/> |
|
38 <link href="/fhiiqm/css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print"/> |
|
39 <title>Report Laser</title> |
|
40 </head> |
|
41 |
|
42 <body> |
|
43 |
|
44 <?php |
|
45 echo " "; |
|
46 if (!isset($_GET['s']) || $_GET['s'] != 2 ) |
|
47 { |
|
48 echo "<div class=\"float-br smaller\" valign='top'>"; |
|
49 echo " user: " . $_SESSION["userid"]; |
|
50 echo " <a class='sc' href='/fhiiqm/logout.php' title='Session beenden'>logout</a></div>\n"; |
|
51 } |
|
52 echo "<div class=\"float-r\"><img src=\"/fhiiqm/img/laser.png\" border=\"0\" alt=\"Laser\" title=\"Laser\"/></div>\n"; |
|
53 |
|
54 $las = $_POST["las"]; // Parameter aus Form |
|
55 $search = $_POST["search"]; |
|
56 if (!$search) $search = $_GET["s"]; |
|
57 |
|
58 $zeil = $las["z"]; |
|
59 if (!$zeil) $zeil = $_GET["z"]; |
|
60 if (!$zeil) $zeil = 9999; // Anzahl der gezeigten Zeilen |
|
61 $start = $_GET["st"]; // Start bei DS $start+1 |
|
62 if (!$start) $start=0; |
|
63 |
|
64 if (!is_array($las)) |
|
65 { |
|
66 $las["geb"] = $_GET["g"]; |
|
67 $las["rnum"] = $_GET["r"]; |
|
68 $las["abt"] = $_GET["a"]; |
|
69 $las["kl"] = $_GET["k"]; |
|
70 $las["bind"] = $_GET["b"]; |
|
71 $las["sort1"] = $_GET["s1"]; |
|
72 $las["sort2"] = $_GET["s2"]; |
|
73 } |
|
74 $_GET["z"] = $zeil; |
|
75 $_GET["g"] = $las["geb"]; |
|
76 $_GET["r"] = $las["rnum"]; |
|
77 $_GET["a"] = $las["abt"]; |
|
78 $_GET["k"] = $las["kl"]; |
|
79 $_GET["b"] = $las["bind"]; |
|
80 $_GET["s1"] = $las["sort1"]; |
|
81 $_GET["s2"] = $las["sort2"]; |
|
82 // print_r($las); echo "<br /><br />"; |
|
83 if ($search && $_GET['s'] != 2) |
|
84 { |
|
85 echo "<span class='sc'>"; |
|
86 echo "<br /> <a href=\"/fhiiqm/laser_report.php\" target=\"_self\" title=\"Berichte\" class='sc'>« zur Berichtsübersicht</a>"; |
|
87 echo " | <a href=\"" . $_SERVER["PHP_SELF"] . "\" target=\"_self\" title=\"Laser\" class=\"sc\">neuer Bericht Laser</a>\n"; |
|
88 echo "</span>"; |
|
89 } |
|
90 echo "<div align='center'>\n"; |
|
91 echo "<p><b>Bericht Laser</b></p>\n"; |
|
92 echo "</div>\n"; |
|
93 |
|
94 if (!$search) |
|
95 { |
|
96 include ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/form/laser_search_form.inc.php"); |
|
97 } |
|
98 else |
|
99 { |
|
100 echo "<div align='center'>\n"; |
|
101 |
|
102 include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php"); |
|
103 include ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php"); |
|
104 |
|
105 if (!isset($dbc) || !$dbc) $dbc = new dbconnection(); |
|
106 $sql = "SELECT las_bez,las_art_bez,las_klasse_ID,abt_name,geb_ID,l.raum_ID,raum_nr,CONCAT(nachname,', ',IFNULL(vorname,'')) AS vma |
|
107 FROM Laser l |
|
108 LEFT OUTER JOIN Laser_Art la ON l.las_art_ID=la.las_art_ID |
|
109 LEFT OUTER JOIN Mitarbeiter m ON l.persknr=m.persknr |
|
110 LEFT OUTER JOIN Abteilung a ON m.abt_tel=a.abt_ID |
|
111 LEFT OUTER JOIN Raum r ON l.raum_ID=r.raum_ID"; |
|
112 $lim = " LIMIT $start,$zeil"; |
|
113 |
|
114 if (!$las["bind"]) $bind = " AND "; else $bind = $las["bind"]; |
|
115 |
|
116 if ($las["geb"]> -1) |
|
117 { |
|
118 $where = " geb_ID = '$las[geb]' "; |
|
119 $krit = " [Gebäude = '" . $las["geb"] ."']"; |
|
120 } |
|
121 if ($las["rnum"]) |
|
122 { |
|
123 if ($where) $where .= "$bind raum_ID = '$las[rnum]' "; else $where = " raum_ID = '$las[rnum]'' "; |
|
124 if ($krit) $bd = " ".$bind; else $bd = ""; |
|
125 $rnr = $dbc -> querySingleItem("SELECT raum_nr FROM Raum WHERE raum_ID = ". $las["rnum"]); |
|
126 $krit .= $bd. " [Raum-Nr. = '$rnr']"; |
|
127 } |
|
128 if ($las["abt"]> -1) |
|
129 { |
|
130 if ($where) $where .= "$bind abt_name = '$las[abt]' "; else $where = " abt_name = '$las[abt]' "; |
|
131 if ($krit) $bd = " ".$bind; else $bd = ""; |
|
132 $krit .= $bd . " [Abteilung = '" . $las["abt"] ."']"; |
|
133 } |
|
134 if ($las["kl"]> -1) |
|
135 { |
|
136 if ($where) $where .= "$bind las_klasse_ID = '$las[kl]' "; else $where = " las_klasse_ID = '$las[kl]' "; |
|
137 if ($krit) $bd = " ".$bind; else $bd = ""; |
|
138 $krit .= $bd . " [Laserklasse = '" . $las["kl"] ."']"; |
|
139 } |
|
140 if ($where) $where = " WHERE $where"; |
|
141 |
|
142 if ($las["sort1"]>0 || $las["sort2"]>0) |
|
143 { |
|
144 if ($las["sort1"]>0) $ord = " ORDER BY ".$las["sort1"]; |
|
145 if ($las["sort2"]>0) $ord .= ",".$las["sort2"]; |
|
146 } |
|
147 $sql .= $where; |
|
148 if ($ord) $ord .= ",1"; else $ord = " ORDER BY 1 "; |
|
149 $sqlg = $sql. $ord . $lim; |
|
150 // echo "sql = $sqlg<br />\n"; |
|
151 $result = $dbc ->queryObjectArray($sqlg); |
|
152 |
|
153 if ($krit )echo "Ergebnis der Suche nach $krit"; |
|
154 |
|
155 if ($result) |
|
156 { |
|
157 $bg1 = "#F8F8F8"; |
|
158 $bg2 = "#DEDFE1"; |
|
159 $bg = "#FFFFFF"; |
|
160 |
|
161 $ianz = $dbc -> numrows($sql); |
|
162 |
|
163 //$ianz = $dbc -> numrows($sql); //liefert nur $zeil! |
|
164 printf ("<p>Anzahl gefundener Datensätze: %s</p>", $ianz); |
|
165 |
|
166 echo "<table width='99%' border='1' cellspacing='0' cellpadding='2'>\n"; |
|
167 $cols=7; |
|
168 // Listenkopf |
|
169 echo "<tr bgcolor='#68ACBF'>"; |
|
170 echo "<th>Laserbezeichnung</th>"; |
|
171 echo "<th>Art</th>"; |
|
172 if ($las["kl"] == -1 || $las["bind"] == 'OR') echo "<th>Klasse</th>"; |
|
173 echo "<th>Standort</th>"; |
|
174 if ($las["abt"] == -1 || $las["bind"] == 'OR') echo "<th>Abt.</th>"; |
|
175 echo "<th>Verantwortlicher</th>"; |
|
176 echo "</tr>"; |
|
177 |
|
178 foreach ($result as $row) |
|
179 { |
|
180 if ($bg == $bg1) $bg = $bg2; else $bg = $bg1; |
|
181 echo "<tr bgcolor='" . $bg . "'>"; |
|
182 echo "<td>$row->las_bez</td>"; |
|
183 echo "<td>$row->las_art_bez</td>"; |
|
184 if ($las["kl"] == -1 || $las["bind"] == 'OR') echo "<td class='center'>$row->las_klasse_ID</td>"; |
|
185 if ($row->raum_nr) echo "<td>$row->geb_ID, $row->raum_nr</td>"; else echo "<td> </td>"; |
|
186 if ($las["abt"] == -1 || $las["bind"] == 'OR') echo "<td>$row->abt_name</td>"; |
|
187 echo "<td>$row->vma</td></td>"; |
|
188 } |
|
189 echo "</table>\n"; |
|
190 |
|
191 |
|
192 echo "<p></p><table width=80%><tr><td class='right'><a href=\"javascript:window.print()\" class='sc'> |
|
193 <img src=\"/fhiiqm/img/printer.png\" alt=\"Bericht drucken\" border=\"0\" align=\"right\" title=\"Bericht drucken\"></a></td></tr></table>"; |
|
194 echo "</div>\n"; |
|
195 |
|
196 echo "<br /> "; |
|
197 if ($search != 2) // Aufruf aus fhiiqm |
|
198 { |
|
199 // Parameter aus $_GET fuer weitere Seiten |
|
200 $_GET["s"] = 1; // bewirkt weitere Suche |
|
201 foreach ($_GET as $key=>$val) |
|
202 { |
|
203 if ($key != "st") $liste .= "&" . $key ."=".$val; |
|
204 } |
|
205 // Links auf andere Seiten generieren |
|
206 liste_links($start,$zeil,$ianz,$liste); |
|
207 } |
|
208 } |
|
209 else |
|
210 { |
|
211 echo "<p class='red'> Leider gibt es kein Ergebnis für die von Ihnen gewählten Kriterien!</p>"; |
|
212 echo "</div>\n"; |
|
213 echo "<br /> "; |
|
214 } |
|
215 if ($search != 2) |
|
216 { |
|
217 echo "<span class='sc'>"; |
|
218 echo "<br /><br /> <a href=\"/fhiiqm/laser_report.php\" target=\"_self\" title=\"Berichte\" class='sc'>« zur Berichtsübersicht</a>"; |
|
219 echo " | <a href=\"" . $_SERVER["PHP_SELF"] . "\" target=\"_self\" title=\"RAG GMV\" class=\"sc\">neuer Bericht Laser</a>\n"; |
|
220 echo "</span>"; |
|
221 } |
|
222 else |
|
223 echo "<a href='javascript:history.back();' onMouseOver=\"{window.status='Zurück'; return true;}\">« Zurück</a>"; |
|
224 } |
|
225 |
|
226 ?> |
|
227 |
|
228 </body> |
|
229 </html> |