Letzte Aenderungen am Konto und Homelink
[infodrom.org/service.infodrom.org] / src / InfoCon / account / list.wml
1 #include <infocon.style>
2
3 <page title="Kontoführung">
4
5 <h1 align=center><font face="Helvetica,Arial">Kontoführung</font></h1>
6
7 <h3 align=center><font face="Helvetica,Arial"> - <?
8   $both = explode (":", $blzkto);
9   printf ("BLZ %s, Konto %s", $both[0], $both[1]);
10 ?> - </font></h1>
11
12 <table width=100% border=1 cellpadding=2 cellspacing=0>
13 <tr>
14   <th width=15%>Datum</th>
15   <th width=20%>Kategorie</th>
16   <th width=50%>Verwendungszweck</th>
17   <th width=15%>Betrag</th>
18 </tr>
19 <?
20   $dbh = pg_pconnect ("kuolema", "5432", "<db>")
21                or die("Unable to connect to SQL server");
22
23   pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
24
25   $where[] = "blz_kto = '$blzkto'";
26   if (strlen($year)) {
27     $where[] = "datum >= '$year-01-01'";
28     $year++;
29     $where[] = "datum < '$year-01-01'";
30   }
31   if (strlen($category)) {
32     $where[] = "category = '$category'";
33   }
34   if (strlen($from_to)) {
35     $where[] = "from_to = '$from_to'";
36   }
37   if ($input && !$output) {
38     $where[] = "value_dm > 0.0";
39   } elseif ($output && !$input) {
40     $where[] = "value_dm < 0.0";
41   }
42
43   $query = "SELECT datum,oid,category,descr,value_dm FROM account WHERE "
44          . implode ($where, " AND ")
45          . " ORDER BY datum,oid";
46   $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
47
48   $sum = 0.0;
49   for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
50     $row = pg_fetch_array ($sth, $nr);
51
52     $descr = explode ("
53 ", $row['descr']);
54     $date = explode (" ", $row['datum']);
55     $date = explode ("-", $date[0]);
56     $date = sprintf ("%d.%d.%d", $date[2], $date[1], $date[0]);
57
58     echo ("<tr>");
59     printf ("<td width=\"15%%\" align=\"right\">%s</td>", $date);
60     printf ("<td width=\"20%%\">%s</td>", $row['category']);
61     printf ("<td width=\"50%%\"><a href=\"edit.php3?oid=%d\">%s</a></td>", $row['oid'], $descr[0]);
62     printf ("<td width=\"15%%\" align=\"right\">%5.2f</td>", $row['value_dm']);
63     $sum += $row['value_dm'];
64     echo ("</tr>");
65   }
66     echo ("<tr>");
67     echo ("<td width=\"85%\" colspan=\"3\">Summe</td>");
68     printf ("<td width=\"15%%\" align=\"right\">%5.2f</td>", $sum);
69     echo ("</tr>");
70
71 ?>
72 </table><p>
73
74 <? printf ("<a href=\"edit.php3?blzkto=%s\">Neuer Eintrag</a>", $blzkto); ?>
75
76
77 </page>
78
79 # Local variables:
80 # mode: text
81 # mode: auto-fill
82 # mode: iso-accents
83 # end: