<?php

include ("config.php");

if (!isset($_SESSION["Sadmin"]))
{
	header ("Location: consultation.php");
	exit;
}

$highlight_menu = 5;
$highlight_cousu = 6;
$display_consu = true;

_request("id_consult", "confirm");

if ($infoConsu = $consu->get_consultation($id_consult))
	$ok = true;
else
{
	header ("Location: consultation.php");
	exit;
}

if ($confirm == 1)
{
	if ($consu->del_consultation($id_consult))
	{
		if ($infoConsu["consu_type"] == 3)
		{
			$consu->regenerateCSNumero($infoConsu["id_pat"], $infoConsu["id_prop"]);
		}

		header ("Location: consultation.php?action=suppression");
		exit;
	}
}

$infoPat = $pat->get_patient($infoConsu["id_pat"]);
$infoProp = $prop->get_proposition($infoConsu["id_prop"]);
$infoModule = $menu->get_module($infoProp["id_mod"]);

include ("header.php");

if (!empty($error))
{
	if (is_int($error))
		echo "<p class=\"center error\">" . $error_list[$error] . "</p>\n";
	else
		echo "<p class=\"center error\">" . $error . "</p>\n";
}

?>
<div id="form-menu">
<table class="center">

<tr>
<th class="center" colspan="2">Informations concernant la consultation</th>
</tr>

<tr>
<td class="bold">Date de consultation</td>
<td><?php echo format_date($infoConsu["consu_date"]); ?></td>
</tr>

<tr>
<td class="bold">Type de consultation</td>
<td><?php echo $consu_type_tab[$infoConsu["consu_type"]]; ?></td>
</tr>

<tr>
<td class="bold">Patient</td>
<td><?php echo $infoPat["pat_nom"] . " " . $infoPat["pat_prenom"]; ?></td>
</tr>

<tr>
<td class="bold">Module en cours</td>
<td><?php echo $infoModule["mod_nom"]; ?></td>
</tr>

<tr>
<td colspan="2">&nbsp;</td>
</tr>

<tr>
<td colspan="2" class="center"><a class="sdel" href="dossier_suppression.php?id_consult=<?php echo $id_consult; ?>&amp;confirm=1">Confirmer la suppression de cette consultation</a></td>
</tr>

</table>
</div>
<?php

echo "<p class=\"center\"><a class=\"slink\" href=\"consultation.php\">Retour &agrave; la liste des consultations</a></p>\n";

include ("footer.php");

?>