<?php
echo "<fieldset>\n";
echo "	<legend>" . $legend . "</legend>\n";
echo "	<form action=\"index.php?section=" . $_GET['section'] . "\" method=\"post\">\n";

if ("0" == $result->num_rows)
{
	echo "<h2>Keine Datensätze \n";
}
elseif ("1" == $result->num_rows)
{
	echo "<h2>" . $result->num_rows . " Datensatz \n";
}
else
{
	echo "<h2>" . $result->num_rows . " Datensätze \n";
}
if (isset($_POST['search']))
{
	echo "gefunden";
}
else
{
	echo "in der Datenbank";
}
echo "</h2>\n";

echo "		<select name=\"ID\">\n";
while ($nt = $result->fetch_assoc())
{
	while (strlen($nt['ID']) < $_SESSION['Firma']['Stellen'])
	{
		$nt['ID'] = "0" . $nt['ID'];
	}
	echo "			<option value=\"" . $nt['Jahr'] . "_" . $nt['ID'] . "\">" . $nt['Jahr'] . "_" . $nt['ID'] . ", ";
	echo $nt['Nachname'] . ", " . $nt['Vorname'] . " - " . $nt['Firma'];
	if ("turnus" == $_GET['section'])
	{
		echo ": " . $nt['Datum'];
	}
	echo "</option>\n";
}
echo "		</select>\n";
echo "		<br />\n";
echo "		<br />\n";
echo "		<input type=\"submit\" name=\"formaction\" value=\"add\" title=\"" . $type . " anlegen\" class=\"button_add\" />\n";
echo "		<input type=\"submit\" name=\"formaction\" value=\"edit\" title=\"" . $type . " bearbeiten\" class=\"button_edit\" />\n";
echo "		<input type=\"submit\" name=\"formaction\" value=\"del\" title=\"" . $type . " löschen\" class=\"button_del\" />\n";
if ("turnus" != $_GET['section'])
{
	echo "		<input type=\"submit\" name=\"formaction\" value=\"view\" title=\"" . $type . " anzeigen\" class=\"button_view\" />\n";
	echo "		<input type=\"submit\" name=\"formaction\" value=\"email\" title=\"" . $type . " per EMail versenden\" class=\"button_email\" />\n";
}
if (("lv" == $_GET['section']) OR ("angebot" == $_GET['section']) OR ("schrift" == $_GET['section']))
{
	echo "		<input type=\"submit\" name=\"formaction\" value=\"copy\" title=\"" . $type . " kopieren\" class=\"button_copy\" />\n";
}
if ("lv" == $_GET['section'])
{
	if ($_SESSION['Firma']['KfZ'])
	{
		echo "		<input type=\"submit\" name=\"formaction\" value=\"create\" title=\"Bestätigung erzeugen\" class=\"button_best\" />\n";
	}
	else
	{
		echo "		<input type=\"submit\" name=\"formaction\" value=\"create\" title=\"Angebot erzeugen\" class=\"button_ang\" />\n";
	}
}
elseif ("angebot" == $_GET['section'])
{
	echo "		<input type=\"submit\" name=\"formaction\" value=\"create\" title=\"Bestätigung erzeugen\" class=\"button_best\" />\n";
}
elseif ("bestaet" == $_GET['section'])
{
	echo "		<input type=\"submit\" name=\"formaction\" value=\"rcreate\" title=\"Rechnung erzeugen\" class=\"button_rech\" />\n";
	echo "		<input type=\"submit\" name=\"formaction\" value=\"lcreate\" title=\"Lieferschein erzeugen\" class=\"button_liefer\" />\n";
}
elseif ("rechnung" == $_GET['section'])
{
	echo "		<input type=\"submit\" name=\"formaction\" value=\"lcreate\" title=\"Lieferschein erzeugen\" class=\"button_liefer\" />\n";
	echo "		<input type=\"submit\" name=\"formaction\" value=\"gcreate\" title=\"Gutschrift erzeugen\" class=\"button_gut\" />\n";
}
elseif (("liefer" == $_GET['section']) OR ("turnus" == $_GET['section']))
{
	echo "		<input type=\"submit\" name=\"formaction\" value=\"create\" title=\"Rechnung erzeugen\" class=\"button_rech\" />\n";
}
echo "	</form>\n";
echo "</fieldset>\n";