<!-- You have to write a php code which displays the deals done in that sector-->
		
			<?php 
			$earning_arr= get_earning_report($SponsID);
			$meeting_arr= get_meeting_report($SponsID);
			echo "<table class=\"sponsrepnav\" style=\"width:100%\" >";
			echo"<caption><h2>Sponsorship Representative Details:</h2></caption>";

			echo "<tr align=left>
				<th>Name:</th>
			<td>";
			echo get_person_name($SponsID);
			echo "</td></tr><tr align=left>
				<th>Sector:</th>
			<td>";
			echo get_person_sector($SponsID);
			echo "</td></tr><tr align=left>
				<th>Companies signed:</th>
			<td>";
			echo $earning_arr[1];
			echo "</td></tr>
			<tr align=left>
				<th>Total Earned (Rupees):</th>
				<td>";
			echo $earning_arr[2];
			echo "
				</td>
			</tr>
			<tr align=left>
				<th>Calls Made:</th>
				<td>";
	echo '</header>';

	echo '<h3 class="SponsID">';
	echo 'SponsID: ' . $SponsID;
	echo '<br>Name: ' . get_person_name($SponsID);

	$role = get_access_level($SponsID);
	$printing_role = $role;
	if ($role == 'SponsRep') $printing_role = "Sponsorship Representative";
	if ($role == 'SectorHead') $printing_role = "Sector Head";
	if ($role == 'CSO') $printing_role = "Chief Sponsorship Officer";
	echo '<br>Role: ' . $printing_role;

	if (get_access_level($SponsID) == "SponsRep" || get_access_level($SponsID) == "SectorHead"){
		echo '<br>Sector: ' . get_person_sector($SponsID);
	}
	echo '</h3>';


	echo '<div align="center">';


	$meeting_view_query = "SELECT
		SponsOfficer.SponsID as 'SponsID',
		Name as 'SponsRep Name',
		CMPName as 'Company Name',
		CEName as 'Company Executive Name',
		MeetingType as 'Meeting Type',
		Date,
		Time,
    echo '<form action="sort_search_table.php" class="search_form" method="post" align="center">';
    echo 'Search by:<select name="search_by">';
    $i = 0;
    while ($i < mysql_num_fields($result)) {
        $attr = mysql_fetch_field($result, $i);
        echo "<option>" . $attr->name . "</option>";
        $i++;
    }
    echo '</select> ';
    echo '<input type="text" name="search_field">';
    echo '<button type="submit" name="submit">Search</button>';
    echo '</form>';
}
$SponsAccessLevel = get_access_level($SponsID);
$SponsName = get_person_name($SponsID);
$SponsSector = get_person_sector($SponsID);
$table_message = $_SESSION['table_message'];
$main_query = $_SESSION['main_query'];
echo '<header align="center">
			<h1>Sponsorship Department</h1>';
if ($SponsAccessLevel == "SectorHead") {
    echo $SectorHeadBackButton;
}
if ($SponsAccessLevel == "SponsRep") {
    echo $SponsRepBackButton;
}
if ($SponsAccessLevel == "CSO") {
    echo $CSOBackButton;
}
echo '</header>';
echo '<div align="center">';