<?php
if (!in_array("Rechte", $_SESSION['Rechte'])) {
	exit(ZUGRIFF_ERROR);
}
if (!isset($_SESSION['ID'])) {
} else {
// Wohnimmobilien - Abfrage
	$sql =		"SELECT Count(*) AS Anz, SUM(Count) AS Zugriffe FROM objekte WHERE O_TYP = \"Wohnung\" AND V_TYP = \"Miete\" AND Aktiv = \"1\";";
	$result =	$db->query($sql);
	$wma =		$result->fetch_assoc();
	$sql =		"SELECT Count(*) AS Anz, SUM(Count) AS Zugriffe FROM objekte WHERE O_TYP = \"Wohnung\" AND V_TYP = \"Miete\" AND Aktiv = \"0\";";
	$result =	$db->query($sql);
	$wmi =		$result->fetch_assoc();
	$sql =		"SELECT Count(*) AS Anz, SUM(Count) AS Zugriffe FROM objekte WHERE O_TYP = \"Wohnung\" AND V_TYP = \"Kauf\" AND Aktiv = \"1\";";
	$result =	$db->query($sql);
	$wka =		$result->fetch_assoc();
	$sql =		"SELECT Count(*) AS Anz, SUM(Count) AS Zugriffe FROM objekte WHERE O_TYP = \"Wohnung\" AND V_TYP = \"Kauf\" AND Aktiv = \"0\";";
	$result =	$db->query($sql);
	$wki =		$result->fetch_assoc();
	$sql =		"SELECT Count(*) AS Anz, SUM(Count) AS Zugriffe FROM objekte WHERE O_TYP = \"Haus\" AND V_TYP = \"Miete\" AND Aktiv = \"1\";";
	$result =	$db->query($sql);
	$hma =		$result->fetch_assoc();
	$sql =		"SELECT Count(*) AS Anz, SUM(Count) AS Zugriffe FROM objekte WHERE O_TYP = \"Haus\" AND V_TYP = \"Miete\" AND Aktiv = \"0\";";
	$result =	$db->query($sql);
	$hmi =		$result->fetch_assoc();
	$sql =		"SELECT Count(*) AS Anz, SUM(Count) AS Zugriffe FROM objekte WHERE O_TYP = \"Haus\" AND V_TYP = \"Kauf\" AND Aktiv = \"1\";";
	$result =	$db->query($sql);
	$hka =		$result->fetch_assoc();
	$sql =		"SELECT Count(*) AS Anz, SUM(Count) AS Zugriffe FROM objekte WHERE O_TYP = \"Haus\" AND V_TYP = \"Kauf\" AND Aktiv = \"0\";";
	$result =	$db->query($sql);
	$hki =		$result->fetch_assoc();
// Berechnungen zu Wohnimmobilien
	// Wohnungen
	$wmg['Anz'] =		$wma['Anz'] + $wmi['Anz'];
	$wkg['Anz'] =		$wka['Anz'] + $wki['Anz'];
	$wa['Anz'] =		$wma['Anz'] + $wka['Anz'];
	$wi['Anz'] =		$wmi['Anz'] + $wki['Anz'];
	$wg['Anz'] =		$wa['Anz'] + $wi['Anz'];
	$wmg['Zugriffe'] =	$wma['Zugriffe'] + $wmi['Zugriffe'];
	$wkg['Zugriffe'] =	$wka['Zugriffe'] + $wki['Zugriffe'];
	$wg['Zugriffe'] =	$wmg['Zugriffe'] + $wkg['Zugriffe'];
	// Häuser
	$hmg['Anz'] =		$hma['Anz'] + $hmi['Anz'];
	$hkg['Anz'] =		$hka['Anz'] + $hki['Anz'];
	$ha['Anz'] =		$hma['Anz'] + $hka['Anz'];
	$hi['Anz'] =		$hmi['Anz'] + $hki['Anz'];
	$hg['Anz'] =		$ha['Anz'] + $hi['Anz'];
	$hmg['Zugriffe'] =	$hma['Zugriffe'] + $hmi['Zugriffe'];
	$hkg['Zugriffe'] =	$hka['Zugriffe'] + $hki['Zugriffe'];
	$hg['Zugriffe'] =	$hmg['Zugriffe'] + $hkg['Zugriffe'];
	// Miete
	$wima['Anz'] =		$wma['Anz'] + $hma['Anz'];
	$wimi['Anz'] =		$wmi['Anz'] + $hmi['Anz'];
	$wimg['Anz'] =		$wima['Anz'] + $wimi['Anz'];
	$wimg['Zugriffe'] =	$wmg['Zugriffe'] + $hmg['Zugriffe'];
	// Kauf
	$wika['Anz'] =		$wka['Anz'] + $hka['Anz'];
	$wiki['Anz'] =		$wki['Anz'] + $hki['Anz'];
	$wikg['Anz'] =		$wika['Anz'] + $wiki['Anz'];
	$wikg['Zugriffe'] =	$wkg['Zugriffe'] + $hkg['Zugriffe'];
	// Alle
	$wia['Anz'] =		$wa['Anz'] + $ha['Anz'];
	$wii['Anz'] =		$wi['Anz'] + $hi['Anz'];
	$wig['Anz'] =		$wia['Anz'] + $wii['Anz'];
	$wig['Zugriffe'] =	$wg['Zugriffe'] + $hg['Zugriffe'];

// Gewerbeimmobilien - Abfrage
	$sql =		"SELECT Count(*) AS Anz, SUM(Count) AS Zugriffe FROM objekte WHERE (O_TYP = \"Büro\" OR O_TYP = \"Praxis\") AND Aktiv = \"1\";";
	$result =	$db->query($sql);
	$bpa =		$result->fetch_assoc();
	$sql =		"SELECT Count(*) AS Anz, SUM(Count) AS Zugriffe FROM objekte WHERE (O_TYP = \"Büro\" OR O_TYP = \"Praxis\") AND Aktiv = \"0\";";
	$result =	$db->query($sql);
	$bpi =		$result->fetch_assoc();
	$sql =		"SELECT Count(*) AS Anz, SUM(Count) AS Zugriffe FROM objekte WHERE (O_TYP = \"Einzelhandel\" OR O_TYP = \"Industrie\") AND Aktiv = \"1\";";
	$result =	$db->query($sql);
	$eia =		$result->fetch_assoc();
	$sql =		"SELECT Count(*) AS Anz, SUM(Count) AS Zugriffe FROM objekte WHERE (O_TYP = \"Einzelhandel\" OR O_TYP = \"Industrie\") AND Aktiv = \"0\";";
	$result =	$db->query($sql);
	$eii =		$result->fetch_assoc();
	$sql =		"SELECT Count(*) AS Anz, SUM(Count) AS Zugriffe FROM objekte WHERE (O_TYP = \"Gastronomie\" OR O_TYP = \"Hotel\") AND Aktiv = \"1\";";
	$result =	$db->query($sql);
	$gha =		$result->fetch_assoc();
	$sql =		"SELECT Count(*) AS Anz, SUM(Count) AS Zugriffe FROM objekte WHERE (O_TYP = \"Gastronomie\" OR O_TYP = \"Hotel\") AND Aktiv = \"0\";";
	$result =	$db->query($sql);
	$ghi =		$result->fetch_assoc();
	$sql =		"SELECT Count(*) AS Anz, SUM(Count) AS Zugriffe FROM objekte WHERE O_TYP = \"Multifunktion\" AND Aktiv = \"1\";";
	$result =	$db->query($sql);
	$mfa =		$result->fetch_assoc();
	$sql =		"SELECT Count(*) AS Anz, SUM(Count) AS Zugriffe FROM objekte WHERE O_TYP = \"Multifunktion\" AND Aktiv = \"0\";";
	$result =	$db->query($sql);
	$mfi =		$result->fetch_assoc();
	$sql =		"SELECT Count(*) AS Anz, SUM(Count) AS Zugriffe FROM objekte WHERE KAT = \"gewerbe\" AND V_TYP = \"Miete\" AND Aktiv = \"1\";";
	$result =	$db->query($sql);
	$gma =		$result->fetch_assoc();
	$sql =		"SELECT Count(*) AS Anz, SUM(Count) AS Zugriffe FROM objekte WHERE KAT = \"gewerbe\" AND V_TYP = \"Miete\" AND Aktiv = \"0\";";
	$result =	$db->query($sql);
	$gmi =		$result->fetch_assoc();
// Berechnungen zu Gewerbeimmobilien
	$bpg['Anz'] =		$bpa['Anz'] + $bpi['Anz'];
	$eig['Anz'] =		$eia['Anz'] + $eii['Anz'];
	$ghg['Anz'] =		$gha['Anz'] + $ghi['Anz'];
	$mfg['Anz'] =		$mfa['Anz'] + $mfi['Anz'];
	$bpg['Zugriffe'] =	$bpa['Zugriffe'] + $bpi['Zugriffe'];
	$eig['Zugriffe'] =	$eia['Zugriffe'] + $eii['Zugriffe'];
	$ghg['Zugriffe'] =	$gha['Zugriffe'] + $ghi['Zugriffe'];
	$mfg['Zugriffe'] =	$mfa['Zugriffe'] + $mfi['Zugriffe'];
	// Alle
	$gia['Anz'] =		$bpa['Anz'] + $eia['Anz'] + $gha['Anz'] + $mfa['Anz'];
	$gii['Anz'] =		$bpi['Anz'] + $eii['Anz'] + $ghi['Anz'] + $mfi['Anz'];
	$gig['Anz'] =		$bpg['Anz'] + $eig['Anz'] + $ghg['Anz'] + $mfg['Anz'];
	$gig['Zugriffe'] =	$bpg['Zugriffe'] + $eig['Zugriffe'] + $ghg['Zugriffe'] + $mfg['Zugriffe'];
	// Gewerbe Miete
	$gmg['Anz'] =		$gma['Anz'] + $gmi['Anz'];
	$gmg['Zugriffe'] =	$gma['Zugriffe'] + $gmi['Zugriffe'];
	// Gewerbe Kauf
	$gka['Anz'] =		$gia['Anz'] - $gma['Anz'];
	$gki['Anz'] =		$gii['Anz'] - $gmi['Anz'];
	$gkg['Anz'] =		$gka['Anz'] + $gki['Anz'];
	$gkg['Zugriffe'] =	$gig['Zugriffe'] - $gmg['Zugriffe'];

// Abfragen zu sonstigen Immobilien
	$sql =		"SELECT Count(*) AS Anz, SUM(Count) AS Zugriffe FROM objekte WHERE KAT = \"andere\" AND Aktiv = \"1\";";
	$result =	$db->query($sql);
	$sia =		$result->fetch_assoc();
	$sql =		"SELECT Count(*) AS Anz, SUM(Count) AS Zugriffe FROM objekte WHERE KAT = \"andere\" AND Aktiv = \"0\";";
	$result =	$db->query($sql);
	$sii =		$result->fetch_assoc();
	$sql =		"SELECT Count(*) AS Anz, SUM(Count) AS Zugriffe FROM objekte WHERE O_TYP = \"ausland\" AND Aktiv = \"1\";";
	$result =	$db->query($sql);
	$aia =		$result->fetch_assoc();
	$sql =		"SELECT Count(*) AS Anz, SUM(Count) AS Zugriffe FROM objekte WHERE O_TYP = \"ausland\" AND Aktiv = \"0\";";
	$result =	$db->query($sql);
	$aii =		$result->fetch_assoc();
	$sql =		"SELECT Count(*) AS Anz, SUM(Count) AS Zugriffe FROM objekte WHERE O_TYP = \"rendite\" AND Aktiv = \"1\";";
	$result =	$db->query($sql);
	$ria =		$result->fetch_assoc();
	$sql =		"SELECT Count(*) AS Anz, SUM(Count) AS Zugriffe FROM objekte WHERE O_TYP = \"rendite\" AND Aktiv = \"0\";";
	$result =	$db->query($sql);
	$rii =		$result->fetch_assoc();
	$sql =		"SELECT Count(*) AS Anz, SUM(Count) AS Zugriffe FROM objekte WHERE O_TYP = \"grund\" AND Aktiv = \"1\";";
	$result =	$db->query($sql);
	$gsa =		$result->fetch_assoc();
	$sql =		"SELECT Count(*) AS Anz, SUM(Count) AS Zugriffe FROM objekte WHERE O_TYP = \"grund\" AND Aktiv = \"0\";";
	$result =	$db->query($sql);
	$gsi =		$result->fetch_assoc();
	
// Berechnungen zu sonstigen Immobilien
	$sig['Anz'] =		$sia['Anz'] + $sii['Anz'];
	$aig['Anz'] =		$aia['Anz'] + $aii['Anz'];
	$rig['Anz'] =		$ria['Anz'] + $rii['Anz'];
	$gsg['Anz'] =		$gsa['Anz'] + $gsi['Anz'];
	$sig['Zugriffe'] =	$sia['Zugriffe'] + $sii['Zugriffe'];
	$aig['Zugriffe'] =	$aia['Zugriffe'] + $aii['Zugriffe'];
	$rig['Zugriffe'] =	$ria['Zugriffe'] + $rii['Zugriffe'];
	$gsg['Zugriffe'] =	$gsa['Zugriffe'] + $gsi['Zugriffe'];
	
// Berechnungen zu allen Immobilientypen
	$aoa['Anz'] =		$wia['Anz'] + $gia['Anz'] + $sia['Anz'];
	$aoi['Anz'] =		$wii['Anz'] + $gii['Anz'] + $sii['Anz'];
	$aog['Anz'] =		$wig['Anz'] + $gig['Anz'] + $sig['Anz'];
	$aog['Zugriffe'] =	$wig['Zugriffe'] + $gig['Zugriffe'] + $sig['Zugriffe'];
	
	echo "<h2>Übersicht</h2>\n";

	echo "<table class=\"Stat\">\n";
	echo "	<colgroup>\n";
	echo "		<col width=\"200px\" />\n";
	echo "		<col span=\"4\" width=\"70px\" />\n";
	echo "	</colgroup>\n";
	echo "	<tr>\n";
	echo "		<th colspan=\"5\">alle Immobilien</th>\n";
	echo "	</tr>\n";
	echo "	<tr class=\"underline\">\n";
	echo "		<td>Typ</td>\n";
	echo "		<td>Aktiv</td>\n";
	echo "		<td>Inaktiv</td>\n";
	echo "		<td>Gesamt</td>\n";
	echo "		<td>Zugriffe</td>\n";
	echo "	</tr>\n";
	echo "	<tr>\n";
	echo "		<td>Wohnimmobilien</td>\n";
	echo "		<td>".$wia['Anz']."</td>\n";
	echo "		<td>".$wii['Anz']."</td>\n";
	echo "		<td>".$wig['Anz']."</td>\n";
	echo "		<td>".$wig['Zugriffe']."</td>\n";
	echo "	</tr>\n";
	echo "	<tr>\n";
	echo "		<td>Gewerbeimmobilien</td>\n";
	echo "		<td>".$gia['Anz']."</td>\n";
	echo "		<td>".$gii['Anz']."</td>\n";
	echo "		<td>".$gig['Anz']."</td>\n";
	echo "		<td>".$gig['Zugriffe']."</td>\n";
	echo "	</tr>\n";
	echo "	<tr>\n";
	echo "		<td>Sonstige Immobilien</td>\n";
	echo "		<td>".$sia['Anz']."</td>\n";
	echo "		<td>".$sii['Anz']."</td>\n";
	echo "		<td>".$sig['Anz']."</td>\n";
	echo "		<td>".$sig['Zugriffe']."</td>\n";
	echo "	</tr>\n";
	echo "	<tr class=\"Summe\">\n";
	echo "		<td>Alle Immobilien</td>\n";
	echo "		<td>".$aoa['Anz']."</td>\n";
	echo "		<td>".$aoi['Anz']."</td>\n";
	echo "		<td>".$aog['Anz']."</td>\n";
	echo "		<td>".$aog['Zugriffe']."</td>\n";
	echo "	</tr>\n";
	
	echo "	<tr>\n";
	echo "		<th colspan=\"5\">Wohnimmobilien</th>\n";
	echo "	</tr>\n";
	echo "	<tr class=\"underline\">\n";
	echo "		<td>Typ</th>\n";
	echo "		<td>Aktiv</th>\n";
	echo "		<td>Inaktiv</th>\n";
	echo "		<td>Gesamt</th>\n";
	echo "		<td>Zugriffe</th>\n";
	echo "	</tr>\n";
	echo "	<tr>\n";
	echo "		<td>Wohnungen</td>\n";
	echo "		<td>".$wa['Anz']."</td>\n";
	echo "		<td>".$wi['Anz']."</td>\n";
	echo "		<td>".$wg['Anz']."</td>\n";
	echo "		<td>".$wg['Zugriffe']."</td>\n";
	echo "	</tr>\n";
	echo "	<tr>\n";
	echo "		<td>Häuser</td>\n";
	echo "		<td>".$ha['Anz']."</td>\n";
	echo "		<td>".$hi['Anz']."</td>\n";
	echo "		<td>".$hg['Anz']."</td>\n";
	echo "		<td>".$hg['Zugriffe']."</td>\n";
	echo "	</tr>\n";
	echo "	<tr class=\"Summe\">\n";
	echo "		<td>alle Wohnimmobilien</td>\n";
	echo "		<td>".$wia['Anz']."</td>\n";
	echo "		<td>".$wii['Anz']."</td>\n";
	echo "		<td>".$wig['Anz']."</td>\n";
	echo "		<td>".$wig['Zugriffe']."</td>\n";
	echo "	</tr>\n";
	echo "	<tr>\n";
	echo "		<td>Mietobjekte</td>\n";
	echo "		<td>".$wima['Anz']."</td>\n";
	echo "		<td>".$wimi['Anz']."</td>\n";
	echo "		<td>".$wimg['Anz']."</td>\n";
	echo "		<td>".$wimg['Zugriffe']."</td>\n";
	echo "	</tr>\n";
	echo "	<tr>\n";
	echo "		<td>Kaufobjekte</td>\n";
	echo "		<td>".$wika['Anz']."</td>\n";
	echo "		<td>".$wiki['Anz']."</td>\n";
	echo "		<td>".$wikg['Anz']."</td>\n";
	echo "		<td>".$wikg['Zugriffe']."</td>\n";
	echo "	</tr>\n";
	echo "	<tr class=\"Summe\">\n";
	echo "		<td>alle Wohnimmobilien</td>\n";
	echo "		<td>".$wia['Anz']."</td>\n";
	echo "		<td>".$wii['Anz']."</td>\n";
	echo "		<td>".$wig['Anz']."</td>\n";
	echo "		<td>".$wig['Zugriffe']."</td>\n";
	echo "	</tr>\n";
	echo "	<tr>\n";
	echo "		<td>Wohnungen - Miete</td>\n";
	echo "		<td>".$wma['Anz']."</td>\n";
	echo "		<td>".$wmi['Anz']."</td>\n";
	echo "		<td>".$wmg['Anz']."</td>\n";
	echo "		<td>".$wmg['Zugriffe']."</td>\n";
	echo "	</tr>\n";
	echo "	<tr>\n";
	echo "		<td>Wohnungen - Kauf</td>\n";
	echo "		<td>".$wka['Anz']."</td>\n";
	echo "		<td>".$wki['Anz']."</td>\n";
	echo "		<td>".$wkg['Anz']."</td>\n";
	echo "		<td>".$wkg['Zugriffe']."</td>\n";
	echo "	</tr>\n";
	echo "	<tr class=\"Summe\">\n";
	echo "		<td>alle Wohnungen</td>\n";
	echo "		<td>".$wa['Anz']."</td>\n";
	echo "		<td>".$wi['Anz']."</td>\n";
	echo "		<td>".$wg['Anz']."</td>\n";
	echo "		<td>".$wg['Zugriffe']."</td>\n";
	echo "	</tr>\n";
	echo "	<tr>\n";
	echo "		<td>Häuser - Miete</td>\n";
	echo "		<td>".$hma['Anz']."</td>\n";
	echo "		<td>".$hmi['Anz']."</td>\n";
	echo "		<td>".$hmg['Anz']."</td>\n";
	echo "		<td>".$hmg['Zugriffe']."</td>\n";
	echo "	</tr>\n";
	echo "	<tr>\n";
	echo "		<td>Häuser - Kauf</td>\n";
	echo "		<td>".$hka['Anz']."</td>\n";
	echo "		<td>".$hki['Anz']."</td>\n";
	echo "		<td>".$hkg['Anz']."</td>\n";
	echo "		<td>".$hkg['Zugriffe']."</td>\n";
	echo "	</tr>\n";
	echo "	<tr class=\"Summe\">\n";
	echo "		<td>alle Häuser</td>\n";
	echo "		<td>".$ha['Anz']."</td>\n";
	echo "		<td>".$hi['Anz']."</td>\n";
	echo "		<td>".$hg['Anz']."</td>\n";
	echo "		<td>".$hg['Zugriffe']."</td>\n";
	echo "	</tr>\n";

	echo "	<tr>\n";
	echo "		<th colspan=\"5\">Gewerbeimmobilien</th>\n";
	echo "	</tr>\n";
	echo "	<tr class=\"underline\">\n";
	echo "		<td>Typ</th>\n";
	echo "		<td>Aktiv</th>\n";
	echo "		<td>Inaktiv</th>\n";
	echo "		<td>Gesamt</th>\n";
	echo "		<td>Zugriffe</th>\n";
	echo "	</tr>\n";
	echo "	<tr>\n";
	echo "		<td>Büros / Praxen</td>\n";
	echo "		<td>".$bpa['Anz']."</td>\n";
	echo "		<td>".$bpi['Anz']."</td>\n";
	echo "		<td>".$bpg['Anz']."</td>\n";
	echo "		<td>".$bpg['Zugriffe']."</td>\n";
	echo "	</tr>\n";
	echo "	<tr>\n";
	echo "		<td>Einzelhandel / Industrie</td>\n";
	echo "		<td>".$eia['Anz']."</td>\n";
	echo "		<td>".$eii['Anz']."</td>\n";
	echo "		<td>".$eig['Anz']."</td>\n";
	echo "		<td>".$eig['Zugriffe']."</td>\n";
	echo "	</tr>\n";
	echo "	<tr>\n";
	echo "		<td>Gastronomie / Hotels</td>\n";
	echo "		<td>".$gha['Anz']."</td>\n";
	echo "		<td>".$ghi['Anz']."</td>\n";
	echo "		<td>".$ghg['Anz']."</td>\n";
	echo "		<td>".$ghg['Zugriffe']."</td>\n";
	echo "	</tr>\n";
	echo "	<tr>\n";
	echo "		<td>Multifunktionsobjekte</td>\n";
	echo "		<td>".$mfa['Anz']."</td>\n";
	echo "		<td>".$mfi['Anz']."</td>\n";
	echo "		<td>".$mfg['Anz']."</td>\n";
	echo "		<td>".$mfg['Zugriffe']."</td>\n";
	echo "	</tr>\n";
	echo "	<tr class=\"Summe\">\n";
	echo "		<td>Alle Gewerbeimmobilien</td>\n";
	echo "		<td>".$gia['Anz']."</td>\n";
	echo "		<td>".$gii['Anz']."</td>\n";
	echo "		<td>".$gig['Anz']."</td>\n";
	echo "		<td>".$gig['Zugriffe']."</td>\n";
	echo "	</tr>\n";
	echo "	<tr>\n";
	echo "		<td>Mietobjekte</td>\n";
	echo "		<td>".$gma['Anz']."</td>\n";
	echo "		<td>".$gmi['Anz']."</td>\n";
	echo "		<td>".$gmg['Anz']."</td>\n";
	echo "		<td>".$gmg['Zugriffe']."</td>\n";
	echo "	<tr>\n";
	echo "	<tr>\n";
	echo "		<td>Kaufobjekte</td>\n";
	echo "		<td>".$gka['Anz']."</td>\n";
	echo "		<td>".$gki['Anz']."</td>\n";
	echo "		<td>".$gkg['Anz']."</td>\n";
	echo "		<td>".$gkg['Zugriffe']."</td>\n";
	echo "	<tr>\n";
	echo "	<tr class=\"Summe\">\n";
	echo "		<td>Alle Gewerbeimmobilien</td>\n";
	echo "		<td>".$gia['Anz']."</td>\n";
	echo "		<td>".$gii['Anz']."</td>\n";
	echo "		<td>".$gig['Anz']."</td>\n";
	echo "		<td>".$gig['Zugriffe']."</td>\n";
	echo "	</tr>\n";

	echo "	<tr>\n";
	echo "		<th colspan=\"5\">Sonstige Immobilien</th>\n";
	echo "	</tr>\n";
	echo "	<tr class=\"underline\">\n";
	echo "		<td>Typ</td>\n";
	echo "		<td>Aktiv</td>\n";
	echo "		<td>Inaktiv</td>\n";
	echo "		<td>Gesamt</td>\n";
	echo "		<td>Zugriffe</td>\n";
	echo "	</tr>\n";
	echo "	<tr>\n";
	echo "		<td>Auslandsimmobilien</td>\n";
	echo "		<td>".$aia['Anz']."</td>\n";
	echo "		<td>".$aii['Anz']."</td>\n";
	echo "		<td>".$aig['Anz']."</td>\n";
	echo "		<td>".$aig['Zugriffe']."</td>\n";
	echo "	</tr>\n";
	echo "	<tr>\n";
	echo "		<td>Renditeimmobilien</td>\n";
	echo "		<td>".$ria['Anz']."</td>\n";
	echo "		<td>".$rii['Anz']."</td>\n";
	echo "		<td>".$rig['Anz']."</td>\n";
	echo "		<td>".$rig['Zugriffe']."</td>\n";
	echo "	</tr>\n";
	echo "	<tr>\n";
	echo "		<td>Grundstücke</td>\n";
	echo "		<td>".$gsa['Anz']."</td>\n";
	echo "		<td>".$gsi['Anz']."</td>\n";
	echo "		<td>".$gsg['Anz']."</td>\n";
	echo "		<td>".$gsg['Zugriffe']."</td>\n";
	echo "	</tr>\n";
	echo "	<tr class=\"Summe\">\n";
	echo "		<td>Alle Immobilien</td>\n";
	echo "		<td>".$sia['Anz']."</td>\n";
	echo "		<td>".$sii['Anz']."</td>\n";
	echo "		<td>".$sig['Anz']."</td>\n";
	echo "		<td>".$sig['Zugriffe']."</td>\n";
	echo "	</tr>\n";
	

	echo "</table>\n";
	echo "&nbsp;<br />\n";
	

}
?>