#include <phptools.inc>
#include "account.inc"
-<page func=InfoCon title="Kontoführung">
-
-<account_heading>
-<form_to_yyyymmdd>
-
-<table class="border smallfont" width=100% border=0 cellpadding=0 cellspacing=1>
-<tr class=head>
- <th width=10%>Datum</th>
- <th width=10%>Kategorie</th>
- <th width=70%>Verwendungszweck</th>
- <th width=10%>Betrag</th>
-</tr>
-<?
+<?php
+function filter_account()
+{
+ global $db;
+ $out = '';
$table = "account";
$value = "value_eur";
$add = '';
$date = explode ("-", $date[0]);
$date = sprintf ("%d.%d.%d", $date[2], $date[1], $date[0]);
- printf ("<tr class=\"t%d\">", $color);
- printf ("<td width=\"10%%\" align=\"right\">%s</td>", $date);
- printf ("<td width=\"10%%\" align=\"center\">%s</td>", $row['category']);
- printf ("<td width=\"70%%\"><a href=\"edit.php?id=%d%s\">%s</a></td>",
+ $out .= sprintf ("<tr class=\"t%d\">", $color);
+ $out .= sprintf ("<td width=\"10%%\" align=\"right\">%s</td>", $date);
+ $out .= sprintf ("<td width=\"10%%\" align=\"center\">%s</td>", $row['category']);
+ $out .= sprintf ("<td width=\"70%%\"><a href=\"edit.php?id=%d%s\">%s</a></td>",
$row['id'], $add, $descr[0]);
- printf ("<td width=\"10%%\" align=\"right\" class=\"%s\">%5.2f</td>",
+ $out .= sprintf ("<td width=\"10%%\" align=\"right\" class=\"%s\">%5.2f</td>",
$row[$value]>0?"in":"out", $row[$value]);
$sum += $row[$value];
if ($row[$value] > 0) {
} else {
$sum_out += $row[$value];
}
- echo ("</tr>");
+ $out .= "</tr>";
$color = !$color;
}
- if (strlen($statement)) {
- printf ("<tr class=\"t%d\">", $color);
- echo ("<td width=\"90%\" colspan=\"3\"><strong>Summe Einnahmen</strong></td>");
- printf ("<td width=\"10%%\" align=\"right\" class=\"in\">%5.2f</td>",$sum_in);
- echo ("</tr>");
- printf ("<tr class=\"t%d\">", $color);
- echo ("<td width=\"90%\" colspan=\"3\"><strong>Summe Ausgaben</strong></td>");
- printf ("<td width=\"10%%\" align=\"right\" class=\"out\">%5.2f</td>", $sum_out*-1);
- echo ("</tr>");
- }
- printf ("<tr class=\"t%d\">", $color);
- echo ("<td width=\"90%\" colspan=\"3\" align=\"left\"><strong>Summe</strong></td>");
- printf ("<td width=\"10%%\" align=\"right\" class=\"%s\"><strong>%5.2f</strong></td>",
- $sum>0?"in":"out", $sum);
- echo ("</tr>");
-
+ if (strlen($statement)) {
+ $out .= sprintf ("<tr class=\"t%d\">", $color);
+ $out .= "<td width=\"90%\" colspan=\"3\"><strong>Summe Einnahmen</strong></td>";
+ $out .= sprintf ("<td width=\"10%%\" align=\"right\" class=\"in\">%5.2f</td>",$sum_in);
+ $out .= "</tr>";
+ $out .= sprintf ("<tr class=\"t%d\">", $color);
+ $out .= "<td width=\"90%\" colspan=\"3\"><strong>Summe Ausgaben</strong></td>";
+ $out .= sprintf ("<td width=\"10%%\" align=\"right\" class=\"out\">%5.2f</td>", $sum_out*-1);
+ $out .= "</tr>";
+ }
+ $out .= sprintf ("<tr class=\"t%d\">", $color);
+ $out .= "<td width=\"90%\" colspan=\"3\" align=\"left\"><strong>Summe</strong></td>";
+ $out .= sprintf ("<td width=\"10%%\" align=\"right\" class=\"%s\"><strong>%5.2f</strong></td>",
+ $sum>0?"in":"out", $sum);
+ $out .= "</tr>";
+
+ return $out;
+}
?>
+
+<page func=InfoCon title="Kontoführung">
+
+<account_heading>
+<form_to_yyyymmdd>
+
+<table class="border smallfont" width=100% border=0 cellpadding=0 cellspacing=1>
+<thead>
+<tr class=head>
+ <th width=10%>Datum</th>
+ <th width=10%>Kategorie</th>
+ <th width=70%>Verwendungszweck</th>
+ <th width=10%>Betrag</th>
+</tr>
+</thead>
+<tbody>
+<?=filter_account()?>
+</tbody>
</table><p>
<protect><script type="text/javascript">