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

Version 0.9.9

Copyright (C) 2006-2009  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

Web : http://smitst.homelinux.com
****************************************************************************************/


// Vérification des tentatives de hack
$pos=strpos($_SERVER['PHP_SELF'],"inc.php");
if ($pos===FALSE)
	$ok_inc=TRUE;
else
	$ok_inc=FALSE;
if ($ok_inc==FALSE) header("Location: ../index.php");

if (!isset($_SESSION["lng"])) $_SESSION["lng"]="fr";
include_once("../lng/".$_SESSION["lng"].".inc.php"); // Paramètres de language
include_once("../inc/config.inc.php");
include_once("../inc/func.inc.php");
include_once("../inc/func_date.inc.php");
include_once("../inc/func_log.inc.php");
include_once("../inc/func_geo.inc.php");
include_once("../inc/func_txt.inc.php");
include_once("../inc/fic_tec.inc.php");
include_once("../inc/lst.inc.php");
Archivelog(@$_SESSION["code_log"]);

$txt_stat_tec = array(
	$sel_stat_type,
	$sel_stat_crecli,
	"Nombre de traitements d'ordres sur une période donnée");

$pbm_stat = FALSE;
$aff_stat = FALSE;
$ts_ok=FALSE;

// On a choisi le type de statistique
if (strip_tags(trim(@$_POST["Submit"])) == "OK")
{
	$ts = strip_tags(trim($_POST['ts']));
	switch ($ts)
	{
		case 1 :
		case 2 :
			$ts_ok=TRUE;
			break;
		default :
			$pbm_stat=TRUE;
			break;
	}
}
else
{
	if (isset($_POST['ts']))
	{
		$ts = strip_tags(trim($_POST['ts']));
		$ts_ok=TRUE;

		switch ($ts)
		{
			case 1 :
			case 2 :
				// Les dates sont remplies sur un formulaire validé, donc on peut afficher les statistiques
				if ((isset($_POST['date1f'])) AND (isset($_POST['date2f'])))
				{
					$tec_select = "";
					for ($i = 0; $i < count($_POST["tec"]); $i++)
					{
						$tec_select.=$_POST["tec"][$i]."-";
					}
					$tec_select_tab = explode("-",substr($tec_select,0,strlen($tec_select)-1));
						
					$st = strip_tags(trim(@$_POST["st"]));

					$date1=datefrang($_POST['date1f']);
					$date2=datefrang($_POST['date2f']);
			
					$aff_stat=TRUE;
				}
				break;
			default :
				$pbm_stat=TRUE;
				break;
		}
	}
}

