<?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/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"]);
?>
<!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; ?> : Historiques Produits / Interventions</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 divers -->
<script language="JavaScript" src="../jscript/divers.js"></script>

</head>

<body onLoad="metFocus();">

<?php
include_once("../inc/entete.inc.php"); 
?>
<p align="center"><span class="titrepage">HISTORIQUES ARTICLES </span></p>
<?PHP
// $fic_imp = "int_lsti.php";

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

$rech = cree_strrechlstpdtih();
if ((@$_SESSION["niv_log"] == 4) OR (@$_SESSION["niv_log"] == 3))
{
	if(!stristr($rech,"WHERE "))
		$rech .= " WHERE ".TBINT.".int_codeage='".$_SESSION["code_log"]."'";
	else
		$rech .= " AND ".TBINT.".int_codeage='".$_SESSION["code_log"]."'";
}
$rech .= crestr_triord($pdti_titre_col,"pdti_codepdt",FALSE,$limit);

$rs = mysql_query($rech) or die(mysql_error());
$numrows = mysql_num_rows($rs); // Nombre de résultats à la requête

if($numrows == 0)
{
	retpp();
}
 else
{
	include_once("formr.inc.php"); 

	$rech = cree_strrechlstpdtih();
	if ((@$_SESSION["niv_log"] == 4) OR (@$_SESSION["niv_log"] == 3))
	{
		if(!stristr($rech,"WHERE "))
			$rech .= " WHERE ".TBINT.".int_codeage='".$_SESSION["code_log"]."'";
		else
			$rech .= " AND ".TBINT.".int_codeage='".$_SESSION["code_log"]."'";
	}
	$rech .= crestr_triord($pdti_titre_col,"pdti_codepdt",FALSE,$limit);

	$rs = mysql_query($rech) or die(mysql_error());

	// *** Pagination d'entête
	pagine_lst($numrows,$limit);
		
	// *** Affichage de la table
	 echo "<table class=\"Mtable\" border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\n";     

	// Création entête
	titlst($pdti_titre_col);
	echo "<th>".ucfirst("Interventions")."</th>\n";
	
	$i = 0;
	
	while ($row = mysql_fetch_assoc($rs)) 
	{         
	 // Affichage résumé intervention

		// Création de l'entête de ligne (TR)
		creetrlst($i);

		 // Affichage Code Produit
		 
		 echo "<td>".$row["pdti_codepdt"];
		 
			 // Affichage détail Produit
	
				 $detailpdt = "->";
				 if ($row["pdt_des"] <> "")
					$detailpdt .= $row["pdt_des"];
				 echo "<br>";
				 echo "<span class=\"annot_petit_it\">";
				 echo $detailpdt;
				 echo "</span>";
		
			 // Fin affichage détail Produit
		 
		 echo "</td>\n";
		 
		 // Fin affichage Produit
		 
		 // Affichage Code Intervention 

		 echo "<td>".$row["pdti_codeint"];
		 
			 // Affichage détail client
	
				 $detailcli = "Client : ";
				 if ($row["cli_ste"] <> "")
					$detailcli .= $row["cli_ste"].", ";
				 $detailcli .= $row["cli_civilite"]." ".$row["cli_nom"];
				 echo "<br>";
				 echo "<span class=\"annot_petit_it\">";
				 echo $detailcli;
				 echo "</span>";
		
			 // Fin affichage détail client

			 // Affichage détail Intervention
	
				 $detailint = "Début : ".formatedate($row["int_datedde"]);
				 echo "<br>";
				 echo "<span class=\"annot_petit_it\">";
				 if (formatedate($row["int_datefin"]) <> "")
					$detailint .= " / Fin : ".formatedate($row["int_datefin"]);
				 echo $detailint;
				 echo "</span>";
		
			 // Fin affichage détail Intervention

		 echo "</td>\n";

		 // Fin Affichage Code Intervention 

		 // Affichage Quantité

		 echo "<td>";

			 echo "<div align=\"center\">";
			 echo $row["pdti_qte"];
			 echo "</div>";
	
		 echo "</td>\n";

		 // Fin affichage Quantité


		 // Affichage PU

		 echo "<td>";

			 echo "<div align=\"center\">";
			 echo $row["pdti_puttc"].$lang['symbole_monnaie_txt'];
			 echo "</div>";
	
		 echo "</td>\n";

		 // Fin affichage PU

		 echo "<td>".$row["pdti_ns"]."</td>\n";

		// CREATION lien dynamique sur icône (édition, suppression, etc...)
		 echo "<td>";
		 echo "<div align=\"center\">";

		$lst_maj = TRUE;

		 echo "<a href=\"int_maj.php?td=edit&ci=".$row["int_code"]."&cc=".$row["cli_code"]."\"><img src=\"../img/edit.png\" border=\"0\" align=\"absmiddle\" title=\"".$alt_edit."\"></a>";
		 echo " ";

		$lst_imp = TRUE;
		
		 $urlimp = "int_pdf.php?ci=".$row["int_code"];
		 echo "<a href=\"javascript:;\" onclick=\"lanceimp('".$urlimp."');\")><img src=\"../img/print.png\" title=\"".$alt_impfic."\" border=\"0\" align=\"absmiddle\"></a>";
		 echo " ";

		$lst_impc = TRUE;
		
		 $urlimp = "int_pdf.php?ci=".$row["int_code"]."&cgv=ok";
		 echo "<a href=\"javascript:;\" onclick=\"lanceimp('".$urlimp."');\")><img src=\"../img/printc.png\" title=\"Imprimer (avec CGV)\" border=\"0\" align=\"absmiddle\"></a>";

		 echo "</div>";
		 echo "</td>\n";

		 echo "</tr>\n";
	 // Fin affichage résumé intervention
		
		$i++;    
	}  
	echo "</table>\n";
	// *** Fin affichage de la table
	
	mysql_free_result($rs);
	
	// *** Pagination de pied
	pagine_lst($numrows,$limit);

	mysql_close($conn);  
	
	$taille_piedla="";
	include_once("piedla.inc.php");
}
include_once("pied.php");
?>