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

session_start(); 
?>
<?php if ((@$HTTP_SESSION_VARS["etat_log"] <> "connecte") or (@$HTTP_SESSION_VARS["niv_log"] <> 1)) header("Location: ../index.php") ?>
<?php include ("../inc/config.inc.php") ?>
<?php require ("../inc/func.inc.php") ?>
<?php require ("../inc/func_time.inc.php") ?>
<?php require ("../inc/func_date.inc.php") ?>
<?php require ("../inc/func_log.inc.php") ?>
<?php require ("../inc/fic.inc.php") ?>
<?PHP
	Archivelog(@$HTTP_SESSION_VARS["code_log"]);
?>
<?php
	$ci = strip_tags(trim($_GET['ci'])); // Récupération code Intervention
	$cc = strip_tags(trim($_GET['cc'])); // Récupération code Client
	$ct = strip_tags(trim($_GET['ct'])); // Récupération code Technicien traitant
	$ca = strip_tags(trim($_GET['ca'])); // Récupération code Agence

	$nbartint = 0;

	if ($ci <> "")
	{
		// Vérification qu'il existe bien des articles dans l'intervention
		$nbartint = nb_art_in_int($ci);

		// Récupération des informations intervention
		$row = lit_enr_int($ci);
		extract ($row);

		$int_datecreaf = formatedate($int_datecrea);
		$int_datemodf = formatedate($int_datemod);
		$int_dateddef = formatedate($int_datedde);
		$int_daterdvf = formatedate($int_daterdv);
		$int_dateprevf = formatedate($int_dateprev);
		$int_datefinf = formatedate($int_datefin);
		$int_datecertf = formatedate($int_datecert);
		
		$cc=$int_codecli;
		$ct=$int_codetec;
		$ca=$int_codeage;
		
		$titre = "DETAIL INTERVENTION";

		// Récupération du total travaillé & Techniciens traitants
		$nbtotalsec = 0;
		$nbtotalsecoff = 0;
		$str_tec_traitants = "";

		$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
		mysql_select_db(DBNAME);

		// Récupération total travaillé
		$rech = "SELECT * FROM `" .TBINTH. "` WHERE `inth_codeint`= '".$ci."'";
		$rs = mysql_query($rech);
		if (mysql_num_rows($rs) <> 0)
		{
			while ($row = mysql_fetch_assoc($rs)) 
			{         
				if ($row["inth_offert"] == 0)
					$nbtotalsec = $nbtotalsec + diff_time_sec($row["inth_heurea"],$row["inth_heured"]);
				else
					$nbtotalsecoff = $nbtotalsecoff + diff_time_sec($row["inth_heurea"],$row["inth_heured"]);
			}
		}

		// Si un utilisateur a quitté avant de sauver (bien qu'ayant modifié le détail horaire,
		// on remet en état car seul le détail horaire et technicien enregistré est valable
		if ($int_durees <> $nbtotalsec)
		{
			$rech = "UPDATE `" .TBINT. "` SET `int_datemod`='".$datea."', `int_codemod`='".$codeuser."',`int_durees`='".$nbtotalsec."'";
			$rech .=" WHERE `int_code` = '".$ci."'";
			$rs = mysql_query($rech) or die(mysql_error());
			$int_durees = $nbtotalsec;
		}

		// Chaîne des techniciens traitants
		$rech = "SELECT DISTINCT inth_codetec FROM `" .TBINTH. "` WHERE `inth_codeint`= '".$ci."'";
		$rs = mysql_query($rech);
		if (mysql_num_rows($rs) <> 0)
		{
			while ($row = mysql_fetch_assoc($rs)) 
			{
				$rech2 = "SELECT tec_nom, tec_prenom FROM `" .TBTEC. "` WHERE `tec_code`= '".$row["inth_codetec"]."' ORDER BY tec_nom";
				$rs2 = mysql_query($rech2);
				if (mysql_num_rows($rs2) <> 0)
				{
					if ($row2 = mysql_fetch_assoc($rs2))
						$str_tec_traitants .= $row2["tec_nom"]." ".$row2["tec_prenom"].", ";
				}
				mysql_free_result($rs2);
			}
		}
		$str_tec_traitants = substr($str_tec_traitants,0,strlen($str_tec_traitants)-2).".";
		mysql_free_result($rs);
		mysql_close($conn);
	}

	if ($cc <>"")
	{
			$row = lit_enr_cli($cc);
			extract ($row);

			$int_codecli = $cc;
	}