if (($aff_stat==TRUE) AND ($pbm_stat==FALSE))
{
	switch ($ts)
	{
		/* Nombre de créations de clients sur une période donnée */
		case 1 :
			// Analyse des données et traitements statistiques
			$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
			mysql_select_db(DBNAME);
		
			/* Initialisation des totaux généraux */
		
			$nb_cli_crees_total = 0;
			$nb_cli_prospects_crees_total = 0;
			$nb_cli_ddeot_crees_total = 0;
			$nb_cli_inter_crees_total = 0;
			
			/* Calcul des totaux généraux */

			$rech = "SELECT tec_code FROM ".TBTEC;
			$rech.= " WHERE tec_codest <> ''";
			$rech.= " ORDER BY tec_code";
			$rs = mysql_query($rech) or die(mysql_error());
				
			if (mysql_num_rows($rs) >0)
			{
				while ($row = mysql_fetch_assoc($rs)) 
				{
					extract($row);

					// Détermination du nombre de clients créés par les techniciens sur la période
					$rech2 = "SELECT * FROM ".TBCLI;
					$rech2.= " WHERE cli_codecrea='".$tec_code."'";
					$rech2.= " AND cli_datecrea>='".$date1."' AND cli_datecrea<='".$date2."'";

					$rs2 = mysql_query($rech2) or die(mysql_error());
					$nb_cli_crees_total = $nb_cli_crees_total + mysql_num_rows($rs2);
					
					mysql_free_result($rs2);

					// Détermination du nombre de clients encore prospects et créés par les techniciens sur la période
					$rech2 = "SELECT * FROM ".TBCLI;
					$rech2.= " WHERE cli_codecrea='".$tec_code."'";
					$rech2.= " AND cli_type=0";
					$rech2.= " AND cli_datecrea>='".$date1."' AND cli_datecrea<='".$date2."'";
				
					$rs2 = mysql_query($rech2) or die(mysql_error());
					$nb_cli_prospects_crees_total = $nb_cli_prospects_crees_total + mysql_num_rows($rs2);

					mysql_free_result($rs2);
				
					// Détermination du nombre de client ayant demandé une intervention (non effectuée) et créés par les techniciens sur la période
					$rech2 = "SELECT * FROM ".TBCLI;
					$rech2.= " WHERE cli_codecrea='".$tec_code."'";
					$rech2.= " AND cli_type=1";
					$rech2.= " AND cli_datecrea>='".$date1."' AND cli_datecrea<='".$date2."'";
				
					$rs2 = mysql_query($rech2) or die(mysql_error());						
					$nb_cli_ddeot_crees_total = $nb_cli_ddeot_crees_total + mysql_num_rows($rs2);
					
					mysql_free_result($rs2);

					// Détermination du nombre total de clients ayant demandé une intervention (effectuée) et créés par les techniciens sur la période
					$nb_cli_inter_crees_total = $nb_cli_crees_total - $nb_cli_prospects_crees_total - $nb_cli_ddeot_crees_total;
				}
			}

			/* Traitement par technicien */
		
			$rech = "SELECT tec_code FROM ".TBTEC;
			
			// Traitement de multiples
			if (!in_array("*",$tec_select_tab))
			{
				for ($i=0; $i<count($tec_select_tab); $i++)
				{
					if(!stristr($rech,"WHERE "))
						$rech.= " WHERE tec_code='".$tec_select_tab[$i]."'";
					else
						$rech.= " OR tec_code='".$tec_select_tab[$i]."'";
				}
			}
			if ($st <> "*")
			{
				if(!stristr($rech,"WHERE "))
					$rech.= " WHERE tec_codest='".$st."'";
				else
					$rech.= " AND tec_codest='".$st."'";
			}
			if(!stristr($rech,"WHERE "))
				$rech.= " WHERE tec_codest <> ''";
			else
				$rech.= " AND tec_codest=''";
			$rech.= " ORDER BY tec_nom";
		
			$rs = mysql_query($rech) or die(mysql_error());
			$nb_tec_select = mysql_num_rows($rs);

			$i = 0;
				
			if ($nb_tec_select >0)
			{
				while ($row = mysql_fetch_assoc($rs)) 
				{
					extract($row);

					// Récupération du code technicien
					$code_tec[$i] = $tec_code;

					// Détermination du nombre de clients créés par le technicien sur la période
					$rech2 = "SELECT * FROM ".TBCLI;
					$rech2.= " WHERE cli_codecrea='".$tec_code."'";
					$rech2.= " AND cli_datecrea>='".$date1."' AND cli_datecrea<='".$date2."'";

					$rs2 = mysql_query($rech2) or die(mysql_error());
					$nb_cli_crees_tec[$i] = mysql_num_rows($rs2);
					mysql_free_result($rs2);

					// Détermination du nombre de clients encore prospects et créés par le technicien sur la période
					$rech2 = "SELECT * FROM ".TBCLI;
					$rech2.= " WHERE cli_codecrea='".$tec_code."'";
					$rech2.= " AND cli_type=0";
					$rech2.= " AND cli_datecrea>='".$date1."' AND cli_datecrea<='".$date2."'";
				
					$rs2 = mysql_query($rech2) or die(mysql_error());
					$nb_cli_prospects_crees_tec[$i] = mysql_num_rows($rs2);
					mysql_free_result($rs2);
				
					// Détermination du nombre de client ayant demandé une intervention (non effectuée) et créés par le techniciens sur la période
					$rech2 = "SELECT * FROM ".TBCLI;
					$rech2.= " WHERE cli_codecrea='".$tec_code."'";
					$rech2.= " AND cli_type=1";
					$rech2.= " AND cli_datecrea>='".$date1."' AND cli_datecrea<='".$date2."'";
				
					$rs2 = mysql_query($rech2) or die(mysql_error());
					$nb_cli_ddeot_crees_tec[$i] = mysql_num_rows($rs2);
					mysql_free_result($rs2);

					// Détermination du nombre total de clients ayant demandé une intervention (effectuée) et créés par le techniciens sur la période
					$nb_cli_inter_crees_tec[$i] = $nb_cli_crees_tec[$i] - $nb_cli_prospects_crees_tec[$i] - $nb_cli_ddeot_crees_tec[$i];

					$i++;
				}
			}
			mysql_close($conn);  
			
			$aff_stat = TRUE;
			break;

		/* Nombre de traitements d'ordres sur une période donnée */
		case 2 :
			// Analyse des données et traitements statistiques
			$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
			mysql_select_db(DBNAME);
		
			/* Initialisation des totaux généraux */
		
			$nb_ot_trait_total = 0;
			$nb_ot_ouv_trait_total = 0;
			$nb_ot_prev_trait_total = 0;
			$nb_ot_clos_trait_total = 0;
			
			/* Calcul des totaux généraux */

			$rech = "SELECT tec_code FROM ".TBTEC;
			$rech.= " WHERE tec_codest <> ''";
			$rech.= " ORDER BY tec_code";
		
			$rs = mysql_query($rech) or die(mysql_error());
				
			if (mysql_num_rows($rs) >0)
			{
				while ($row = mysql_fetch_assoc($rs)) 
				{
					extract($row);

					// Détermination du nombre d'ordres créées par les techniciens sur la période
					$rech2 = "SELECT * FROM ".TBOT;
					$rech2.= " WHERE ot_codetec='".$tec_code."'";
					$rech2.= " AND ot_datecrea>='".$date1."' AND ot_datecrea<='".$date2."'";

					$rs2 = mysql_query($rech2) or die(mysql_error());
					$nb_ot_trait_total = $nb_ot_trait_total + mysql_num_rows($rs2);
					
					mysql_free_result($rs2);

					// Détermination du nombre d'ordres encore ouvertes et créées par les techniciens sur la période
					$rech2 = "SELECT * FROM ".TBOT;
					$rech2.= " WHERE ot_codetec='".$tec_code."'";
					$rech2.= " AND ot_dateprev='0000-00-00'";
					$rech2.= " AND ot_datecrea>='".$date1."' AND ot_datecrea<='".$date2."'";
				
					$rs2 = mysql_query($rech2) or die(mysql_error());
					$nb_ot_ouv_trait_total = $nb_ot_ouv_trait_total + mysql_num_rows($rs2);

					mysql_free_result($rs2);
				
					// Détermination du nombre d'ordres, où le client a été prévenu, et créées par les techniciens sur la période
					$rech2 = "SELECT * FROM ".TBOT;
					$rech2.= " WHERE ot_codetec='".$tec_code."'";
					$rech2.= " AND ot_dateprev<>'0000-00-00'";
					$rech2.= " AND ot_datefin='0000-00-00'";
					$rech2.= " AND ot_datecrea>='".$date1."' AND ot_datecrea<='".$date2."'";
				
					$rs2 = mysql_query($rech2) or die(mysql_error());						
					$nb_ot_prev_trait_total = $nb_ot_prev_trait_total + mysql_num_rows($rs2);
					
					mysql_free_result($rs2);

					// Détermination du nombre total d'ordres closes et créés par les techniciens sur la période
					$nb_ot_clos_trait_total = $nb_ot_trait_total - $nb_ot_ouv_trait_total - $nb_ot_prev_trait_total;
				}
			}
	
			/* Traitement par technicien */
			$rech = "SELECT * FROM ".TBTEC;
			
			// Traitement de multiples
			if (!in_array("*",$tec_select_tab))
			{
				for ($i=0; $i<count($tec_select_tab); $i++)
				{
					if(!stristr($rech,"WHERE "))
						$rech.= " WHERE tec_code='".$tec_select_tab[$i]."'";
					else
						$rech.= " OR tec_code='".$tec_select_tab[$i]."'";
				}
			}
			if ($st <> "*")
			{
				if(!stristr($rech,"WHERE "))
					$rech.= " WHERE tec_codest='".$st."'";
				else
					$rech.= " AND tec_codest='".$st."'";
			}
			if(!stristr($rech,"WHERE "))
				$rech.= " WHERE tec_codest <> ''";
			else
				$rech.= " AND tec_codest=''";
			$rech.= " ORDER BY tec_nom";

			$rs = mysql_query($rech) or die(mysql_error());
			$nb_tec_select = mysql_num_rows($rs);

			$i = 0;
					
			if ($nb_tec_select >0)
			{
				while ($row = mysql_fetch_assoc($rs)) 
				{
					extract($row);

					// Récupération du code sous-traitant
					$code_tec[$i] = $tec_code;

					// Détermination du nombre d'ordres créées par le technicien sur la période
					$rech2 = "SELECT * FROM ".TBOT;
					$rech2.= " WHERE ot_codetec='".$tec_code."'";
					$rech2.= " AND ot_datecrea>='".$date1."' AND ot_datecrea<='".$date2."'";

					$rs2 = mysql_query($rech2) or die(mysql_error());
					$nb_ot_trait_tec[$i] = mysql_num_rows($rs2);
					mysql_free_result($rs2);

					// Détermination du nombre d'ordres encore ouvertes et créées par le technicien sur la période
					$rech2 = "SELECT * FROM ".TBOT;
					$rech2.= " WHERE ot_codetec='".$tec_code."'";
					$rech2.= " AND ot_dateprev='0000-00-00'";
					$rech2.= " AND ot_datecrea>='".$date1."' AND ot_datecrea<='".$date2."'";
				
					$rs2 = mysql_query($rech2) or die(mysql_error());
					$nb_ot_ouv_trait_tec[$i] = mysql_num_rows($rs2);
					mysql_free_result($rs2);
				
					// Détermination du nombre d'ordres, où l'agence a été prévenue, et créées par les techniciens sur la période
					$rech2 = "SELECT * FROM ".TBOT;
					$rech2.= " WHERE ot_codetec='".$tec_code."'";
					$rech2.= " AND ot_dateprev<>'0000-00-00'";
					$rech2.= " AND ot_datefin='0000-00-00'";
					$rech2.= " AND ot_datecrea>='".$date1."' AND ot_datecrea<='".$date2."'";
				
					$rs2 = mysql_query($rech2) or die(mysql_error());
					$nb_ot_prev_trait_tec[$i] = mysql_num_rows($rs2);
					mysql_free_result($rs2);

					// Détermination du nombre total d'ordres closes et créées par les techniciens sur la période
					$nb_ot_clos_trait_tec[$i] = $nb_ot_trait_tec[$i] - $nb_ot_ouv_trait_tec[$i] - $nb_ot_prev_trait_tec[$i];

					$i++;
				}
			}
			mysql_close($conn);  
			
			$aff_stat = TRUE;
			
			break;

		default :
			$pbm_stat=TRUE;
			break;
	}
}
?>
<!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 - <?PHP echo $title_esp_prive; ?> : Statistiques Techniciens</title>

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

