<?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");

include_once("../inc/fic_age.inc.php");
include_once("../inc/fic_int.inc.php");
include_once("../inc/fic_mque.inc.php");
include_once("../inc/fic_ret.inc.php");
include_once("../inc/func.inc.php");
include_once("../inc/func_time.inc.php");
include_once("../inc/func_date.inc.php");
include_once("../inc/func_geo.inc.php");
include_once("../inc/func_txt.inc.php");
Archivelog(@$_SESSION["code_log"]);

$pbm_retd = FALSE;

$cpr = strip_tags(trim($_GET['cpr'])); // Récupération code Produit à Retourner
$cm="";
if (isset($_GET['cm']))
	$retd_codemque = strip_tags(trim($_GET['cm'])); // Récupération code marque
if (isset($_GET['td']))
	$td = strip_tags(trim($_GET['td'])); // Récupération type de demande
else
	$pbm_retd = TRUE;

if ($cpr <> "")
{
	// Récupération des informations demande de retour
	$row = lit_enr_retd($cpr,TRUE);
	if (is_array($row))
	{
		extract ($row);
		
		$row = lit_enr_retp($cpr,TRUE);
		if (is_array($row))
		{
			extract ($row);

			// Si retour envoyé ou déjà traité, on force le mode "view"
			if ((exist_enr_rete($cpr,TRUE) == TRUE) OR (exist_enr_retr($cpr,TRUE) == TRUE))
				$td="view";
	
			// Contrôle qu'une agence n'essaye pas de "hacker" une demande
			if ((@$_SESSION["niv_log"] == 4) AND ($retp_codeage <> @$_SESSION["code_age"]))
				$pbm_retd = TRUE;
	
			// Formatage des dates en français
			$retd_dateddef = formatedate($retd_datedde);
			$retd_dblff = formatedate($retd_dblf);
			$retd_daterepf = formatedate($retd_daterep);
		}
		else
			$pbm_retd = TRUE;
	}
	else
	{
		if ($td=="add")
		{
			$row = lit_enr_retp($cpr,TRUE);
			if (is_array($row))
				extract ($row);
			else
				$pbm_retd = TRUE;
		}
		else
			$pbm_retd = TRUE;
	}	
}
else
	$pbm_retd=TRUE;

