<?php

include('pdf/fpdf.php');
session_cache_limiter('private');
session_start();
include("DMMYSQLG.php");
class PDF extends FPDF{
//Cabecera de página
	function Header(){
	    //Logo
	         include("DYIM_VER.php");
	    //Arial bold 14
		$this->SetFont('Arial','B',14);
		//Título
		$this->Cell(225,5,'CATALOGO: REGISTRO DE RESERVACIONES',0,1,'C',0);
		//Salto de línea
		$this->Ln(8);
		$this->SetFont('Arial','B',6);//establece tamaño de letra
		$this->SetFillColor(192,192,192);
		$this->Cell(30,5,'',0,0,'C',0);
		$this->Cell(30,5,'CLAVE',1,0,'C',1);
		$this->Cell(45,5,'HABITACION',1,0,'C',1);
		$this->Cell(40,5,'STATUS',1,0,'C',1);
		$this->cell(30,5,'CLIENTE',1,0,'C',1);
		//$this->cell(35,5,'GUIA',1,0,'C',1);
		$this->cell(25,5,'FECHA DE ENTRADA',1,0,'C',1);
		$this->cell(25,5,'FECHA DE SALIDA',1,1,'C',1);
	
	}	
	//Pie de página
	function Footer()
	{
	//Posición: a 1,5 cm del final
	$this->SetY(-15);
	//Arial italic 8
	$this->SetFont('Arial','I',8);
	//Número de página
	$this->Cell(0,10, $this->PageNo(),0,0,'C');
	}
}

$pdf=new PDF('L','mm','Letter');
$pdf->AddPage();

$pdf->SetFillColor(192,192,192);
$pdf->SetFont('Arial','',6);//establece tamaño de letra

$tbus=mysqli_real_escape_string($GLOBALS['con'],$_POST['tbus']);
if($_POST['bot']==""){
 if($_POST['r1']=="clave")
	{
		//echo '<input name="tip_bus" type="hidden" value="clave">';
	  	@$sql = mysqli_query($GLOBALS['con'] ,"SELECT * FROM valeryus19 WHERE status = '".$_POST['select1']."'");
		
	}elseif($_POST['r1']=="nombre")
	{
		
		@$sql = mysqli_query($GLOBALS['con'] ,"SELECT * FROM valeryus19 WHERE fnombre like '%".$_POST['tbus']."%'");
	}
    //$sql =  mysqli_query($GLOBALS['con'] ,"SELECT * FROM valeryus19 order by fnumres");
	//$sql = mysqli_query($GLOBALS['con'] ,$_POST['tbus']);
}else
	@$sql = mysqli_query($GLOBALS['con'] ,"select * from valeryus19 where n_reg = '".$_POST['bot']."'") ;
	
while($row = mysqli_fetch_array($sql)){
    $pdf-> Cell(30,5,'',0,0,'C',0);
	$pdf-> Cell(30,5, $row["fnumres"],1,0,'C',0);
	$pdf-> Cell(45,5, $row["fnumcto"],1,0,'C',0);
	$pdf-> Cell(40,5, $row["status"],1,0,'C',0);
	$pdf-> Cell(30,5, $row["fnombre"],1,0,'C',0);
	//$pdf-> Cell(35,5, $row["gguia"],1,0,'C',0);
	$pdf-> Cell(25,5, $row["ffecllegada"],1,0,'C',0);
	$pdf-> Cell(25,5, $row["ffecsalida"],1,1,'C',0);
	
}
$pdf->Output("REGISTRO DE RESERVACIONES.pdf","D");
?> 