Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/11/2013, 12:37
MulSist
 
Fecha de Ingreso: noviembre-2013
Mensajes: 13
Antigüedad: 10 años, 5 meses
Puntos: 0
Pregunta Mostrar datos php en fpdf

Estoy tratando de mostrar datos específicos de una base de datos en un pdf, usando fpdf.
esta es mi consulta

Código PHP:
Ver original
  1. $domingos_mostrar_domingos = "0";
  2. if (isset($_GET["domingo"])) {
  3.   $domingos_mostrar_domingos = $_GET["domingo"];
  4. }
  5. mysql_select_db($database_conexion, $conexion);
  6. $query_mostrar_domingos = sprintf("SELECT * FROM minuta WHERE minuta.fecha = %s  AND minuta.nombre='NUMERO 1'", GetSQLValueString($domingos_mostrar_domingos, "int"));
  7. $mostrar_domingos = mysql_query($query_mostrar_domingos, $conexion) or die(mysql_error());
  8. $row_mostrar_domingos = mysql_fetch_assoc($mostrar_domingos);
  9. $totalRows_mostrar_domingos = mysql_num_rows($mostrar_domingos);


Lo que estoy haciendo es pasar una variable de una pagina anterior por metodo GET es esta:

Código HTML:
Ver original
  1. <div id="div_p_botones1">
  2. <a href="generar_PDF.php?domingo=<?php echo $_GET["domingo"];?>"><span class="button_1" style="cursor:pointer;"><img src="../images/Iconos/grafico_menu.png" alt="" width="30" height="26" align="absmiddle" />   Generar PDF</span></a>
  3. </div>

Formato en que mando la fecha es aaaa-mm-dd

Pero solo me muestra la tabla vacía, no muestra nada al poner en

Código PHP:
Ver original
  1. $this->Cell(45,6,"Adultos",'LR',0,'L',$fill);
  2.     $this->Cell(45,6,''.$row_mostrar_domingos['num_1'],'LR',0,'C',$fill);
  3.     $this->Cell(45,6,"Adultos",'LR',0,'L',$fill);
  4.     $this->Cell(45,6,"",'LR',0,'C',$fill);
  5.     $this->Ln();
  6.           $fill=!$fill;
  7.     $this->Cell(45,6,"Niños",'LR',0,'L',$fill);
  8.     $this->Cell(45,6,''.$row_mostrar_domingos['num_2'],'LR',0,'C',$fill);
  9.     $this->Cell(45,6,"Niños",'LR',0,'L',$fill);
  10.     $this->Cell(45,6,"",'LR',0,'C',$fill);
  11.     $fill=true;
  12.     $this->Ln();
  13.           $fill=!$fill;
  14.     $this->Cell(45,6,"Visitas",'LR',0,'L',$fill);
  15.     $this->Cell(45,6,"".$row_mostrar_domingos['num_3'],'LR',0,'C',$fill);
  16.     $this->Cell(45,6,"Visitas",'LR',0,'L',$fill);
  17.     $this->Cell(45,6,"",'LR',0,'C',$fill);
  18.     $fill=false;
  19.     $this->Ln();
  20.           $fill=!$fill;
  21.     $this->Cell(45,6,"Total",'LR',0,'L',$fill);
  22.     $this->Cell(45,6,"".$row_mostrar_domingos['total'],'LR',0,'C',$fill);
  23.     $this->Cell(45,6,"Total",'LR',0,'L',$fill);
  24.     $this->Cell(45,6,"",'LR',0,'C',$fill);

El resto del Codigo es este

