<?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);
	    //Espacio
		
	    //Título
	    $this->Cell(190,1,'REPORTE DE MODULO DE PARAMETROS',0,1,'C');
	    //Salto de línea
	    $this->Ln(1);
		$this->SetFont('Times','',8);//establece tamaño de letra
		$this->SetFillColor(192,192, 192);
		$this->Cell(5,5,'',0,'C',1);//centra
		$this->Cell(20,5,'Clave',1,'','C',1);
		$this->Cell(20,5,'Compras',1,'','C',1);
		$this->Cell(20,5,'Dev. Compras',1,'','C',1);
		$this->Cell(20,5,'Ventas',1,'','C',1);
		$this->Cell(20,5,'Dev. Ventas',1,'','C',1);
		$this->Cell(20,5,'Cargo',1,'','C',1);
		$this->Cell(20,5,'Dev. Cargo',1,'','C',1);
		$this->Cell(20,5,'Caja',1,'','C',1);
		$this->Cell(20,5,'Costo/Vtas',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');
	}
}

if($_POST['bot']==""){
	if($_POST['tip_bus']=="clave"){
		$sql1 ="SELECT * FROM dgparame WHERE key_par = '".$_POST['txt_bus']."' order by key_par";
	}elseif($_POST['tip_bus']=="nombre"){
		$sql1 ="SELECT * FROM dgparame WHERE tip_pol_com LIKE '%".$_POST['txt_bus']."%' order by key_par";
	}else{
		$sql1 = "SELECT * FROM dgparame order by key_par";
	}
}else{
	$sql1 = "SELECT * FROM dgparame WHERE key_par = '".$_POST['bot']."' order by key_par";
}
$sql = mysqli_query ($sql1); 
while ($reg = mysqli_fetch_row($sql)) { 
    $data[] = $reg[0]; 
	$data1[] = $reg[1]; 
	$data2[] = $reg[2]; 
	$data3[] = $reg[3];
	$data4[] = $reg[4];
	$data5[] = $reg[5]; 
	$data6[] = $reg[6]; 
	$data7[] = $reg[7];
	$data8[] = $reg[8];
	$data9[] = $reg[9]; 
	$data10[] = $reg[10]; 
	$data11[] = $reg[11]; 
	$data12[] = $reg[12];
	$data13[] = $reg[13];
	$data14[] = $reg[14]; 
	$data15[] = $reg[15]; 
	$data16[] = $reg[16];
	$data17[] = $reg[17];
	$data18[] = $reg[18];
	$data19[] = $reg[19]; 
	$data20[] = $reg[20]; 
	$data21[] = $reg[21];
	$data22[] = $reg[22];
	}
$num_elementos=count($data);
$pdf=new PDF();
$pdf->AddPage();
//Titolo de la tabla
$pdf->SetFont('Times','',8);//establece tamaño de letra

$pdf->SetFont('Times','',12);
for($i=0;$i<=$num_elementos-1;$i++)
{
	//$pdf->SetFillColor(49,120, 200);
	$pdf->SetFont('Times','',8);//establece tamaño de letra
	$pdf->Cell(5,5,'',0,'C');//centra
	$pdf->Cell(20,5, $data[$i],1,'','C');
	$pdf->Cell(20,5, $data1[$i],1,'','C');
	$pdf->Cell(20,5, $data2[$i],1,'','C');
	$pdf->Cell(20,5, $data3[$i],1,'','C');
	$pdf->Cell(20,5, $data4[$i],1,'','C');
	$pdf->Cell(20,5, $data5[$i],1,'','C');
	$pdf->Cell(20,5, $data6[$i],1,'','C');
	$pdf->Cell(20,5, $data7[$i],1,'','C');
	$pdf->Cell(20,5, $data8[$i],1,1,'C');
} 
$pdf->Output("Parametros_Modulo.pdf","D");
?> 
