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

Version 0.9.7

Copyright (C) 2006-2007  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
****************************************************************************************/

session_start(); 
include_once("../inc/config.inc.php");
include_once("../inc/func_log.inc.php");
if (CheckURLLog(FALSE)==FALSE) header("Location: ../index.php");
if (CheckNivLog("3-4")==FALSE) header("Location: ../index.php");
include_once("../inc/fic_fici.inc.php");
include_once("../inc/func.inc.php");
include_once("../inc/func_date.inc.php");
include_once("../inc/func_time.inc.php");
include_once("../inc/func_txt.inc.php");
include_once("../inc/func_geo.inc.php");
include_once("../inc/lst.inc.php");
Archivelog(@$_SESSION["code_log"]);
$pbm_conf=FALSE;
if (!exist_logo("cge")) $pbm_conf=TRUE;
if (!exist_logo(@$_SESSION["code_age"])) $pbm_conf=TRUE;
if (!existe_cdg()) $pbm_conf=TRUE;
?>
<!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 : Index Agences</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>

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

</head>

<body>

<?php
if ($pbm_conf==FALSE)
{
include_once("../inc/entete.inc.php"); 
?>
<p align="center"><span class="titrepage">TABLEAU DE BORD DE L'AGENCE </span><br></p>
<br>
<div id="menu_ageidx" class="menu_ongletfull">
<a class="ongleti" id="m1" href="javascript:;" onclick="set_mnu_ageidx(this.id);" onFocus="this.blur();">Interventions en cours</a>
<a class="ongleti" id="m2" href="javascript:;" onclick="set_mnu_ageidx(this.id);" onFocus="this.blur();">Relev&eacute;s de parc avec probl&egrave;mes</a>
<a class="ongleti" id="m3" href="javascript:;" onclick="set_mnu_ageidx(this.id);" onFocus="this.blur();">Contrats &agrave; &eacute;ch&eacute;ance prochaine</a>
</div>
<br>

<div id="detailm1" style="display:none">
<?PHP
	$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
	mysql_select_db(DBNAME);

	$rech = cree_strrechlstint($niv_urgence);
	if(!stristr($rech,"WHERE "))
		$rech .= " WHERE ".TBINT.".int_codeage='".@$_SESSION["code_age"]."' AND ".TBINT.".int_codestatut <> 'CLOT'";
	else
		$rech .= " AND ".TBINT.".int_codeage='".@$_SESSION["code_age"]."' AND ".TBINT.".int_codestatut <> 'CLOT'";
		
	$rech .= "ORDER BY ".TBINT.".int_code DESC";
	// *** Fin de Chaîne de Recherche
		 
	$rs = mysql_query($rech) or die(mysql_error());
	$numrows = mysql_num_rows($rs); // Nombre de résultats à la requête
	
	if($numrows > 0)
	{
		echo "<span class=\"annot_std_it\">";
		echo "(Lieu/Statut : laisser la souris sur l'icône pour le d&eacute;tail)<br>";
		echo "</span>";
	
		// *** Affichage de la table
		 echo "<table class=\"Mtable\" border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\n";     
	
		// Création entête
		titlst(TRUE,$int_titre_col);
		echo "<th>".ucfirst("Cliquer")."</th>\n";
		
		$i = 0;
		
		while ($row = mysql_fetch_assoc($rs)) 
		{         
		 // Affichage résumé intervention
	
			// Création de l'entête de ligne (TR)
			creetrlst($i);
	
			 echo "<td>".$row["int_code"]."</td>\n";
			 echo "<td>".formatedate($row["int_datedde"])."</td>\n";
	
			 // Affichage Icône Lieu
			 echo "<td>";
			 echo "<div align=\"center\">";
			 
			 $lieu = $row["int_codelieu"];
			 $rechlieu = "SELECT * FROM ".TBLIEU." WHERE lieu_code = '$lieu'";
			 
			 $rslieu = mysql_query($rechlieu) or die(mysql_error());
			 
				if (mysql_num_rows($rslieu) <> 0)
				{
					 while ($rowlieu = mysql_fetch_array($rslieu)) 
					{
						extract ($rowlieu);
						if ($rowlieu["lieu_img"] <> "")
						{
							$lieuint = $rowlieu["lieu_desc"]." (".$lieu.")";
							echo "<img src=\"".$rowlieu["lieu_img"]."\" title=\"".$lieuint."\" width=\"".$hl_vign."\" height=\"".$hl_vign."\" border=\"0\" align=\"absmiddle\">";
						}
						else
						{
							 echo "<span class=\"annot_std_it\">";
							 echo $lieu;
							 echo "</span>";
						}
					}
				}
			 
				mysql_free_result($rslieu);
	
			 echo "</div>";
			 echo "</td>\n";

			 // Affichage détail urgence
			 echo "<td>";
			 echo "<div align=\"center\">";
			 echo $niv_urgence[$row["int_urg"]];
			 echo "</div>";
			 echo "</td>\n";
		
			 // Fin affichage détail urgence
	
	
			 echo "<td>".$row["int_codecli"];
	
			 // Affichage détail client
	
				 $detailcli = "->";
				 if ($row["cli_ste"] <> "")
					$detailcli .= htmlspecialchars($row["cli_ste"]).", ";
				 $detailcli .= htmlspecialchars($row["cli_civilite"])." ".htmlspecialchars($row["cli_nom"]);
				 echo "<br>";
				 echo "<span class=\"annot_std_it\">";
				 echo $detailcli;
				 echo "</span>";
		
			 // Fin affichage détail client
	
			 echo "</td>\n";
			 if (($row["int_codetec"] <> "") AND ($row["int_codetec"] <> "-1"))
				echo "<td>".$row["int_codetec"]."</td>\n";
			 else
				echo "<td>&nbsp;</td>\n";
			 
			 // Affichage Icône Statut
			 
			 echo "<td>";
			 echo "<div align=\"center\">";
			 
			 $statut = $row["int_codestatut"];
			 $rechico = "SELECT * FROM ".TBSTA." WHERE statut_code = '$statut'";
			 
			 $rsico = mysql_query($rechico) or die(mysql_error());
			 
				if (mysql_num_rows($rsico) <> 0)
				{
					 while ($rowico = mysql_fetch_array($rsico)) 
					{
						extract ($rowico);
						if ($rowico["statut_img"] <> "")
						{
							$statint = $rowico["statut_desc"]." (".$statut.")";
							echo "<img src=\"".$rowico["statut_img"]."\" title=\"".$statint."\" width=\"".$hl_vign."\" height=\"".$hl_vign."\" border=\"0\" align=\"absmiddle\">";
						}
						else
						{
							 echo "<span class=\"annot_std_it\">";
							 echo $statut;
							 echo "</span>";
						}
					}
				}
			 
				mysql_free_result($rsico);
	
			 echo "</div>";
			 echo "</td>\n";
	
			// CREATION lien dynamique sur icône (édition, suppression, etc...)
			 echo "<td>";
			 echo "<div align=\"center\">";
	
			$lst_maj = TRUE;
	
			echo "<a href=\"int_maj.php?td=edit&ci=".$row["int_code"]."\"><img src=\"../img/edit.png\" width=\"".$hl_vign."\" height=\"".$hl_vign."\" border=\"0\" align=\"absmiddle\"></a>";
			echo " ";
	
			$lst_imp = TRUE;
			
			 $urlimp = "int_pdf.php?ci=".$row["int_code"];
			 echo "<a href=\"javascript:;\" onclick=\"lanceimp('".$urlimp."');\")><img src=\"../img/print.gif\" title=\"Imprimer la fiche\" width=\"".$hl_vign."\" height=\"".$hl_vign."\" border=\"0\" align=\"absmiddle\"></a>";
			 echo " ";
			 if ($row["int_codestatut"] <> "CLOT")
			 {
				$lst_del = TRUE;
	
				echo "<a href=\"int_maj.php?td=del&ci=".$row["int_code"]."&cc=".$row["int_codecli"]."&ca=".$row["int_codeage"]."\"><img src=\"../img/del.gif\" width=\"".$hl_vign."\" height=\"".$hl_vign."\" border=\"0\" align=\"absmiddle\"></a>";
			 }
	
			 echo "</div>";
			 echo "</td>\n";
	
			 echo "</tr>\n";
		 // Fin affichage résumé intervention
			
			$i++;    
		}  
		echo "</table>\n";
		// *** Fin affichage de la table
		
		mysql_free_result($rs);
	}
	else
	{
		echo "<span class=\"annot_gras_it\">";
		echo "<br><br>Pas d'intervention en cours";
		echo "</span>";
	}	

	mysql_close($conn);  
	
	$taille_piedla="";
	include("../inc/piedla.inc.php"); ?>
</div>

<div id="detailm2" style="display:none">
<span class="annot_std_it">D&eacute;clar&eacute;s et non affect&eacute;s &agrave; une intervention</span></p>
<?PHP
	$lst_maj = FALSE;
	$lst_imp = FALSE;
	$lst_del = FALSE;
	$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
	mysql_select_db(DBNAME);

	$rech = cree_strrechlstrrel();
	if(!stristr($rech,"WHERE "))
		$rech .= " WHERE ".TBREL.".rel_codeage='".@$_SESSION["code_age"]."'";
	else
		$rech .= " AND ".TBREL.".rel_codeage='".@$_SESSION["code_age"]."'";
	$rech .= crestr_triord($rel_titre_col,"rel_code",FALSE,$limit);
	// *** Fin de Chaîne de Recherche
	$rs = mysql_query($rech) or die(mysql_error());
	$numrows = mysql_num_rows($rs); // Nombre de résultats à la requête
	

	if($numrows > 0)
	{
		$first=TRUE;
		$i = 0;
		
		while ($row = mysql_fetch_assoc($rs)) 
		{         
		 // Affichage résumé relevé
	
			// Vérification si problème(s) non affecté(s)
			// Si oui, on affiche (sinon, non)
			$rexist2 = "SELECT * FROM ".TBRPBM."  WHERE rpbm_codecli = '".$row["cli_code"]."' AND rpbm_codeint IS NULL";
			$rs2 = mysql_query($rexist2) or die(mysql_error());
			if (mysql_num_rows($rs2) > 0)
			{
				if ($first==TRUE)
				{
					// *** Affichage de la table
					 echo "<table class=\"Mtable\" border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\n";     
				
					// Création entête
					titlst(TRUE,$rel_titre_col);
					echo "<th>".ucfirst("Cliquer")."</th>\n";
					
					$first=FALSE;
				}
				
				// Création de l'entête de ligne (TR)
				creetrlst($i);
		
				 echo "<td>";
				 echo $row["rel_code"];
				 echo "</td>\n";
				 echo "<td>".formatedate($row["rel_datecrea"])."</td>\n";
				 echo "<td>".formatedate($row["rel_datemod"])."</td>\n";
				 echo "<td>".$row["rel_codecli"];
		
				 // Affichage détail client
		
					 $detailcli = "->";
					 if ($row["cli_ste"] <> "")
						$detailcli .= htmlspecialchars($row["cli_ste"]).", ";
					 $detailcli .= $row["cli_civilite"]." ".htmlspecialchars($row["cli_nom"]);
					 echo "<br>";
					 echo "<span class=\"annot_std_it\">";
					 echo $detailcli;
					 echo "</span>";
			
				 // Fin affichage détail client
		
				 echo "</td>\n";
				 if ($row["rel_codeage"] <> "")
					echo "<td>".$row["rel_codeage"]."</td>\n";
				 else
					echo "<td>&nbsp;</td>\n";
				 
				// CREATION lien dynamique sur icône (édition, suppression, etc...)
				 echo "<td>";
				 echo "<div align=\"center\">";
		
				$lst_maj = TRUE;
		
				echo "<a href=\"rel_maj.php?td=edit&cr=".$row["rel_code"]."\"><img src=\"../img/edit.png\" width=\"".$hl_vign."\" height=\"".$hl_vign."\" border=\"0\" align=\"absmiddle\"></a>";
				echo " ";
		
				$lst_imp = TRUE;
				
				 $urlimp = "rel_pdf.php?cr=".$row["rel_code"]."&pbm=0";
				 echo "<a href=\"javascript:;\" onclick=\"lanceimp('".$urlimp."');\")><img src=\"../img/print.gif\" title=\"Imprimer le dossier relevé\" width=\"".$hl_vign."\" height=\"".$hl_vign."\" border=\"0\" align=\"absmiddle\"></a>";
				 echo " ";
		
				$lst_impp = TRUE;
				
				 $urlimp = "rel_pdf.php?cr=".$row["rel_code"]."&pbm=1";
				 echo "<a href=\"javascript:;\" onclick=\"lanceimp('".$urlimp."');\")><img src=\"../img/printc.gif\" title=\"Imprimer le dossier relevé avec les problèmes\" width=\"".$hl_vign."\" height=\"".$hl_vign."\" border=\"0\" align=\"absmiddle\"></a>";
				 echo " ";
		
				$lst_del = TRUE;
		
				echo "<a href=\"rel_maj.php?td=del&cr=".$row["rel_code"]."&cc=".$row["rel_codecli"]."&ca=".$row["rel_codeage"]."\"><img src=\"../img/del.gif\" width=\"".$hl_vign."\" height=\"".$hl_vign."\" border=\"0\" align=\"absmiddle\"></a>";
		
				 echo "</div>";
				 echo "</td>\n";
		
				 echo "</tr>\n";
				 // Fin affichage résumé intervention
				
				$i++;
			}
		} 
		
		if ($first==FALSE)
			echo "</table>\n";		// *** Fin affichage de la table
		else
		{
			echo "<span class=\"annot_gras_it\">";
			echo "Pas de problème déclaré non affecté.";
			echo "</span>";
		}
	
		mysql_free_result($rs);
	}
	else
	{
		echo "<span class=\"annot_gras_it\">";
		echo "<br><br>Pas de relevé sur cette agence.";
		echo "</span>";
	}

	mysql_close($conn);  
	
	$taille_piedla="";
	include("../inc/piedla.inc.php"); ?>
</div>

<div id="detailm3" style="display:none">
<span class="annot_std_it">Sign&eacute;s, non renouvel&eacute;s, avec moins de 60 minutes de solde sur quota horaire ou &agrave; &eacute;ch&eacute;ance dans 30 jours maximum</span></p>
<?PHP
	$lst_maj = FALSE;
	$lst_voir = FALSE;
	$lst_int = FALSE;
	$lst_imp = FALSE;
	$lst_impp = FALSE;
	$lst_del = FALSE;
	$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
	mysql_select_db(DBNAME);

	$rech = cree_strrechlstcocl();
	if(!stristr($rech,"WHERE "))
		$rech .= " WHERE ";
	else
		$rech .= " AND ";
	$rech.= TBCOCL.".cocl_codeage='".@$_SESSION["code_age"]."'";
	$rech.= " AND ".TBCOCL.".cocl_datefin ='0000-00-00' AND ".TBCOCL.".cocl_datesig <>'0000-00-00' AND ((".TBCOCL.".cocl_soldes<=3600 AND ".TBCOCL.".cocl_typh=1) OR (".TBCOCL.".cocl_datef <='".nouv_date_plus_jours($datea,30)."' AND ".TBCOCL.".cocl_datef<>'0000-00-00' AND ".TBCOCL.".cocl_datef>='".$datea."'))";
	$rech.= " ORDER BY ".TBCOCL.".cocl_code DESC";
	// *** Fin de Chaîne de Recherche
	
	$rs = mysql_query($rech) or die(mysql_error());
	$numrows = mysql_num_rows($rs); // Nombre de résultats à la requête
	
	if($numrows > 0)
	{
		echo "<span class=\"annot_std_it\">";
		echo "(Code : laisser la souris sur l'icône pour le d&eacute;tail)<br>";
		echo "</span>";

		if (@$_SESSION["niv_log"] == 4)
		{
			echo "<a href=\"coclren_lst.php?ord=DES&tri=Code\">Renouveler des contrats</a>";
		}
	
		// *** Affichage de la table
		 echo "<table class=\"Mtable\" border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\n";     
	
		// Création entête
		titlst(TRUE,$cocl_titre_col);
		echo "<th>".ucfirst("Cliquer")."</th>\n";
		
		$i = 0;
		while ($row = mysql_fetch_assoc($rs)) 
		{         
		 // Affichage résumé Contrat Client
	
			// Création de l'entête de ligne (TR)
			creetrlst($i);
	
			 $echeance_ok = TRUE;
			 if (formatedate($row["cocl_datef"]) <> "")
			 {
				if (echeance_depassee_date($datea,$row["cocl_datef"]) == TRUE)
					$echeance_ok = FALSE;
			 }
	
			 echo "<td>".$row["cocl_code"];
	
			 // CREATION d'icône si signé
			  if (formatedate($row["cocl_datesig"]) <> "")
			  {
				$lst_sig = TRUE;
				 echo " <img src=\"../img/ok.gif\" title =\"Signé le ".formatedate($row["cocl_datesig"])."\" width=\"".$hl_vign."\" height=\"".$hl_vign."\" border=\"0\" align=\"absmiddle\">";
			  }
	
			 // CREATION d'icône si terminé
			  if ((formatedate($row["cocl_datefin"]) <> "") OR ($echeance_ok == FALSE))
			  {
				$lst_fini = TRUE;
				if (formatedate($row["cocl_datefin"]) <> "")
					echo " <img src=\"../img/warn.gif\" title =\"Terminé le ".formatedate($row["cocl_datefin"])."\" width=\"".$hl_vign."\" height=\"".$hl_vign."\" border=\"0\" align=\"absmiddle\">";
				else
					echo " <img src=\"../img/warn.gif\" title =\"Terminé le ".formatedate($row["cocl_datef"])."\" width=\"".$hl_vign."\" height=\"".$hl_vign."\" border=\"0\" align=\"absmiddle\">";
			  }
	
			 // Détail contrat
			 echo "<br>";
			 echo "<span class=\"annot_petit_it\">";
			 $rech2 = "SELECT * FROM " .TBCO. " WHERE co_code = '".$row["cocl_codeco"]."'";
			 $rs2 = mysql_query($rech2) or die(mysql_error());
			 if ($row2 = mysql_fetch_array($rs2))
			 {
				$txt = formatetxt($row2["co_nom"]);
				echo "->".htmlspecialchars($txt,ENT_NOQUOTES);
			 }
			 echo "</span>";

			// Vérifie si échéance bientôt atteinte (<=30 jours) ou si quota horaire <=60mn
			if (formatedate($row["cocl_datefin"])=="")
			{
				if (formatedate($row["cocl_datef"])<>"")
				{
					if (echeance_depassee_date($datea,$row["cocl_datef"]) == FALSE)
					{
						$nb_jours_restants=diff_date_jours($datea,$row["cocl_datef"],TRUE);
						if ($nb_jours_restants<=30)
						{
							echo "<div align=\"right\" class=\"annot_petit_it\">";
							echo "Ech&eacute;ance dans ".$nb_jours_restants." jours";
							echo "</div>";
						}
					}
				}
				
				if ($row["cocl_typh"]==1)
				{
					if ($row["cocl_soldes"]<=3600)
					{
						echo "<div align=\"right\" class=\"annot_petit_it\">";
						echo "Temps restant ".sec_heure($row["cocl_soldes"]);
						echo "</div>";
					}
				}
			}

			 echo "</td>\n";
			 
			if (@$_SESSION["niv_log"] >=3)
			{
				echo "<td>".$row["cocl_codecli"];
				
				// Affichage détail client
				
				$detailcli = "->";
				if ($row["cli_ste"] <> "")
				$detailcli .= $row["cli_ste"].", ";
				$detailcli .= $row["cli_civilite"]." ".$row["cli_nom"];
				echo "<br>";
				echo "<span class=\"annot_petit_it\">";
				echo htmlspecialchars($detailcli,ENT_NOQUOTES);
				echo "</span>";
				
				// Fin affichage détail client
				
				echo "</td>\n";
			}
	
			 echo "<td>";
			 echo "<div align=\"center\">";
			 echo formatedate($row["cocl_datecrea"]);
			 echo "</div>";
			 echo "</td>\n";
			 echo "<td>";
			 echo "<div align=\"center\">";
			 echo formatedate($row["cocl_dated"]);
			 echo "</div>";
			 echo "</td>\n";
			 echo "<td>";
			 echo "<div align=\"center\">";
			 if (formatedate($row["cocl_datef"]) == "")
				echo "&nbsp;";
			 else
				echo formatedate($row["cocl_datef"]);
			 echo "</div>";
			 echo "</td>\n";
			 echo "<td>";
			 echo "<div align=\"center\">";
			 if (formatedate($row["cocl_daterel"]) == "")
				echo "&nbsp;";
			 else
				echo formatedate($row["cocl_daterel"]);
			 echo "</div>";
			 echo "</td>\n";
	
			 echo "<td>";
	
			 // Affichage détail renouvelé
	
				 echo "<div align=\"center\">";
				 echo $non_oui[$row["cocl_renouv"]];
	
				if ($row["cocl_renouv"] == 1)
				{
					 // Affichage détail renouvellement
		
					 $detailren = "(".$row["cocl_rnum"].")";
					 echo "<br>";
					 echo "<span class=\"annot_petit_it\">";
					 echo $detailren;
					 echo "</span>";
			
					 // Fin affichage détail renouvellement
				}
	
				 echo "</div>";
		
			 // Fin affichage détail renouvelé
	
			 echo "</td>\n";
	
			// CREATION lien dynamique sur icône (édition, suppression, etc...)
			 echo "<td>";
			 echo "<div align=\"center\">";
	
	
			 if (@$_SESSION["niv_log"] >= 4) // Edition uniquement si >=agence
			 {
				if (formatedate($row["cocl_datefin"]) == "")
				{
					$lst_maj = TRUE;
					
					echo "<a href=\"cocl_maj.php?td=edit&co=".$row["cocl_code"]."&cc=".$row["cocl_codecli"]."\"><img src=\"../img/edit.png\" width=\"".$hl_vign."\" height=\"".$hl_vign."\" border=\"0\" align=\"absmiddle\"></a>";
				}
				else
				{
					$lst_voir = TRUE;
					
					echo "<a href=\"cocl_maj.php?td=view&co=".$row["cocl_code"]."&cc=".$row["cocl_codecli"]."\"><img src=\"../img/detail.gif\" width=\"".$hl_vign."\" height=\"".$hl_vign."\" border=\"0\" align=\"absmiddle\"></a>";
				}
			 }	
	
			 if (@$_SESSION["niv_log"] <= 3) // Voir si <=Technicien
			 {
				$lst_voir = TRUE;
				
				echo "<a href=\"cocl_maj.php?td=view&co=".$row["cocl_code"]."&cc=".$row["cocl_codecli"]."\"><img src=\"../img/detail.gif\" width=\"".$hl_vign."\" height=\"".$hl_vign."\" border=\"0\" align=\"absmiddle\"></a>";
			 }	
	
			 $lst_imp = TRUE;
			
			 $urlimp = "cocl_pdf.php?code=".$row["cocl_code"];
			 echo " ";
			 echo "<a href=\"javascript:;\" onclick=\"lanceimp('".$urlimp."');\")><img src=\"../img/print.gif\" title=\"Imprimer le contrat\" width=\"".$hl_vign."\" height=\"".$hl_vign."\" border=\"0\" align=\"absmiddle\"></a>";
		
			 echo "</div>";
			 echo "</td>\n";
	
			 echo "</tr>\n";
		 // Fin affichage résumé Contrat Client
			
			$i++;    
		}  
		echo "</table>\n";
		// *** Fin affichage de la table
		
		mysql_free_result($rs);
	}
	else
	{
		echo "<span class=\"annot_gras_it\">";
		echo "<br><br>Pas de contrat bientôt à échéance.";
		echo "</span>";
	}	

	mysql_close($conn);  
	
	$taille_piedla="";
	include("../inc/piedla.inc.php"); 
?>
</div>
<?PHP
include_once("pied.php");
}
else
{
?>
<p align="center"><span class="titrepageerr">PROBLEME DE CONFIGURATION</span></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<div align="center" class="annot_gras_it">SMI n'a pas encore &eacute;t&eacute; totalement configur&eacute; pour votre compte...<br><br>
Merci de contacter l'administrateur ou le centre de gestion</div>
<script type="text/javascript">
window.setTimeout("location=('../index.php');",2000)
</script>
<?PHP
}
?>