Ver Mensaje Individual
  #1 (permalink)  
Antiguo 16/04/2012, 13:57
naw_030586
 
Fecha de Ingreso: marzo-2012
Mensajes: 12
Antigüedad: 12 años, 11 meses
Puntos: 0
Pregunta imprimir variable en fpdf

hola, espero me puedan ayudar, quisiera saber como puedo imprimir la variable: fecDesde, fecHasta, y espAca.
Código PHP:
Ver original
  1. <?php
  2.     require('inc/fpdf.php');
  3.     include("inc/conexion.php");
  4.     /**
  5.      *
  6.      */
  7.    
  8.     class PDF extends FPDF {
  9.        
  10.         var $tpoReporte;
  11.         var $fecDesde;
  12.         var $fecHasta;
  13.         var $tpoDep;
  14.         var $espAca;
  15.         var $cveEspUni;
  16.    
  17.         var $query;
  18.         var $result;
  19.        
  20.         var $link;
  21.        
  22.         // Cabecera de página
  23.         function Header()
  24.         {
  25.             // Logo
  26.             $this->Image('img/escudo.jpg',11,20,25);
  27.             $this->Image('img/logo_didepa.jpg',160,18,30);
  28.            
  29.             //titulo fecha actual
  30.             global $titFecAct;
  31.             $this->SetFont('Arial','',7); // Arial bold 15
  32.             $this->Cell(1); // Movernos a la derecha
  33.             $this->Cell(10,0,$titFecAct);
  34.             $this->Ln(0);   // Salto de línea
  35.        
  36.             //titulo Control Escolar
  37.             global $titCont;
  38.             $this->SetFont('Arial','',7);
  39.             $this->Cell(60);
  40.             $this->Cell(10,0,$titCont);
  41.             $this->Ln(12);         
  42.            
  43.             //titulo UAEM
  44.             global $titUaem;
  45.             $this->SetFont('Arial','B',10); // Arial bold 15
  46.             $this->Cell(28); // Movernos a la derecha
  47.             $this->Cell(76,5,$titUaem,'B',0);
  48.             $this->Ln(5);           // Salto de línea
  49.            
  50.             //UAEM
  51.             global $uaem;
  52.             $this->SetFont('Arial','B',10); // Arial bold 15
  53.             $this->Cell(28); // Movernos a la derecha
  54.             $this->Cell(10,5,$uaem);
  55.             $this->Ln(0);
  56.            
  57.             //titulo Secretaria
  58.             global $titSec;
  59.             $this->SetFont('Arial','B',7); // Arial bold 15
  60.             $this->Cell(76); // Movernos a la derecha
  61.             $this->Cell(10,5,$titSec);
  62.             $this->Ln(12);
  63.            
  64.             //tit Direccion
  65.             global $titDir;
  66.             $this->SetFont('Arial','B',11);
  67.             $this->Cell(28);
  68.             $this->Cell(10,5,$titDir);
  69.             $this->Ln(6);
  70.            
  71.             //tit Sistema
  72.             global $titSis;
  73.             $this->SetFont('Arial','',9);
  74.             $this->Cell(28);
  75.             $this->Cell(10,5,$titSis);
  76.             $this->Ln(6);
  77.            
  78.             //titulo reporte
  79.             global $titRep;
  80.             $this->SetFont('Arial','',9);
  81.             $this->Cell(28);
  82.             $this->Cell(0,5,$titRep);
  83.             $this->Ln(6);
  84.            
  85. /*          //fechadesde
  86.             global $titFecDes;
  87.             $this->SetFont('Arial','',8);
  88.             $this->Cell(60);
  89.             $this->Cell(40,5,$titFecDes);
  90.             $this->Ln(0);
  91.            
  92.             //fechahasta
  93.             global $titFecHas;
  94.             $this->SetFont('Arial','',8);
  95.             $this->Cell(90);
  96.             $this->Cell(40,5,$titFecHas);
  97.             $this->Ln(0);
  98.            
  99.             //Espacio
  100.             global $spacio;
  101.             $this->SetFont('Arial','B',8);
  102.             $this->Cell(60);
  103.             $this->Cell(40,20,$spacio);*/
  104.            
  105.             $this->Ln(18); // Salto de línea
  106.         }
  107.        
  108.         // Pie de página
  109.         function Footer()
  110.         {
  111.             $this->SetY(-15); // Posición: a 1,5 cm del final
  112.             $this->SetFont('Arial','I',8); // Arial italic 8
  113.             $this->SetTextColor(128); // Color del texto en gris
  114.             // Número de página
  115.             $this->Cell(0,10,utf8_decode('Página:  ').$this->PageNo().'/{nb}',0,0,'R');
  116.         }
  117.  
  118.  
  119.         function BasicTable($encabezado){
  120.             $link = Conectarse();
  121.             //Anchuras de las columnas
  122.             $w = array(150,25);
  123.             for($i = 0; $i < count($encabezado); $i++){            
  124.                 $this->Cell($w[$i],5,$encabezado[$i],1,0,'C');             
  125.             }
  126.             $this->Ln();
  127.            
  128.             $tpoReporte = (isset($_GET['tpoReporte'])) ? $_GET['tpoReporte'] : "";
  129.             $fecDesde = (isset($_GET['fecDesde'])) ? $_GET['fecDesde'] : "";
  130.             $fecHasta = (isset($_GET['fecHasta'])) ? $_GET['fecHasta'] : "";
  131.             $tpoDep = (isset($_GET['tpoDep'])) ? $_GET['tpoDep'] : "";
  132.             $espAca = (isset($_GET['espAca'])) ? $_GET['espAca'] : "";
  133.             $cveEspUni = (isset($_GET['cveEspUni'])) ? $_GET['cveEspUni'] : "";
  134.            
  135.             //fILTROS
  136.             $filEspAca = (!empty($espAca)) ? " AND UCASE(TRIM(B.AdsNiv))='$espAca'" : "";
  137.             $filEspUni = (!empty($cveEspUni)) ? " AND B.AdsClv=$cveEspUni" : "";
  138.             $filFecVig = (!empty($fecDesde) && !empty($fecHasta)) ? " AND C.CrsIni>='$fecDesde' AND C.CrsFin<='$fecHasta'" : "";
  139.            
  140.             $query = "SELECT C.CrsIni,C.CrsFin,B.AdsClv,B.AdsNiv,B.AdsNom espacio,count(D.ClvAsi) totalAsi
  141.             FROM tblasi A
  142.             INNER JOIN tblads B ON (A.AsiAds=B.AdsClv)
  143.             INNER JOIN detcrs D ON (A.AsiClv=D.ClvAsi)
  144.             INNER JOIN tblcrs C ON (C.CrsClv=D.ClvCrs)
  145.             WHERE 1=1
  146.             AND (UCASE(TRIM(C.CrsTip))='DES. HUM.'
  147.             OR UCASE(TRIM(C.CrsTip))='DIDACTICOS'
  148.             OR UCASE(TRIM(C.CrsTip))='DISCIPLINARIOS'
  149.             OR UCASE(TRIM(C.CrsTip))='EBC'
  150.             OR UCASE(TRIM(C.CrsTip))='ENSEÑANZA APRENDIZAJE'
  151.             OR UCASE(TRIM(C.CrsTip))='TRANSVERSALIDAD'
  152.             OR UCASE(TRIM(C.CrsTip))='PROINSTA')
  153.             $filFecVig
  154.             $filEspAca
  155.             $filEspUni         
  156.             GROUP BY espacio";
  157.            
  158.             $result = mysql_query($query,$link) or die ("Error reporte 1: " . mysql_error());
  159.             $total = 0;
  160.             while($fila = mysql_fetch_array($result,MYSQL_BOTH)){
  161.                 $this->Cell($w[0],4,utf8_decode($fila['espacio']),'LR');
  162.                 $this->Cell($w[1],4,number_format($fila['totalAsi']),'LR');
  163.                 $this->Ln();               
  164.                 $total = $total + $fila['totalAsi'];
  165.             }
  166.             $this->Cell($w[0],4,'TOTAL','LR');
  167.             $this->Cell($w[1],4,number_format($total),'LR');
  168.             $this->Ln();
  169.             $this->Cell(array_sum($w),0,'','T');
  170.         }
  171.            
  172.     }
  173.    
  174.     $pdf = new PDF('P','mm','A4');
  175.     $titFecAct = date('d/m/y');
  176.     $titCont = 'SISTEMA INTEGRAL DE CONTROL ESCOLAR';
  177.     $titUaem = utf8_decode('Universidad Autónoma del Estado de México');
  178.     $uaem = 'UAEM';
  179.     $titSec = utf8_decode('Secretaría de Docencia');
  180.     $titDir = utf8_decode('Dirección de Desarrollo de Personal Académico');
  181.     $titSis = utf8_decode('Sistema De Información y Control Estadístico de Formación Docente');
  182.     $titRep = utf8_decode('Asistentes Totales en Cursos de Formación, Profesionalización y Capacitación');
  183.     /*$titFecDes = 'DEL  ".[$fecDesde]" ';
  184.     $titFecHas = 'AL'.$fecHasta;
  185.     $spacio = utf8_decode('ESPACIO');*/
  186.    
  187.     $pdf->AliasNbPages();
  188.     $encabezado = array('ESPACIO UNIVERSITARIO', 'TOTAL');
  189.     $pdf->SetFont('Arial','',7); //escoger fuente
  190.     $pdf->AddPage(); //añadir pagina
  191.     $pdf->BasicTable($encabezado);
  192.     $pdf->Output(); //documento se cierra y se envía al navegador
  193. ?>

Quedo en espera de sus comentarios, gracias