?>

<!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 : Fiche Intervention</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 validation des formulaires -->
<script language="JavaScript" src="../inc/validator.js"></script>

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

<!-- Scripts Javascript pour vérifications -->
<script language="JavaScript" src="../inc/verif.js"></script>

<!-- Définition Javascript pour calendrier popup -->

  <!-- Feuille de Style -->
  <link rel="stylesheet" type="text/css" media="all" href="../jscal/skins/aqua/theme.css" title="Aqua" />

  <!-- Script Javascript Principal -->
  <script type="text/javascript" src="../jscal/calendar.js"></script>

  <!-- Choix du langage -->
  <script type="text/javascript" src="../jscal/lang/calendar-fr.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="../jscal/calendar-setup.js"></script>

<!-- Fin de la définition Javascript pour calendrier popup -->

<!-- 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 ("../inc/entete.php"); 
?>

<p align="center"> <span class="titrepage"><?PHP echo $titre ?></span></p>

<!-- Affiché uniquement s'il y a un code client -->
<?PHP
if ($cc <> "")
{
?>
<table width="100%"  border="0">
<tr>
	<td width="33%"><strong><em><a href="int_lst.php">Retour &agrave; la liste</a></em></strong></td>
	<td width="33%" valign="top"><div align="center"></div></td>
	<td width="33%">&nbsp;</td>
</tr>
</table>
<form name="int_maj" method="post" action="#">

<!-- Date de demande -->
<table width="800"  border="0">
<tr>
	<td width="160" class="tfvNormal" id="f_dateddef"><div align="right">Date Demande </div></td>
	<td>
		<input name="dateddef" type="text" id="dateddef" value="<?PHP echo $int_dateddef ?>" size="10" maxlength="10" readonly="1">
	</td>
</tr>
</table>

<!-- Code de l'intervention (affiché uniquement si édition ou suppression) -->
<?PHP if ($td <> "add") {?>
<table width="800"  border="0">
<tr>
	<td width="160" class="tfvNormal" id="f_codeint"><div align="right">Code </div></td>
	<td>
		<input name="code" type="text" id="code" value="<?PHP echo $int_code ?>" size="20" maxlength="20" readonly="1">
	</td>
</tr>
</table>
<?PHP }  ?>

<!-- Affichage du client -->
<table width="800"  border="0">
<tr>
	<td width="400" class="tfvNormal" id="f_codecli">
		<div align="center">Client 
		</div>
	</td>
</tr>
</table>

<!-- Détails client -->
<table width="800"  border="0">
<tr>
	<td width="400" valign="top" bgcolor="#CCFFCC">
	<?PHP
	echo "<b>";
	if ($cli_ste <>"") 
	{
		echo $cli_ste."<br>";
		echo "<span class=\"annot_gras_it\">";
	}
	echo $cli_civilite." ".$cli_prenom." ".$cli_nom."<br>";
	if ($cli_ste <>"") 
	{
		echo "</span>";
	}
	echo "</b>";
	echo $cli_adr1."<br>";
	if ($cli_adr2 <>"") 
		echo $cli_adr2."<br>";
	echo Retournecp($cli_ville)." ".Retourneville($cli_ville)."<br>";
	echo "Tel : ".$cli_telf."<br>";
	?>
	</td>
	</tr>
</table>

<!-- Code de l'agence (choisi uniquement si création, affiché uniquement si édition ou suppression) -->
<table width="800"  border="0">
<tr>
	<td width="160" class="tfvNormal" id="f_agence"><div align="right">Agence</div></td>
	<td>
		<?PHP 
			$row = lit_enr_age($int_codeage);
			extract($row);
		?>
		<input name="nomage" type="text" id="nomage" value="<?PHP echo $age_nom ?>" size="50" maxlength="50" readonly="1">
	</td>
</tr>
</table>

<!-- Détail du contrat -->
<?PHP if ($cc <> "") {?>
<table width="800"  border="0">
<tr>
	<td width="160" class="tfvNormal" id="f_codeco"><div align="right">Sur le contrat</div></td>
	<td>
 	  <?PHP
			$txt_cocl = "";
			if ($int_codecocl <> "")
			{
				$row = lit_enr_cocl($int_codecocl);
				if (is_array($row))
					extract($row);
				$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
				mysql_select_db(DBNAME);
				$rech2 = "SELECT * FROM " .TBCO. " WHERE co_code = '".$cocl_codeco."'";
				$rs2 = mysql_query($rech2) or die(mysql_error());
				if ($row2 = mysql_fetch_array($rs2))
				{
					$txt_cocl = $cocl_code." - ".$row2["co_nom"];
				}
				mysql_free_result($rs2);
				mysql_close($conn);
			}
		?>
			<input name="codecocl" type="hidden" id="codecocl" value="<?PHP echo $int_codecocl ?>">
			<input name="ncocl" type="text" id="ncocl" value="<?PHP echo $txt_cocl ?>" size="100" readonly="1">
		<?PHP
		}
		?>
	</td>
</tr>
</table>
<?PHP }  ?>

