<?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/fic_st.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_log.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['cs']));

if (@$_SESSION["niv_log"] == 10)
	$coderech = @$_SESSION["code_log"];
	
$pbm_st=FALSE;

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

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

	// Récupération des informations sous-traitant
	$row = lit_enr_st($coderech);
	if (is_array($row))
		extract ($row);
	else
		$pbm_st=TRUE;
}
else
	$pbm_st=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 - <?PHP echo $title_esp_prive; ?> : Impression Fiche Sous-traitant</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_st==FALSE)
{
	entimpfic("FICHE SOUS-TRAITANT");
?>
  <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" align="right">Actif ? </td>
      <td width="62%">
		  <?PHP
			if ($st_ouvert == 1)
				echo "Ouvert";
			else
				echo "Fermé";
			?>
	  </td>
    </tr>
	<?PHP
	}
	?>
    <tr>
      <td width="21%" class="rubNormal" id="f_code" align="right"><?PHP echo $txt_chp_code; ?></td>
      <td>
	  	<?PHP
         	echo $st_code;
		?>
      </td>
    </tr>
    <tr>
      <td height="21" class="rubNormal" id="f_logo" align="right">Logo</td>
      <td>
		  <?PHP
				echo "<div align=\"left\">";
				echo "<img src=\"".$chemin_logos."/log".strtolower($st_code).".png"."\"><br>";
				echo "</div>";
			?>
	  </td>
    </tr>
    <tr>
      <td width="21%" class="rubNormal" id="f_nom" align="right"><?PHP echo $txt_chp_nom; ?></td>
      <td><?PHP echo $st_nom; ?></td>
    </tr>
    <tr>
      <td class="rubNormal" id="f_rcs" align="right"><?PHP echo $txt_chp_siret; ?></td>
      <td><?PHP echo $st_rcs ?></td>
    </tr>
    <tr>
      <td class="rubNormal" id="f_rcs" align="right"><?PHP echo $txt_chp_ape; ?></td>
      <td><?PHP echo $st_rcs ?></td>
    </tr>
    <tr>
      <td class="rubNormal" id="f_rcs" align="right"><?PHP echo $txt_chp_tvai; ?></td>
      <td><?PHP echo $st_rcs ?></td>
    </tr>
    <tr>
      <td class="rubNormal" id="f_tcom" align="right"><?PHP echo $txt_chp_tcom; ?></td>
      <td><?PHP echo $st_tcom ?></td>
    </tr>
    <tr>
      <td width="21%" class="rubNormal" id="f_adr1" align="right"><?PHP echo $txt_chp_adr1; ?></td>
      <td><?PHP echo $st_adr1 ?></td>
    </tr>
    <tr>
      <td width="21%" class="rubNormal" id="f_adr2" align="right"><?PHP echo $txt_chp_adr2; ?></td>
      <td><?PHP echo $st_adr2 ?></td>
    </tr>
    <tr>
      <td width="21%" class="rubNormal" id="f_ville" align="right">Code Postal</td>
      <td>
          <?PHP
				// Affichage du Code Postal
				echo Retournecp_openId($st_ville,TRUE);
			?>
	  </td>
    </tr>
    <tr>
      <td width="21%" class="rubNormal" id="f_ville" align="right"><?PHP echo $txt_chp_ville; ?></td>
      <td>
          <?PHP
				// Affichage de la ville
				echo Retourneville_openId($st_ville,TRUE);
			?>
	  </td>
    </tr>
    <tr>
      <td class="rubNormal" id="f_pays" align="right"><?PHP echo $txt_chp_pays; ?></td>
      <td>
          <?PHP
				// Affichage du pays
				echo Retournepays_open($st_codepays,TRUE);
			?>
	  </td>
    </tr>
    <tr>
      <td width="21%" class="rubNormal" id="f_telf" align="right"><?PHP echo $txt_chp_telf; ?> </td>
      <td>
	  <?PHP 
		echo $st_telf."<br>";
		echo $st_txttelf;
	  ?>
	  </td>
    </tr>
    <tr>
      <td width="21%" class="rubNormal" id="f_fax" align="right"><?PHP echo $txt_chp_fax; ?></td>
      <td>
	  <?PHP 
	  	echo $st_fax."<br>";
		echo $st_txtfax;
		?>
		</td>
    </tr>
    <tr>
      <td class="rubNormal" id="f_web" align="right">Site Web </td>
      <td><?PHP echo $st_web ?></td>
    </tr>
    <tr>
      <td class="rubNormal" id="f_heures" align="right"><?PHP echo $txt_chp_horaires; ?></td>
      <td><?PHP echo $st_heures ?></td>
    </tr>
    <tr>
      <td class="rubNormal" id="f_heures" align="right">Ent&ecirc;te</td>
      <td>
		<?PHP
			echo formatetxt($st_txtent);
		?>
	  </td>
    </tr>
      <td colspan="2">&nbsp;</td>
    </tr>
    <tr>
      <td colspan="2" class="rubNormal" id="f_web" align="center"><u>Contact principal  </u></td>
    </tr>
    <tr>
      <td class="rubNormal" id="f_rcivil" align="right"><?PHP echo $txt_chp_civil; ?></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 = '".$st_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" align="right"><?PHP echo $txt_chp_pnom; ?></td>
      <td><?PHP echo $st_resp_prenom ?></td>
    </tr>
    <tr>
      <td class="rubNormal" id="f_rnom" align="right"><?PHP echo $txt_chp_nom; ?></td>
      <td><?PHP echo $st_resp_nom ?></td>
    </tr>
    <tr>
      <td class="rubNormal" id="f_rtelf" align="right">Tel. Fixe </td>
      <td><?PHP echo $st_resp_telf ?></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td colspan="2" class="rubNormal" align="center"><u><?PHP echo $txt_chp_emails; ?></u></td>
      <td width="17%">  
    </tr>
    <tr>
      <td width="21%" class="rubNormal" id="f_email" align="right"><?PHP echo $txt_chp_emailgeneral; ?></td>
      <td><?PHP echo $st_email ?>
		 <span class="annot_std_it">(<?PHP echo $txt_div_ctactcli; ?>)</span>
	  </td>
    </tr>
    <tr>
      <td width="21%" class="rubNormal" id="f_emaild" align="right"><?PHP echo $txt_chp_emaildir; ?></td>
      <td><?PHP echo $st_emaild ?></td>
    </tr>
    <tr>
      <td width="21%" class="rubNormal" id="f_emailc" align="right">Comptabilit&eacute;</td>
      <td><?PHP echo $st_emailc ?></td>
    </tr>
    <tr>
      <td width="21%" class="rubNormal" id="f_emailt" align="right"><?PHP echo $txt_chp_emailtech; ?></td>
      <td><?PHP echo $st_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" align="right"><?PHP echo $txt_chp_notes; ?></td>
      <td><?PHP 
			echo "<span class=\"txtnotes\">";
			echo formatetxt($st_nota);
			echo "</span>";
 		  ?>
	  </td>
    </tr>
    <tr>
      <td width="21%">&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td width="21%" class="rubNormal" id="f_factures" align="right">Emet ses factures </td>
      <td><?PHP echo $non_oui[$st_fact]; ?></td>
    </tr>
	<?PHP
	}
	?>
  </table>

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