1 #include <infocon.style>
2 #include <phptools.inc>
5 <page func=InfoCon title="Kontoführung">
10 <table class="border smallfont" width=100% border=0 cellpadding=0 cellspacing=1>
12 <th width=10%>Datum</th>
13 <th width=10%>Kategorie</th>
14 <th width=70%>Verwendungszweck</th>
15 <th width=10%>Betrag</th>
21 if ((strlen ($_POST['currency']) > 0) && ($_POST['currency'] == "dm")) {
22 $table = "account_dm";
27 $where[] = sprintf("blz_kto = '%s'", $_POST['blzkto']);
28 if (strlen($_POST['year'])) {
29 $where[] = sprintf ("datum >= '%04d-01-01'", $_POST['year']);
31 $where[] = sprintf ("datum < '%04d-01-01'", $_POST['year']+1);
34 if (strlen($_POST[deadline]) && strlen(trim($_POST['deadline']))) {
35 $date = form_to_yyyymmdd ($_POST['deadline']);
36 $where[] = sprintf ("datum < '%s'", $date);
39 if (strlen($_POST['statement']) && strlen(trim($_POST['statement']))) {
40 $where[] = sprintf("statement = '%s'", $_POST['statement']);
43 if (strlen($_POST['category']) && strlen(trim($_POST['category']))) {
44 $where[] = sprintf("category = '%s'", $_POST['category']);
47 if (strlen($_POST['keyword']) && strlen(trim($_POST['keyword']))) {
48 $where[] = sprintf("descr ~* '%s'", $_POST['keyword']);
51 if (strlen($_POST['from_to']) && strlen(trim($_POST['from_to']))) {
52 $where[] = sprintf("from_to = '%s'", $_POST['from_to']);
55 if ($_POST['input'] && !$_POST['output']) {
56 $where[] = "$value > 0.0";
57 } elseif ($_POST['output'] && !$_POST['input']) {
58 $where[] = "$value < 0.0";
61 $query = "SELECT datum,id,category,descr,$value FROM $table WHERE "
62 . implode ($where, " AND ")
63 . " ORDER BY datum,id";
69 foreach ($db->fetchAssocList($query) as $row) {
72 $date = explode (" ", $row['datum']);
73 $date = explode ("-", $date[0]);
74 $date = sprintf ("%d.%d.%d", $date[2], $date[1], $date[0]);
76 printf ("<tr class=\"t%d\">", $color);
77 printf ("<td width=\"10%%\" align=\"right\">%s</td>", $date);
78 printf ("<td width=\"10%%\" align=\"center\">%s</td>", $row['category']);
79 printf ("<td width=\"70%%\"><a href=\"edit.php?id=%d%s\">%s</a></td>",
80 $row['id'], $add, $descr[0]);
81 printf ("<td width=\"10%%\" align=\"right\" class=\"%s\">%5.2f</td>",
82 $row[$value]>0?"in":"out", $row[$value]);
84 if ($row[$value] > 0) {
85 $sum_in += $row[$value];
87 $sum_out += $row[$value];
92 if (strlen($statement)) {
93 printf ("<tr class=\"t%d\">", $color);
94 echo ("<td width=\"90%\" colspan=\"3\"><strong>Summe Einnahmen</strong></td>");
95 printf ("<td width=\"10%%\" align=\"right\" class=\"in\">%5.2f</td>",$sum_in);
97 printf ("<tr class=\"t%d\">", $color);
98 echo ("<td width=\"90%\" colspan=\"3\"><strong>Summe Ausgaben</strong></td>");
99 printf ("<td width=\"10%%\" align=\"right\" class=\"out\">%5.2f</td>", $sum_out*-1);
102 printf ("<tr class=\"t%d\">", $color);
103 echo ("<td width=\"90%\" colspan=\"3\" align=\"left\"><strong>Summe</strong></td>");
104 printf ("<td width=\"10%%\" align=\"right\" class=\"%s\"><strong>%5.2f</strong></td>",
105 $sum>0?"in":"out", $sum);