<!-- Paramètres de la demande -->
<table width="800"  border="0">
  <tr>
    <td width="160" class="tfvNormal" id="f_orig"><div align="right">Demand&eacute; par </div></td>
    <td>
		<?PHP 
		$row = lit_enr_ori($int_codeorig);
		extract($row);
		?>
        <input name="nomorig" type="text" id="nomorig" value="<?PHP echo $orig_desc ?>" size="10" maxlength="10" readonly="1">
        <span class="annot_petit_it">(ATELIER = mat&eacute;riel directement apport&eacute;)</span> </td>
  </tr>
  <tr>
    <td width="160" class="tfvNormal" id="f_statut"><div align="right">Statut </div></td>
    <td>
		<?PHP
		// Affichage du statut

		$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
		mysql_select_db(DBNAME);
		$rs = mysql_query("SELECT * FROM ".TBSTA." WHERE statut_code='".$int_codestatut."'");
		if ($row = mysql_fetch_array($rs))
		{
			extract($row);
		}
		mysql_free_result($rs);
		mysql_close($conn);
		?>
        <input name="codestatut" type="text" id="codestatut" value="<?PHP echo $statut_desc ?>" size="50" maxlength="50" readonly="1">
    </td>
  </tr>
  <tr>
    <td width="160" class="tfvNormal" id="f_lieu"><div align="right">Lieu </div></td>
    <td>
        <?PHP
		
		// Affichage du Lieu

		$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
		mysql_select_db(DBNAME);
		$rs = mysql_query("SELECT * FROM ".TBLIEU." WHERE lieu_code='".$int_codelieu."'");
		if ($row = mysql_fetch_array($rs))
		{
			extract ($row);
		}
		mysql_free_result($rs);
		mysql_close($conn);

		?>
        <input name="codelieu" type="text" id="codelieu" value="<?PHP echo $lieu_desc ?>" size="50" maxlength="50" readonly="1">
	</td>
  </tr>
</table>

<!-- Date de RDV -->
<table width="800"  border="0">
<tr>
	<td width="160" class="tfvNormal" ><div align="right">Date RDV </div></td>
	<td>
		<input name="daterdvf" type="text" id="daterdvf" value="<?PHP echo $int_daterdvf ?>" size="10" maxlength="10" readonly="1">
	</td>
</tr>
</table>

<!-- Matériel et problème de la demande -->
<table width="800"  border="0">
<tr>
	<td width="160" class="tfvNormal" id="f_mat"><div align="right">Mat&eacute;riel </div></td>
	<td>
		<textarea name="mat" cols="95" rows="5" readonly id="mat"><?PHP echo $int_mat ?></textarea>
	</td>
</tr>
<tr>
	<td width="160" class="tfvNormal" id="f_pbm">
		<div align="right">
		<p>Descriptif probl&egrave;me</p>
		</div>
	</td>
	<td>
		<textarea name="pbm" cols="95" rows="5" readonly id="pbm"><?PHP echo $int_pbm ?></textarea>
	</td>
</tr>
</table>

