<?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_log.inc.php") ?>
<?php require ("../inc/fic.inc.php") ?>
<?php require ("../inc/lst.inc.php") ?>
<?PHP
	Archivelog(@$HTTP_SESSION_VARS["code_log"]);
?>
<?php
	$co =  strip_tags(trim($_GET['co'])); // Récupération du code contrat type
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>

<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<title>SMI - ESPACE PRIVE : Contrats Possibles</title>

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

<!-- Feuille de style & Script pour le menu -->
<link href="../inc/menu.css" rel="stylesheet" type="text/css">
<script language="JavaScript" src="../coolmenus/coolmenus4.js"></script>

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

<!-- Affichage nouvelle fenêtre pour impression -->
<script type="text/javascript">
	function lanceimp(page)
	{
	  window.open(page,'impression','width='+screen.width+' height='+screen.height);
	}
</script>

</head>

<body>

<?php 
	include_once ("entete.php"); 
?>


<p align="center"><span class="titrepage">NOS OFFRES DE CONTRATS</span></p>
<p>&nbsp;</p>

<!-- Formulaire de demande du numéro de contrat -->
<form name="dde_co" id="dde_co" method="GET" action="co_disp.php">
<table width="800"  border="0" cellspacing="0" cellpadding="0">
<tr>
	<td>
		<select name="co" size="1" id="co" onChange="dde_co.submit()">
		
		<?PHP 
		// Création de la liste des contrats
		
		if ($co <> "")
			echo "<option value=\"\">-- Choisissez un contrat type --</option>";
		else
			echo "<option value=\"\" selected>-- Choisissez un contrat type --</option>";
		
		$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
		mysql_select_db(DBNAME);
		$rs = mysql_query("SELECT * FROM ".TBCO." WHERE `co_actif` = '1' ORDER BY co_nom");
		
		while ($resultat = mysql_fetch_array($rs)) 
		{
			extract($resultat);
			
			if ($co_code == $co)
				echo '<option value="'.$co_code.'" selected>'.$co_nom.'</option>';
			else
				echo '<option value="'.$co_code.'">'.$co_nom.'</option>';
		}
		mysql_free_result($rs);
		mysql_close($conn);
		?>
		</select>
	</td>
</tr>
</table>
</form>
<!-- Fin de formulaire de demande du numéro de contrat -->

<?PHP
	if( isset($_GET['co']) && !empty($_GET['co']))  
	{
?>
<table width="800"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="20">&nbsp;
	
	</td>
    <td class="td_ombre">
		<?PHP
			$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
			mysql_select_db(DBNAME);
			$rs = mysql_query("SELECT * FROM ".TBCO." WHERE `co_code` = '".$co."'");
			
			if ($row = mysql_fetch_array($rs))
			{
				extract($row);
			}
			mysql_free_result($rs);
			mysql_close($conn);
			echo formatetxt($co_desc);
		?>
	</td>
  </tr>
</table>
<?PHP
	}
?>
<table width="800"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="20">&nbsp;
	
	</td>
    <td class="annot_std_it">
		<?PHP
			$row = lit_enr_txt("CON_PUBCPR");
			echo formatetxt($row["txt_texte"]);
		?>
    </td>
  </tr>
</table>

<?php 
	include_once ("pied.php")
?>
