|
1 <?php |
|
2 |
|
3 /** |
|
4 * @author Bettina Schwarzer, Fritz-Haber-Institut |
|
5 * @copyright 03/2013 |
|
6 * |
|
7 * Report Projekte für HT-Website |
|
8 * z.Zt. nicht genutzt (26.03.2013) |
|
9 * |
|
10 */ |
|
11 |
|
12 error_reporting(E_ALL ^ E_NOTICE); |
|
13 |
|
14 if (!isset($_GET['s']) || $_GET['s'] != 2 ) |
|
15 { |
|
16 session_start(); |
|
17 if (! isset($_SESSION["userid"])) |
|
18 { |
|
19 include_once ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php"); |
|
20 login($_SERVER["PHP_SELF"]); |
|
21 exit; |
|
22 } |
|
23 |
|
24 if (is_null($_SESSION["recht"]) || (!is_null($_SESSION["recht"]) && !in_array("pzr",$_SESSION["recht"]) && !in_array("pze",$_SESSION["recht"]))) |
|
25 { |
|
26 header("Location: start.php"); |
|
27 exit; |
|
28 } |
|
29 } |
|
30 include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php"); |
|
31 if (!isset($dbc) || !$dbc) $dbc = new dbconnection(); |
|
32 |
|
33 ?> |
|
34 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
35 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
|
36 |
|
37 <head> |
|
38 <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> |
|
39 <link href="/fhiiqm/css/db.css" rel="STYLESHEET" type="TEXT/CSS" media="screen"/> |
|
40 <link href="/fhiiqm/css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print"/> |
|
41 <title>Report Projekte</title> |
|
42 </head> |
|
43 |
|
44 <body> |
|
45 |
|
46 <?php |
|
47 echo " "; |
|
48 if (!isset($_GET['s']) || $_GET['s'] != 2 ) |
|
49 { |
|
50 echo "<div class=\"float-br smaller\" valign='top'>"; |
|
51 echo " user: " . $_SESSION["userid"]; |
|
52 echo " <a class='sc' href='/fhiiqm/logout.php' title='Session beenden'>logout</a></div>\n"; |
|
53 } |
|
54 echo "<div class=\"float-r\"><img src=\"/fhiiqm/img/sheduled_task.png\" border=\"0\" alt=\"AG,Raum-Gefahr\" title=\"Projekt\"/></div>\n"; |
|
55 |
|
56 $pz = $_POST["pz"]; // Parameter aus Form |
|
57 $search = $_POST["search"]; |
|
58 if (!$search) $search = $_GET["s"]; |
|
59 |
|
60 $zeil = $pz["z"]; |
|
61 if (!$zeil) $zeil = $_GET["z"]; |
|
62 if (!$zeil) $zeil = 9999; // Anzahl der gezeigten Zeilen |
|
63 $start = $_GET["st"]; // Start bei DS $start+1 |
|
64 if (!$start) $start=0; |
|
65 $pak = $_GET["a"]; // 1 Projekt je Druckseite |
|
66 if (!$psep) $psep = $pz["ak"]; |
|
67 |
|
68 if (!is_array($pz)) |
|
69 { |
|
70 $pz["stat"] = $_GET["su"]; |
|
71 $pz["va"] = $_GET["v"]; |
|
72 $pz["bind"] = $_GET["b"]; |
|
73 $pz["sort1"] = $_GET["s1"]; |
|
74 $pz["sort2"] = $_GET["s2"]; |
|
75 $pz["sep"] = $_GET["sp"]; |
|
76 } |
|
77 $_GET["su"] = $pz["stat"]; |
|
78 $_GET["v"] = $pz["va"]; |
|
79 $_GET["b"] = $pz["bind"]; |
|
80 $_GET["sp"] = $pz["sep"]; |
|
81 $_GET["s1"] = $pz["sort1"]; |
|
82 $_GET["s2"] = $pz["sort2"]; |
|
83 $_GET["z"] = $zeil; |
|
84 |
|
85 if ($search && $_GET['s'] != 2) |
|
86 { |
|
87 echo "<span class='sc'>"; |
|
88 echo "<br /> <a href=\"/fhiiqm/pz_report.php\" target=\"_self\" title=\"Berichte\" class='sc'>« zur Berichtsübersicht</a>"; |
|
89 echo " | <a href=\"" . $_SERVER["PHP_SELF"] . "\" target=\"_self\" title=\"RAG GMV\" class=\"sc\">neuer Bericht Projekte</a>\n"; |
|
90 echo "</span>"; |
|
91 } |
|
92 echo "<div align='center'>\n"; |
|
93 echo "<p><b>Bericht Projekte</b></p>\n"; |
|
94 echo "</div>\n"; |
|
95 |
|
96 if (!$search) |
|
97 { |
|
98 ?> |
|
99 <div align="center"> |
|
100 <p>Bitte Kriterien für die Suche wählen</p> |
|
101 <form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" enctype="application/x-www-form-urlencoded" name="form_proj" target="_self"> |
|
102 <table width="50%" border="0" cellspacing="3" cellpadding="3"> |
|
103 <tr> |
|
104 <td>Status</td> |
|
105 <td> |
|
106 <select name="pz[stat]" size="1"> |
|
107 <?php |
|
108 if ($pz["stat"] == -1) $select = " selected = 'selected'"; else $select = ""; |
|
109 echo "<option $select value=\"-1\"></option>\n"; |
|
110 $sql = "SELECT proz_stat_ID, proz_stat_bez FROM Proz_Status ORDER BY 1"; |
|
111 if ($result = $dbc->queryObjectArray($sql)) |
|
112 { |
|
113 foreach ($result as $row) |
|
114 { |
|
115 $select = ($row->proz_stat_ID == $pz['stat'])? " selected = 'selected'" : ""; |
|
116 echo "<option$select value=\"$row->proz_stat_ID\">$row->proz_stat_bez</option>\n"; |
|
117 } |
|
118 } |
|
119 ?> |
|
120 </select> |
|
121 </td> |
|
122 </tr> |
|
123 <tr><td>Verantwortlicher</td><td><input type="text" name="pz[va]" value="<?php echo $pz['va']; ?>" /></td></tr> |
|
124 <tr><td>nur aktuelle Projekte?</td><td><input type="checkbox" name="pz[ak]" value="1" <?php if ($pak) echo "checked='checked'"; ?>/></td></tr> |
|
125 <tr> |
|
126 <td>Verknüpfung</td> |
|
127 <td>UND |
|
128 <input type="radio" name="pz[bind]" value="AND" <?php if (isset($pz["bind"]) && $pz["bind"]=="AND") echo "checked='checked'"; else echo "checked='checked'";?>> |
|
129 ODER |
|
130 <input type="radio" name="pz[bind]" value="OR" <?php if (isset($pz["bind"]) && $pz["bind"]=="OR") echo "checked='checked'"; ?>></td> |
|
131 </tr> |
|
132 <tr> |
|
133 <td>Sortierung nach<br />(in dieser Reihenfolge)</td><td> |
|
134 <?php |
|
135 $sort = array("-1"=>"","proz_bez"=>"Bezeichnung","verantw"=>"Verantwortlicher","proz_stat"=>"Status","prod_name"=>"Produkt"); |
|
136 for ($i=1; $i<3; $i++) |
|
137 { |
|
138 echo "$i. <select name='pz[sort$i]'>\n"; |
|
139 foreach ($sort as $key=>$val) |
|
140 { |
|
141 $rsort = "sort" . $i; |
|
142 if ($pz[$rsort] == $val) $select= " selected"; else $select = ""; |
|
143 echo "<option$select value='$key'>$val</option>\n"; |
|
144 } |
|
145 echo "</select> \n"; |
|
146 } |
|
147 echo "</td></tr>\n"; |
|
148 echo "</td></tr>\n"; |
|
149 |
|
150 $azeil = array(10=>'10',20=>'20',25=>'25',50=>'50',100=>'100',9999=>'alle'); // Anzahl gezeigter rows |
|
151 echo "<tr><td>Zeilen/Seite?</td><td><select name='pz[z]'>\n"; |
|
152 if (!$pz['z']) $pz['z'] = 9999; |
|
153 foreach ($azeil as $key=>$val) |
|
154 { |
|
155 if ($key == $pz['z']) $select = "selected"; else $select = ""; |
|
156 echo "<option $select value='$key'>$val</option>\n"; |
|
157 } |
|
158 echo "</select></td></tr>\n"; |
|
159 |
|
160 ?> |
|
161 <tr> |
|
162 <td> </td> |
|
163 <td><input class="button" type="submit" name="search" value="Bericht erstellen"/></td> |
|
164 </tr> |
|
165 </table> |
|
166 </div> |
|
167 </form> |
|
168 <?php |
|
169 } |
|
170 else |
|
171 { |
|
172 include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php"); |
|
173 include ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php"); |
|
174 |
|
175 if (!isset($dbc) || !$dbc) $dbc = new dbconnection(); |
|
176 |
|
177 $sql = "SELECT proz_ID,proz_bez,proz_bez_l,proz_start_pl,proz_end_pl,proz_kost_pl,proz_start,proz_end,proz_kosten, |
|
178 proz_ref_ID,proz_bem,persknr,verantw,persknr_a,auftragg,proz_stat_ID,proz_stat,proz_urg_ID,proz_urg_bez, |
|
179 produkt_ID,prod_name,proz_step_ID,proz_step,step_stat_ID,step_stat,step_bem |
|
180 FROM fhiiqm.v_projekt_report "; |
|
181 |
|
182 $lim = " LIMIT $start,$zeil"; |
|
183 $where = ""; |
|
184 $krit = ""; |
|
185 $bind = $pz["bind"]; |
|
186 $heute =date('Y-m-d'); |
|
187 if ($pz["stat"] > "-1") |
|
188 { |
|
189 $where .= " proz_stat_ID = ".$pz["stat"]; |
|
190 $stat = $dbc->querySingleItem("SELECT proz_stat_bez FROM Proz_Status WHERE proz_stat_ID =".$pz["stat"]); |
|
191 $krit = " [Projektstatus = '$stat'] "; |
|
192 } |
|
193 if ($pz["va"]) |
|
194 { |
|
195 if ($where) $bd = $bind; else $bd = ""; |
|
196 $where .= " $bd verantw LIKE '".$pz["va"] . "%' "; |
|
197 $krit .= $bd . " [Verantwortlicher wie '".$pz["va"]."*'] "; |
|
198 } |
|
199 if ($pz["ak"]) |
|
200 { |
|
201 if ($where) $bd = $bind; else $bd = ""; |
|
202 $where .= " $bd ('$heute' BETWEEN proz_start_pl AND proz_end_pl) OR ('$heute' BETWEEN proz_start AND proz_end) "; |
|
203 $heuted = date('d.m.Y'); |
|
204 $krit .= $bd . " [$heuted innerhalb Start-/Endedatum ] "; |
|
205 } |
|
206 if ($pz["sort1"]>"-1" || $pz["sort2"]>"-1") |
|
207 { |
|
208 if ($pz["sort1"]>"-1") $ord = " ORDER BY " . $pz["sort1"]; |
|
209 if ($pz["sort2"]>"-1") $ord .= ",".$pz["sort2"]; |
|
210 $ord .= ",proz_step_ID "; |
|
211 } |
|
212 else $ord = " ORDER BY proz_bez,proz_step_ID"; |
|
213 if ($where) $where = " WHERE $where"; |
|
214 |
|
215 $sql .= $where . $ord .$lim; |
|
216 //echo "sql = $sql<br />\n"; |
|
217 $result = $dbc -> queryObjectArray($sql); |
|
218 |
|
219 echo "<div align='center'>\n"; |
|
220 |
|
221 if ($krit) echo "<p>Projekte für $krit</p>"; else echo "<p> </p>"; |
|
222 |
|
223 if ($result) |
|
224 { |
|
225 $sql = "SELECT COUNT(*) FROM v_projekt_report $where"; |
|
226 $ianz = $dbc -> querySingleItem($sql); |
|
227 $bg1 = "#F8F8F8"; |
|
228 $bg2 = "#DEDFE1"; |
|
229 $bg = "#FFFFFF"; |
|
230 |
|
231 echo "<table border='0' cellspacing='0' cellpadding='2' width='99%'>\n"; |
|
232 // Listenkopf |
|
233 foreach ($result as $row) |
|
234 { |
|
235 foreach ($row as &$val) if (is_null($val) || $val <=' ') $val = " "; |
|
236 if ($vproz != $row->proz_ID) |
|
237 { |
|
238 if ($bg == $bg1) $bg = $bg2; else $bg = $bg1; |
|
239 echo "<tr bgcolor='" . $bg . "' background='../img/linelightblue.gif'>"; |
|
240 echo "<td width='15%'><b>$row->proz_bez</b></td>"; |
|
241 echo "<td>$row->proz_bez_l</td>"; |
|
242 echo "<td width='15%'>Verantwortlich: $row->verantw</td>"; |
|
243 echo "<td width='10%'>Status: $row->proz_stat</td>"; |
|
244 echo "<td>$row->proz_bem</td></tr>\n"; |
|
245 echo "<tr bgcolor='" . $bg . "'>"; |
|
246 if ($row->proz_start_pl>" ") |
|
247 { |
|
248 $dat = new DateTime($row->proz_start_pl); |
|
249 echo "<td class=\"left\">Planstart: " . $dat->format('d.m.Y')."</td>"; |
|
250 } |
|
251 else echo "<td>Planstart:</td>"; |
|
252 if ($row->proz_end_pl>" ") |
|
253 { |
|
254 $dat = new DateTime($row->proz_end_pl); |
|
255 echo "<td class=\"left\">Planende: " . $dat->format('d.m.Y')."</td>"; |
|
256 } |
|
257 else echo "<td>Planende:</td>"; |
|
258 // if ($row->proz_kost_pl>" ") echo "<td>".number_format($row->proz_kost_pl,2,",","."); else echo "<td> </td>"; |
|
259 if ($row->proz_start>" ") |
|
260 { |
|
261 $dat = new DateTime($row->proz_start); |
|
262 echo "<td class=\"left\">Start: " . $dat->format('d.m.Y')."</td>"; |
|
263 } |
|
264 else echo "<td>Start:</td>"; |
|
265 if ($row->proz_end>" ") |
|
266 { |
|
267 $dat = new DateTime($row->proz_end); |
|
268 echo "<td class=\"left\" colspan='2'>Ende: " . $dat->format('d.m.Y')."</td>"; |
|
269 } |
|
270 else echo "<td colspan='2'>Ende:</td></tr>\n"; |
|
271 // if ($row->proz_kosten>" ") echo "<td>".number_format($row->proz_kosten,2,",","."); else echo "<td> </td>"; |
|
272 echo "<tr bgcolor='" . $bg . "'>"; |
|
273 echo "<td colspan='3'> $row->proz_step</td>"; |
|
274 echo "<td>Status: $row->step_stat</td>"; |
|
275 echo "<td>$row->step_bem</td></tr>\n"; |
|
276 |
|
277 } |
|
278 if ($vproz == $row->proz_ID && $vstep != $row->proz_step_ID) |
|
279 { |
|
280 echo "<tr bgcolor='" . $bg . "'>"; |
|
281 echo "<td colspan='3'> $row->proz_step</td>"; |
|
282 echo "<td>Status: $row->step_stat</td>"; |
|
283 echo "<td>$row->step_bem</td></tr>\n"; |
|
284 } |
|
285 $vproz = $row->proz_ID; |
|
286 $vstep = $row->proz_step_ID; |
|
287 $begin = 1; |
|
288 } |
|
289 echo "</table>\n"; |
|
290 echo "<p></p><table width=90%><tr><td class='right'><a href=\"javascript:window.print()\" class='sc'> |
|
291 <img src=\"/fhiiqm/img/printer.png\" alt=\"Bericht drucken\" border=\"0\" align=\"right\" title=\"Bericht drucken\"></a></td></tr></table>"; |
|
292 echo "</div>\n"; |
|
293 echo "<br /> "; |
|
294 |
|
295 if ($search != 2) // Aufruf aus fhiiqm |
|
296 { |
|
297 // Parameter aus $_GET fuer weitere Seiten |
|
298 $_GET["s"] = 1; // bewirkt weitere Suche |
|
299 foreach ($_GET as $key=>$val) |
|
300 { |
|
301 if ($key != "st") $liste .= "&" . $key ."=".$val; |
|
302 } |
|
303 // Links auf andere Seiten generieren |
|
304 liste_links($start,$zeil,$ianz,$liste); |
|
305 echo "<br /> "; |
|
306 } |
|
307 } |
|
308 else |
|
309 { |
|
310 echo "<p class='red'> Leider gibt es kein Ergebnis für die von Ihnen gewählten Kriterien!</p>"; |
|
311 echo "</div>\n"; |
|
312 echo "<br /> "; |
|
313 } |
|
314 |
|
315 if ($search != 2) |
|
316 { |
|
317 echo "<span class='sc'>"; |
|
318 echo "<br /> <a href=\"/fhiiqm/pz_report.php\" target=\"_self\" title=\"Berichte\" class='sc'>« zur Berichtsübersicht</a>"; |
|
319 echo " | <a href=\"" . $_SERVER["PHP_SELF"] . "\" target=\"_self\" title=\"Projekt\" class=\"sc\">neuer Bericht Projekte</a>\n"; |
|
320 echo "</span>"; |
|
321 } |
|
322 else |
|
323 echo "<a href='javascript:history.back();' onMouseOver=\"{window.status='Zurück'; return true;}\">« Zurück</a>"; |
|
324 } |
|
325 ?> |
|
326 |
|
327 </body> |
|
328 </html> |