<!-- Feuille de style & Script pour le menu -->

<script language="JavaScript" src="../jscript/coolmenus/coolmenus4.js"></script>

<!-- Scripts Javascript pour fenêtres -->
<script language="JavaScript" src="../jscript/fen.js"></script>

<!-- Définition Javascript pour calendrier popup -->
  <!-- Feuille de Style -->
  <link rel="stylesheet" type="text/css" media="all" href="../jscript/jscal/skins/aqua/theme.css" title="Aqua" />

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

  <!-- Choix du langage -->
  <script type="text/javascript" src="../jscript/jscal/lang/calendar-<?PHP echo $_SESSION["lng"]; ?>.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="../jscript/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>

<!-- Scripts Javascript de validation des formulaires -->
<script	type="text/javascript" src="../jscript/verif_form.js"></script>

<!-- Scripts Javascript divers -->
<script language="JavaScript" src="../jscript/divers.js"></script>

</head>

<body onLoad="metFocus();">

<?php 
include_once("../inc/entete.inc.php"); 
?>
<p align="center"> <span class="titrepage">STATISTIQUES TECHNICIENS ST</span></p>
<?PHP
if ($pbm_stat==FALSE)
{
	$total_tec = 0;
	if (@$_SESSION["niv_log"] > 4)
		$total_tec = nb_tec_st("");
	else
	{
		if (@$_SESSION["niv_log"] == 10)
			$total_tec = nb_tec_st(@$_SESSION["code_log"]);
	}
	
	if ($total_tec >0)
	{
?>
	<form name="ts" method="post" action="tecs_stat.php">
	<br>
	<div align="center">
	<?PHP
	if ($ts_ok==FALSE)
	{
	?>
		<select name="ts" id="ts">
		<?PHP
		for ($i=0; $i<count($txt_stat_tec); $i++)
		{
		?>
		<option value="<?PHP echo $i; ?>" <?PHP if ($ts==$i) echo "selected=\"selected\""; ?>><?PHP echo $txt_stat_tec[$i]; ?></option>			
		<?PHP
		}
		?>					
		</select>
		<input type="submit" class="bton_std" name="Submit" value="<?PHP echo $but_ok; ?>">
	<?PHP
	}
	else
	{
	?>
		<br>
		<span class="titre_gras_soul">
		<?PHP echo $txt_stat_tec[$ts]; ?>
		</span>
		<br><br><br>
	<?PHP
		if (count($tec_select_tab) <> "")
		{
			switch ($ts)
			{
				/* Nombre de créations de clients sur une période donnée */
				case 1 :
				/* Nombre de traitements d'ordres sur une période donnée */
				case 2 :
					echo "<span class=\"annot_std_it\">";
					if ((in_array("*",$tec_select_tab)) AND (count($tec_select_tab) == 1))
					{
						echo "Tous les techniciens";
					}
					else
					{
						$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
						mysql_select_db(DBNAME);
						if (!in_array("*",$tec_select_tab))
							if (count($tec_select_tab) == 1) // Un seul technicien choisi
								$liste_tec = "Pour le technicien : ";
							else
								$liste_tec = "Pour les techniciens : ";
						for ($i=0; $i<count($tec_select_tab); $i++)
						{
							$rs = mysql_query("SELECT * FROM ".TBTEC." WHERE `tec_code` = '".$tec_select_tab[$i]."'");
							if (mysql_num_rows($rs) == 1) // Il ne peut y avoir qu'un seul résultat
							{
								if ($row = mysql_fetch_array($rs))
								{
									extract($row);
									$liste_tec .=$tec_nom." ".$tec_prenom.", ";
								}
							}
						}
						echo substr($liste_tec,0,strlen($liste_tec)-2);
						mysql_free_result($rs);
						mysql_close($conn);
					}
					if ($st <> "*")
					{
						$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
						mysql_select_db(DBNAME);
						$rs = mysql_query("SELECT * FROM ".TBST." WHERE `st_code` = '".$st."'");
						if (mysql_num_rows($rs) == 1) // Il ne peut y avoir qu'un seul résultat
						{
							if ($row = mysql_fetch_array($rs))
							{
								extract($row);
								echo "<br>Filtre sur le sous-traitant : ".$st_nom;
							}
						}
						mysql_free_result($rs);
						mysql_close($conn);
					}
					else
						echo "<br>Tous les donneurs d'ordres";
					echo "<br>";
					echo $txt_div_perdu.$_POST['date1f'].$txt_div_to.$_POST['date2f']."<br>";
					echo "</span>";
					break;
	
				default :
					break;
			}
		}
	}
	?>
	</div>
	<br>
	</form>
	<?PHP	
	if ($aff_stat == TRUE)
	{
	?>
		<a href="javascript:;" onclick="self.location.href=('tecs_stat.php');")><img src="../img/stat.png" title="<?PHP echo $alt_autrestat; ?>" border="0" align="absmiddle"></a>
		<a href="javascript:;" onclick="self.location.href=('tecs_stat.php');")> <?PHP echo $alt_autrestat; ?> </a>
		<br>
	<?PHP
	}
	if ($ts_ok == TRUE)
	{
		switch ($ts)
		{
			/* Nombre de créations de clients sur une période donnée */
			case 1 :
				if ($aff_stat == FALSE) // On est en mode "paramètres"
				{
	?>
				<script language="javascript">
				<!--
				var tab_champ=new Array(
					"nom:tec[] ; format:listem ; req:Y ; txt:Technicien ; vmn:0 ; stok:frmok ; stbad:frmbad",
					"nom:date1f ; format:date ; req:Y ; txt:<?PHP echo html_entity_decode($txt_chp_dtedeb); ?>; masque:<?PHP echo $datemsql; ?> ; stok:frmok ; stbad:frmbad",
					"nom:date2f ; format:date ; req:Y ; txt:<?PHP echo html_entity_decode($txt_chp_dtefin); ?> ; masque:<?PHP echo $datemsql; ?> ; stok:frmok ; stbad:frmbad");
				//-->
				</script>

				<form name="clients" class="form_pointilles" method="post" action="tecs_stat.php">
				<input name="ts" type="hidden" id="ts" value="<?PHP echo $ts ?>">
				<table width="100%" border="0">
				<tr>
                    <td width="50%" align="center">
						<br>
						Choisissez un technicien (s&eacute;lections multiples possibles).
						<br>
						<span class="annot_petit_it">(Si 'Tous', les techniciens licenci&eacute;s seront aussi analys&eacute;s)</span>
					</td>
                    <td align="center">
					<?PHP
					if( (@$_SESSION["niv_log"] == 5) OR (@$_SESSION["niv_log"] == 9))
					{
					?>
						<br>
						Choisissez un sous-traitant.
						<br>
						<br>
					<?PHP
					}
					else
					{
					?>
						&nbsp;
					<?PHP
					}
					?>
					</td>
				</tr>
				<tr>
                    <td width="50%" align="center">
						<select name="tec[]" id="tec" size="5" multiple="multiple">
						<option value="*" selected="selected"><?PHP echo $sel_lst_tous; ?></option>
		
						<?PHP
						// Création de la liste des techniciens actifs
						
						$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
						mysql_select_db(DBNAME);
						if( (@$_SESSION["niv_log"] == 5) OR (@$_SESSION["niv_log"] == 9))
							$rs = mysql_query("SELECT * FROM ".TBTEC." WHERE `tec_out` = '0' AND tec_codest <> '' ORDER BY tec_nom");
						else
						{
							if (@$_SESSION["niv_log"] == 10)
								$rs = mysql_query("SELECT * FROM ".TBTEC." WHERE `tec_out` = '0' AND `tec_codest` = '".@$_SESSION["code_log"]."' ORDER BY tec_nom");
						}
						while ($resultat = mysql_fetch_array($rs)) 
						{
							extract($resultat);
							$txt_tec = $tec_nom." ".$tec_prenom." (".$tec_code.")";
							echo '<option value="'.$tec_code.'">'.$txt_tec.'</option>';
						}
						mysql_free_result($rs);
						mysql_close($conn);
						?>
						</select>
					</td>
                    <td align="center">
					<?PHP
					if( (@$_SESSION["niv_log"] == 5) OR (@$_SESSION["niv_log"] == 9))
					{
					?>
						<select name="st" size="5" id="st">
						<option value="*" selected="selected"><?PHP echo $sel_lst_tous; ?></option>
						<?PHP
						
						// Création de la liste des donneurs d'ordres
						
						$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
						mysql_select_db(DBNAME);
						$rs = mysql_query("SELECT * FROM ".TBST." ORDER BY st_nom");
						
						while ($resultat = mysql_fetch_array($rs)) 
						{
							extract($resultat);
							echo '<option value="'.$st_code.'">'.$st_nom.'</option>';
						}
						mysql_free_result($rs);
						mysql_close($conn);
						?>
						</select>
					<?PHP
					}
					else
					{
						if (@$_SESSION["niv_log"] == 10)
						{
					?>
							<input name="st" type="hidden" id="st" value="<?PHP echo @$_SESSION["code_log"]; ?>">
					<?PHP
						}
					}
					?>
					</td>
                  </tr>
                </table>
				<br>
				<br>
				<br>
				<table width="400"  border="0" align="center">
				<tr>
					<td width="30" class="rubfrm" id="f_date1" align="right"><?PHP echo $txt_div_fromMAJ; ?>...</td>
					<td>
						<input name="date1f" type="text" id="date1f" size="10" maxlength="10" readonly="1">
						<img src="../img/calendar.png" align="absmiddle" id="f_img_date1f" title="<?PHP echo $alt_chxdate; ?>">
						<img src="../img/oblig.png" align="absmiddle" alt="<?PHP echo $alt_chp_oblig; ?>">
					</td>
					<td width="30" class="rubfrm" id="f_date2f" align="right"><?PHP echo $txt_div_toMAJ; ?>...</td>
					<td>
						<input name="date2f" type="text" id="date2f" size="10" maxlength="10" readonly="1">
						<img src="../img/calendar.png" align="absmiddle" id="f_img_date2f" title="<?PHP echo $alt_chxdate; ?>">
						<img src="../img/oblig.png" align="absmiddle" alt="<?PHP echo $alt_chp_oblig; ?>">
					</td>
				</tr>
				</table>
				<p align="center">
					<input name="Submit" type="button" class="bton_std" id="Submit" value="<?PHP echo $but_calc; ?>" onClick="verif_stats_tec(clients,tab_champ,'','',this.value);">
					<input name="init" type="reset" class="bton_std" id="init" value="<?PHP echo $but_reinit; ?>">
				</p>
			</form>
			
			<script type="text/javascript">
			<!--
				Calendar.setup({
					inputField     :    "date1f",     // id of the input field
					ifFormat       :    "<?PHP echo $datefmtc; ?>",      // format of the input field
					button         :    "f_img_date1f",  // trigger for the calendar (button ID)
					align          :    "Ll",           // alignment (defaults to "Bl")
					electric	   :	false,
					singleClick    :    true
				});
				Calendar.setup({
					inputField     :    "date2f",     // id of the input field
					ifFormat       :    "<?PHP echo $datefmtc; ?>",      // format of the input field
					button         :    "f_img_date2f",  // trigger for the calendar (button ID)
					align          :    "Ll",           // alignment (defaults to "Bl")
					electric	   :	false,
					singleClick    :    true
				});
			//-->
			</script>
			  
	<?PHP
			}
			else // On est en mode "affichage de stats"
			{
				// Définition et entête de la table
				echo "<table class=\"Mtable\" border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\n";
	
				echo "<th>";
				echo "Technicien";
				echo "</th>\n";
				echo "<th>";
				echo $tab_ent_totcrees;
				echo "</th>\n";
				echo "<th>";
				echo $tab_ent_encprosp;
				echo "</th>\n";
				echo "<th>";
				echo $tab_ent_attint;
				echo "</th>\n";
				echo "<th>";
				echo $tab_ent_int;
				echo "</th>\n";

				$i = 0;

				/* Données pour tous les techniciens */

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

				echo "<td>";
				echo "<span class=\"annot_std_it\">";
				echo "Tous les techniciens";
				echo "</span>";
				echo "</td>\n";
				echo "<td align=\"center\">";
				if ($nb_cli_crees_total <> 0)
				{
					echo "<span class=\"annot_std_it\">";
					echo $nb_cli_crees_total;
					echo "</span>";
				}
				else
					echo "-";
				echo "</td>\n";
				echo "<td align=\"center\">";
				if ($nb_cli_prospects_crees_total <> 0)
				{
					echo "<span class=\"annot_std_it\">";
					echo $nb_cli_prospects_crees_total;
					echo "</span>";
					if ($nb_cli_crees_total <> 0)
					{
						echo"<span class=\"annot_petit_it\">";
						echo " (".round((($nb_cli_prospects_crees_total/$nb_cli_crees_total)*100),2)."%)";
						echo "</span>";
					}
				}
				else
					echo "-";
				echo "</td>\n";
				echo "<td align=\"center\">";
				if ($nb_cli_ddeot_crees_total <> 0)
				{
					echo "<span class=\"annot_std_it\">";
					echo $nb_cli_ddeot_crees_total;
					echo "</span>";
					if ($nb_cli_crees_total <> 0)
					{
						echo"<span class=\"annot_petit_it\">";
						echo " (".round((($nb_cli_ddeot_crees_total/$nb_cli_crees_total)*100),2)."%)";
						echo "</span>";
					}
				}
				else
					echo "-";
				echo "</td>\n";
				echo "<td align=\"center\">";
				if ($nb_cli_inter_crees_total <> 0)
				{
					echo "<span class=\"annot_std_it\">";
					echo $nb_cli_inter_crees_total;
					echo "</span>";
					if ($nb_cli_crees_total <> 0)
					{
						echo"<span class=\"annot_petit_it\">";
						echo " (".round((($nb_cli_inter_crees_total/$nb_cli_crees_total)*100),2)."%)";
						echo "</span>";
					}
				}
				else
					echo "-";
				echo "</td>\n";

				echo "</tr>\n";
				
				$i++;

				/* Saut de ligne pour lisibilité */
				
				// Création de l'entête de ligne (TR)
				creetrlst($i);

				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>";
				echo "&nbsp;";
				echo "</td>\n";

				echo "</tr>\n";
				
				$i++;

				if ($nb_tec_select > 0)
				{
					for ($j=0; $j<$nb_tec_select; $j++)
					{
						// Création de l'entête de ligne (TR)
						creetrlst($i);
		
						echo "<td>";
						$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
						mysql_select_db(DBNAME);
						$rs = mysql_query("SELECT * FROM ".TBTEC." WHERE `tec_code` = '".$code_tec[$j]."'");
						if ($row = mysql_fetch_array($rs))
						{
							extract($row);
							$txt_tec = $tec_nom." ".$tec_prenom;
						}
						mysql_free_result($rs);
						mysql_close($conn);
						echo "<span class=\"annot_std_gras\">";
						echo $txt_tec." (".$code_tec[$j].")";
						echo "</span>";
						if ($tec_out == 1)
						{
							echo "<span class=\"annot_petit_it\">";
							echo " Licencié";
							echo "</span>";
						}
						echo "<br>";
						if ($nb_cli_crees_tec[$j] <> 0)
						{
							echo "<span class=\"annot_petit_it\">";
							echo "<div align=\"right\">";
							echo "Par rapport technicien : ";
							echo "<br>".$txt_div_raptot." : ";
							echo "</div>";
							echo "</span>";
						}
						echo "</td>\n";
						echo "<td align=\"center\">";
						if ($nb_cli_crees_tec[$j] <> 0)
						{
							echo "<span class=\"annot_std_gras\">";
							echo $nb_cli_crees_tec[$j];
							echo "</span>";
							if ($nb_cli_crees_total <> 0)
							{
								echo"<span class=\"annot_petit_it\">";
								echo "<br>-<br>(".round((($nb_cli_crees_tec[$j]/$nb_cli_crees_total)*100),2)."%)";
								echo "</span>";
							}							
						}
						else
							echo "-";
						echo "</td>\n";
						echo "<td align=\"center\">";
						if ($nb_cli_prospects_crees_tec[$j] <> 0)
						{
							echo "<span class=\"annot_std_gras\">";
							echo $nb_cli_prospects_crees_tec[$j];
							echo "</span>";
							echo "<br>";
							if ($nb_cli_crees_tec[$j] <> 0)
							{
								echo"<span class=\"annot_petit_it\">";
								echo "(".round((($nb_cli_prospects_crees_tec[$j]/$nb_cli_crees_tec[$j])*100),2)."%)";
								echo "</span>";
							}
							else
								echo "-";
							echo "<br>";
							if ($nb_cli_prospects_crees_total <> 0)
							{
								echo"<span class=\"annot_petit_it\">";
								echo "(".round((($nb_cli_prospects_crees_tec[$j]/$nb_cli_prospects_crees_total)*100),2)."%)";
								echo "</span>";
							}							
							else
								echo "-";
						}
						else
							echo "-";
						echo "</td>\n";
						echo "<td align=\"center\">";
						if ($nb_cli_ddeot_crees_tec[$j] <> 0)
						{
							echo "<span class=\"annot_std_gras\">";
							echo $nb_cli_ddeot_crees_tec[$j];
							echo "</span>";
							echo "<br>";
							if ($nb_cli_crees_tec[$j] <> 0)
							{
								echo"<span class=\"annot_petit_it\">";
								echo " (".round((($nb_cli_ddeot_crees_tec[$j]/$nb_cli_crees_tec[$j])*100),2)."%)";
								echo "</span>";
							}
							else
								echo "-";
							echo "<br>";
							if ($nb_cli_ddeot_crees_total <> 0)
							{
								echo"<span class=\"annot_petit_it\">";
								echo "(".round((($nb_cli_ddeot_crees_tec[$j]/$nb_cli_ddeot_crees_total)*100),2)."%)";
								echo "</span>";
							}							
							else
								echo "-";
						}
						else
							echo "-";
						echo "</td>\n";
						echo "<td align=\"center\">";
						if ($nb_cli_inter_crees_tec[$j] <> 0)
						{
							echo "<span class=\"annot_std_gras\">";
							echo $nb_cli_inter_crees_tec[$j];
							echo "</span>";
							echo "<br>";
							if ($nb_cli_crees_tec[$j] <> 0)
							{
								echo"<span class=\"annot_petit_it\">";
								echo " (".round((($nb_cli_inter_crees_tec[$j]/$nb_cli_crees_tec[$j])*100),2)."%)";
								echo "</span>";
							}							
							echo "<br>";
							if ($nb_cli_inter_crees_total <> 0)
							{
								echo"<span class=\"annot_petit_it\">";
								echo "(".round((($nb_cli_inter_crees_tec[$j]/$nb_cli_inter_crees_total)*100),2)."%)";
								echo "</span>";
							}							
							else
								echo "-";
						}
						else
							echo "-";
						echo "</td>\n";
		
						echo "</tr>\n";
						
						$i++;
					}
				}
				else
				{
					// Création de l'entête de ligne (TR)
					creetrlst($i);
	
					echo "<td>";
					echo"<span class=\"annot_petit_it\">";
					echo $txt_div_noresdde.".";
					echo "</span>";
					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>";
					echo "&nbsp;";
					echo "</td>\n";
	
					echo "</tr>\n";
				}
				
				echo "</table>\n";
				// *** Fin affichage de la table
			}
			break;
		
			/* Nombre de traitements d'ordres sur une période donnée */
			case 2 :
				if ($aff_stat == FALSE) // On est en mode "paramètres"
				{
		?>
				<script language="javascript">
				<!--
				var tab_champ=new Array(
					"nom:tec[] ; format:listem ; req:Y ; txt:Technicien; vmn:0 ; stok:frmok ; stbad:frmbad",
					"nom:st ; format:liste ; req:Y ; txt:Sous-traitant; vmn:0 ; stok:frmok ; stbad:frmbad",
					"nom:date1f ; format:date ; req:Y ; txt:<?PHP echo html_entity_decode($txt_chp_dtedeb); ?>; masque:<?PHP echo $datemsql; ?> ; stok:frmok ; stbad:frmbad",
					"nom:date2f ; format:date ; req:Y ; txt:<?PHP echo html_entity_decode($txt_chp_dtefin); ?> ; masque:<?PHP echo $datemsql; ?> ; stok:frmok ; stbad:frmbad");
				//-->
				</script>
				
				<form name="inter" class="form_pointilles" method="post" action="tecs_stat.php">
				<input name="ts" type="hidden" id="ts" value="<?PHP echo $ts ?>">
				<table width="100%" border="0">
				<tr>
                    <td width="50%" align="center">
						<br>
						Choisissez un technicien (s&eacute;lections multiples possibles).
						<br>
						<span class="annot_petit_it">(Si 'Tous', les techniciens licenci&eacute;s seront aussi analys&eacute;s)</span>
					</td>
                    <td align="center">
					<?PHP
					if( (@$_SESSION["niv_log"] == 5) OR (@$_SESSION["niv_log"] == 9))
					{
					?>
						<br>
						Choisissez un sous-traitant.
						<br>
						<br>
					<?PHP
					}
					else
					{
					?>
						&nbsp;
					<?PHP
					}
					?>
					</td>
				</tr>
				<tr>
                    <td width="50%" align="center">
						<select name="tec[]" id="tec" size="5" multiple="multiple">
						<option value="*" selected="selected"><?PHP echo $sel_lst_tous; ?></option>
		
						<?PHP
						// Création de la liste des techniciens actifs
						
						$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
						mysql_select_db(DBNAME);
						if( (@$_SESSION["niv_log"] == 5) OR (@$_SESSION["niv_log"] == 9))
							$rs = mysql_query("SELECT * FROM ".TBTEC." WHERE `tec_out` = '0' AND tec_codest <> '' ORDER BY tec_nom");
						else
						{
							if (@$_SESSION["niv_log"] == 10)
								$rs = mysql_query("SELECT * FROM ".TBTEC." WHERE `tec_out` = '0' AND `tec_codest` = '".@$_SESSION["code_log"]."' ORDER BY tec_nom");
						}
						while ($resultat = mysql_fetch_array($rs)) 
						{
							extract($resultat);
							$txt_tec = $tec_nom." ".$tec_prenom." (".$tec_code.")";
							echo '<option value="'.$tec_code.'">'.$txt_tec.'</option>';
						}
						mysql_free_result($rs);
						mysql_close($conn);
						?>
						</select>
					</td>
                    <td align="center">
					<?PHP
					if( (@$_SESSION["niv_log"] == 5) OR (@$_SESSION["niv_log"] == 9))
					{
					?>
						<select name="st" size="5" id="st">
						<option value="*" selected="selected"><?PHP echo $sel_lst_tous; ?></option>
						<?PHP
						
						// Création de la liste des donneurs d'ordres
						
						$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
						mysql_select_db(DBNAME);
						$rs = mysql_query("SELECT * FROM ".TBST." ORDER BY st_nom");
						
						while ($resultat = mysql_fetch_array($rs)) 
						{
							extract($resultat);
							echo '<option value="'.$st_code.'">'.$st_nom.'</option>';
						}
						mysql_free_result($rs);
						mysql_close($conn);
						?>
						</select>
					<?PHP
					}
					else
					{
						if (@$_SESSION["niv_log"] == 10)
						{
					?>
							<input name="st" type="hidden" id="st" value="<?PHP echo @$_SESSION["code_log"]; ?>">
					<?PHP
						}
					}
					?>
					</td>
                  </tr>
                </table>
				<br>
				<br>
				<br>
				<table width="400"  border="0" align="center">
				<tr>
					<td width="30" class="rubfrm" id="f_date1" align="right"><?PHP echo $txt_div_fromMAJ; ?>...</td>
					<td>
						<input name="date1f" type="text" id="date1f" size="10" maxlength="10" readonly="1">
						<img src="../img/calendar.png" align="absmiddle" id="f_img_date1f" title="<?PHP echo $alt_chxdate; ?>">
						<img src="../img/oblig.png" align="absmiddle" alt="<?PHP echo $alt_chp_oblig; ?>">
					</td>
					<td width="30" class="rubfrm" id="f_date2f" align="right"><?PHP echo $txt_div_toMAJ; ?>...</td>
					<td>
						<input name="date2f" type="text" id="date2f" size="10" maxlength="10" readonly="1">
						<img src="../img/calendar.png" align="absmiddle" id="f_img_date2f" title="<?PHP echo $alt_chxdate; ?>">
						<img src="../img/oblig.png" align="absmiddle" alt="<?PHP echo $alt_chp_oblig; ?>">
					</td>
				</tr>
				</table>
				<p align="center">
					<input name="Submit" type="button" class="bton_std" id="Submit" value="<?PHP echo $but_calc; ?>" onClick="verif_stats_tec(inter,tab_champ,'','',this.value);">
					<input name="init" type="reset" class="bton_std" id="init" value="<?PHP echo $but_reinit; ?>">
				</p>
			</form>
			
			<script type="text/javascript">
			<!--
				Calendar.setup({
					inputField     :    "date1f",     // id of the input field
					ifFormat       :    "<?PHP echo $datefmtc; ?>",      // format of the input field
					button         :    "f_img_date1f",  // trigger for the calendar (button ID)
					align          :    "Ll",           // alignment (defaults to "Bl")
					electric	   :	false,
					singleClick    :    true
				});
				Calendar.setup({
					inputField     :    "date2f",     // id of the input field
					ifFormat       :    "<?PHP echo $datefmtc; ?>",      // format of the input field
					button         :    "f_img_date2f",  // trigger for the calendar (button ID)
					align          :    "Ll",           // alignment (defaults to "Bl")
					electric	   :	false,
					singleClick    :    true
				});
			//-->
			</script>
			  
	<?PHP
			}
			else // On est en mode "affichage de stats"
			{
				// Définition et entête de la table
				echo "<table class=\"Mtable\" border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\n";
	
				echo "<th>";
				echo "Sous-traitant";
				echo "</th>\n";
				echo "<th>";
				echo "Total trait&eacute;s";
				echo "</th>\n";
				echo "<th>";
				echo "Ouverts";
				echo "</th>\n";
				echo "<th>";
				echo "Agences pr&eacute;venues";
				echo "</th>\n";
				echo "<th>";
				echo "Clots";
				echo "</th>\n";

				$i = 0;

				/* Données pour tous les techniciens */

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

				echo "<td>";
				echo "<span class=\"annot_std_it\">";
				echo "Tous les techniciens";
				echo "</span>";
				echo "</td>\n";
				echo "<td align=\"center\">";
				if ($nb_ot_trait_total <> 0)
				{
					echo "<span class=\"annot_std_it\">";
					echo $nb_ot_trait_total;
					echo "</span>";
				}
				else
					echo "-";
				echo "</td>\n";
				echo "<td align=\"center\">";
				if ($nb_ot_ouv_trait_total <> 0)
				{
					echo "<span class=\"annot_std_it\">";
					echo $nb_ot_ouv_trait_total;
					echo "</span>";
					if ($nb_ot_trait_total <> 0)
					{
						echo"<span class=\"annot_petit_it\">";
						echo " (".round((($nb_ot_ouv_trait_total/$nb_ot_trait_total)*100),2)."%)";
						echo "</span>";
					}
				}
				else
					echo "-";
				echo "</td>\n";
				echo "<td align=\"center\">";
				if ($nb_ot_prev_trait_total <> 0)
				{
					echo "<span class=\"annot_std_it\">";
					echo $nb_ot_prev_trait_total;
					echo "</span>";
					if ($nb_ot_trait_total <> 0)
					{
						echo"<span class=\"annot_petit_it\">";
						echo " (".round((($nb_ot_prev_trait_total/$nb_ot_trait_total)*100),2)."%)";
						echo "</span>";
					}
				}
				else
					echo "-";
				echo "</td>\n";
				echo "<td align=\"center\">";
				if ($nb_ot_clos_trait_total <> 0)
				{
					echo "<span class=\"annot_std_it\">";
					echo $nb_ot_clos_trait_total;
					echo "</span>";
					if ($nb_ot_trait_total <> 0)
					{
						echo"<span class=\"annot_petit_it\">";
						echo " (".round((($nb_ot_clos_trait_total/$nb_ot_trait_total)*100),2)."%)";
						echo "</span>";
					}
				}
				else
					echo "-";
				echo "</td>\n";

				echo "</tr>\n";
				
				$i++;

				/* Saut de ligne pour lisibilité */
				
				// Création de l'entête de ligne (TR)
				creetrlst($i);

				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>";
				echo "&nbsp;";
				echo "</td>\n";

				echo "</tr>\n";
				
				$i++;

				if ($nb_tec_select > 0)
				{
					for ($j=0; $j<$nb_tec_select; $j++)
					{
						// Création de l'entête de ligne (TR)
						creetrlst($i);
		
						echo "<td>";
						$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
						mysql_select_db(DBNAME);
						$rs = mysql_query("SELECT * FROM ".TBTEC." WHERE `tec_code` = '".$code_tec[$j]."'");
						if ($row = mysql_fetch_array($rs))
						{
							extract($row);
							$txt_tec = $tec_nom." ".$tec_prenom;
						}
						mysql_free_result($rs);
						mysql_close($conn);
						echo "<span class=\"annot_std_gras\">";
						echo $txt_tec." (".$code_tec[$j].")";
						echo "</span>";
						if ($tec_out == 1)
						{
							echo "<span class=\"annot_petit_it\">";
							echo " Licencié";
							echo "</span>";
						}
						echo "<br>";
						if ($nb_ot_trait_tec[$j] <> 0)
						{
							echo "<span class=\"annot_petit_it\">";
							echo "<div align=\"right\">";
							echo "Par rapport technicien : ";
							echo "<br>".$txt_div_raptot." : ";
							echo "</div>";
							echo "</span>";
						}
						echo "</td>\n";
						echo "<td align=\"center\">";
						if ($nb_ot_trait_tec[$j] <> 0)
						{
							echo "<span class=\"annot_std_gras\">";
							echo $nb_ot_trait_tec[$j];
							echo "</span>";
							if ($nb_ot_trait_total <> 0)
							{
								echo"<span class=\"annot_petit_it\">";
								echo "<br>-<br>(".round((($nb_ot_trait_tec[$j]/$nb_ot_trait_total)*100),2)."%)";
								echo "</span>";
							}							
						}
						else
							echo "-";
						echo "</td>\n";
						echo "<td align=\"center\">";
						if ($nb_ot_ouv_trait_tec[$j] <> 0)
						{
							echo "<span class=\"annot_std_gras\">";
							echo $nb_ot_ouv_trait_tec[$j];
							echo "</span>";
							echo "<br>";
							if ($nb_ot_trait_tec[$j] <> 0)
							{
								echo"<span class=\"annot_petit_it\">";
								echo "(".round((($nb_ot_ouv_trait_tec[$j]/$nb_ot_trait_tec[$j])*100),2)."%)";
								echo "</span>";
							}
							else
								echo "-";
							echo "<br>";
							if ($nb_ot_ouv_trait_total <> 0)
							{
								echo"<span class=\"annot_petit_it\">";
								echo "(".round((($nb_ot_ouv_trait_tec[$j]/$nb_ot_ouv_trait_total)*100),2)."%)";
								echo "</span>";
							}							
							else
								echo "-";
						}
						else
							echo "-";
						echo "</td>\n";
						echo "<td align=\"center\">";
						if ($nb_ot_prev_trait_tec[$j] <> 0)
						{
							echo "<span class=\"annot_std_gras\">";
							echo $nb_ot_prev_trait_tec[$j];
							echo "</span>";
							echo "<br>";
							if ($nb_ot_trait_tec[$j] <> 0)
							{
								echo"<span class=\"annot_petit_it\">";
								echo " (".round((($nb_ot_prev_trait_tec[$j]/$nb_ot_trait_tec[$j])*100),2)."%)";
								echo "</span>";
							}
							else
								echo "-";
							echo "<br>";
							if ($nb_ot_prev_trait_total <> 0)
							{
								echo"<span class=\"annot_petit_it\">";
								echo "(".round((($nb_ot_prev_trait_tec[$j]/$nb_ot_prev_trait_total)*100),2)."%)";
								echo "</span>";
							}							
							else
								echo "-";
						}
						else
							echo "-";
						echo "</td>\n";
						echo "<td align=\"center\">";
						if ($nb_ot_clos_trait_tec[$j] <> 0)
						{
							echo "<span class=\"annot_std_gras\">";
							echo $nb_ot_clos_trait_tec[$j];
							echo "</span>";
							echo "<br>";
							if ($nb_ot_trait_tec[$j] <> 0)
							{
								echo"<span class=\"annot_petit_it\">";
								echo " (".round((($nb_ot_clos_trait_tec[$j]/$nb_ot_trait_tec[$j])*100),2)."%)";
								echo "</span>";
							}							
							echo "<br>";
							if ($nb_ot_clos_trait_total <> 0)
							{
								echo"<span class=\"annot_petit_it\">";
								echo "(".round((($nb_ot_clos_trait_tec[$j]/$nb_ot_clos_trait_total)*100),2)."%)";
								echo "</span>";
							}							
							else
								echo "-";
						}
						else
							echo "-";
						echo "</td>\n";
		
						echo "</tr>\n";
						
						$i++;
					}
				}
				else
				{
					// Création de l'entête de ligne (TR)
					creetrlst($i);
	
					echo "<td>";
					echo"<span class=\"annot_petit_it\">";
					echo $txt_div_noresdde.".";
					echo "</span>";
					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>";
					echo "&nbsp;";
					echo "</td>\n";
	
					echo "</tr>\n";
				}
				
				echo "</table>\n";
				// *** Fin affichage de la table
			}
		
			break;

		default :
			break;
		}
	}
	}
	else
	{
		echo '<p align="center" class="annot_std_it">Vous n\'avez cr&eacute;&eacute; aucun technicien...</p>';
		aff_ret_idx_auto("index.php",2000);
	}
}
else
{
	echo '<p align="center" class="annot_std_it"><?PHP echo $alert_prm; ?>...</p>';
	aff_ret_idx_auto("index.php",2000);
}
include_once("pied.php")
?>
