1 #include <infocon.style>
3 <page func=InfoCon title="Buchhaltung">
5 <style type="text/css">
6 span.in { color: green; }
7 span.out { color: red; }
8 span.in:hover, span.out:hover { background: yellow; border: 1px solid #ccc; }
11 <h3>Nicht bezahlte Rechnungen</h3>
14 $dbh = pg_pconnect ("<dbhost>", "<dbport>", "<dbname>")
15 or die("Unable to connect to SQL server");
17 <form method=POST action=list.php>
18 <input type=hidden name=blzkto value="<? echo $blzkto; ?>">
19 <b>Jahr:</b> <select name=year>
22 $query = "SELECT DISTINCT substr(date,0,5) AS year FROM sales ORDER BY substr(date,0,5) DESC";
23 $sth = pg_exec ($dbh, $query);
25 for ($nr=0; $nr <pg_NumRows ($sth); $nr++) {
26 $cat = pg_fetch_array ($sth, $nr);
27 printf ("<option value=\"%s\">%s", $cat["year"], $cat["year"]);
30 <b>Kategorie:</b> <select name=category>
33 $query = "SELECT DISTINCT category FROM sales ORDER BY category";
34 $sth = pg_exec ($dbh, $query);
36 for ($nr=0; $nr <pg_NumRows ($sth); $nr++) {
37 $cat = pg_fetch_array ($sth, $nr);
38 printf ("<option value=\"%s\">%s", $cat['category'], $cat['category']);
41 <b>Zahlung</b>: <input type=checkbox name=input value=1 checked> Einnahmen <input type=checkbox name=output value=1 checked> Ausgaben<br>
44 <input class=button type=submit name=submit value="List">
45 <input class=button type=submit name=submit value="Overview">
46 <input class=button type=submit name=submit value="Tally">
47 <input class=button type=reset value="Reset">
53 $query = "SELECT nr,date,description,price FROM sales_dm WHERE paid=0 ORDER BY date,nr";
54 $sth = pg_exec ($dbh, $query);
56 if (pg_NumRows ($sth) > 0) {
58 echo ("<h3>Nicht bezahlte Rechnungen</h3>");
59 echo ("<form method=\"POST\" action=\"pay.php\">");
62 for ($nr=0; $nr <pg_NumRows ($sth); $nr++) {
63 $row = pg_fetch_array ($sth, $nr);
64 $date = substr ($row['date'],6,2) . "." . substr ($row['date'],4,2) . "." . substr ($row['date'],0,4);
65 printf (" <input type=\"checkbox\" name=\"pay_dm_%d\" value=\"1\">", $row['nr']);
66 printf ("%d. %s %s (%.2f DM)<br>", $row['nr'], $date, $row['description'], $row['price']);
69 $query = "SELECT nr,date,description,price FROM sales WHERE paid=0 ORDER BY date,nr";
70 $sth = pg_exec ($dbh, $query);
72 if (!form && pg_NumRows ($sth) > 0) {
74 echo ("<h3>Nicht bezahlte Rechnungen</h3>");
75 echo ("<form method=\"POST\" action=\"pay.php\">");
78 for ($nr=0; $nr <pg_NumRows ($sth); $nr++) {
79 $row = pg_fetch_array ($sth, $nr);
80 $date = substr ($row['date'],6,2) . "." . substr ($row['date'],4,2) . "." . substr ($row['date'],0,4);
81 printf (" <input type=\"checkbox\" name=\"pay_%d\" value=\"1\">", $row['nr']);
82 printf ('<span class="%s">%d. %s %s (%.2f €)</span><br>',
83 $row['price'] < 0 ? 'out' : 'in',
84 $row['nr'], $date, $row['description'], $row['price']);
88 echo ("<p><input type=\"submit\" class=\"button\" value=\"Bezahlen\"> <input type=\"reset\" class=\"button\" value=\"Reset\"><p>");