This file belongs to the Webinterface of schokokeks.org Hosting

Written 2008-2012 by schokokeks.org Hosting, namely
  Bernd Wurst <bernd@schokokeks.org>
  Hanno Böck <hanno@schokokeks.org>

To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.

You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see 

Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code.




output('<p>Hier können Sie Ihre bisherigen Rechnungen einsehen und herunterladen.</p>');

$show_paid = (isset($_GET['paid']) && $_GET['paid'] == '1');

$invoices = my_invoices();

$invoices_to_show = array();
foreach ($invoices as $i) {
  if ($show_paid || $i['bezahlt'] == 0) {
    array_push($invoices_to_show, $i);

if (count($invoices_to_show) == 0) {
  $error = 'Keine Rechnungen gefunden.';
  if (count($invoices) == 0) {
    $error = 'Bisher keine Rechnungen vorhanden.';
  } else {
    $error = 'Keine offenen Rechnungen vorhanden. Klicken Sie auf den nachstehenden Link um bereits bezahlte Rechnungen zu sehen.';
  if ($show_paid) {

} else {

  foreach($invoices_to_show AS $invoice)
	  $bezahlt = 'Nein';
  	if ($invoice['bezahlt'] == 1)
	  	$bezahlt = 'Ja';
  	output("<tr><td>".internal_link("html", $invoice['id'], "id={$invoice['id']}")."</td><td>{$invoice['datum']}</td><td>{$invoice['betrag']} €</td><td>{$bezahlt}</td><td>".internal_link("pdf", "PDF", "id={$invoice['id']}").' &#160; '.internal_link("html", "HTML", "id={$invoice['id']}")."</td></tr>\n");

  output('</table><br />');

if (! $show_paid) {
  output('<p>'.internal_link('', 'Bereits bezahlte Rechnungen zeigen', 'paid=1').'</p>');
output('<p>'.internal_link('upcoming', 'Zukünftige Rechnungsposten anzeigen').'</p>');