<?php
/****************************************************************************************
SMI (Services Maintenance Interventions) est une gestion libre de maintenance et de SAV

Copyright (C) 2006  Sylvain FATOME

This program is free software; you can redistribute it and/or modify it under the terms
of the GNU General Public License as published by the Free Software Foundation; 
either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program
(in the directory docs); 
if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
Boston, MA  02110-1301, USA.

Contact : galawa@free.fr
****************************************************************************************/

include ("../inc/config.inc.php");
?>
<?php require ("../inc/func.inc.php") ?>
<?php require ("../inc/func_date.inc.php") ?>
<?php require ("../inc/func_log.inc.php") ?>
<?php require ("../inc/fic.inc.php") ?>
<?PHP
	Archivelog(@$HTTP_SESSION_VARS["code_log"]);
?>
<?php
	$ci = strip_tags(trim($_GET['ci'])); // Récupération code Intervention

	$detail_ok = TRUE;
	
	if ($ci <> "")
	{
		// Récupération des informations intervention
		$row = lit_enr_int($ci);
		if (is_array($row))
		{
			extract ($row);

			if (@$HTTP_SESSION_VARS["niv_log"] >=3)
			{
				if ((@$HTTP_SESSION_VARS["niv_log"] == 4) OR (@$HTTP_SESSION_VARS["niv_log"] == 3))
				{
					// Récupération des informations clients
					$row = lit_enr_cli($int_codecli);
					extract ($row);
			
					$row = lit_enr_age($HTTP_SESSION_VARS["code_age"]);
					extract ($row);
					$zc_couverte = $age_zone;
	
					if (dep_in_zc($cli_dep,$zc_couverte) == TRUE) 
					{
						if ($cli_prop <> @$HTTP_SESSION_VARS["code_age"])
						{
							$detail_ok = FALSE;
						}
					}
					else
					{
						$detail_ok = FALSE;
					}

					if ($int_codeage <> @$HTTP_SESSION_VARS["code_age"])
						$detail_ok = FALSE;
				}
			
				$int_datecreaf = formatedate($int_datecrea);
				$int_datemodf = formatedate($int_datemod);
				$int_datecertf = formatedate($int_datecert);
			}
			else
			{
				$detail_ok = FALSE;
			}
		}
		else
			$detail_ok = FALSE;
	}
	else
		$detail_ok = FALSE;
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>SMI - ESPACE PRIVE : D&eacute;tail Intervention</title>

<!-- Feuille de style pour les affichages courants -->
<link href="../inc/smi.css" rel="stylesheet" type="text/css">

<!-- Feuille de style pour les affichages du menu -->
<link href="../inc/menu.css" rel="stylesheet" type="text/css">

<!-- Scripts Javascript pour validation des formulaires -->
<script language="JavaScript" src="../inc/validator.js"></script>

<!-- Scripts Javascript pour affichages -->
<script language="JavaScript" src="../inc/aff.js"></script>

<!-- Scripts Javascript pour vérifications -->
<script language="JavaScript" src="../inc/verif.js"></script>

</head>
<?PHP
if ($detail_ok == TRUE)
{
?>
	<body>
<?PHP
}
else
{
?>
	<body>
<?PHP
}

if ($detail_ok == TRUE)
{
?>
	<p align="center"> <span class="titrepage">DETAILS DE L'INTERVENTION </span></p>
	<p align="center"><span class="titre_gras"><?php echo $ci; ?></span></p>
	
	<!-- Date de création et de modification -->
	<table width="800"  border="0">
	<tr>
		<td width="160" class="tfvNormal" id="f_datecreaf"><div align="right">Cr&eacute;&eacute;e le </div></td>
		<td>
			<input name="datecreaf" type="text" id="datecreaf" value="<?PHP echo $int_datecreaf ?>" size="10" maxlength="10" readonly="1">
			<?PHP 
				echo "<span class=\"annot_petit_it\">";
				echo " Par ".Retournecreateur($int_codecrea,$admin_code);
				echo "</span>";
			?>
		</td>
	</tr>
	</table>
	<table width="800"  border="0">
	<tr>
		<td width="160" class="tfvNormal" id="f_datemodf"><div align="right">Modifi&eacute;e le </div></td>
		<td>
			<input name="datemodf" type="text" id="datemodf" value="<?PHP echo $int_datemodf ?>" size="10" maxlength="10" readonly="1">
			<?PHP 
				echo "<span class=\"annot_petit_it\">";
				echo " Par ".Retournecreateur($int_codemod,$admin_code);
				echo "</span>";
			?>
		</td>
	</tr>
	</table>
	
	<?PHP
	if ($int_pces == 2) // Si pièces conservées par le client, on n'affiche rien 
	{
	?> 
		<br>
		<table width="800"  border="0">
		  <tr>
			<td width="160" class="tfvNormal" id="f_datemodf"><div align="right">Certificat de destruction envoy&eacute; le </div></td>
			<td>
				<input name="datecertf" type="text" id="datecertf" value="<?PHP echo $int_datecertf ?>" size="10" maxlength="10" readonly="1">
			</td>
		  </tr>
		</table>
	<?PHP 
	} 
	?>
	
	<br>
	
	<!-- bouton de fermeture de la fenêtre -->
	<div align="center">
		<input name="ferm" type="button" id="ferm" value="Fermer la fen&ecirc;tre" onclick="javascript:; self.close('fscomp');">
	</div>
<?PHP
}
else
{
?>
	<script type="text/javascript">
	self.close('fscomp');
	</script>
<?PHP
}
?>

</body>
</html>