switch ($td)
{
	case "add" :
		$titre = "SAISIE DEMANDE DE RETOUR";
		break;
	case "edit" :
		$titre = "MISE A JOUR DEMANDE DE RETOUR";
		break;
	case "view" :
			$titre = "DETAIL DEMANDE DE RETOUR";
		break;
	case "del":
		$titre = "SUPPRESSION DEMANDE DE RETOUR";
		break;
	default:
			$titre = "PROBLEME";
			$pbm_retd=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; ?> : Fiche Demande de Retour</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 pour vérifications -->
<script language="JavaScript" src="../jscript/verif_field.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>


<?PHP 
if (($td == "edit")  OR ($td=="add"))
{
?>
<script language="javascript">
<!--
var tab1_champ=new Array(
	"nom:codepdtm; format:txt ; req:Y ; txt:Code produit distributeur ; lmx:20 ; stok:frmok ; stbad:frmbad",
	"nom:blf; format:liste ; req:Y ; txt:Type de document ; vmn:1 ; stok:frmok ; stbad:frmbad",
	"nom:nblf; format:txt ; req:Y ; txt:Numéro de document ; lmx:20 ; stok:frmok ; stbad:frmbad",
	"nom:dblff; format:date ; masque:<?PHP echo $datemsql; ?> ; req:Y ; txt:Date document; stok:frmok ; stbad:frmbad",
	"nom:gar; format:liste ; req:Y ; txt:Sous garantie ; vmn:1 ; stok:frmok ; stbad:frmbad",
<?PHP if (($td =="add") OR ($td=="edit")) { ?>
	"nom:dateddef ; format:date ; masque:<?PHP echo $datemsql; ?> ; req:Y ; txt:Date demande ; stok:frmok ; stbad:frmbad",
	"nom:codemque; format:liste ; req:Y ; txt:Destinataire ; vmn:1 ; stok:frmok ; stbad:frmbad",
	"nom:codemd; format:liste ; req:Y ; txt:Mode de demande ; vmn:1 ; stok:frmok ; stbad:frmbad",
	"nom:urgence; format:liste ; req:Y ; txt:Niveau d'urgence ; vmn:1 ; stok:frmok ; stbad:frmbad",
	"nom:dossier; format:txt ; req:N ; txt:Code de dossier ; lmx:20 ; stok:frmok ; stbad:frmbad",
<?PHP } ?>
	"nom:daterepf; format:date ; masque:<?PHP echo $datemsql; ?> ;  req:N ; txt:Date de réponse ; stok:frmok ; stbad:frmbad",
	"nom:rma; format:txt ; req:N ; txt:Numéro de retour ; lmx:40 ; stok:frmok ; stbad:frmbad");
//-->
</script>
<?PHP
}
?>

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

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

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

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

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

</head>

<?PHP	
switch ($td)
{
case "del" :
case "view" :
	echo '<body onLoad="metReadonly();">';
	break;
default :
	echo '<body onLoad="metFocus();">';
	break;
}
	
include_once("../inc/entete.inc.php"); 
?>
<p align="center"> <span class="titrepage"><?PHP echo $titre ?></span></p>
<?PHP
if ($pbm_retd == FALSE)
{
if (nb_marques("") <>0)
{
?>
<table width="100%"  border="0">
<tr>
	<td width="40%">
		<strong><em><a href="retp_lst.php?ord=DES&tri=Code">Retour liste des produits d&eacute;fectueux </a></em></strong>
		/ <strong><em><a href="retd_lst.php?ord=DES&tri=Demande%20le">Liste des demandes </a></em></strong>
	</td>
	<td width="160" valign="top">
	<div id="oblig" align="center" class="annot_petit_it">(<img src="../img/oblig.png" align="absmiddle" alt="<?PHP echo $alt_chp_oblig; ?>"> : <?PHP echo $txt_div_saisoblg; ?>)</div>
	</td>
	<td width="40%" align="right">
	<?PHP  if (($td=="edit") OR ($td=="view")) { 
		$urlimp = "retd_pdf.php?cpr=".$cpr;
	?>
		<a href="javascript:;" onclick="lanceimp('<?PHP echo $urlimp; ?>');")><img src="../img/printc.png" title="Imprimer la demande" border="0" align="absmiddle"></a> 
		<a href="javascript:;" onclick="lanceimp('<?PHP echo $urlimp; ?>');")> Imprimer la demande</a></div>
	<?PHP } else echo "&nbsp;" ?>
    </td>
</tr>
</table>
<form name="retd_maj" method="post" action="retd_enr.php" onSubmit="javascript:; return (verif_retd(this,tab1_champ,'',''));">
<input name="titre" type="hidden" id="titre" value="<?PHP echo $titre ?>">
<input name="td" type="hidden" id="td" value="<?PHP echo $td ?>">
<input name="coderetp" type="hidden" id="coderetp" value="<?PHP echo $cpr ?>">

<!-- Produit à retourner -->
<table width="100%"  border="0">
<tr>
	<td width="180" class="rubfrm" id="f_retp" align="right">Produit (N/S)</td>
	<td>
		<span class="annot_std_gras"><?PHP echo $retp_des; ?> (<?PHP echo $retp_ns; ?>)</span>
	<?PHP if (clos_retr($retp_code,TRUE)==TRUE)
	{
		echo '<span class="alerte1">';
		echo 'Trait&eacute;';
		echo '</span>';
	} 
	else
	{
		if (exist_enr_rete($retp_code,TRUE)==TRUE)
		{
			echo '<span class="alerte1">';
			if (exist_enr_rete_clos($retp_code,TRUE)==TRUE)
				echo "Envoy&eacute;";
			else
				echo "Pr&ecirc;t &agrave; partir";
			echo "</span>";
		}
	}
	?>
	</td>
</tr>
</table>

<!-- Destinataire -->
<table width="100%"  border="0">
<tr>
	<td width="180" class="rubfrm" id="f_codemque" align="right">Destinataire</td>
	<td>
	<?PHP
		if ($td =="add")  // Ajout = zone modifiable (on peut choisir un destinataire)
		{ 
			// Création de la liste des destinataires
			echo'<select name="codemque" id="codemque">';
			echo'<option value="">--- Choisissez un destinataire ---</option>';
			$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
			mysql_select_db(DBNAME);
			// Création de la liste des codes destinataires
			$rech = "SELECT mque_code, mque_ste FROM ".TBMQUE;
			$rech.= " WHERE mque_code<>'*'";
			$rech.= " ORDER BY mque_ste";
			$rs = mysql_query($rech) or die(mysql_error());

			if (mysql_num_rows($rs) <> 0)
			{
				while ($resultat = mysql_fetch_array($rs)) 
				{
					extract($resultat);
					echo '<option value="'.$mque_code.'"';
					if ($retd_codemque == $mque_code)
						echo ' selected';
					echo '>'.$mque_ste.'</option>';
				}
			}
			mysql_free_result($rs);
			mysql_close($conn);
			?>
			</select>
			 <img src="../img/oblig.png" align="absmiddle" alt="<?PHP echo $alt_chp_oblig; ?>">
		<?PHP
		} 
		else  // Edition ou suppression = zone non modifiable (affichage seul)
		{
			$row = lit_enr_mque($retd_codemque,TRUE);
			if (is_array($row))
				extract($row);
			$mque_nomcode = $mque_ste." (".$mque_code.")";
		?>
		<input name="codemque" type="hidden" id="codemque" value="<?PHP echo $retd_codemque ?>">
		<input name="nommque" type="text" id="nommque" value="<?PHP echo $mque_nomcode ?>" size="60" maxlength="60" readonly="1">
	<?PHP 
	} 
	?>
	<br><span class="annot_petit_it">(Celui chez qui le produit devra être retourn&eacute;)</span>
	</td>
</tr>
</table>

<!-- Date de demande -->
<table width="100%"  border="0">
<tr>
	<td width="180" class="rubfrm" id="f_dateddef" align="right">Date Demande </td>
	<td>
		<input name="dateddef" type="text" id="dateddef" value="<?PHP echo $retd_dateddef ?>" size="10" maxlength="10" readonly="1">
		<?PHP if ($td == "add") { ?>
		<img src="../img/calendar.png" align="absmiddle" id="f_img_dateddef" title="<?PHP echo $alt_chxdate; ?>">
		<img src="../img/oblig.png" align="absmiddle" alt="<?PHP echo $alt_chp_oblig; ?>">
		<?PHP } ?>
	</td>
</tr>
</table>

<!-- Mode de demande -->
<table width="100%"  border="0">
<tr>
	<td width="180" class="rubfrm" id="f_codemd" align="right">Mode de demande</td>
	<td>
		<?PHP
		if (($td =="add") OR ($td=="edit"))  // Ajout/Edition = zone modifiable (on peut choisir un mode)
		{ 
			// Création de la liste des mode de demande
			$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
			mysql_select_db(DBNAME);
			// Filtre sur agences ouvertes
			$rech = "SELECT * FROM ".TBMD." ORDER BY md_nom";
			$rs = mysql_query($rech) or die(mysql_error());

			if (mysql_num_rows($rs) <> 0)
			{
			?>
				<select name="codemd" id="codemd">
				<?PHP
					echo "<option>-- Choisissez un mode --</option>";

					while ($resultat = mysql_fetch_array($rs)) 
					{
						extract($resultat);
		
						echo '<option value="'.$md_code.'"';
						if ($retd_codemd == $md_code)
							echo ' selected';
						echo '>'.$md_nom.'</option>';
					}
				?>
				</select>
				<img src="../img/oblig.png" align="absmiddle" alt="<?PHP echo $alt_chp_oblig; ?>">
		<?PHP
			}
			mysql_free_result($rs);
			mysql_close($conn);
		} 
		else  // Edition ou suppression = zone non modifiable (affichage seul)
		{
			$row = lit_enr_md($retd_codemd,TRUE);
			if (is_array($row))
				extract($row);
		?>
		<input name="codemd" type="hidden" id="codemd" value="<?PHP echo $retd_codemd ?>">	
		<input name="nommd" type="text" id="nommd" value="<?PHP echo $md_nom ?>" size="50" maxlength="50" readonly="1">
		<?PHP 
		} 
		?>
	</td>
</tr>
</table>

<!-- Numéro de dossier -->
<table width="100%"  border="0">
<tr>
	<td width="180" class="rubfrm" id="f_dossier" align="right">N° dossier</td>
	<td>
	<input name="dossier" type="text" id="dossier" value="<?PHP echo $retd_dossier; ?>" size="20" maxlength="20">
	<br><span class="annot_petit_it">(Celui donn&eacute; par le distributeur)</span>
	</td>
</tr>
</table>

<!-- Code produit du distributeur -->
<table width="100%"  border="0">
<tr>
	<td width="180" class="rubfrm" id="f_codepdtm" align="right">Code produit</td>
	<td>
		<input name="codepdtm" type="text" id="codepdtm" value="<?PHP echo $retd_codepdtm ?>" size="20" maxlength="20">
		<img src="../img/oblig.png" align="absmiddle" alt="<?PHP echo $alt_chp_oblig; ?>">
		<br><span class="annot_petit_it">(Code du produit chez le distributeur)</span>
	</td>
</tr>
</table>

<!-- BL ou Facture ? -->
<table width="100%"  border="0">
<tr>
	<td width="180" class="rubfrm" id="f_blf" align="right">Type document</td>
	<td>
	<?PHP
	if (($td =="add") OR ($td =="edit"))  // Ajout/Edition = zone modifiable (on peut choisir un type)
	{ 
	?>
		<select name="blf" id="blf">
		<option>-- Choisissez le type --</option>
		<?PHP
		foreach ($doc_types as $key=>$value)
		{
			echo '<option value="'.$key.'"'; 
			if (($retd_blf == $key) AND ($td=="edit"))
				echo ' selected';
			echo '>';
			echo $value."</option>";
		}
		?>
		</select>
		<img src="../img/oblig.png" align="absmiddle" alt="<?PHP echo $alt_chp_oblig; ?>">
		<br><span class="annot_petit_it">(Type du document d'origine)</span>
	<?PHP
	}
	else
	{
	?>
	<input name="blf" type="hidden" id="blf" value="<?PHP echo $retd_blf; ?>">
	<input name="nomblf" type="text" id="nomblf" value="<?PHP echo $doc_types[$retd_blf]; ?>" size="20" maxlength="20" readonly="readonly">
	<?PHP
	}
	?>
	</td>
</tr>
</table>

<!-- N° de BL ou de facture -->
<table width="100%"  border="0">
<tr>
	<td width="180" class="rubfrm" id="f_nblf" align="right">N° document</td>
	<td>
		<input name="nblf" type="text" id="nblf" value="<?PHP echo $retd_nblf ?>" size="20" maxlength="20">
		<img src="../img/oblig.png" align="absmiddle" alt="<?PHP echo $alt_chp_oblig; ?>">
	</td>
</tr>
</table>

<!-- Date du document -->
<table width="100%"  border="0">
<tr>
	<td width="180" class="rubfrm" id="f_dblf" align="right">Date document</td>
	<td>
		<input name="dblff" type="text" id="dblff" value="<?PHP echo $retd_dblff ?>" size="10" maxlength="10" readonly="1">
		<?PHP if (($td == "add") OR ($td=="edit")) { ?>
		<img src="../img/calendar.png" align="absmiddle" id="f_img_dblff" title="<?PHP echo $alt_chxdate; ?>">
		<?PHP } ?>
		<img src="../img/oblig.png" align="absmiddle" alt="<?PHP echo $alt_chp_oblig; ?>">
	</td>
</tr>
</table>

<!-- Sous garantie ?-->
<table width="100%"  border="0">
<tr>
	<td width="180" class="rubfrm" id="f_gar" align="right">Sous garantie ?</td>
	<td>
	<?PHP
	if (($td =="add") OR ($td =="edit"))  // Ajout/Edition = zone modifiable (on peut choisir la garantie)
	{ 
	?>
		<select name="gar" id="gar">
		<option>-- Choisissez si garanti --</option>
		<?PHP
		foreach ($non_oui as $key=>$value)
		{
			echo '<option value="'.$key.'"'; 
			if (($td=="edit") AND ($retd_gar == $key))
				echo ' selected';
			echo '>';
			echo $value."</option>";
		}
		?>
		</select>
		<img src="../img/oblig.png" align="absmiddle" alt="<?PHP echo $alt_chp_oblig; ?>">
	<?PHP
	}
	else
	{
	?>
	<input name="gar" type="hidden" id="gar" value="<?PHP echo $retd_gar; ?>">
	<input name="ngar" type="text" id="ngar" value="<?PHP echo $non_oui[$retd_gar]; ?>" size="3" maxlength="3" readonly="readonly">
	<?PHP
	}
	?>
	</td>
</tr>
</table>

<!-- Niveau d'urgence -->
<table width="100%"  border="0">
<tr>
	<td width="180" class="rubfrm" id="f_urgence" align="right">Urgence</td>
	<td>
	<?PHP
	if (($td =="add") OR ($td=="edit"))  // Ajout/Edition = zone modifiable (on peut choisir un niveau)
	{ 
	?>
		<select name="urgence" id="urgence">
		<option value="">-- Choisissez l'urgence --</option>
		<?PHP
		foreach ($niv_urgence as $key=>$value)
		{
			echo '<option value="'.$key.'"'; 
			if (($retd_nivurg<>"") AND ($retd_nivurg == $key))
				echo ' selected';
			echo '>';
			echo $value."</option>";
		}
		?>
		</select>
		<img src="../img/oblig.png" align="absmiddle" alt="<?PHP echo $alt_chp_oblig; ?>">
	<?PHP
	}
	else
	{
	?>
	<input name="urgence" type="hidden" id="urgence" value="<?PHP echo $retd_nivurg; ?>">
	<input name="nurgence" type="text" id="nurgence" value="<?PHP echo $niv_urgence[$retd_nivurg]; ?>" size="20" maxlength="20" readonly="readonly">
	<?PHP
	}
	?>
	</td>
</tr>
</table>

<?PHP
if (($td =="add") OR ($td=="edit"))  // Uniquement sur ajout ou édition
{ 
?>
<!-- Imprimer la demande ? -->
<table width="100%"  border="0">
<tr>
	<td width="180" class="rubfrm" id="f_imprimer" align="right">Imprimer demande</td>
	<td>
		<input type="checkbox" name="imprimer" value="ok">
		<br><span class="annot_petit_it">(Si coch&eacute;, la demande de retour sera imprim&eacute;e)</span>
	</td>
</tr>
</table>
<?PHP } ?>

<!-- Date de réponse -->
<table width="100%"  border="0">
<tr>
	<td width="180" class="rubfrm" id="f_daterepf" align="right">Date r&eacute;ponse</td>
	<td>
		<input name="daterepf" type="text" id="daterepf" value="<?PHP echo $retd_daterepf ?>" size="10" maxlength="10" readonly="readonly">
		<?PHP if (($td == "add") OR ($td=="edit")) { ?>
		<img src="../img/calendar.png" align="absmiddle" id="f_img_daterepf" title="<?PHP echo $alt_chxdate; ?>">
		 <a href="javascript:;" onClick="document.retd_maj.daterepf.value='';"><img src="../img/raz.png" border="0" align="absmiddle"></a>
		<?PHP } ?>
	</td>
</tr>
</table>

<!-- N° de retour -->
<table width="100%"  border="0">
<tr>
	<td width="180" class="rubfrm" id="f_rma" align="right">N° de retour</td>
	<td>
		<input name="rma" type="text" id="rma" value="<?PHP echo $retd_rma ?>" size="40" maxlength="40">
	</td>
</tr>
</table>

<p align="center">
<?PHP
if (($td == "edit") OR ($td == "add"))
{
?>
	<input name="RAZ" type="reset" class="bton_std" id="RAZ" value="<?PHP echo $but_reinit; ?>">
	<input name="enr" type="submit" class="bton_std" id="enr" value="<?PHP echo $but_enr; ?>">
<?PHP
}
if ($td == "del") // Bouton si en mode suppression
{ 
?>
	<input name="del" type="submit" class="bton_std" id="del" value="<?PHP echo $but_del; ?>">
<?PHP 
} 
?>
</p>
</form>
<?PHP 
	if (($td <> "view") AND ($td<>"del"))
	{
	?>
		<script type="text/javascript">
		<!--
		<?PHP
		if ($td=="add")
		{
		?>
		Calendar.setup({
			inputField     :    "dateddef",     // id of the input field
			ifFormat       :    "<?PHP echo $datefmtc; ?>",      // format of the input field
			button         :    "f_img_dateddef",  // trigger for the calendar (button ID)
			align          :    "Br",           // alignment (defaults to "Bl")
			electric	   :	false,
			singleClick    :    true
		});
		<?PHP
		}
	
		if (($td=="add") OR ($td=="edit"))
		{
		?>
		Calendar.setup({
			inputField     :    "dblff",     // id of the input field
			ifFormat       :    "<?PHP echo $datefmtc; ?>",      // format of the input field
			button         :    "f_img_dblff",  // trigger for the calendar (button ID)
			align          :    "Br",           // alignment (defaults to "Bl")
			electric	   :	false,
			singleClick    :    true
		});

		Calendar.setup({
			inputField     :    "daterepf",     // id of the input field
			ifFormat       :    "<?PHP echo $datefmtc; ?>",      // format of the input field
			button         :    "f_img_daterepf",  // trigger for the calendar (button ID)
			align          :    "Br",           // alignment (defaults to "Bl")
			electric	   :	false,
			singleClick    :    true
		});
		<?PHP
		}
		?>
		//-->
		</script>
<?PHP
	}
}
else
{
?>
	<script type="text/javascript">
	<!--
	setTimeout("self.location.href=('mque_lst.php');",2000)
	//-->
	</script>
	<p align="center" class="annot_std_it">Merci de cr&eacute;er au moins un distributeur...</p>
<?PHP
}
}
else
{
?>
	<script type="text/javascript">
	<!--
	setTimeout("self.location.href=('index.php');",2000)
	//-->
	</script>
	<p align="center" class="annot_std_it">Probl&egrave;me de param&egrave;tres</p>
<?PHP
}
include_once("pied.php");
?>