Código PHP:
Ver original
  1. <?php
  2. require ('../Scripts/fpdf/fpdf.php');
  3. require_once('../Connections/conexion.php');
  4.  
  5.  
  6.  
  7. class PDF extends FPDF{
  8. public function Header(){
  9.         $this->Image('../images/banner.JPG');
  10.         $this-> SetFont ('Arial','B',18);
  11.         $this->Ln(5);
  12.         $this->SetTextColor(0,0,139);
  13.         $this->Cell(190,10,'Día '.$_GET["domingo"],0,0,'C');
  14.         /*$this-> Cell(190,10,'Multiforma',0,0,'C');*/
  15.         $this-> Ln(10);
  16.         }
  17.  
  18.     //Tabla coloreada
  19. function TablaColores($header)
  20. {
  21.     $row_mostrar_domingos =isset($_REQUEST['row_mostrar_domingos']);
  22. //Colores, ancho de línea y fuente en negrita
  23.     $this->SetFillColor(25,25,112);
  24.     $this->SetTextColor(255);
  25.     $this->SetDrawColor(0,0,0);
  26.     $this->SetLineWidth(.3);
  27.     $this->SetFont('Arial','B',14);
  28. //Cabecera
  29.  
  30.  
  31.     for($i=0;$i<count($header);$i++)
  32.     $this->Cell(45,7,$header[$i],1,0,'C',1);
  33.     $this->Ln();
  34.     //Restauración de colores y fuentes
  35.     $this->SetFillColor(224,235,255);
  36.     $this->SetTextColor(0,0,0);
  37.     $this->SetFont('Courier','',12);
  38.     //Datos
  39.        $fill=false;
  40.     $this->Cell(45,6,"Adultos",'LR',0,'L',$fill);
  41.     $this->Cell(45,6,''.$row_mostrar_domingos['num_1'],'LR',0,'C',$fill);
  42.     $this->Cell(45,6,"Adultos",'LR',0,'L',$fill);
  43.     $this->Cell(45,6,"",'LR',0,'C',$fill);
  44.     $this->Ln();
  45.           $fill=!$fill;
  46.     $this->Cell(45,6,"Niños",'LR',0,'L',$fill);
  47.     $this->Cell(45,6,''.$row_mostrar_domingos['num_2'],'LR',0,'C',$fill);
  48.     $this->Cell(45,6,"Niños",'LR',0,'L',$fill);
  49.     $this->Cell(45,6,"",'LR',0,'C',$fill);
  50.     $fill=true;
  51.     $this->Ln();
  52.           $fill=!$fill;
  53.     $this->Cell(45,6,"Visitas",'LR',0,'L',$fill);
  54.     $this->Cell(45,6,"".$row_mostrar_domingos['num_3'],'LR',0,'C',$fill);
  55.     $this->Cell(45,6,"Visitas",'LR',0,'L',$fill);
  56.     $this->Cell(45,6,"",'LR',0,'C',$fill);
  57.     $fill=false;
  58.     $this->Ln();
  59.           $fill=!$fill;
  60.     $this->Cell(45,6,"Total",'LR',0,'L',$fill);
  61.     $this->Cell(45,6,"".$row_mostrar_domingos['total'],'LR',0,'C',$fill);
  62.     $this->Cell(45,6,"Total",'LR',0,'L',$fill);
  63.     $this->Cell(45,6,"",'LR',0,'C',$fill);
  64.     $fill=true;
  65.        $this->Ln();
  66.        $this->Cell(180,0,'','T');
  67. }
  68.  
  69. }
  70.  
  71. $pdf = new PDF ();
  72. $pdf-> AddPage();
  73.  
  74.  
  75.  
  76. //Títulos de las columnas
  77. $pdf->SetFont('Arial','B',18);
  78. $pdf->SetTextColor(255,255,0);
  79.  
  80. $header=array('NUMERO 1','Número','NUMERO 2','Número');
  81.  
  82.  
  83. $pdf->AliasNbPages();
  84. //Primera página
  85.  
  86. $pdf->SetY(50);
  87. //$pdf->AddPage();
  88. $pdf->TablaColores($header);
  89. $pdf->Ln(10);
  90.  
  91. $pdf->Output();
  92.  
  93. mysql_free_result($mostrar_domingos);
  94. ?>

Espero de su gran ayuda, por favor.