1 #include <infocon.style>
3 <page title="Buchhaltung">
5 <headline "Buchhaltung">
7 <form method=POST action=list.php3>
8 <input type=hidden name=blzkto value="<? echo $blzkto; ?>">
9 <b>Jahr</b>: <input name=year size=10 maxlength=4><br>
10 <b>Kategorie:</b> <select name=category>
13 $dbh = pg_pconnect ("kuolema", "5432", "<db>")
14 or die("Unable to connect to SQL server");
16 $query = "SELECT DISTINCT category FROM sales ORDER BY category";
17 $sth = pg_exec ($dbh, $query);
19 for ($nr=0; $nr <pg_NumRows ($sth); $nr++) {
20 $cat = pg_fetch_array ($sth, $nr);
21 printf ("<option value=\"%s\">%s", $cat['category'], $cat['category']);
24 <b>Zahlung</b>: <input type=checkbox name=input value=1 checked> Einnahmen <input type=checkbox name=output value=1 checked> Ausgaben<br>
26 <p><center><input type=submit value="Query"> <input type=reset value="Reset"></center><p>
30 $query = "SELECT nr,date,description,price FROM sales WHERE paid=0 ORDER BY date,nr";
31 $sth = pg_exec ($dbh, $query);
33 if (pg_NumRows ($sth) > 0) {
34 echo ("<h3>Nicht bezahlte Rechnungen</h3>");
35 echo ("<form method=\"POST\" action=\"pay.php3\">");
38 for ($nr=0; $nr <pg_NumRows ($sth); $nr++) {
39 $row = pg_fetch_array ($sth, $nr);
40 $date = substr ($row['date'],6,2) . "." . substr ($row['date'],4,2) . "." . substr ($row['date'],0,4);
41 printf (" <input type=\"checkbox\" name=\"pay_%d\" value=\"1\">", $row['nr']);
42 printf ("%d. %s %s (%.2f)<br>", $row['nr'], $date, $row['description'], $row['price']);
45 if (pg_NumRows ($sth) > 0) {
46 echo ("<p><input type=\"submit\" value=\"Bezahlen\"> <input type=\"reset\" value=\"Reset\"><p>");