<!-- Intervention sous garantie ou pas ? -->
<table width="800"  border="0">
<tr>
	<td width="160" class="tfvNormal" id="f_gar"><div align="right">Garantie</div></td>
	<td>
		<?PHP
		if ($int_gar == 0)
		{
		?>
		<input name="gar" type="text" id="gar" value="Non" size="3" maxlength="3" readonly="1">
		<?PHP
		}
		else
		{
		?>
		<input name="gar" type="text" id="gar" value="Oui" size="3" maxlength="3" readonly="1">
		<?PHP
		}
		?>
		<span class="annot_std_gras">R&eacute;f&eacute;rence facture :</span>
		<input name="fgar" type="text" id="fgar" value="<?PHP echo $int_fgar ?>" size="30" maxlength="30" readonly="1">
    </td>
</tr>
</table>

<!-- Acompte versé -->
<table width="800"  border="0">
<tr>
	<td width="160" class="tfvNormal" id="f_acpte"><div align="right">Acompte (&euro; TTC) </div></td>
	<td>
		<input name="acpte" type="text" id="acpte" align="right" value="<?PHP echo $int_acpte ?>" size="10" maxlength="10" readonly="1"> 
	</td>
</tr>
</table>

<br>
<!-- Technicien responsable -->
<table width="800"  border="0">
  <tr>
    <td width="160" class="tfvNormal" id="f_codetec"><div align="right">Responsable dossier</div></td>
    <td>
        <?PHP
			// Récupération données du technicien
			$row = lit_enr_tec($int_codetec);
			if (is_array($row)) // Contrôle pour résoudre le problème si technicien pas affecté
				extract ($row);
		?>
		<input name="tec" type="text" id="tec" value="<?PHP echo $tec_civilite." ".$tec_prenom." ".$tec_nom;?>" size="100" maxlength="100" readonly="1">
		
	</td>
  </tr>
</table>

<!-- Techniciens traitants -->
<table width="800"  border="0">
  <tr>
    <td width="160" class="tfvNormal" id="f_tect"><div align="right">Technicien(s) traitant(s) </div></td>
    <td>
		<textarea name="tect" cols="98" rows="2" id="tect" readonly="1"><?PHP echo $str_tec_traitants; ?></textarea>            
	</td>
  </tr>
</table>

<!-- Travail effectué -->
<table width="800"  border="0">
<tr>
	<td width="160" class="tfvNormal" id="f_duree"><div align="right">Temps travaill&eacute;</div></td>
	<td>
		<input name="duree" type="text" id="duree" value="<?PHP echo sec_heure($int_durees) ?>" size="8" maxlength="8" readonly="1"> 
		<!-- Détails internes du temps passé -->
		<?PHP
		$url_detinth = "inth_maj.php?td=view&ci=".$ci;
		?>
			<a href="javascript:;" onclick="fensaisie('<?PHP echo $url_detinth; ?>',1024,600,'status=no,scrollbars=yes,menubar=no,statusbar=no,location=no,locationbar=no');")><img src="../img/clock.gif" width="16" height="16" border="0" align="absmiddle"></a>
			<a href="javascript:;" onclick="fensaisie('<?PHP echo $url_detinth; ?>',1024,600,'status=no,scrollbars=yes,menubar=no,statusbar=no,location=no,locationbar=no');")> Détail horaires &amp; techniciens</a>
		<?PHP
		if ($nbtotalsecoff <> 0)
		{
			echo "<br>";
			echo "<span class=\"annot_petit_it\">";
			echo "(Plus temps offert : ";
			?>
			<input name="dureeoff" type="text" id="dureeoff" value="<?PHP echo sec_heure($nbtotalsecoff) ?>" size="8" maxlength="8" readonly="1"> 
			<?PHP
			echo ")";
			echo "</span>";
		}
		?>
	</td>
</tr>
<tr>
	<td width="160" class="tfvNormal" id="f_fait"><div align="right">Travail effectu&eacute; </div></td>
	<td>
		<textarea name="fait" cols="98" rows="5" readonly id="fait"><?PHP echo $int_fait ?></textarea>            
	</td>
</tr>
</table>

<!-- Date d'appel du client une fois le dossier traité -->
<table width="800"  border="0">
<tr>
	<td width="160" class="tfvNormal" id="f_dateprevf"><div align="right">Client pr&eacute;venu  le </div></td>
	<td>
		<input name="dateprevf" type="text" id="dateprevf" value="<?PHP echo $int_dateprevf ?>" size="10" maxlength="10" readonly="1">
	</td>
