1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
<?php
include ("classes.inc");
$Con=mysql_connect('localhost','ewa','ewa',3306)
or die('Could not connect: ' . mysql_error());
mysql_select_db('ewa') or die('Could not select database');
$query = "SELECT b.AuftragNr, b.SessionId, p.Bezeichnung, b.Lieferadresse, b.Zustand
FROM t_bestellung b
NATURAL JOIN t_pizza p
WHERE b.zustand = 'bestellt' OR b.zustand='imOfen' OR b.zustand='fertig'
ORDER BY Lieferadresse,Zeitpunkt
";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
$Best=array();
$n=0;
while($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
$Best[$n] = new Bestellung(
$line[AuftragNr],
$line[SessionId],
$line[Lieferadresse],
$line[Bezeichnung],
$line[Zustand]
);
$n++;
}
//if (isset($_POST))
if (isset($_GET))
{
foreach ($_GET as $key => $val)
//echo "$key $val \n";
{
$auftrg_nr = substr($key,2);
//echo $auftrg_nr;
}
//if(is_array($Best))
{
//print_r($Best);
foreach ($Best as $aktBest) {
if ($aktBest->AuftNr == $auftrg_nr)
{
$pzAktZust = $aktBest->zustand;
$newZustand=$pzAktZust;
if ($pzAktZust == 'bestellt')
$newZustand = 'imOfen';
else if ($pzAktZust == 'imOfen')
$newZustand = 'fertig';
}
}
}
$update_str = "UPDATE t_bestellung b SET Zustand='$newZustand' WHERE b.AuftragNr = '$auftrg_nr'";
//echo $update_str;
$res = mysql_query($update_str) or die('Query failed: ' . mysql_error());
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<script type="text/javascript">
<!--
function submit_form() {
document.baecker.submit();
//parent.location.reload();
}
-->
</script>
<title>Pizzabäcker (bestellte Pizza)</title>
<link rel="stylesheet" type="text/css" href="formats.css">
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body>
<h1>Pizzabäcker (bestellte Pizza)</h1>
<?php
//echo "<form action=\"".$_SERVER['PHP_SELF']."\" method=\"POST\" name=\"baecker\">";
echo "<form action=\"".$_SERVER['PHP_SELF']."\" method=\"GET\" name=\"baecker\">";
//echo "<form action=\"http://www.fbi.h-da.de/cgi-bin/Echo.pl\" method=\"POST\" name=\"baecker\">";
?>
<table>
<tr>
<td class="dummy">
</td>
</tr>
<tr>
<td class="dummy">
</td>
<td>im Ofen
</td>
<td>fertig
</td>
</tr>
<?php
if (is_array($Best))
{
foreach ($Best as $aktBest)
{
$nr=$aktBest->getauftnr();
echo"<tr>\n<td>";
$aktName =$aktBest->getpiz_name();
echo $aktName;
$aktZustand = $aktBest->zustand;
echo "</td>";
if ($aktZustand == 'imOfen') {
echo "<td><input type=\"radio\" name=\"nr$nr\" CHECKED DISABLED></td>\n";
echo "<td><input onclick=\"submit_form()\" type=\"radio\" name=\"nr$nr\"></td>\n";
}
else if ($aktZustand == 'bestellt') {
echo "<td><input onclick=\"submit_form()\" type=\"radio\" name=\"nr$nr\"></td>\n";
echo "<td><input type=\"radio\" name=\"nr$nr\" DISABLED></td>\n";
} else if ($aktZustand == 'fertig') {
echo "<td><input type=\"radio\" name=\"nr$nr\" DISABLED></td>\n";
echo "<td><input type=\"radio\" name=\"nr$nr\" CHECKED DISABLED></td>\n";
}
echo "</tr>\n";
}
}
?>
</table>
</form>
</body>
</html>
|