1 #include <infocon.style>
3 <page func=InfoCon title="Buchhaltung">
5 <h3>Nicht bezahlte Rechnungen</h3>
8 $dbh = pg_pconnect ("<dbhost>", "<dbport>", "<dbname>")
9 or die("Unable to connect to SQL server");
11 <form method=POST action=list.php>
12 <input type=hidden name=blzkto value="<? echo $blzkto; ?>">
13 <b>Jahr:</b> <select name=year>
16 $query = "SELECT DISTINCT substr(date,0,5) AS year FROM sales ORDER BY substr(date,0,5)";
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["year"], $cat["year"]);
24 <b>Kategorie:</b> <select name=category>
27 $query = "SELECT DISTINCT category FROM sales ORDER BY category";
28 $sth = pg_exec ($dbh, $query);
30 for ($nr=0; $nr <pg_NumRows ($sth); $nr++) {
31 $cat = pg_fetch_array ($sth, $nr);
32 printf ("<option value=\"%s\">%s", $cat['category'], $cat['category']);
35 <b>Zahlung</b>: <input type=checkbox name=input value=1 checked> Einnahmen <input type=checkbox name=output value=1 checked> Ausgaben<br>
38 <input class=button type=submit name=submit value="List">
39 <input class=button type=submit name=submit value="Overview">
40 <input class=button type=submit name=submit value="Tally">
41 <input class=button type=reset value="Reset">
47 $query = "SELECT nr,date,description,price FROM sales_dm WHERE paid=0 ORDER BY date,nr";
48 $sth = pg_exec ($dbh, $query);
50 if (pg_NumRows ($sth) > 0) {
52 echo ("<h3>Nicht bezahlte Rechnungen</h3>");
53 echo ("<form method=\"POST\" action=\"pay.php\">");
56 for ($nr=0; $nr <pg_NumRows ($sth); $nr++) {
57 $row = pg_fetch_array ($sth, $nr);
58 $date = substr ($row['date'],6,2) . "." . substr ($row['date'],4,2) . "." . substr ($row['date'],0,4);
59 printf (" <input type=\"checkbox\" name=\"pay_dm_%d\" value=\"1\">", $row['nr']);
60 printf ("%d. %s %s (%.2f DM)<br>", $row['nr'], $date, $row['description'], $row['price']);
63 $query = "SELECT nr,date,description,price FROM sales WHERE paid=0 ORDER BY date,nr";
64 $sth = pg_exec ($dbh, $query);
66 if (!form && pg_NumRows ($sth) > 0) {
68 echo ("<h3>Nicht bezahlte Rechnungen</h3>");
69 echo ("<form method=\"POST\" action=\"pay.php\">");
72 for ($nr=0; $nr <pg_NumRows ($sth); $nr++) {
73 $row = pg_fetch_array ($sth, $nr);
74 $date = substr ($row['date'],6,2) . "." . substr ($row['date'],4,2) . "." . substr ($row['date'],0,4);
75 printf (" <input type=\"checkbox\" name=\"pay_%d\" value=\"1\">", $row['nr']);
76 printf ("%d. %s %s (%.2f €)<br>", $row['nr'], $date, $row['description'], $row['price']);
80 echo ("<p><input type=\"submit\" class=\"button\" value=\"Bezahlen\"> <input type=\"reset\" class=\"button\" value=\"Reset\"><p>");