More highlighting
[infodrom.org/infocon.infodrom.org] / src / shop / calc.wml
1 #include <infocon.style>
2 #include <shop.inc>
3
4 <page title="Bestellungskontrolle">
5
6 <form method=post action=order.php3>
7 &nbsp;<table width=100% border=0 cellpadding=0 cellspacing=0>
8
9 <?
10   # So werden 1 Pixel dicke Rahmen erzeugt
11   $la = "<tr><td width=\"2\" bgcolor=\"#000000\"></td><td bgcolor=\"#000000\"><table cellpadding=\"0\" cellspacing=\"1\" width=\"100%\" border=\"0\" summary=\"\"><tr><td bgcolor=\"#ffffff\">";
12   $le = "</td></tr></table></td></tr>";
13 #  $ch = "#5dbbf9";
14 #  $cd = "#9bd4fa";
15 #  $ch = "#85c5f0";
16 #  $cd = "#abdcfc";
17   $ch = "#abdcfc";
18   $cd = "#eff0f1";
19
20   $tind = "<tr bgcolor=\"$ch\"><th><font face=\"Helvetica,Arial\">Anzahl</font></th>"
21          ."<th align=\"left\"><font face=\"Helvetica,Arial\">Artikel</font></th>"
22          ."<th align=\"right\"><font face=\"Helvetica,Arial\">Einzel</font></th>"
23          ."<th align=\"right\"><font face=\"Helvetica,Arial\">Gesamt</font></th></tr>";
24
25   $dbh = dbconnect();
26
27   // WHERE spool > 0
28   $sth = dbquery ($dbh, "SELECT article.name,article.article,offer.subname,offer.price,offer.articleid "
29                        ."FROM article,offer WHERE article.article = offer.article ORDER BY offer.articleid");
30
31   $sum = 0.0;
32   echo ($la);
33   echo ("<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" summary=\"\">");
34
35   $color = $cd;
36   for ($i=0; $i < pg_NumRows ($sth); $i++) {
37     $row = pg_fetch_array ($sth, $i);
38
39     if (${$row['articleid']} > 0) {
40       if ($sum == 0.0) {
41         echo ($tind);
42       }
43       $color = $color == $cd?"#ffffff":$cd;
44       printf ("<tr bgcolor=\"%s\">", $color);
45       printf ("<td width=\"10%%\" align=\"center\"><font face=\"Helvetica,Arial\">"
46              ."<input name=\"%s\" size=\"3\" maxlength=\"3\" value=\"%d\"></font></td>",
47              $row['articleid'], ${$row['articleid']});
48
49       printf ("<td width=\"70%%\" align=\"left\"><font face=\"Helvetica,Arial\">"
50              ."<a href=\"show.php3?article=%s\">%s, %s</a></font></td>",
51              $row['article'], $row['name'], $row['subname']);
52
53       printf ("<td width=\"10%%\" align=\"right\"><font face=\"Helvetica,Arial\">%6.2f</font></td>",
54              $row['price']);
55
56       printf ("<td width=\"10%%\" align=\"right\"><font face=\"Helvetica,Arial\">%6.2f</font></td></tr>",
57              $row['price'] * ${$row['articleid']});
58       $sum += $row['price'] * ${$row['articleid']};
59     }
60   }
61   if ($sum == 0.0) {
62     printf ("<tr bgcolor=\"%s\"><th colspan=\"4\" align=\"left\"><font face=\"Helvetica,Arial\">%s</font></th>",
63             $ch, "Sie haben vergessen, Waren auszuwählen");
64   } else {
65     printf ("<tr bgcolor=\"%s\"><th colspan=\"3\" align=\"left\"><font face=\"Helvetica,Arial\">Summe</font></th>", $ch);
66     printf ("<th align=\"right\"><font face=\"Helvetica,Arial\">%7.2f</font></th></tr>", $sum);
67   }
68   echo ("</table>");
69   echo ($le);
70 ?>
71
72 </table>
73 <? if ($sum > 0.0) { ?>
74 <p><center><input type=submit value="Bestellen"> . <input type=reset value="Reset"></center>
75 <? } ?>
76 </form><p>
77
78 </page>
79 # Local variables:
80 # mode: indented-text
81 # mode: auto-fill
82 # mode-: iso-accents
83 # end: