<?php
//Incluir Archivos Necesarios
require('../../../pdf/fpdf.php');
date_default_timezone_set('America/Caracas'); 
$hora_local = date('H:i:s');
class PDF extends FPDF
{ }
//Incluir Archivos Necesarios
require('../../../Clases/db.php');
   
$mostrar = new conn ();
$conex = $mostrar->crearconn();
    $pdf = new PDF();
$pdf->SetX(4);

$pdf->SetMargins(17,17,17);
  $pdf->AddPage();
$pdf->Image('../../../Imagenes/logo.png',165,12,35,35,'PNG');
  $pdf->SetFont('Arial','B',16);
  $pdf->SetTextColor(32,100,210);
  $pdf->Cell(150,10,iconv("UTF-8", "ISO-8859-1",strtoupper("Emperadora Internet y Mas")),0,0,'L');

  $pdf->Ln(9);

  $pdf->SetFont('Arial','',10);
  $pdf->SetTextColor(39,39,51);
  $pdf->Cell(150,9,iconv("UTF-8", "ISO-8859-1","RIF: J-29966140-6"),0,0,'L');

  $pdf->Ln(5);

  $pdf->Cell(150,9,iconv("UTF-8", "ISO-8859-1","Valencia Barrio Monumental III Av principal"),0,0,'L');

  $pdf->Ln(5);

  $pdf->Cell(150,9,iconv("UTF-8", "ISO-8859-1","Teléfono: 0241-8480889"),0,0,'L');

  $pdf->Ln(5);

  $pdf->Cell(150,9,iconv("UTF-8", "ISO-8859-1","Email: laemperadorainternetymas@gmail.com"),0,0,'L');

  $pdf->Ln(10);

  $pdf->SetFont('Arial','',10);
  $pdf->Cell(30,7,iconv("UTF-8", "ISO-8859-1","Fecha de emisión:"),0,0);
  $pdf->SetTextColor(97,97,97);
  $pdf->Cell(116,7,iconv ("UTF-8", "ISO-8859-1",date("d/m/Y", strtotime($hora_local))." ".date($hora_local)),0,0,'L');
  $pdf->SetFont('Arial','B',10);
  $pdf->SetTextColor(39,39,51);
  $pdf->Cell(26,7,iconv("UTF-8", "ISO-8859-1",strtoupper("Reporte Total de los Clientes")),0,0,'C');

  

  $pdf->Ln(9);
  # Tabla de productos #
  $pdf->SetFont('Arial','',8);
  $pdf->SetFillColor(23,83,201);
  $pdf->SetDrawColor(23,83,201);
  $pdf->SetTextColor(255,255,255);
   $pdf->Cell(18,8,iconv("UTF-8", "ISO-8859-1","Cedula"),1,0,'C',true);
    $pdf->Cell(25,8,iconv("UTF-8", "ISO-8859-1","Nombre"),1,0,'C',true);
    $pdf->Cell(25,8,iconv("UTF-8", "ISO-8859-1","Apellido"),1,0,'C',true);
      $pdf->Cell(30,8,iconv("UTF-8", "ISO-8859-1","Direccion"),1,0,'C',true);
  $pdf->Cell(20,8,iconv("UTF-8", "ISO-8859-1","Telefono"),1,0,'C',true);
  $pdf->Cell(35,8,iconv("UTF-8", "ISO-8859-1","Correo"),1,0,'C',true);
    $pdf->Cell(35,8,iconv("UTF-8", "ISO-8859-1","Fecha"),1,0,'C',true);

  $pdf->Ln(8);

  
  $pdf->SetTextColor(39,39,51);
     /*----------  Detalles de la tabla  ----------*/
     $sql2 = "SELECT cl.ID,cl.Fecha, d.Nombre as Nombre_cliente, d.Cedula as Cedula_cliente, d.Apellido as Apellido_cliente, d.Direccion as direccion, d.Telefono as telefono, d.Correo as correo  FROM cliente cl
INNER JOIN datos_personales d on cl.CI_Datos = d.Cedula where Estado = 1 ";
$resultado = $conex->query($sql2);
$totalp= 0;
while($rows = $resultado->fetch_assoc()){


    $pdf->Cell(18,7,iconv("UTF-8", "ISO-8859-1",$rows['Cedula_cliente']),'LR',0,'C');
    $pdf->Cell(25,7,iconv("UTF-8", "ISO-8859-1",$rows['Nombre_cliente']),'L',0,'C');
     $pdf->Cell(25,7,iconv("UTF-8", "ISO-8859-1",$rows['Apellido_cliente']),'L',0,'C');
  $pdf->Cell(30,7,iconv("UTF-8", "ISO-8859-1",$rows['direccion']),'L',0,'C');
  $pdf->Cell(20,7,iconv("UTF-8", "ISO-8859-1",$rows['telefono']),'L',0,'C');
  $pdf->Cell(35,7,iconv("UTF-8", "ISO-8859-1",$rows['correo']),'LR',0,'C');
    $pdf->Cell(35,7,iconv("UTF-8", "ISO-8859-1",$rows['Fecha']),'LR',0,'C');

  $pdf->Ln(7);
  /*----------  Fin Detalles de la tabla  ----------*/

}


$pdf->SetFont('Arial','B',9);
$pdf->Cell(100,7,iconv("UTF-8", "ISO-8859-1",''),'T',0,'C');
  $pdf->Cell(15,7,iconv("UTF-8", "ISO-8859-1",''),'T',0,'C');
  $pdf->Cell(32,7,iconv("UTF-8", "ISO-8859-1",""),'T',0,'C');
 $pdf->Cell(41,7,iconv("UTF-8", "ISO-8859-1",""),'T',0,'C');

  $pdf->Ln(7);
$pdf->Output("I",true);