#include #include #include "account.inc" > 0) && ($_POST[currency] == "dm")) { $table = "account_dm"; $value = "value_dm"; $add = "&cur=dm"; } $where[] = "blz_kto = '$_POST[blzkto]'"; if (strlen($_POST[year])) { $where[] = sprintf ("datum >= '%04d-01-01'", $_POST[year]); $year++; $where[] = sprintf ("datum < '%04d-01-01'", $_POST[year]+1); } if (strlen($_POST[deadline])) { $date = form_to_yyyymmdd ($_POST[deadline]); $where[] = sprintf ("datum < '%s'", $date); } if (strlen($_POST[statement])) { $where[] = "statement = '$_POST[statement]'"; } if (strlen($_POST[category])) { $where[] = "category = '$_POST[category]'"; } if (strlen($_POST[keyword])) { $where[] = "descr ~* '$_POST[keyword]'"; } if (strlen($_POST[from_to])) { $where[] = "from_to = '$_POST[from_to]'"; } if ($_POST[input] && !$_POST[output]) { $where[] = "$value > 0.0"; } elseif ($_POST[output] && !$_POST[input]) { $where[] = "$value < 0.0"; } $query = "SELECT datum,oid,category,descr,$value FROM $table WHERE " . implode ($where, " AND ") . " ORDER BY datum,oid"; $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!"); $sum = 0.0; $sum_in = 0.0; $sum_out = 0.0; $color = ""; for ($nr=0; $nr < pg_NumRows ($sth); $nr++) { $row = pg_fetch_array ($sth, $nr); $color = $color==""?"":""; $descr = explode (" ", $row['descr']); $date = explode (" ", $row['datum']); $date = explode ("-", $date[0]); $date = sprintf ("%d.%d.%d", $date[2], $date[1], $date[0]); printf ("", $color); printf ("", $date); printf ("", $row['category']); printf ("", $row['oid'], $add, $descr[0]); printf ("", $row[$value]); $sum += $row[$value]; if ($row[$value] > 0) { $sum_in += $row[$value]; } else { $sum_out += $row[$value]; } echo (""); } $color = $color==""?"":""; printf ("", $color); echo (""); printf ("", $sum); echo (""); if (strlen($statement)) { $color = $color==""?"":""; printf ("", $color); echo (""); printf ("", $sum_in); echo (""); $color = $color==""?"":""; printf ("", $color); echo (""); printf ("", $sum_out*-1); echo (""); } ?>
Datum Kategorie Verwendungszweck Betrag
%s%s%s%5.2f
Summe%5.2f
Summe Einnahmen%5.2f
Summe Ausgaben%5.2f

Neuer Eintrag", $_POST[blzkto]); ?> # Local variables: # mode: text # mode: auto-fill # end: