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

Version 0.9.6
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_time.inc.php") ?>
<?php require ("../inc/func_date.inc.php") ?>
<?php require ("../inc/func_log.inc.php") ?>
<?php require ("../inc/func_txt.inc.php") ?>
<?php require ("../inc/fic.inc.php") ?>
<?php require ("../inc/lst.inc.php") ?>
<?PHP
	Archivelog(@$HTTP_SESSION_VARS["code_log"]);
?>
<?php
	$typdde = strip_tags(trim(@$_GET['td']));
	$codeint = strip_tags(trim(@$_GET['ci']));
	$id = strip_tags(trim(@$_GET['id']));

	if ($typdde == "")
		$typdde = strip_tags(trim(@$_POST['td']));
	if ($codeint == "")
		$codeint = strip_tags(trim(@$_POST['ci']));
	if ($id == "")
		$id = strip_tags(trim(@$_POST['id']));

	if (@$HTTP_SESSION_VARS["niv_log"] == 1)
		$typdde = "view";

	$pbm_inth = FALSE;
	$pbm_enr_inth = FALSE;

	if ($codeint <> "")
	{
		$row = lit_enr_int($codeint);
		if (is_array($row))
			extract($row);
		if (formatedate($int_datefin) <> "")
			$typdde = "view";
		if (((@$HTTP_SESSION_VARS["niv_log"] == 4) OR (@$HTTP_SESSION_VARS["niv_log"] == 3)) AND ($int_codeage <> @$HTTP_SESSION_VARS["code_age"]))
			$pbm_inth = TRUE;
			
		if (((strip_tags(trim(@$_POST["enr"])) == "Ajouter") OR (strip_tags(trim(@$_POST["enr"])) == "Modifier")) AND ($pbm_inth == FALSE))
		{
			$id = strip_tags(trim(@$_POST["id"]));
			$datef = strip_tags(trim(@$_POST["date"]));
			if ($datef <> "")
				$date = datefrang($datef);
			else
				$date ="";
			$codetec = strip_tags(trim(@$_POST["codetec"]));
			$codelieu = strip_tags(trim(@$_POST["codelieu"]));
			$heurea = strip_tags(trim(@$_POST["heurea"]));
			$heurea_full = $heurea.":00";
			$heured = strip_tags(trim(@$_POST["heured"]));
			$heured_full = $heured.":00";
			$offert = 0;
			if (strtolower(strip_tags(trim(@$_POST["offert"]))) == "on")
				$offert = 1;
			
			if (($date <> "") AND ($codelieu <> "") AND ($codetec <> "") AND ($heurea <> "") AND ($heurea_full <> "00:00:00") AND ($heured <> "") AND ($heured_full <> "00:00:00"))
			{
				if (heure_sec($heured_full)>=heure_sec($heurea_full))
				{
					$codeuser = @$HTTP_SESSION_VARS["code_log"];
			
					$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
					mysql_select_db(DBNAME);
					if (strip_tags(trim(@$_POST["enr"])) == "Ajouter")
					{
						$rech = "INSERT INTO " .TBINTH;
						$rech .= " (inth_datecrea,inth_codecrea,inth_datemod,inth_codemod,inth_codeint,inth_date,inth_codetec,inth_codelieu,inth_heurea,inth_heured,inth_offert) VALUES";
						$rech .= " ('$datea','$codeuser','$datea','$codeuser','$codeint','$date','$codetec','$codelieu','$heurea_full','$heured_full','$offert')";
					}
					if (strip_tags(trim(@$_POST["enr"])) == "Modifier")
					{
						if ($id <> "")
						{
							$rech = "UPDATE `" .TBINTH;
							$rech .= "` SET `inth_datemod`='".$datea."',`inth_codemod`='".$codeuser."', `inth_date`='".$date."', `inth_codetec`='".$codetec."', `inth_codelieu`='".$codelieu."', `inth_heurea`='".$heurea_full."', `inth_heured`='".$heured_full."', `inth_offert`='".$offert."'  WHERE `inth_id` = '".$id."'";
						}
					}
					$rs = mysql_query($rech) or die(mysql_error());
					mysql_close($conn);
					$typdde ="add";
				}
				else
				{
					$pbm_enr_inth = TRUE;
					$msg = "Problème sur les heures choisies.";
				}
			}
			else
			{
				$pbm_enr_inth = TRUE;
				$msg = "Merci de compléter les champs obligatoires.";
			}
		}
		else
		{
			if ((strip_tags(trim(@$_POST["enr"])) == "Supprimer") AND ($pbm_inth == FALSE))
			{
				if ($id <> "")
				{
					$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
					mysql_select_db(DBNAME);
					$rech = "DELETE FROM `" .TBINTH. "` WHERE `inth_id` = '$id'";
					$rs = mysql_query($rech) or die(mysql_error());
					mysql_close($conn);
				}
				$typdde ="add";
			}
		}
	}
	else
	{
		$pbm_inth = TRUE;
	}
	
	if ($pbm_inth == FALSE)
	{
		if ($typdde == "add")
		{
			$inth_heurea = "00:00";
			$inth_heured = "00:00";
			$titre = "Ajouter Détail horaire";
		}
		if ($typdde == "edit")
		{
			if ($id <> "")
			{
				$row = lit_enr_inth($id);
				if (is_array($row))
				{
					extract($row);
					$inth_heurea=substr($inth_heurea,0,5);
					$inth_heured=substr($inth_heured,0,5);
				}	
				$datef = datefr($inth_date);	
			}
			$titre = "Editer Détail horaire";
		}
		if ($typdde == "view")
		{
			if ($id <> "")
			{
				$row = lit_enr_inth($id);
				if (is_array($row))
				{
					extract($row);
					$inth_heurea=substr($inth_heurea,0,5);
					$inth_heured=substr($inth_heured,0,5);
				}	
				$datef = datefr($inth_date);	
			}
			$titre = "Voir Détail horaire";
		}
		if ($typdde == "del")
		{
			if ($id <> "")
			{
				$row = lit_enr_inth($id);
				if (is_array($row))
				{
					extract($row);
					$inth_heurea=substr($inth_heurea,0,5);
					$inth_heured=substr($inth_heured,0,5);
				}	
				$datef = datefr($inth_date);	
			}
	
			$titre = "Supprimer Détail horaire";
		}
	
		// Récupération du total travaillé & Techniciens traitants
		$nbtotalsec = 0;
		$nbtotalsecoff = 0;
		$str_tec_traitants = "";
		if (($typdde == "add") OR ($typdde == "edit") OR ($typdde == "view") OR ($typdde == "del"))
		{
			$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
			mysql_select_db(DBNAME);
	
			// Récupération total travaillé
			$rech = "SELECT * FROM `" .TBINTH. "` WHERE `inth_codeint`= '".$codeint."'";
			$rs = mysql_query($rech);
			if (mysql_num_rows($rs) <> 0)
			{
				while ($row = mysql_fetch_assoc($rs)) 
				{         
					$nbtotalsec = $nbtotalsec + diff_time_sec($row["inth_heurea"],$row["inth_heured"]);
					if ($row["inth_offert"] == 1)
						$nbtotalsecoff = $nbtotalsecoff + diff_time_sec($row["inth_heurea"],$row["inth_heured"]);
				}
			}
	
			// Chaîne des techniciens traitants
			$rech = "SELECT DISTINCT inth_codetec FROM `" .TBINTH. "` WHERE `inth_codeint`= '".$codeint."'";
			$rs = mysql_query($rech);
			if (mysql_num_rows($rs) <> 0)
			{
				while ($row = mysql_fetch_assoc($rs)) 
				{
					$rech2 = "SELECT tec_nom, tec_prenom FROM `" .TBTEC. "` WHERE `tec_code`= '".$row["inth_codetec"]."' ORDER BY tec_nom";
					$rs2 = mysql_query($rech2);
					if (mysql_num_rows($rs2) <> 0)
					{
						if ($row2 = mysql_fetch_assoc($rs2))
							$str_tec_traitants .= $row2["tec_nom"]." ".$row2["tec_prenom"].", ";
					}
					mysql_free_result($rs2);
				}
			}
			$str_tec_traitants = substr($str_tec_traitants,0,strlen($str_tec_traitants)-2).".";
			mysql_free_result($rs);
			mysql_close($conn);
		}	
	}
?>

<!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 Horaire Intervention</title>

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

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

<!-- Définition Javascript pour calendrier popup -->

  <!-- Feuille de Style -->
  <link rel="stylesheet" type="text/css" media="all" href="../jscal/skins/aqua/theme.css" title="Aqua" />

  <!-- Script Javascript Principal -->
  <script type="text/javascript" src="../jscal/calendar.js"></script>

  <!-- Choix du langage -->
  <script type="text/javascript" src="../jscal/lang/calendar-fr.js"></script>

  <!-- the following script defines the Calendar.setup helper function, which makes
       adding a calendar a matter of 1 or 2 lines of code. -->
  <script type="text/javascript" src="../jscal/calendar-setup.js"></script>

<!-- Fin de la définition Javascript pour calendrier popup -->

<!-- Scripts Javascript pour contrôle de formulaire -->
<script	type="text/javascript" src="../jscript/vform/vform.js"></script>

<script language="javascript">
var tab1_champ=new Array(
	"nom:date ; format:date ; masque:jj-mm-aaaa ; req:Y ; txt:Date ; stok:frmok ; stbad:frmbad",
	"nom:codetec ; format:liste ; req:Y ; txt:Technicien ; vmn:1 ; stok:frmok ; stbad:frmbad",
	"nom:codelieu ; format:liste ; req:Y ; txt:Lieu ; vmn:1 ; stok:frmok ; stbad:frmbad",
	"nom:heurea ; format:heurehhmm ; req:Y ; txt:Heure de début ; stok:frmok ; stbad:frmbad",
	"nom:heured ; format:heurehhmm ; req:Y ; txt:Heure de fin ; stok:frmok ; stbad:frmbad");
</script>

<!-- Fonction pour mettre à jourla fiche intervention  -->
<script type="text/javascript">
function maj_int(duree,dureeoff,ntect)
{
	window.opener.document.int_maj.duree.value=duree;
 	window.opener.document.int_maj.dureeoff.value=dureeoff;
 	window.opener.document.int_maj.tect.value=ntect;

  	var objet1 = window.opener.document.getElementById("affoffoui");
	var objet2 = window.opener.document.getElementById("affoffnon");
	var tab_duree = dureeoff.split(":");
	nbsec = (Number(tab_duree[0])*3600)+(Number(tab_duree[1])*60);

	if (nbsec>0)
	{
		objet1.style.display = 'block';
		objet2.style.display = 'none';
	}
	else
	{
		objet1.style.display = 'none';
		objet2.style.display = 'block';
	}
}
</script>

</head>

<?PHP 
if ($typdde <> "edit")
{
	if ($pbm_inth == FALSE)
	{
?>
		<body onLoad="javascript:; window.focus();">
<?PHP
	}
	else
	{
?>
		<body>
<?PHP
	}
}
else
{
?>
	<body onLoad="javascript:; window.focus();">
<?PHP
}
?>

<?PHP
if (($pbm_inth == FALSE) AND ($pbm_enr_inth == FALSE))
{
?>
	<p align="center"> <span class="titrepage">DETAIL HORAIRE</span></p>
	<p align="center"><span class="titre_gras">Pour l'intervention : <?php echo $codeint; ?> </span></p>
	
	<p>
	  <?PHP
		$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
		mysql_select_db(DBNAME);
		$rech = "SELECT * FROM `" .TBINTH. "` WHERE `inth_codeint`= '".$codeint."' ORDER BY inth_date, inth_heurea";
		
		$rs = mysql_query($rech);
		
		if (mysql_num_rows($rs) <> 0)
		{
		
			echo "<table class=\"MtableD\" border=\"0\" width=\"890\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\">\n";
			 
			// Création de l'entête de la table "relevés de problèmes"
			echo "<th>";
			echo "Date";
			echo "</th>\n";
			echo "<th>";
			echo "Technicien";
			echo "</th>\n";
			echo "<th>";
			echo "Lieu";
			echo "</th>\n";
			echo "<th>";
			echo "Heure début";
			echo "</th>\n";
			echo "<th>";
			echo "Heure fin";
			echo "</th>\n";
			echo "<th>";
			echo "Temps passé";
			echo "</th>\n";
			echo "<th>";
			echo "Offert ?";
			echo "</th>\n";
			echo "<th>";
			echo "Cliquer";
			echo "</th>\n";
			
			$j = 0;
			
			while ($row = mysql_fetch_assoc($rs)) 
			{         
				// Création de l'entête de ligne (TR)
				creetrlstdet($j);
				
				echo "<td align=\"center\">\n";
				echo formatedate($row["inth_date"]);
				echo "<td>\n";
				echo $row["inth_codetec"];
				// Récupération et affichage détail technicien
				$rech2 = "SELECT * FROM `" .TBTEC. "` WHERE `tec_code`= '".$row["inth_codetec"]."'";
				$rs2 = mysql_query($rech2);
				if (mysql_num_rows($rs2) <> 0)
				{
					if ($row2 = mysql_fetch_assoc($rs2)) 
					{
						extract($row2);
						echo "<br>";
						echo "<span class=\"annot_petit_it\">";
						echo $tec_nom." ".$tec_prenom;
						echo "</span>";
					}
				}
				else
					echo "&nbsp;";
				echo "</td>\n";
				echo "</td>\n";
				echo "<td align=\"center\">\n";
				// Récupération et affichage libellé lieu
				$rech2 = "SELECT * FROM `" .TBLIEU. "` WHERE `lieu_code`= '".$row["inth_codelieu"]."'";
				$rs2 = mysql_query($rech2);
				if (mysql_num_rows($rs2) <> 0)
				{
					if ($row2 = mysql_fetch_assoc($rs2)) 
					{
						extract($row2);
						echo $lieu_desc;
					}
				}
				else
					echo "&nbsp;";
				echo "</td>\n";
				echo "<td align=\"center\">\n";
				echo substr($row["inth_heurea"],0,5);
				echo "</td>\n";
				echo "<td align=\"center\">\n";
				echo substr($row["inth_heured"],0,5);
				echo "</td>\n";
				echo "<td align=\"center\">\n";
				echo substr(sec_heure(diff_time_sec($row["inth_heurea"],$row["inth_heured"])),0,5);
				echo "</td>\n";
				echo "<td align=\"center\">\n";
				if ($row["inth_offert"] == 1)
					echo "Oui";
				else
					echo "-";
				echo "</td>\n";
				echo "<td align=\"center\">\n";
				if ($typdde <> "view")
				{
					$lst_maj = TRUE;
			
					echo "<a href=\"inth_maj.php?td=edit&ci=".$codeint."&id=".$row["inth_id"]."\"><img src=\"../img/edit.png\" width=\"".$hl_vign."\" height=\"".$hl_vign."\" border=\"0\" align=\"absmiddle\"></a>";
					echo " ";
	
					$lst_del = TRUE;
		
					echo "<a href=\"inth_maj.php?td=del&ci=".$codeint."&id=".$row["inth_id"]."\"><img src=\"../img/del.gif\" width=\"".$hl_vign."\" height=\"".$hl_vign."\" border=\"0\" align=\"absmiddle\"></a>";
				}
				else
					echo "-";
				echo "</td>\n";

				echo "</tr>\n";
			
				$j++;
			}
			
			/* Totaux */
			
			// Total Général

			// Création de l'entête de ligne (TR)
			creetrlstdet($j);

			echo "<td>";
			echo "&nbsp;";
			echo "</td>\n";
			echo "<td>";
			echo "&nbsp;";
			echo "</td>\n";
			echo "<td>";
			echo "&nbsp;";
			echo "</td>\n";
			echo "<td>";
			echo "&nbsp;";
			echo "</td>\n";
			echo "<td align=\"right\">";
			echo "<span class=\"annot_std_gras\">";
			echo "Temps total : ";
			echo "</span>";
			echo "</td>\n";
			echo "<td align=\"center\">";
			echo "<span class=\"annot_std_gras\">";
			echo substr(sec_heure($nbtotalsec),0,5);
			echo "</span>";
			echo "</td>\n";
			echo "<td>";
			echo "&nbsp;";
			echo "</td>\n";
			echo "<td>";
			echo "&nbsp;";
			echo "</td>\n";

			// Temps offert

			// Création de l'entête de ligne (TR)
			$j++;
			creetrlstdet($j);

			echo "<td>";
			echo "&nbsp;";
			echo "</td>\n";
			echo "<td>";
			echo "&nbsp;";
			echo "</td>\n";
			echo "<td>";
			echo "&nbsp;";
			echo "</td>\n";
			echo "<td>";
			echo "&nbsp;";
			echo "</td>\n";
			echo "<td align=\"right\">";
			echo "<span class=\"annot_std_gras\">";
			echo "Temps offert : ";
			echo "</span>";
			echo "</td>\n";
			echo "<td align=\"center\">";
			if ($nbtotalsecoff <> 0)
			{
				echo "<span class=\"annot_std_gras\">";
				echo substr(sec_heure($nbtotalsecoff),0,5);
				echo "</span>";
			}
			else
				echo "-";
			echo "</td>\n";
			echo "<td>";
			echo "&nbsp;";
			echo "</td>\n";
			echo "<td>";
			echo "&nbsp;";
			echo "</td>\n";

			// Temps retenu

			// Création de l'entête de ligne (TR)
			$j++;
			creetrlstdet($j);

			echo "<td>";
			echo "&nbsp;";
			echo "</td>\n";
			echo "<td>";
			echo "&nbsp;";
			echo "</td>\n";
			echo "<td>";
			echo "&nbsp;";
			echo "</td>\n";
			echo "<td>";
			echo "&nbsp;";
			echo "</td>\n";
			echo "<td align=\"right\">";
			echo "<span class=\"annot_std_gras\">";
			echo "Temps retenu : ";
			echo "</span>";
			echo "</td>\n";
			echo "<td align=\"center\">";
			echo "<span class=\"annot_std_gras\">";
			echo substr(sec_heure($nbtotalsec-$nbtotalsecoff),0,5);
			echo "</span>";
			echo "</td>\n";
			echo "<td>";
			echo "&nbsp;";
			echo "</td>\n";
			echo "<td>";
			echo "&nbsp;";
			echo "</td>\n";

			echo "</table>\n";
			// Fin affichage table détail horaire
			
		}
		else
		{
		?>
			<p class="annot_petit_it">Aucun d&eacute;tail horaire enregistr&eacute; </p>
			<?PHP
		}
		mysql_free_result($rs);
		mysql_close($conn);

		$taille_piedla="";
		include_once ("piedla.php"); 
	?>
	</p>
	<?PHP 
	if ($typdde <> "view")
	{
	?>
		<br>
		<form name="inth_maj" class="form_pointilles" method="post" action="inth_maj.php" onSubmit="javascript:; return (VForm(this,tab1_champ,''));">
		<p align="center" class="annot_std_gras"><?PHP echo $titre; ?></p>
		<p align="center" class="annot_petit_it">Tous les champs sont obligatoires</p>
			<input name="td" type="hidden" id="td" value="<?PHP echo $typdde; ?>">
			<input name="ci" type="hidden" id="ci" value="<?PHP echo $codeint; ?>">
			<input name="id" type="hidden" id="id" value="<?PHP echo $id; ?>">
			<table width="580"  border="0" align="center">
				<tr>
					<td width="30%" class="rubfrm" id="f_date" align="right">
						Date
					</td>
					<td align="left">
						<input name="date" type="text" id="date" value="<?PHP echo $datef; ?>" size="10" maxlength="10" readonly="1">
						<img src="../img/calendar.png" id="f_img_date" title="Choisir votre date" width="16" height="16">
						<a href="javascript:;" onclick="document.inth_maj.date.value=''"><img src="../img/raz.gif" width="12" height="12" border="0" align="absmiddle"></a>
					</td>
				</tr>
				<tr>
					<td width="30%" class="rubfrm" id="f_tec" align="right">
						Technicien
					</td>
					<td align="left">
					<?PHP
						
						// Création de la liste des Techniciens
						
						$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
						mysql_select_db(DBNAME);
						$rech = "SELECT int_codeage FROM ".TBINT." WHERE `int_code` =  '".$codeint."'";
						$rs = mysql_query($rech);
						
						if (mysql_num_rows($rs) >0)
						{
							if ($row = mysql_fetch_array($rs)) 
							{
								extract($row);
								$rech2 = "SELECT * FROM ".TBTEC." WHERE `tec_codeage`= '".$int_codeage."' AND `tec_out` = '0' ORDER BY tec_nom";
								$rs2 = mysql_query($rech2);
						
								if (mysql_num_rows($rs2) >0)
								{
								?>
									<select name="codetec" id="codetec">
								<?PHP
									echo "<option>-- Choisissez un technicien --</option>";
							
									while ($resultat = mysql_fetch_array($rs2)) 
									{
										extract($resultat);
										$txt_tec = $tec_nom." ".$tec_prenom;
										
										if ($inth_codetec == $tec_code)
											echo '<option value="'.$tec_code.'" selected>'.$txt_tec.'</option>';
										else
											echo '<option value="'.$tec_code.'">'.$txt_tec.'</option>';
									}
								?>
									</select>
								<?PHP
								}
								else
								{
								?>
									<select name="codetec" id="codetec">
									<option>-- Pas de technicien actif sur cette agence --</option>
									</select>
								<?PHP
								}
							}
						}
						mysql_free_result($rs);
						mysql_close($conn);
					?>
					</td>
				</tr>
				<tr>
					<td width="30%" class="rubfrm" id="f_lieu" align="right">
						Lieu
					</td>
					<td align="left">
					<select name="codelieu" id="codelieu">
					<?PHP
						
						echo "<option>-- Choisissez un lieu --</option>";

						// Création de la liste des Lieux
						
						$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
						mysql_select_db(DBNAME);
						$rech = "SELECT * FROM ".TBLIEU." ORDER BY lieu_desc";
						$rs = mysql_query($rech);
				
						while ($resultat = mysql_fetch_array($rs)) 
						{
							extract($resultat);
							if ($inth_codelieu == $lieu_code)
								echo '<option value="'.$lieu_code.'" selected>'.$lieu_desc.'</option>';
							else
								echo '<option value="'.$lieu_code.'">'.$lieu_desc.'</option>';
						}
						mysql_free_result($rs);
						mysql_close($conn);
					?>
					  </select>
					</td>
				</tr>
				<tr>
					<td width="30%" class="rubfrm" id="f_horaires" align="right">
						Horaires
					</td>
					<td align="left">
						 D&eacute;but 
						 <input name="heurea" type="text" id="heurea" value="<?PHP echo substr($inth_heurea,0,5) ?>" size="5" maxlength="5">
						<a href="javascript:;" onclick="document.inth_maj.heurea.value='00:00'"><img src="../img/raz.gif" width="12" height="12" border="0" align="absmiddle"></a>
						/ Fin 
						<input name="heured" type="text" id="heured" value="<?PHP echo substr($inth_heured,0,5) ?>" size="5" maxlength="5">
						<a href="javascript:;" onclick="document.inth_maj.heured.value='00:00'"><img src="../img/raz.gif" width="12" height="12" border="0" align="absmiddle"></a>
						<span class="annot_petit_it">
						 (hh:mm)
						</span>
					</td>
				</tr>
				<tr>
					<td width="30%" class="rubfrm" id="f_offert" align="right">
						Offert
					</td>
					<td align="left">
					<?PHP if ($inth_offert == 1)
					{
					?>
						<input type="checkbox" name="offert" style="background : #FFFFFF;" checked>
					<?PHP
					}
					else
					{
					?>
						<input type="checkbox" name="offert" style="background : #FFFFFF;">
					<?PHP
					}
					?>
					</td>
				</tr>
			</table>
			<p align="center">
			<input name="annul" type="button" id="annul" value="Annuler" onclick="javascript:; self.location.href='inth_maj.php?ci=<?PHP echo $codeint; ?>';">
			<?PHP
				if ($typdde == "add")
				{
			?>
					<input name="enr" type="submit" id="enr" value="Ajouter">
			<?PHP
				}
				if ($typdde == "edit")
				{
			?>
					<input name="enr" type="submit" id="enr" value="Modifier">
			<?PHP
				}
				if ($typdde == "del")
				{
			?>
				<input name="enr" type="submit" id="enr" value="Supprimer">
			<?PHP
				}
			?>
				<input name="quit" type="button" id="quit" value="Quitter" onclick="javascript:; self.close('fscomp');">
			</p>
		</form>
		
		<script type="text/javascript">
			Calendar.setup({
				inputField     :    "date",     	// id of the input field
				ifFormat       :    "%d-%m-%Y",     // format of the input field
				button         :    "f_img_date",  	// trigger for the calendar (button ID)
				align          :    "Ll",           // alignment (defaults to "Bl")
				singleClick    :    true
			});
		</script>

		<script type="text/javascript">
		maj_int('<?PHP echo substr(sec_heure($nbtotalsec),0,5); ?>','<?PHP echo substr(sec_heure($nbtotalsecoff),0,5); ?>','<?PHP echo $str_tec_traitants; ?>');
		</script>
<?PHP
	}
}
else
{
	if ($pbm_inth == TRUE)
	{
?>
		<script type="text/javascript">
		self.close('fscomp');
		</script>
<?PHP
	}
	if ($pbm_enr_inth == TRUE)
	{
?>
		<p align="center" class="annot_std_it"><?PHP echo $msg; ?></p>
		<script type="text/javascript">
		window.setTimeout("location=('inth_maj.php?ci=<?PHP echo $codeint; ?>&td=<?PHP echo $typdde; ?>&id=<?PHP echo $id; ?>');",3000)
		</script>
<?PHP
	}
}
?>
</body>
</html>
