1 #include <infocon.style>
3 <page func=InfoCon title="Buchhaltung">
6 <style type="text/css">
7 span.in { color: green; }
8 span.out { color: red; }
9 span.in:hover, span.out:hover { background: yellow; border: 1px solid #ccc; }
10 input[id^=date_] { width: 6.1em; }
16 $dbh = pg_pconnect ("<dbhost>", "<dbport>", "<dbname>")
17 or die("Unable to connect to SQL server");
19 <form method=POST action=list.php>
20 <input type=hidden name=blzkto value="<? echo $blzkto; ?>">
21 <b>Jahr:</b> <select name=year>
24 $query = "SELECT DISTINCT substr(date,0,5) AS year FROM sales ORDER BY substr(date,0,5) DESC";
25 $sth = pg_exec ($dbh, $query);
27 for ($nr=0; $nr <pg_NumRows ($sth); $nr++) {
28 $cat = pg_fetch_array ($sth, $nr);
29 printf ("<option value=\"%s\">%s", $cat["year"], $cat["year"]);
32 <b>Kategorie:</b> <select name=category>
35 $query = "SELECT DISTINCT category FROM sales ORDER BY category";
36 $sth = pg_exec ($dbh, $query);
38 for ($nr=0; $nr <pg_NumRows ($sth); $nr++) {
39 $cat = pg_fetch_array ($sth, $nr);
40 printf ("<option value=\"%s\">%s", $cat['category'], $cat['category']);
43 <b>Zahlung</b>: <input type=checkbox name=input value=1 checked> Einnahmen <input type=checkbox name=output value=1 checked> Ausgaben<br>
46 <input class=button type=submit name=submit value="List">
47 <input class=button type=submit name=submit value="Overview">
48 <input class=button type=submit name=submit value="Tally">
49 <input class=button type=reset value="Reset">
55 $query = "SELECT nr,date,description,price FROM sales_dm WHERE paid=0 AND visible=1 ORDER BY date,nr";
56 $sth = pg_exec ($dbh, $query);
58 if (pg_NumRows ($sth) > 0) {
60 echo ("<h3>Nicht bezahlte Rechnungen</h3>");
61 echo ("<form method=\"POST\" action=\"pay.php\">");
64 for ($nr=0; $nr <pg_NumRows ($sth); $nr++) {
65 $row = pg_fetch_array ($sth, $nr);
66 $date = substr ($row['date'],6,2) . "." . substr ($row['date'],4,2) . "." . substr ($row['date'],0,4);
67 printf (" <input type=\"text\" id=\"date_%d\" name=\"date_%d\" size=\"7\" value=\"\">", $row['nr'], $row['nr']);
68 printf (" <img class=\"calendar\" src=\"<root_prefix>pix/calendar.gif\" onclick=\"event.cancelBubble=true;popcalendar('date_%d');\" alt=\"\">", $row['nr']);
69 printf (" %d. %s %s (%.2f DM)<br>", $row['nr'], $date, $row['description'], $row['price']);
72 $query = "SELECT nr,date,description,price FROM sales WHERE paid=0 AND visible=1 ORDER BY date,nr";
73 $sth = pg_exec ($dbh, $query);
75 if (!$form && pg_NumRows ($sth) > 0) {
77 echo ("<h3>Nicht bezahlte Rechnungen</h3>");
78 echo ("<form method=\"POST\" action=\"pay.php\">");
81 for ($nr=0; $nr <pg_NumRows ($sth); $nr++) {
82 $row = pg_fetch_array ($sth, $nr);
83 $date = substr ($row['date'],6,2) . "." . substr ($row['date'],4,2) . "." . substr ($row['date'],0,4);
84 printf (" <input type=\"text\" id=\"date_%d\" name=\"date_%d\" size=\"6\" value=\"\">", $row['nr'], $row['nr']);
85 printf (" <img class=\"calendar\" src=\"<root_prefix>pix/calendar.gif\" onclick=\"event.cancelBubble=true;popcalendar('date_%d');\" alt=\"\">", $row['nr']);
86 printf (' <span class="%s">%d. %s %s (%.2f €)</span><br>',
87 $row['price'] < 0 ? 'out' : 'in',
88 $row['nr'], $date, $row['description'], $row['price']);
92 echo ("<p><input type=\"submit\" class=\"button\" value=\"Bezahlen\"> <input type=\"reset\" class=\"button\" value=\"Reset\"><p>");