<?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 ',0,1,'C');
	    //Salto de línea
	    $this->Ln(3);
		//$this->Cell(10,5,'',0,'C');//centra
		$this->SetFont('Times','',7);//establece tamaño de letra
		$this->SetFillColor(192,192, 192);
		$this->Cell(40,5,'',0,'','C',0);
		$this->Cell(20,5,'Codigo Producto:',1,'','C',1);
		$this->Cell(75,5,'Descripcion:',1,'','C',1);
		$this->Cell(35,5,'Cantidad Disponible:',1,'','C',1);
		$this->Cell(30,5,'Tipo de moneda:',1,'','C',1);
		$this->Cell(15,5,'Precio',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['t1']=="clave") $sql ="SELECT * FROM dginvent WHERE dginvent.modulo='".$_SESSION['mod_sis']."' AND   nparte1 = '".$_POST['b1']."' order by nparte1 ";
elseif($_POST['t1']=="nombre") $sql="SELECT * FROM dginvent WHERE dginvent.modulo='".$_SESSION['mod_sis']."' AND   np_desc1 like '%".$_POST['b1']."%' order by nparte1";
else $sql = "SELECT * FROM dginvent 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',0);
	$pdf->Cell(20,5, $data['nparte1'],0,'','C');
	$pdf->Cell(75,5, $data['np_desc1'],0,'','C');
	$pdf->Cell(35,5, $data['exi_dis'],0,'','C');
	$pdf->Cell(30,5, $data['tip_mon'],0,'','C');
	$pdf->Cell(15,5, $data['lim_vta1'],0,'1','C');
} 
$pdf->Output("Inventario_Principal.pdf","D");
?> 
