<?php
/****************************************************************************************
SMI (Services Maintenance Interventions) est une gestion libre de maintenance et de SAV

Version 0.9.6
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
****************************************************************************************/

include ("../inc/config.inc.php");
?>
<?php include ("../inc/func_log.inc.php") ?>
<?php require ("../inc/func_txt.inc.php") ?>
<?php include ("../inc/fic_fpdf.inc.php") ?>
<?php include ("../inc/txt.inc.php") ?>
<?PHP
	Archivelog(@$HTTP_SESSION_VARS["code_log"]);

	$tfr = strip_tags(trim($_GET['tfr']));	// Récupération type Fiche Relevé
	$cc = strip_tags(trim($_GET['cc']));	// Récupération Code Client
	$agence = @$HTTP_SESSION_VARS["code_age"]; // Récupération code agence
	
	function datefr($dateang) 
	{
		$split = split("-",$dateang);
		$annee = $split[0];
		$mois = $split[1];
		$jour = $split[2];
		return "$jour"."-"."$mois"."-"."$annee";
	}

	function formatedate($dte)
	{
		$date = "";
	
		if (($dte <> "") AND ($dte <> "0000-00-00"))
			$date = datefr($dte);
		else
			$date = "";
			
		return $date;
	}

	// Test si date1 supérieure à date2 (Format Anglais)
	
	function echeance_depassee_date($date1,$date2) 
	{
	  $depasse = FALSE;
	
	  $tDeb = explode("-", $date1);
	  $tFin = explode("-", $date2);
	
	  if (mktime(0, 0, 0, $tDeb[1], $tDeb[2], $tDeb[0]) > mktime(0, 0, 0, $tFin[1], $tFin[2], $tFin[0]))
		$depasse = TRUE;
	  
	  return $depasse;
	
	}
	
	function Retourneville($insee)
	{
		$ville_nom = "";
		
		$conn2 = mysql_connect(DBHOST, DBUSER, DBPASS);
		mysql_select_db(DBNAME);
		$rnom = "SELECT villes_insee,villes_nom FROM " .TBVILLES. " WHERE villes_insee='".$insee."'";;
		$rsnom = mysql_query($rnom) or die(mysql_error());
		if (mysql_num_rows($rsnom) == 1) // Uniquement UN SEUL enregistrement !
		{
			if ($rowville = mysql_fetch_array($rsnom)) 
			{
				extract ($rowville);
			}
		}
	
		mysql_free_result($rsnom);
		mysql_close($conn2);  
	
		$ville = str_majuscules($villes_nom);
		
		// Les villes de LYON, MARSEILLE, PARIS doivent être traitées à part (arrondissements)
		
		if (stristr($villes_nom,"LYON"))
			$ville="LYON";
		if (stristr($villes_nom,"MARSEILLE"))
			$ville="MARSEILLE";
		if (stristr($villes_nom,"PARIS"))
			$ville="PARIS";
			
		return $ville;
	}

	function Retournecp($insee)
	{
		$villes_cp = "";
		
		$conn2 = mysql_connect(DBHOST, DBUSER, DBPASS);
		mysql_select_db(DBNAME);
		$rcp = "SELECT villes_insee,villes_cp FROM " .TBVILLES. " WHERE villes_insee='".$insee."'";;
		$rscp = mysql_query($rcp) or die(mysql_error());
		if (mysql_num_rows($rscp) == 1) // Uniquement UN SEUL enregistrement !
		{
			if ($rowcp = mysql_fetch_array($rscp)) 
			{
				extract ($rowcp);
			}
		}
	
		mysql_free_result($rscp);
		mysql_close($conn2);  
	
		return $villes_cp;
	}

	if (($tfr <> "") AND ($cc <> "") AND (($tfr == 1) OR ($tfr == 2)))
	{
		// Récupération des données agence
		$row = lit_enr_age(@$HTTP_SESSION_VARS["code_age"]);
		extract ($row);

		$cp_age = Retournecp($age_ville);
		$ville_age = Retourneville($age_ville);

		// Récupération des données client
		$row = lit_enr_cli($cc);
		extract ($row);

		require('../classes/fpdf/fpdf.php');
		
		class PDF extends FPDF
		{
			//En-tête
			function Header()
			{
				global
					$agence,
					$tfr,
					$chemin_logos,
					$pv_ent_age,
					$pv_ent_rel,
					$age_adr1,
					$age_adr2,
					$age_ville,
					$age_telf,
					$age_fax,
					$age_txtfax,
					$age_web,
					$age_email,
					$age_heures,
					$age_txtent,
					$cp_age,
					$ville_age;
					
		

				$pv_ent_age = 30; // Valeur de départ (mm) du pointeur pour l'affichage agence par rapport au bord haut de la feuille
								  // Cette valeur comprend la hauteur du logo (20 mm)
		
				$pv_ent_rel = 20; // Valeur de départ (mm) du pointeur pour l'affichage de l'entête intervention par rapport au bord haut de la feuille


				// Logo Agence
				$urlimg = $chemin_logos."/log".strtolower($agence).".png"; 
				$this->Image($urlimg,10,10,55,15); // Image à 10mm du bord gauche, 10mm du bord haut, largeur maximum 55mm
							
				// Entête Agence
				
					// N° de Siret
					$this->SetY($pv_ent_age);
					$this->SetFont('Arial','I',6);
					$this->Cell(95,3,$age_rcs,0,0,'L');
	
					// Coordonnées
					$ent_age = $age_adr1."\n";
					if ($age_adr2 <> "")
						$ent_age.= $age_adr2."\n";
					$ent_age.= $cp_age." ".$ville_age."\n";
					$ent_age.= "Tel : ";
					$ent_age.=$age_telf;
					if ($age_txttelf <> "")
						$ent_age.= " (".$age_txttelf.")\n";
					else
						$ent_age.= "\n";
					$ent_age.="Fax : ";
					$ent_age.= $age_fax;
					if ($age_txtfax <> "")
						$ent_age.= " (".$age_txtfax.")\n";
					else
						$ent_age.= "\n";
	
					$pv_ent_age = $pv_ent_age + 3;
					$this->SetY($pv_ent_age);
					$this->SetFont('Arial','',8);
					$this->MultiCell(95,3,$ent_age,0,'L');
	
					// Textes complémentaires
					$ent_age = "";
					if ($age_web <> "")
					{
						$ent_age = "Site Web : ";
						$ent_age.= $age_web." / ";
					}
					$ent_age.= "Email : ";
					$ent_age.= $age_email."\n";
					$ent_age.= "Horaires : ";
					$ent_age.= $age_heures."\n";
					$ent_age.= formatetxt($age_txtent);
					$this->SetFont('Arial','I',6); // Pas besoin de SetY car le MultiCell renvoie juste en dessous
					$this->MultiCell(95,3,$ent_age,0,'L');
					$pv_ent_age = $this->GetY(); // Récupération de la position du pointeur
	
				// Entête Relevé
				
				$this->SetY($pv_ent_rel);
				$this->Cell(95);
				$this->SetFont('Arial','BU',14);
				if ($tfr == 1)
				{
					$this->Cell(95,10,'RELEVE DE PARC LICENCES',0,1,'C');
					$ent_rel = "FOLIO RL".str_repeat("_",20);
				}
				else
				{
					$this->Cell(95,10,'RELEVE DE PARC MATERIELS',0,1,'C');
					$ent_rel = "FOLIO RM".str_repeat("_",20);
				}
				$ent_rel .= "\nDate saisie : __/__/____";
				$ent_rel .= "\nPar : ".str_repeat("_",40);
				$pv_ent_rel = $pv_ent_rel + 10;
				$this->SetY($pv_ent_rel);
				$this->Cell(95);
				$this->SetFont('Arial','',10);
				$this->MultiCell(95,5,$ent_rel,0,'C');
				
				$this->SetDrawColor(125);
				$this->SetLineWidth(0.4);
				$this->Line(10,$pv_ent_age,287,$pv_ent_age);
				$this->SetDrawColor(0);
				$this->SetLineWidth(0.2);

				$pv_ent_age++;
				$this->SetY($pv_ent_age);

			}
			
			//Pied de page
			function Footer()
			{
				//Positionnement à 1,5 cm du bas
				$this->SetY(-15);
				//Police Arial italique 8
				$this->SetFont('Arial','I',8);
				//Numéro de page
				$this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'R');
			}

			var $B;
			var $I;
			var $U;
			var $HREF;
			
			function PDF($orientation='P',$unit='mm',$format='A4')
			{
				//Appel au constructeur parent
				$this->FPDF($orientation,$unit,$format);
				//Initialisation
				$this->B=0;
				$this->I=0;
				$this->U=0;
				$this->HREF='';
			}
			
			function WriteHTML($html)
			{
				//Parseur HTML
				/*
				$html=str_replace("\n",' ',$html);
				*/
				$a=preg_split('/<(.*)>/U',$html,-1,PREG_SPLIT_DELIM_CAPTURE);
				foreach($a as $i=>$e)
				{
					if($i%2==0)
					{
						//Texte
						if($this->HREF)
							$this->PutLink($this->HREF,$e);
						else
							$this->Write(3,$e);
					}
					else
					{
						//Balise
						if($e{0}=='/')
							$this->CloseTag(str_majuscules(substr($e,1)));
						else
						{
							//Extraction des attributs
							$a2=explode(' ',$e);
							$tag=str_majuscules(array_shift($a2));
							$attr=array();
							foreach($a2 as $v)
								if(ereg('^([^=]*)=["\']?([^"\']*)["\']?$',$v,$a3))
									$attr[str_majuscules($a3[1])]=$a3[2];
							$this->OpenTag($tag,$attr);
						}
					}
				}
			}
			
			function OpenTag($tag,$attr)
			{
				//Balise ouvrante
				if($tag=='B' or $tag=='I' or $tag=='U')
					$this->SetStyle($tag,true);
				if($tag=='A')
					$this->HREF=$attr['HREF'];
				if($tag=='BR')
					$this->Ln(5);
				if($tag=='SDP')
					$this->AddPage();
			}
			
			function CloseTag($tag)
			{
				//Balise fermante
				if($tag=='B' or $tag=='I' or $tag=='U')
					$this->SetStyle($tag,false);
				if($tag=='A')
					$this->HREF='';
			}
			
			function SetStyle($tag,$enable)
			{
				//Modifie le style et sélectionne la police correspondante
				$this->$tag+=($enable ? 1 : -1);
				$style='';
				foreach(array('B','I','U') as $s)
					if($this->$s>0)
						$style.=$s;
				$this->SetFont('',$style);
			}
			
			function PutLink($URL,$txt)
			{
				//Place un hyperlien
				$this->SetTextColor(0,0,255);
				$this->SetStyle('U',true);
				$this->Write(3,$txt,$URL);
				$this->SetStyle('U',false);
				$this->SetTextColor(0);
			}

			function Rotate($angle,$x=-1,$y=-1)
			{
				if($x==-1)
					$x=$this->x;
				if($y==-1)
					$y=$this->y;
				if($this->angle!=0)
					$this->_out('Q');
				$this->angle=$angle;
				if($angle!=0)
				{
					$angle*=M_PI/180;
					$c=cos($angle);
					$s=sin($angle);
					$cx=$x*$this->k;
					$cy=($this->h-$y)*$this->k;
					$this->_out(sprintf('q %.5f %.5f %.5f %.5f %.2f %.2f cm 1 0 0 1 %.2f %.2f cm',$c,$s,-$s,$c,$cx,$cy,-$cx,-$cy));
				}
			}
			
			// Permet de rajouter un fonds de page en sous-impression
			function fond($texte)
			{
				$this->SetFont('Arial','B',60);
				$this->SetTextColor(203,203,203);
				$this->Rotate(45,55,190);
				$this->Text(55,190,$texte);
				$this->Rotate(0);
				$this->SetTextColor(0,0,0);
			}
		}
	
		$pdf=new PDF();
		$pdf->FPDF('L','mm','A4');
		$pdf->SetDisplayMode('real');
		$pdf->AliasNbPages();
		$pdf->SetTitle('Relevé N°'.$rel_code);
		$pdf->SetSubject('Relevé N°'.$rel_code);
		$pdf->AddPage();

		$pv_det_cli = $pv_ent_age; // Récupération de la position sous l'entête agence pour le pointeur détail client
		$pv_det_rel = $pv_ent_age; // Récupération de la position sous l'entête agence pour le pointeur détail intervention

		$pdf->SetLineWidth(0.4);

		// Impression du détail client

		$pdf->SetY($pv_det_cli); // Renvoie le pointeur SOUS l'entête agence

		$pdf->SetFont('Arial','BU',12); // Titre
		$pdf->Cell(138,5,'CLIENT','LTR',1,'C');
		
		$ent_cli = ""; // Détail
		if ($cli_ste <>"") 
		{
			$ent_cli.=$cli_ste."\n";
			$ent_cli.= $cli_civilite." ".$cli_prenom." ".$cli_nom."\n";
		}
		else
		{
			$ent_cli.= $cli_civilite." ".$cli_prenom." ".$cli_nom."\n\n"; // Double saut pour compenser le manque de la société
		}
		$pdf->SetFont('Arial','B',10);
		$pdf->MultiCell(138,4,$ent_cli,'LR','L');

		$ent_cli = $cli_adr1."\n"; // Suite...
		$ent_cli.= $cli_adr2."\n";
		$ent_cli.= Retournecp($cli_ville)." ".Retourneville($cli_ville)."\n";
		$ent_cli.= "Tel : ".$cli_telf."\n";
		$ent_cli.= "Fax : ".$cli_fax;
		$pdf->SetFont('Arial','',10);
		$pdf->MultiCell(138,4,$ent_cli,'LRB','L');

		// Impression du détail relevé

		$pdf->SetY($pv_det_rel); // Renvoie le pointeur SOUS l'entête agence

		$pdf->Cell(138);

		$pdf->SetFont('Arial','BU',12);
		$pdf->Cell(139,5,'DETAIL','LTR',1,'C');

		$pdf->Cell(138);

		$pdf->SetFont('Arial','',8);
		$ent_rel = "\n";
		$ent_rel.= "Racine codage :\n";
		$ent_rel.= "Dernier n° machine :\n";
		$ent_rel.= "\n";
		$ent_rel.= "\n";
		$ent_rel.= "\n";
		$ent_rel.= "\n";

		$pdf->MultiCell(30,4,$ent_rel,'B','R');

		$pdf->SetY($pv_det_rel+5); // Renvoie le pointeur SOUS l'entête agence + 5mm (cellule niveau urgence)
		$pdf->Cell(168);

		$pdf->SetFont('Arial','',8);
		$ent_rel = "\n";
		$ent_rel.= str_repeat("_",20)."\n";
		$ent_rel.= str_repeat("_",8)."\n";
		$ent_rel.= "\n";
		$ent_rel.= "\n";
		$ent_rel.= "\n";
		$ent_rel.= "\n";

		$pdf->MultiCell(109,4,$ent_rel,'BR','L');

		$pdf->SetDrawColor(0);
		$pdf->SetLineWidth(0.2);

		$pdf->Ln(1);
	
		$pdf->SetFont('Arial','B',8);
		$pdf->Cell(30,4,'Site utilisation : ',0,0,'R');
		$pdf->SetFont('Arial','',8);
		$pdf->SetDrawColor(125);
		$pdf->Cell(150,4,str_repeat("_",150),0,1,'L');
		$pdf->SetDrawColor(0);

		switch ($tfr)
		{
		 case 1 :
			//
			// Impression des fiches licences
			//
	
			// Marque
			$pdf->SetFont('Arial','B',8);
			$pdf->Cell(30,4,'Marque : ',0,0,'R');
			$pdf->SetFont('Arial','',8);
			$pdf->Cell(247,4,str_repeat("_",40),0,1,'L');
	
			// Modèle
			$pdf->SetFont('Arial','B',8);
			$pdf->Cell(30,4,'Modèle : ',0,0,'R');
			$pdf->SetFont('Arial','',8);
			$pdf->Cell(247,4,str_repeat("_",40),0,1,'L');
	
			// Version
			$pdf->SetFont('Arial','B',8);
			$pdf->Cell(30,4,'Version : ',0,0,'R');
			$pdf->SetFont('Arial','',8);
			$pdf->Cell(247,4,str_repeat("_",10),0,1,'L');
	
			// Type
			$pdf->SetFont('Arial','B',8);
			$pdf->Cell(30,4,'Type : ',0,0,'R');
			$pdf->SetFont('Arial','',8);
			$pdf->Cell(247,4,str_repeat("_",40),0,1,'L');
	
			// Maximum de postes
			$pdf->SetFont('Arial','B',8);
			$pdf->Cell(30,4,'Maximum de postes : ',0,0,'R');
			$pdf->SetFont('Arial','',8);
			$pdf->Cell(247,4,str_repeat("_",4).' (Utilisé : '.str_repeat("_",4).')',0,1,'L');
	
			$pdf->SetFont('Arial','B',8);
			$pdf->Cell(30,4,'Détail utilisation : ',0,0,'R');
			$pdf->SetFont('Arial','',7);
			$pdf->SetDrawColor(125);
			$pdf->Cell(150,4,str_repeat("_",150),0,1,'L');
			$pdf->SetDrawColor(0);
			$pdf->Cell(30,4,'(Noter les n° de folios produits) : ',0,0,'R');
			$pdf->SetDrawColor(125);
			$pdf->Cell(150,4,str_repeat("_",150),0,1,'L');
	
			for ($i=0; $i <1; $i++)
			{         
				$pdf->Cell(30);
				$pdf->Cell(150,4,str_repeat("_",150),0,1,'L');
			}
			$pdf->SetDrawColor(0);
	
			// Média
			$pdf->SetFont('Arial','B',8);
			$pdf->Cell(30,4,'Média : ',0,0,'R');
			$pdf->SetFont('Arial','',8);
			$pdf->Cell(247,4,str_repeat("_",40),0,1,'L');
	
			// Numéro
			$pdf->SetFont('Arial','B',8);
			$pdf->Cell(30,4,'Numéro : ',0,0,'R');
			$pdf->SetFont('Arial','',8);
			$pdf->Cell(247,4,str_repeat("_",40),0,1,'L');
	
			// Clef
			$pdf->SetFont('Arial','B',8);
			$pdf->Cell(30,4,'Clef d\'activation : ',0,0,'R');
			$pdf->SetFont('Arial','',8);
			$pdf->Cell(247,4,str_repeat("_",40),0,1,'L');
	
			// A jour / Légale ?
			$pdf->SetFont('Arial','B',8);
			$pdf->Cell(30,4,'A jour / Légale : ',0,0,'R');
			$pdf->SetFont('Arial','',8);
			$pdf->Cell(247,4,'___/___',0,1,'L');
	
			// Date Validité
			$pdf->SetFont('Arial','B',8);
			$pdf->Cell(30,4,'Date de validité : ',0,0,'R');
			$pdf->SetFont('Arial','',8);
			$pdf->Cell(247,4,'__/__/____',0,1,'L');
	
			// Notes
			$pdf->SetFont('Arial','B',8);
			$pdf->Cell(30,4,'Notes : ',0,0,'R');
			$pdf->SetFont('Arial','',7);
			$pdf->SetDrawColor(125);
			$pdf->Cell(150,4,str_repeat("_",150),0,1,'L');
			for ($i=0; $i <2; $i++)
			{         
				$pdf->Cell(30);
				$pdf->Cell(150,4,str_repeat("_",150),0,1,'L');
			}
	
			//Problèmes
			$pdf->Ln(2);
			$pdf->SetFont('Arial','IU',10);
			$pdf->Cell(277,5,'PROBLEMES',0,1,'C');
			$pdf->Ln(1);
			$pdf->SetFont('Arial','',7);
			$pdf->SetDrawColor(125);
			for ($i=0; $i <3; $i++)
			{         
				$pdf->Cell(200,4,str_repeat("_",200),0,1,'L');
			}
	
			$pdf->Ln(2);
	
			// Validation
			$pdf->SetFont('Arial','B',8);
			$pdf->Cell(30,4,'Validé par : ',0,0,'R');
			$pdf->SetFont('Arial','',8);
			$pdf->Cell(100,4,str_repeat("_",50),0,0,'L');
			$pdf->Cell(3);
	
			// Signature
			$pdf->SetFont('Arial','B',8);
			$pdf->Cell(30,4,'Signature & Tampon : ',0,0,'R');
			$pdf->SetFont('Arial','',8);
			$pdf->MultiCell(100,4,str_repeat("\n",3),0,'L');

			break;
			
		case 2 :
			//
			// Impression des fiches Matériels 
			//

			// Catégorie
			$pdf->SetFont('Arial','B',8);
			$pdf->Cell(30,4,'Catégorie : ',0,0,'R');
			$pdf->SetFont('Arial','',8);
			$pdf->Cell(247,4,str_repeat("_",40),0,1,'L');
	
			// Marque
			$pdf->SetFont('Arial','B',8);
			$pdf->Cell(30,4,'Marque : ',0,0,'R');
			$pdf->SetFont('Arial','',8);
			$pdf->Cell(247,4,str_repeat("_",40),0,1,'L');
	
			// Modèle & NS
			$pdf->SetFont('Arial','B',8);
			$pdf->Cell(30,4,'Modèle / NS : ',0,0,'R');
			$pdf->SetFont('Arial','',8);
			$pdf->Cell(247,4,str_repeat("_",40).' / '.str_repeat("_",40),0,1,'L');
	
			// Licences
			$pdf->SetFont('Arial','IB',8);
			$pdf->Cell(30,4,'Détail licences : ',0,0,'R');
			$pdf->SetFont('Arial','',7);
			$pdf->Cell(150,4,str_repeat("_",150),0,1,'L');
			$pdf->Cell(30,4,'(Noter les n° de folios licences) : ',0,0,'R');
			$pdf->SetFont('Arial','',7);
			$pdf->Cell(150,4,str_repeat("_",150),0,1,'L');
	
			for ($i=0; $i <1; $i++)
			{         
				$pdf->Cell(30);
				$pdf->Cell(150,4,str_repeat("_",150),0,1,'L');
			}
	
			// Emplacement
			$pdf->SetFont('Arial','B',8);
			$pdf->Cell(30,4,'Emplacement : ',0,0,'R');
			$pdf->SetFont('Arial','',8);
			$pdf->Cell(247,4,str_repeat("_",40),0,1,'L');
	
			// Codage
			$pdf->SetFont('Arial','B',8);
			$pdf->Cell(30,4,'Codage Produit : ',0,0,'R');
			$pdf->SetFont('Arial','',8);
			$pdf->Cell(247,4,str_repeat("_",20),0,1,'L');
	
			// Utilisateur
			$pdf->SetFont('Arial','B',8);
			$pdf->Cell(30,4,'Utilisateur : ',0,0,'R');
			$pdf->SetFont('Arial','',8);
			$pdf->Cell(247,4,str_repeat("_",40),0,1,'L');
	
			// Date Achat
			$pdf->SetFont('Arial','B',8);
			$pdf->Cell(30,4,'Date d\'achat : ',0,0,'R');
			$pdf->SetFont('Arial','',8);
			$pdf->Cell(247,4,'__/__/____',0,1,'L');
	
			// Fin de Garantie
			$pdf->SetFont('Arial','B',8);
			$pdf->Cell(30,4,'Date d\'achat : ',0,0,'R');
			$pdf->SetFont('Arial','',8);
			$pdf->Cell(247,4,'__/__/____',0,1,'L');
	
			// Gtie Sur site / propriétaire
			$pdf->SetFont('Arial','B',8);
			$pdf->Cell(30,4,'G. site / Propriétaire : ',0,0,'R');
			$pdf->SetFont('Arial','',8);
			$pdf->Cell(247,4,'___ / ___',0,1,'L');
	
			// Nom du poste
			$pdf->SetFont('Arial','B',8);
			$pdf->Cell(30,4,'Nom du poste : ',0,0,'R');
			$pdf->SetFont('Arial','',8);
			$pdf->Cell(247,4,str_repeat("_",20),0,1,'L');
	
			// Groupe Travail
			$pdf->SetFont('Arial','B',8);
			$pdf->Cell(30,4,'Groupe de Travail : ',0,0,'R');
			$pdf->SetFont('Arial','',8);
			$pdf->Cell(247,4,str_repeat("_",40),0,1,'L');
	
			// Domaine
			$pdf->SetFont('Arial','B',8);
			$pdf->Cell(30,4,'Domaine : ',0,0,'R');
			$pdf->SetFont('Arial','',8);
			$pdf->Cell(247,4,str_repeat("_",40),0,1,'L');
	
			// Login / MDP
			$pdf->SetFont('Arial','B',8);
			$pdf->Cell(30,4,'Login / MDP : ',0,0,'R');
			$pdf->SetFont('Arial','',8);
			$pdf->Cell(247,4,str_repeat("_",40)." / ".str_repeat("_",40),0,1,'L');
	
			// IP / Masque / Passerelle
			$pdf->SetFont('Arial','B',8);
			$pdf->Cell(30,4,'IP / Masque / Pass. : ',0,0,'R');
			$pdf->SetFont('Arial','',8);
			$pdf->Cell(247,4,str_repeat("_",15)." / ".str_repeat("_",15)." / ".str_repeat("_",15),0,1,'L');
	
			// SID / WEP
			$pdf->SetFont('Arial','B',8);
			$pdf->Cell(30,4,'SID / WEP : ',0,0,'R');
			$pdf->SetFont('Arial','',8);
			$pdf->Cell(247,4,str_repeat("_",50)." / ".str_repeat("_",50),0,1,'L');
	
			// Notes
			$pdf->SetFont('Arial','B',8);
			$pdf->Cell(30,4,'Notes : ',0,0,'R');
			$pdf->SetFont('Arial','',7);
			$pdf->SetDrawColor(125);
			$pdf->Cell(150,4,str_repeat("_",150),0,1,'L');
			for ($i=0; $i <2; $i++)
			{         
				$pdf->Cell(30);
				$pdf->Cell(150,4,str_repeat("_",150),0,1,'L');
			}
	
			$pdf->AddPage();
			
			//Problèmes
			$pdf->Ln(2);
			$pdf->SetFont('Arial','IU',10);
			$pdf->Cell(277,5,'PROBLEMES',0,1,'C');
			$pdf->Ln(1);
			$pdf->SetFont('Arial','',7);
			$pdf->SetDrawColor(125);
			for ($i=0; $i <3; $i++)
			{         
				$pdf->Cell(200,4,str_repeat("_",200),0,1,'L');
			}
	
			$pdf->Ln(2);
	
			// Validation
			$pdf->SetFont('Arial','B',8);
			$pdf->Cell(30,4,'Validé par : ',0,0,'R');
			$pdf->SetFont('Arial','',8);
			$pdf->Cell(100,4,str_repeat("_",50),0,0,'L');
			$pdf->Cell(3);
	
			// Signature
			$pdf->SetFont('Arial','B',8);
			$pdf->Cell(30,4,'Signature & Tampon : ',0,0,'R');
			$pdf->SetFont('Arial','',8);
			$pdf->MultiCell(100,4,str_repeat("\n",4),0,'L');

			break;

		default :
			break;
		}
/*
		//Détermination d'un nom de fichier temporaire dans le répertoire courant
		$file=basename(tempnam(getcwd(),'tmp'));
		rename($file,$file.'.pdf');
		$file.='.pdf';
*/
		// $pdf->Output($file,'D');
		$pdf->Output('releve_vierge','I');
	}
?>