<?php

include('pdf/fpdf.php');
session_cache_limiter('private');
session_start();
$com = "I";
include("DMMYSQLG.php");
include("DSA3000.php");
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',10);
	
	    //Título
			$this->Cell(230,3,'REPORTE----> MESAS',0,1,'C');
	    //Salto de línea
	    $this->Ln(3);
		//$this->Cell(10,5,'',0,'C');//centra
		$this->SetFont('Arial','',7);//establece tamaño de letra
		$this->SetFillColor(192,192, 192);
		$this->Cell(40,5,'',0,0,'C',0);
		$this->Cell(30,5,'CODIGO:',1,'','C',1);
		$this->Cell(45,5,'DESCRIPCION:',1,'','C',1);
		$this->Cell(55,5,'PUNTO VTA.:',1,'','C',1);
		$this->Cell(65,5,'AREA:',1,'1','C',1);		
		//$this->Cell(40,5,'Linea',1,'0','L',1);
		//$this->Cell(40,5,'Grupo',1,'0','L',1);
		//$this->Cell(20,5,'Exis Dis:',1,'0','C',1);
		//$this->Cell(20,5,'Exis Min:',1,'0','C',1);
		//$this->Cell(20,5,'Exis Max:',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().'/{nb}',0,0,'C');
	}
}
if($_POST['bot']) $sql ="SELECT * FROM ctmesas WHERE    nparte1 = '".$_POST['bot']."' order by nparte1 ";
//elseif($_POST['t1']=="nombre") $sql="SELECT * FROM ctmesas WHERE modulo='".$_SESSION['mod_sis']."' AND   np_desc1 like '%".$_POST['b1']."%' order by nparte1";
else $sql = "SELECT * FROM ctmesas order by nparte1 ";
$result = mysqli_query ($sql) or die (mysqli_error($GLOBALS['con'])); 
$num_elementos=count($data);
$pdf=new PDF('L','mm','A4');
$pdf->AddPage();
while ($data = mysqli_fetch_array($result)) { 
   
	$pdf->Cell(40,5,'',0,'','C');
	$pdf->Cell(30,5, $data['nparte1'],0,'','C');
	$pdf->Cell(40,5, $data['np_desc1'],0,'','L');
	$pv=mysqli_fetch_array(mysqli_query($GLOBALS['con'] ,"select * from ptventa where nparte1='".$data['descripcion']."'"));
	$pdf->Cell(55,5, $pv['np_desc1'],0,'','L');	
	$ar=mysqli_fetch_array(mysqli_query($GLOBALS['con'] ,"select * from ctarea where nparte1='".$data['area']."'"));	
	$pdf->Cell(65,5, $ar['np_desc1'],0,'1','L');	
	//@$sq_linea = mysqli_query($GLOBALS['con'] ,"SELECT * FROM dglineas WHERE linea = '".$data['linea']."'");
	//$row = mysqli_fetch_array($sq_linea);
	//$pdf->Cell(40,5, $row['des_linea'],0,'','L')
	//@$sq_basico = mysqli_query($GLOBALS['con'] ,"SELECT * FROM dgbasico WHERE gpo_basico = '".$data['gpo_basico']."'");
	//$rew = mysqli_fetch_array($sq_basico);
	//$pdf->Cell(40,5, $rew['des_basico'],0,'','L');
	//$pdf->Cell(20,5, $data['exi_dis'],0,'0','C');
    //$pdf->Cell(20,5, $data['exi_min'],0,'0','C');
	//$pdf->Cell(20,5, $data['exi_max'],0,'1','C');

	
	
} 
$pdf->Output("CATALOGO DE MESAS.pdf","D");
?> 
