<?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
****************************************************************************************/


// 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_do.inc.php");
include_once("../inc/fic_hum.inc.php");
include_once("../inc/func.inc.php");
include_once("../inc/func_date.inc.php");
include_once("../inc/func_geo.inc.php");
include_once("../inc/func_txt.inc.php");
include_once("../inc/lst.inc.php");
Archivelog(@$_SESSION["code_log"]);

$coderech = strip_tags(trim($_GET['cd']));

if (@$_SESSION["niv_log"] == 6)
	$coderech = @$_SESSION["code_log"];
	
$pbm_do=FALSE;

if (@$_SESSION["niv_log"] <= 4)
	$pbm_do=TRUE;

if ($coderech <> "")
{
	$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
	mysql_select_db(DBNAME);

	// Récupération des informations donneur d'ordres
	$row = lit_enr_do($coderech);
	if (is_array($row))
		extract ($row);
	else
		$pbm_do=TRUE;
}
else
	$pbm_do=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 : Impression Fiche Donneur d'Ordres</title>

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

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

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


</head>

<body onLoad="warnimpfic();">

<?PHP
if ($pbm_do==FALSE)
{
	entimpfic("FICHE DONNEUR D'ORDRES");
?>
  <table class="Ftable" width="740"  border="0">
	<?PHP
	if ((@$_SESSION["niv_log"] == 5) OR (@$_SESSION["niv_log"] == 9))
	{
	?>
    <tr>
      <td class="rubNormal" id="f_code"><div align="right">Actif ? </div></td>
      <td width="62%">
		  <?PHP
			if ($do_ouvert == 1)
				echo "Ouvert";
			else
				echo "Fermé";
			?>
	  </td>
    </tr>
	<?PHP
	}
	?>
    <tr>
      <td width="21%" class="rubNormal" id="f_code"><div align="right">Code</div></td>
      <td>
	  	<?PHP
         	echo $do_code;
		?>
      </td>
    </tr>
    <tr>
      <td height="21" class="rubNormal" id="f_logo"><div align="right">Logo</div></td>
      <td>
		  <?PHP
				$urlimg = $chemin_logos."/log".strtolower($do_code).".png"; 
				echo "<div align=\"left\">";
				echo "<img src=\"".$urlimg."\"><br>";
				echo "</div>";
			?>
	  </td>
    </tr>
    <tr>
      <td width="21%" class="rubNormal" id="f_nom"><div align="right">Nom</div></td>
      <td><?PHP echo $do_nom; ?></td>
    </tr>
    <tr>
      <td class="rubNormal" id="f_rcs"><div align="right">RCS / APE </div></td>
      <td><?PHP echo $do_rcs ?></td>
    </tr>
    <tr>
      <td class="rubNormal" id="f_tcom"><div align="right">Tribunal com. </div></td>
      <td><?PHP echo $do_tcom ?></td>
    </tr>
    <tr>
      <td width="21%" class="rubNormal" id="f_adr1"><div align="right">Adresse (1) </div></td>
      <td><?PHP echo $do_adr1 ?></td>
    </tr>
    <tr>
      <td width="21%" class="rubNormal" id="f_adr2"><div align="right">Adresse (2) </div></td>
      <td><?PHP echo $do_adr2 ?></td>
    </tr>
    <tr>
      <td width="21%" class="rubNormal" id="f_ville"><div align="right">Code Postal</div></td>
      <td>
          <?PHP
				// Affichage du Code Postal
				echo Retournecp_openId($do_ville,TRUE);
			?>
	  </td>
    </tr>
    <tr>
      <td width="21%" class="rubNormal" id="f_ville"><div align="right">Ville</div></td>
      <td>
          <?PHP
				// Affichage de la ville
				echo Retourneville_openId($do_ville,TRUE);
			?>
	  </td>
    </tr>
    <tr>
      <td class="rubNormal" id="f_pays"><div align="right">Pays</div></td>
      <td>
          <?PHP
				// Affichage du pays
				echo Retournepays_open($do_codepays,TRUE);
			?>
	  </td>
    </tr>
    <tr>
      <td width="21%" class="rubNormal" id="f_telf"><div align="right">T&eacute;l&eacute;phone Fixe </div></td>
      <td>
	  <?PHP 
		echo $do_telf."<br>";
		echo $do_txttelf;
	  ?>
	  </td>
    </tr>
    <tr>
      <td width="21%" class="rubNormal" id="f_fax"><div align="right">T&eacute;l&eacute;copieur</div></td>
      <td>
	  <?PHP 
	  	echo $do_fax."<br>";
		echo $do_txtfax;
		?>
		</td>
    </tr>
    <tr>
      <td class="rubNormal" id="f_web"><div align="right">Site Web </div></td>
      <td><?PHP echo $do_web ?></td>
    </tr>
    <tr>
      <td class="rubNormal" id="f_heures"><div align="right">Horaires</div></td>
      <td><?PHP echo $do_heures ?></td>
    </tr>
    <tr>
      <td class="rubNormal" id="f_heures"><div align="right">Ent&ecirc;te</div></td>
      <td>
		<?PHP
			echo formatetxt($do_txtent);
		?>
	  </td>
    </tr>
      <td colspan="2">&nbsp;</td>
    </tr>
    <tr>
      <td colspan="2" class="rubNormal" id="f_web"><div align="center"><u>Contact principal </u></div></td>
    </tr>
    <tr>
      <td class="rubNormal" id="f_rcivil"><div align="right">Civilit&eacute;</div></td>
      <td>
          <?PHP
				
				// Affichage de la civilité
	
				$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
				mysql_select_db(DBNAME);
				$rs = mysql_query("SELECT * FROM ".TBCIV." WHERE civ_code = '".$do_resp_civilite."'");
				if (mysql_num_rows($rs) <> 0)
				{
					while ($resultat = mysql_fetch_array($rs)) 
					{
						extract($resultat);
						echo $civ_desc;
					}
				}
				mysql_free_result($rs);
				mysql_close($conn);
				?>
	  </td>
    </tr>
    <tr>
      <td class="rubNormal" id="f_rprenom"><div align="right">Pr&eacute;nom</div></td>
      <td><?PHP echo $do_resp_prenom ?></td>
    </tr>
    <tr>
      <td class="rubNormal" id="f_rnom"><div align="right">Nom</div></td>
      <td><?PHP echo $do_resp_nom ?></td>
    </tr>
    <tr>
      <td class="rubNormal" id="f_rtelf"><div align="right">Tel. Fixe </div></td>
      <td><?PHP echo $do_resp_telf ?></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td colspan="2" class="rubNormal"><div align="center"><u>Emails</u></div></td>
      <td width="17%">  
    </tr>
    <tr>
      <td width="21%" class="rubNormal" id="f_email"><div align="right">G&eacute;n&eacute;ral</div></td>
      <td><?PHP echo $do_email ?>
		 <span class="annot_std_it">(Pour contacts clients)</span>
	  </td>
    </tr>
    <tr>
      <td width="21%" class="rubNormal" id="f_emaild"><div align="right">Direction</div></td>
      <td><?PHP echo $do_emaild ?></td>
    </tr>
    <tr>
      <td width="21%" class="rubNormal" id="f_emailc"><div align="right">Comptabilit&eacute;</div></td>
      <td><?PHP echo $do_emailc ?></td>
    </tr>
    <tr>
      <td width="21%" class="rubNormal" id="f_emailt"><div align="right">Technique</div></td>
      <td><?PHP echo $do_emailt ?></td>
    </tr>
    <tr>
      <td width="21%">&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
	<?PHP
	if ((@$_SESSION["niv_log"] == 5) OR (@$_SESSION["niv_log"] == 9))
	{
	?>
    <tr>
      <td width="21%" class="rubNormal" id="f_nota"><div align="right">Notes</div></td>
      <td><?PHP 
			echo "<span class=\"txtnotes\">";
			echo formatetxt($do_nota);
			echo "</span>";
 		  ?>
	  </td>
    </tr>
    <tr>
      <td width="21%">&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td width="21%" class="rubNormal" id="f_factures"><div align="right">Emet ses factures </div></td>
      <td><?PHP 
					if ($do_fact == TRUE)
					{
						echo "Oui";
					}
					else
					{
						echo "Non";
					}
				?>
	  </td>
    </tr>
	<?PHP
	}
	?>
  </table>

<?PHP
}
else
{
?>
	<script type="text/javascript">
	window.close();
	</script>
<?PHP
}
?>
</body>
</html>