<?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',16);
		//Título
		$this->Cell(225,5,'CATALOGO: SEGMENTOS',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(-5,5,'',0,0,'C',0);
		$this->Cell(10,5,'CLAVE',1,0,'C',1);
		$this->Cell(35,5,'gdescrip',1,0,'C',1);
		$this->cell(35,5,'TIPO DE MERCADO',1,0,'C',1);
		$this->cell(20,5,'PERSONAS X DIA',1,0,'C',1);
		$this->cell(20,5,'PERSONAS X MES',1,0,'C',1);
		$this->cell(20,5,'PERSONAS X AÑO',1,0,'C',1);
		$this->cell(20,5,'CUARTOS X DIA',1,0,'C',1);
		$this->cell(20,5,'CUARTOS X MES',1,0,'C',1);
		$this->cell(20,5,'CUARTOS X AÑO',1,0,'C',1);
		$this->cell(20,5,'INGRESOS X DIA',1,0,'C',1);
		$this->cell(20,5,'INGRESOS X MES',1,0,'C',1);
		$this->cell(20,5,'INGRESOS X AÑO',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']=="")
    $sql =  mysqli_query($GLOBALS['con'] ,"SELECT * FROM cotimp order by clavesg");
	//$sql = mysqli_query($GLOBALS['con'] ,$_POST['tbus']);
else
	@$sql = mysqli_query($GLOBALS['con'] ,"select * from cotimp where nparte1 = '".$_POST['bot']."'") ;
	
while($row = mysqli_fetch_array($sql)){
    $pdf-> Cell(-5,5,'',0,0,'C',0);
	$pdf-> Cell(10,5, $row["nparte1"],1,0,'C',0);
	$pdf-> Cell(35,5, $row["gdescrip"],1,0,'C',0);
	$pdf-> Cell(35,5, $row["stipodaily"],1,0,'C',0);
	$pdf-> Cell(20,5, $row["paxdia"],1,0,'C',0);
	$pdf-> Cell(20,5, $row["paxmes"],1,0,'C',0);
	$pdf-> Cell(20,5, $row["paxano"],1,0,'C',0);
	$pdf-> Cell(20,5, $row["ctosdia"],1,0,'C',0);
	$pdf-> Cell(20,5, $row["ctosmes"],1,0,'C',0);
	$pdf-> Cell(20,5, $row["ctosano"],1,0,'C',0);
	$pdf-> Cell(20,5, $row["ingdia"],1,0,'C',0);
	$pdf-> Cell(20,5, $row["ingmes"],1,0,'C',0);
	$pdf-> Cell(20,5, $row["ingano"],1,1,'C',0);
	
}
$pdf->Output("Catalogo De Segmentos.pdf","D");
?> 