<?php
@session_start();

if ( strtolower( $_SESSION[ "benutzer_anmeldename" ] ) <> "superuser" )
{
	$_SESSION[ "benutzer_anmeldename" ] = "";
	header("Location: index.php");
}

$_SESSION[ "title" ] = "Mandanten";
include( 'ssi_header.php' );
$_SESSION[ "title" ] = "";

$mandanten = liefere_alle_mandanten( true );


	include( "su_menu.php" );

	echo "<div style='margin-left:200px; padding-bottom:30px;  min-height:550px;'>";
	
	
	
	
	
	
	
	
	
	
	//onclick="fuelle_element( \'mandant_ergebnis_3\', \'\' ); ajaxFunction( \'su_web.php?cmd=liefere_mandant&mandant_name=\'+encodeURIComponent( this.value ), \'mandant_ergebnis_1\' ); ajaxFunction( \'su_web.php?cmd=liefere_mandant_optionen&mandant_name=\'+encodeURIComponent( this.value ), \'mandant_ergebnis_2\' );"
	
	echo '<select size="20" name="users" id="select_style_1"  onchange="fuelle_element( \'mandant_ergebnis_3\', \'\' ); ajaxFunction( \'su_web.php?cmd=liefere_mandant&mandant_name=\'+encodeURIComponent( this.value ), \'mandant_ergebnis_1\' ); ajaxFunction( \'su_web.php?cmd=liefere_mandant_optionen&mandant_name=\'+encodeURIComponent( this.value ), \'mandant_ergebnis_2\' );"  >';


	foreach ( $mandanten[ 2 ] as $mandant )
	{
		
		echo "<option value='".$mandant."'>".$mandant."</option>";
		
		//$mandant_info = liefere_mandant( $mandant );
		
		//echo "<tr><td>".$mandant_info[ 2 ][ "mandant_id" ]."</td><td>".$mandant_info[ 2 ][ "mandant_name" ]."</td><td>".date( "d.m.Y", $mandant_info[ 2 ][ "mandant_erstellt_am" ] )."</td><td>".$mandant_info[ 2 ][ "mandant_lizenz" ]."</td></tr>";
		
	}

	echo "</select>";
	
	




?>
	<div name="mandant_ergebnis_1" id="mandant_ergebnis_1" style=" vertical-align:top;  position:absolute;  display:inline; margin-top:10px;" ></div>
	
	


<div name="mandant_ergebnis_2" id="mandant_ergebnis_2" style=" margin-top:10px;" ><input type="button" value="Anlegen" style="width:150px;margin-left:10px;" onclick="ajaxFunction( 'su_web.php?cmd=mandant_anlegen', 'mandant_ergebnis_3' );" /></div>

<?php
	
	echo '<div name="mandant_ergebnis_3" id="mandant_ergebnis_3" style=" margin-top:10px;" >'.$_SESSION[ "meldung_su" ].'</div>';
	$_SESSION[ "meldung_su" ] = "";
	//echo '<div name="mandant_ergebnis_4" id="mandant_ergebnis_4" style=" border: 1px solid white; margin-top:10px;" >4</div>';


	//echo "<p style='height:200px;' />";
	echo '</div>';
echo "<p style='clear:both;' />";
include( 'ssi_footer.php' );

?>