</tr>
</table>

<!-- Mode de règlement -->
<table width="800"  border="0">
  <tr>
    <td width="160" class="tfvNormal" id="f_reg"><div align="right">R&egrave;glement</div></td>
    <td>
        <?PHP
		
		// Affichage du Règlement

		$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
		mysql_select_db(DBNAME);
		$rs = mysql_query("SELECT * FROM ".TBREG." WHERE reg_code='".$int_codereg."'");
		while ($resultat = mysql_fetch_array($rs)) 
		{
			extract($resultat);
		}
		mysql_free_result($rs);
		mysql_close($conn);
		?>
		<input name="reg" type="text" id="reg" value="<?PHP echo $reg_desc ?>" size="50" maxlength="50" readonly="1">
	  </td>
  </tr>
</table>

<!-- Date de clôture du dossier -->
<table width="800"  border="0">
<tr>
	<td width="160" class="tfvNormal" id="f_datefinf"><div align="right">Dossier cl&ocirc;t le </div></td>
	<td>
		<input name="datefinf" type="text" id="datefinf" value="<?PHP echo $int_datefinf ?>" size="10" maxlength="10" readonly="1">
	</td>
</tr>
</table>
  
<!-- Zone de saisie des articles et prestations -->
	<table width="800"  border="0">
	<tr>
		<td class="tfvNormal">
		<div align="left">Forfaits et pi&egrave;ces factur&eacute;es </div>
		</td>
	</tr>
	</table>

	<?PHP
	if ($nbartint <> 0) // Si des articles présents, on les affiche
	{ 
		$totalint = 0;
		
		$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
		mysql_select_db(DBNAME);
		$rech = "SELECT * FROM ".TBPDTI." WHERE pdti_codeint='".$ci."' ORDER BY 'pdti_id'";
		
		$rs = mysql_query($rech) or die(mysql_error());
		
		// *** Affichage de la table
		echo "<table class=\"Ltable\"  border=\"0\" width=\"800\">\n";     
		
		// Création entête
		echo "<th class=\"thlst\">Code</th>\n";
		echo "<th class=\"thlst\">Désignation + NS</th>\n";
		echo "<th class=\"thlst\">PU TTC</th>\n";
		echo "<th class=\"thlst\">Qté</th>\n";
		echo "<th class=\"thlst\">Total</th>\n";
		echo "<th class=\"thlst\">&nbsp;</th>\n";
		
		$i = 0;
		
		while ($row = mysql_fetch_assoc($rs)) 
		{         
		
			// Extraction information article
			
			$rech2 = "SELECT pdt_des FROM ".TBPDT." WHERE pdt_code='".$row["pdti_codepdt"]."'";
			$rs2 = mysql_query($rech2) or die(mysql_error());
			
			while ($row2 = mysql_fetch_assoc($rs2)) 
			{
				extract($row2);
			}
			
			// Couleurs alternées
			if($i%2 == 0)  
				echo "<tr class=\"TRalter1\">\n";
			else
				echo "<tr class=\"TRalter2\">\n";
			
			echo "<td class=\"tdlst\" valign=\"top\">".$row["pdti_codepdt"]."</td>\n";
			echo "<td class=\"tdlst\" valign=\"top\">";
			echo $pdt_des;
			if ($row["pdti_ns"] <> "")
			{
				$ligne_cesure = cesuretxt_tab($row["pdti_texte"],100);
				$serie = "";
				foreach ($ligne_cesure as $index_ligne=>$ligne)
					$serie .= $ligne."<br>";
				echo "<br>";
				echo "&raquo;";
				echo "<span class=\"annot_moy_it\">";
				echo $serie;
				echo "</span>";
			}
			if ($row["pdti_texte"] <> "")
			{
				$ligne_cesure = cesuretxt_tab($row["pdti_texte"],100);
				$commentaire = "";
				foreach ($ligne_cesure as $index_ligne=>$ligne)
					$commentaire .= $ligne."<br>";
				echo "<br>";
				echo "<span class=\"annot_moy_it\">";
				echo $commentaire;
				echo "</span>";
			}
			echo "</td>\n";
			echo "<td class=\"tdlst\" valign=\"top\">";
			echo "<div align=\"right\">";
			echo $row["pdti_puttc"]."€";
			echo "</div>";
			echo "</td>\n";
			echo "<td class=\"tdlst\" valign=\"top\">";
			echo "<div align=\"right\">";
			echo $row["pdti_qte"];
			echo "</div>";
			echo "</td>\n";
			$total = $row["pdti_puttc"]*$row["pdti_qte"];
			echo "<td class=\"tdlst\" valign=\"top\">";
			echo "<div align=\"right\">";
			echo number_format($total,2,'.','')."€";
			echo "</div>";
			echo "</td>\n";		
			
			$totalint = $totalint+$total;

			echo "<td class=\"tdlst\">&nbsp;</td>\n";
			
			echo "</tr>\n";
			
			$i++;
		}  
	
		echo "<tr class=\"TRalter3\">\n";
		echo "<td>\n</td>\n";
		echo "<td>\n</td>\n";
		echo "<td>\n</td>\n";
		echo "<td>";
		echo "<div align=\"right\">";
		echo "Total :";
		echo "</div>";
		echo "</td>\n";
		echo "<td>";
		echo "<div align=\"right\">";
		echo number_format($totalint,2,'.','')."€";
		echo "</div>";
		echo "</td>\n";		
		echo "<td>";
		echo "<div align=\"left\">";
		echo "TTC";
		echo "</div>";
		echo "</td>\n";
		echo "</tr>\n";
		echo "<tr class=\"TRalter3\">\n";
		echo "<td>\n</td>\n";
		echo "<td>\n</td>\n";
		echo "<td>\n</td>\n";
		echo "<td>";
		echo "<div align=\"right\">";
		echo "Acompte :";
		echo "</div>";
		echo "</td>\n";
		echo "<td>";
		echo "<div align=\"right\">";
		echo "-".number_format($int_acpte,2,'.','')."€";
		echo "</div>";
		echo "<td>";
		echo "<div align=\"left\">";
		echo "TTC";
		echo "</div>";
		echo "</td>\n";
		echo "<tr class=\"TRalter3\">\n";
		echo "<td>\n</td>\n";
		echo "<td>\n</td>\n";
		echo "<td>\n</td>\n";
		echo "<td>";
		echo "<div align=\"right\">";
		echo "Net à payer :";
		echo "</div>";
		echo "</td>\n";
		echo "<td>";
		echo "<div align=\"right\">";
		echo number_format(($totalint-$int_acpte),2,'.','')."€";
		echo "</div>";
		echo "</td>\n";
		echo "<td>";
		echo "<div align=\"left\">";
		echo "TTC";
		echo "</div>";
		echo "</td>\n";
		echo "</tr>\n";
		
		echo "</table>\n";
		// *** Fin affichage de la table
		
		mysql_free_result($rs);
		mysql_close($conn);  
	}
	else
	{
		echo "<span class=\"annot_gras_it\">";
		echo "Aucun article ou prestation";
		echo "</span>";
		echo "<br>";
	}
		$urlchoixart = "pdt_lst.php?ta=i&td=".$td."&cc=".$cc."&ct=".$ct."&cte=".$cte."&ci=".$ci."&cx=";
	?>

	<!-- Choix de "l'avenir" des pièces changées -->
	<?PHP 
	// On peut choisir quoi faire avec les pièces, uniquement s'il y en a eu de changées
	// ET si le certificat de destruction n'a pas été envoyé
	if (($nbartint <> 0) AND ($int_datecertf == ""))
	{ 
	?>
		<table width="800" border="0" cellspacing="0" cellpadding="0">
		<tr>
			<td>
			<div align="center">
			<span class="annot_std_gras">Pi&egrave;ces hors service :</span> 
			<span class="annot_std_it"> 
			<?PHP 
			if ($int_pces == 0)
				echo "Sans objet";
			if ($int_pces == 1)
				echo "Rendues";
			if ($int_pces == 2)
				echo "Conservées"; ?>
			</span>
			</div>
			</td>
		</tr>
		</table>
	<?PHP 
	} 
	?>

<input name="totalint" type="hidden" id="totalint" value="<?PHP echo $totalint ?>">
</form>

<!-- Fin Affiché uniquement s'il y a un code client -->

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