|
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
2 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
|
3 |
|
4 <head> |
|
5 <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> |
|
6 <link href="css/db.css" rel="STYLESHEET" type="TEXT/CSS" /> |
|
7 |
|
8 <title>Produkthierarchie</title> |
|
9 </head> |
|
10 |
|
11 <body> |
|
12 <div class="float-r"><img src="img/node-tree.png" border="0" alt="Produkte" title="Produkte"/></div> |
|
13 |
|
14 <?php |
|
15 |
|
16 /** |
|
17 * @author Bettina Schwarzer, Fritz-Haber-Institut |
|
18 * @copyright 06/2011 |
|
19 * |
|
20 * Suche und Anzeige Produkthierarchien |
|
21 */ |
|
22 |
|
23 error_reporting(E_ALL ^ E_NOTICE); |
|
24 |
|
25 $prods = $_POST['prods']; |
|
26 $submit = $_POST['search']; |
|
27 |
|
28 include_once("inc/dbconnect.inc.php"); |
|
29 $dbc = new dbconnection(); |
|
30 |
|
31 echo "<div align='center'>\n"; |
|
32 |
|
33 if (!$submit) |
|
34 { |
|
35 ?> |
|
36 <p><b>Suche Produkthierarchie</b><br /><br /> |
|
37 Sie können einen Produktbereich und/oder eine Produktgruppe wählen oder<br /> |
|
38 die gesamte Hierarchie anschauen, indem Sie nur auf 'suchen' klicken. |
|
39 </p> |
|
40 <form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" enctype="application/x-www-form-urlencoded" name="form_prod_search" target="_self"> |
|
41 <!-- <form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" enctype="multipart/form-data" name="form_prod_search" target="_self"> --> |
|
42 <table width="50%" border="0" cellspacing="3" cellpadding="3"> |
|
43 <tr> |
|
44 <td>Produktbereich</td> |
|
45 <td><select name="prods[ber]" onchange="this.form.submit();"> |
|
46 <?php |
|
47 if ($prods['ber'] == 0) $select = " selected "; else $select = ""; |
|
48 echo "<option $select value=\"0\"></option>\n"; |
|
49 $sql = "SELECT prod_ber_ID, prod_ber_name FROM Produkt_Bereich ORDER BY 2"; |
|
50 if ($result = $dbc->queryObjectArray($sql)) |
|
51 { |
|
52 foreach ($result as $row) |
|
53 { |
|
54 if ($row->prod_ber_ID == $prods['ber']) |
|
55 echo "<option selected value=\"$row->prod_ber_ID\">$row->prod_ber_name ($row->prod_ber_ID)</option>\n"; |
|
56 else |
|
57 echo "<option value=\"$row->prod_ber_ID\">$row->prod_ber_name ($row->prod_ber_ID)</option>\n"; |
|
58 } |
|
59 } |
|
60 ?> |
|
61 </select> |
|
62 </td> |
|
63 </tr> |
|
64 <tr> |
|
65 <td>Produktgruppe</td> |
|
66 <td><select name="prods[grp]"> |
|
67 <?php |
|
68 if ($prods['grp'] == 0) $select = " selected "; else $select = ""; |
|
69 echo "<option $select value=\"0\"></option>\n"; |
|
70 if (isset($prods['ber'])) $where = "WHERE prod_ber_ID = " . $prods['ber']; else $where = ""; |
|
71 $sql = "SELECT prod_group_ID, prod_group_name, prod_group_hier FROM Produkt_Gruppe $where ORDER BY 2"; |
|
72 if ($result = $dbc->queryObjectArray($sql)) |
|
73 { |
|
74 foreach ($result as $row) |
|
75 { |
|
76 if ($row->prod_group_ID == $prods['grp']) |
|
77 echo "<option selected value=\"$row->prod_group_ID\">$row->prod_group_name ($row->prod_group_hier)</option>\n"; |
|
78 else |
|
79 echo "<option value=\"$row->prod_group_ID\">$row->prod_group_name ($row->prod_group_hier)</option>\n"; |
|
80 } |
|
81 } |
|
82 ?> |
|
83 </select> |
|
84 </td> |
|
85 </tr> |
|
86 <?php |
|
87 echo "<tr>\n"; |
|
88 echo " |
|
89 <td> </td> |
|
90 <td align=\"left\"><input class=\"button\" type=\"submit\" value=\"suchen\" name=\"search\" title=\"search\" /></td>\n"; |
|
91 echo "</tr>\n"; |
|
92 echo "</table>\n"; |
|
93 echo "</div>\n"; |
|
94 echo "</form>\n"; |
|
95 echo "</div>\n"; |
|
96 } |
|
97 else |
|
98 { |
|
99 if ($prods['ber'] || $prods['grp']) |
|
100 { |
|
101 if (!$prods['grp']) $prods['grp']=0; |
|
102 if (!$prods['ber']) $prods['ber']=0; |
|
103 } |
|
104 else |
|
105 { |
|
106 $prods['ber']=0; |
|
107 $prods['grp']=0; |
|
108 } |
|
109 |
|
110 $sql = "CALL prod_hiera_all(" .$prods['ber'].",".$prods['grp'].")"; |
|
111 if ($result = $dbc->queryObjectArray($sql)) |
|
112 { |
|
113 // printf ("<p>Es wurden %s Saetze gefunden.</p>", $dbc->numrows($sql)); |
|
114 $bg1 = "#F8F8F8"; |
|
115 $bg2 = "#DEDFE1"; |
|
116 $bg = "#FFFFFF"; |
|
117 echo "<p><b>Produkthierarchie</b></p>\n"; |
|
118 echo "<p>Die Produkte (unterste Hierarchieebene) können Sie mittels Klick auf '<img src=\"img/edit.gif\" alt='edit' title='edit' border='0'/>' editiern</p>\n"; |
|
119 echo "<table cellpadding='2'>"; |
|
120 echo "<tr bgcolor='#68ACBF'><th align='left'>Hierar.</th><th> </th> |
|
121 <th align='left'>Produkt-Kategorie</th><th align='left'>AG (Abteilung)</th><th align='left'>Wichtigkeit</th><th align='left'>Bindungsstärke</th><th align='left'>Bemerkung</th></tr>\n"; |
|
122 foreach($result as $row) |
|
123 { |
|
124 if ($bg == $bg1) $bg = $bg2; else $bg = $bg1; |
|
125 if (strlen($row->bez) > 70) |
|
126 $prod=str_replace(" "," ",htmlentities(substr($row->bez,0,70))) ."..."; |
|
127 else |
|
128 $prod=str_replace(" "," ",htmlentities($row->bez)); |
|
129 if ($row->level == 4) |
|
130 $hier="<a href='produkt_upd.php?uid=$row->prid'><img src=\"img/edit.gif\" alt='edit' title='edit' border='0'/></a>"; |
|
131 else |
|
132 $hier=" "; |
|
133 print "<tr bgcolor='" . $bg . "'><td>$row->hier</td><td> $hier</td> |
|
134 <td>$prod</td><td>$row->ag</td><td>$row->imp</td><td>$row->conn</td><td>$row->bem</td></tr>"; |
|
135 } |
|
136 echo "</table>\n"; |
|
137 // $dbc->close(); |
|
138 } |
|
139 else |
|
140 echo "leider kein Ergebnis!<br>\n"; |
|
141 if ($result = $dbc -> querySingleItem("SELECT COUNT(*) FROM produkt")) |
|
142 { |
|
143 echo "<p>Tabelle 'produkt' enthaelt $result Eintraege</p>\n"; |
|
144 } |
|
145 echo "</div>\n"; |
|
146 echo "<p> <a href=\"prod_hier.php\" target=\"_self\" title=\"Produkthierarchie\">neue Suche Produkthierarchie</a></p>\n"; |
|
147 echo "<p> <a href=\"produkt_ins.php\" target=\"_self\" title=\"Produkt erfassen\">Produkt erfassen</a></p>\n"; |
|
148 } |
|
149 |
|
150 ?> |
|
151 </body> |
|
152 </html> |