<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace CmBundle\Controller;

use FPDF;

date_default_timezone_set('America/Mexico_City');

/**
 * Description of PHP
 *
 * @author grupo2m
 */
class PDF extends FPDF
{

    public $titulo;
    public $posicion;
    private $ingresosMatricualcion = 0;
    private $ingresosTitutlacion = 0;

    function setPosicion($posicion)
    {
        $this->posicion = $posicion;
    }

    function setTitulo($titulo)
    {
        $this->titulo = $titulo;
    }

    // Cabecera de página
    function Header()
    {
        if ($this->posicion == 'V') {
            setlocale(LC_ALL, 'spanish');
            $fecha = date('d-F-Y');
            $this->SetXY(0, 0);
            //Arial italic 8
            $this->SetFont('Arial', 'I', 8);
            //$this->Cell(20, 10, utf8_encode(strftime("%d-%B-%Y")), 0, 1, 'L');
            $this->SetLeftMargin(10);
            $this->SetRightMargin(10);
            $this->SetFillColor(78, 148, 210);
            $this->Cell(0, 15, "", 0, 0, 'C', false);

            $this->SetXY(7, 20);
            //if ($this->PageNo() == 1) {
            // Logo
            //$this->Image('images/sep.png', 10, 1, 20);
            //$this->Image('images/escudoJ.png', 180, 1, 25);
            $this->Image('images/fondos/mg.png', 0, 0, 216);
            // Titulo del reporte
            $this->SetFont('Arial', 'B', 16);
            $this->Cell(0, 20, utf8_decode($this->titulo), 0, 0, 'R');
            $this->SetFont('Arial', 'B', 12);
            //}
            $this->Ln(20);
            $this->SetLeftMargin(10);
            $this->SetRightMargin(10);
        } else if ($this->posicion == 'H') {
            setlocale(LC_ALL, 'spanish');
            $fecha = date('d-F-Y');
            $this->SetXY(0, 0);
            //Arial italic 8
            $this->SetFont('Arial', 'I', 8);
            //$this->Cell(20, 10, utf8_encode(strftime("%d-%B-%Y")), 0, 1, 'L');
            $this->SetRightMargin(0);
            $this->SetFillColor(78, 148, 210);
            $this->Cell(0, 15, "", 0, 0, 'C', false);
            //if ($this->PageNo() == 1) {
            // Logo
            //$this->Image('images/sep.png', 10, 1, 13);
            //$this->Image('images/escudoJ.png', 245, 1, 25);
            //
            //$this->Image('images/escudoJ.png', 245, 1, 10);
            $this->Image('images/encabezadoOK.png', 0, 0, 216);
            // Titulo del Reporte
            $this->SetXY(0, 0);
            $this->SetFont('Arial', 'B', 16);
            $this->SetTextColor(0);
            $this->Cell(0, 16, $this->titulo, 0, 0, 'C');
            //$this->Image('images/logo2.png', 7, 7, 50, 15);
            //}
            $this->Ln(25);
        }
    }

    // Pie de página
    function Footer()
    {
        if ($this->posicion == 'V') {

            //$this->Image('images/pieOK.png', 0, 255, 216);
        } else if ($this->posicion == 'H') {

        }


        /* $this->SetXY(0, 201);
          $this->SetRightMargin(0);
          $this->SetFillColor(78, 148, 210);
          $this->Cell(0, 15, "", 0, 0, 'C', true);
         */

        $this->SetLeftMargin(10);
        $this->SetRightMargin(10);
        // 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, utf8_decode('Página ' . $this->PageNo() . '/{nb}'), 0, 0, 'C');
    }

    // Tabla alumnos
    function TablaAlumnos($header, $data)
    {
        $this->SetLeftMargin(20);
        setlocale(LC_ALL, 'spanish');
        // Colores, ancho de línea y fuente en negrita
        $this->SetFillColor(165, 204, 138); //Fondo verde del table-header
        $this->SetTextColor(255);
        $this->SetDrawColor(165, 204, 138); //Linea verde
        $this->SetLineWidth(.3);
        $this->SetFont('', 'B', 8);
        // Cabecera
        $w = array(15, 20, 25, 25, 25, 25, 30, 25, 25, 25); //CAMBIAN LOS VALORES DE ACUERDO AL NUMERO DE COLUMNAS
        for ($i = 0; $i < count($header); $i++)
            $this->Cell($w[$i], 7, $header[$i], 0, 0, 'C', true);
        $this->Ln();
        // Restauración de colores y fuentes
        //$this->SetFillColor(229, 255, 211);
        $this->SetFillColor(239, 252, 229);
        $this->SetTextColor(0);
        $this->SetFont('');
        // Datos
        $fill = false;
        $j = 1;
        if (count($data) == 0) {
            $this->Cell(array_sum($w), 7, "NO HAY DATOS", 0, 0, 'C', true); // NO CAMBIA
            $this->Ln(); // NO CAMBIA
        } else {
            foreach ($data as $row) {
                //$this->Cell(ancho,alto,texto,borde,no me acuerdo pero ponle 0,alinacion,fondo)
                $this->Cell($w[0], 7, $j, 0, 0, 'C', $fill); // NO CAMBIA
                $this->Cell($w[1], 7, utf8_decode($row->getNumCtl()), 0, 0, 'C', $fill);
                $this->Cell($w[2], 7, utf8_decode($row->getApePat()), 0, 0, 'C', $fill);
                $this->Cell($w[3], 7, utf8_decode($row->getApeMat()), 0, 0, 'C', $fill);
                $this->Cell($w[4], 7, utf8_decode($row->getNomAlu()), 0, 0, 'C', $fill);
                $this->Cell($w[5], 7, utf8_decode($row->getSexAlu()), 0, 0, 'C', $fill);
                $this->Cell($w[6], 7, utf8_decode($row->getStaAlu()->getDesSta()), 0, 0, 'L', $fill);
                $this->Cell($w[7], 7, utf8_decode($row->getCveEsc()->getCct()), 0, 0, 'C', $fill);
                $this->Cell($w[8], 7, utf8_decode($row->getCveCar()->getCveCar()), 0, 0, 'C', $fill);
                $this->Cell($w[9], 7, utf8_decode($row->getCveApo()->getCveApo()), 0, 0, 'C', $fill);
                $this->Ln(); // NO CAMBIA
                $fill = !$fill; // NO CAMBIA
                $j++; // NO CAMBIA
            }
        }

        // Línea de cierre
        $this->Cell(array_sum($w), 0, '', 'T');
        $this->Ln();
    }

    // Tabla alumnos
    function Historial($a, $pagos)
    {
        $this->SetLeftMargin(20);
        setlocale(LC_ALL, 'spanish');


        $this->SetFont('', '', 10);
        $this->Cell(0, 9, 'Nombre del Alumno: ' . utf8_decode($a->getApePat() . " " . $a->getApeMat() . " " . $a->getNomAlu()));
        $this->Ln();
        $this->Cell(50, 9, 'Num. Ctl.: ' . $a->getCveCtl());
        $this->Ln();
        if ($a->getTipoAlumno() == 1) { //Bachillerato Escolarizado
            $this->Cell(50, 9, 'Bachillerato: ' . utf8_decode($a->getCveLic()->getNomLic()));
        } elseif ($a->getTipoAlumno() == 3) { // Licenciatuiras
            $this->Cell(50, 9, 'Licenciatura: ' . utf8_decode($a->getCveLic()->getNomLic()));
        } elseif ($a->getTipoAlumno() == 4) { // Licenciatuiras
            $this->Cell(50, 9, utf8_decode('Maestría: ') . utf8_decode($a->getCveLic()->getNomLic()));
        } elseif ($a->getTipoAlumno() == 5) { // Licenciatuiras
            $this->Cell(50, 9, 'Doctorado: ' . utf8_decode($a->getCveLic()->getNomLic()));
        }


        $this->Ln();
        $this->Cell(50, 9, 'Colegiatura: ' . utf8_decode("$ " . number_format($a->getCostoMensualidad(), 2, ".", ",")));
        $this->Ln();


        // Colores, ancho de línea y fuente en negrita
        $this->SetFillColor(165, 204, 138); //Fondo verde del table-header
        $this->SetTextColor(255);
        $this->SetDrawColor(165, 204, 138); //Linea verde
        $this->SetLineWidth(.3);
        $this->SetFont('', 'B', 8);
        $this->Ln(); // NO CAMBIA
        // Cabecera
        $this->Cell(10, 7, utf8_decode("NP"), 0, 0, 'C', true); // NO CAMBIA
        if ($a->getModalidad() == "SEMESTRAL") {
            $this->Cell(25, 7, utf8_decode("SEMESTRE"), 0, 0, 'C', true); // NO CAMBIA
        } else {
            $this->Cell(25, 7, utf8_decode("CUATRIMESTRE"), 0, 0, 'C', true); // NO CAMBIA
        }
        $this->Cell(50, 7, utf8_decode("CONCEPTO"), 0, 0, 'C', true); // NO CAMBIA
        $this->Cell(25, 7, utf8_decode("MES"), 0, 0, 'C', true); // NO CAMBIA
        $this->Cell(25, 7, utf8_decode("FORMA DE PAGO"), 0, 0, 'C', true); // NO CAMBIA
        $this->Cell(25, 7, utf8_decode("TOTAL"), 0, 0, 'C', true); // NO CAMBIA
        $this->Ln(); // NO CAMBIA
        // Restauración de colores y fuentes
        //$this->SetFillColor(229, 255, 211);
        $this->SetFillColor(239, 252, 229);
        $this->SetTextColor(0);
        $this->SetFont('');

        // Datos
        $fill = false;
        $j = 1;
        $total = 0;
        $semestre = 0;
        if (count($pagos) == 0) {
            $this->Cell(0, 7, "NO HAY DATOS", 0, 0, 'C', true); // NO CAMBIA
            $this->Ln(); // NO CAMBIA
        } else {
            foreach ($pagos as $row) {
                if ($j > 1) {
                    if ($semestre != $row->getSemestre()) {
                        $this->Cell(160, 1, "", 1, 0, 'C', false); // NO CAMBIA
                        $this->Ln();
                        $semestre = $row->getSemestre();
                    }
                } else {
                    $semestre = $row->getSemestre();
                }
                //$this->Cell(ancho,alto,texto,borde,no me acuerdo pero ponle 0,alineacion,fondo)
                $this->Cell(10, 7, $j, 0, 0, 'C', $fill); // NO CAMBIA
                $this->Cell(25, 7, $row->getSemestre(), 0, 0, 'C', $fill); // NO CAMBIA
                $this->Cell(50, 7, utf8_decode($row->getDescripcion()), 0, 0, 'C', $fill);
                if ($row->getNumero() == 0) {
                    if ($a->getModalidad() == "SEMESTRAL") {
                        $this->Cell(25, 7, utf8_decode("SEMESTRE: " . "#" . $row->getSemestre()), 0, 0, 'R', $fill);
                    } else {
                        $this->Cell(25, 7, utf8_decode("CUATRIMESTRE: " . "#" . $row->getSemestre()), 0, 0, 'R', $fill);
                    }
                } else {
                    $this->Cell(25, 7, utf8_decode($row->getNomMes() . " " . $row->getFecIni()->format('Y')), 0, 0, 'R', $fill);
                }

                $this->SetFont('', 'B', '');
                if ($row->getTipPag() == 0 & $row->getTipPag() != null) {
                    $this->Cell(25, 7, utf8_decode("BOUCHER"), 0, 0, 'L', $fill);
                } elseif ($row->getTipPag() == 1) {
                    $this->Cell(25, 7, utf8_decode("EFECTIVO"), 0, 0, 'L', $fill);
                } elseif ($row->getTipPag() == 2) {
                    $this->Cell(25, 7, utf8_decode("TRANSFERENCIA"), 0, 0, 'L', $fill);
                } elseif ($row->getTipPag() == 3) {
                    $this->Cell(25, 7, utf8_decode("TERMINAL"), 0, 0, 'L', $fill);
                } elseif ($row->getTipPag() == 99) {
                    $this->Cell(25, 7, utf8_decode("EXCEL"), 0, 0, 'L', $fill);
                } else {
                    $this->Cell(25, 7, utf8_decode("*NO PAGADO*"), 0, 0, 'L', $fill);
                }
                $this->SetFont('');
                if ($row->getMonto() == null | $row->getMonto() == 0) {
                    $this->Cell(25, 7, utf8_decode("$ 0.00"), 0, 0, 'R', $fill);
                } else {
                    $this->Cell(25, 7, utf8_decode("$ " . number_format($row->getMonto(), 2, ".", ",")), 0, 0, 'R', $fill);
                    $total = $total + $row->getMonto();
                }
                $this->Ln(); // NO CAMBIA
                $fill = !$fill; // NO CAMBIA
                $j++; // NO CAMBIA
            }
            $this->SetFont('', 'B', '');
            $this->Cell(135, 7, "TOTAL", "T", 0, 'C', true); // NO CAMBIA
            $this->Cell(25, 7, "$ " . number_format($total, 2, ".", ","), "T", 0, 'R', true); // NO CAMBIA
        }

        // Línea de cierre
        $this->Ln();
    }

    function HistorialBachillerato($a, $pagos, $ingresos)
    {
        $this->SetLeftMargin(20);
        $this->SetRightMargin(20);
        setlocale(LC_ALL, 'spanish');


        $this->SetFont('', '', 10);
        $this->Cell(0, 9, 'Nombre del Alumno: ' . utf8_decode($a->getApePat() . " " . $a->getApeMat() . " " . $a->getNomAlu()));
        $this->Ln();
        $this->Cell(50, 9, 'No. de Control.: ' . $a->getCveCtl());
        $this->Ln();
        $this->Cell(50, 9, 'Bachilletaro: ' . utf8_decode($a->getCveLic()->getNomLic()));
        $this->Ln();
        //$this->Cell(50, 9, 'Colegiatura: ' . utf8_decode("$ " . number_format($a->getCostoMensualidad(), 2, ".", ",")));
        $this->Ln();


        // Colores, ancho de línea y fuente en negrita
        $this->SetFillColor(165, 204, 138); //Fondo verde del table-header
        $this->SetTextColor(255);
        $this->SetDrawColor(165, 204, 138); //Linea verde
        $this->SetLineWidth(.3);
        $this->SetFont('', 'B', 8);
        $this->Ln(); // NO CAMBIA
        // Cabecera
        $this->Cell(10, 7, utf8_decode("NP"), 0, 0, 'C', true); // NO CAMBIA
        $this->Cell(50, 7, utf8_decode("CONCEPTO"), 0, 0, 'C', true); // NO CAMBIA
        $this->Cell(25, 7, utf8_decode("MONTO"), 0, 0, 'C', true); // NO CAMBIA
        $this->Cell(25, 7, utf8_decode("DEPOSITO"), 0, 0, 'C', true); // NO CAMBIA
        $this->Cell(25, 7, utf8_decode(""), 0, 0, 'C', true); // NO CAMBIA
        $this->Ln(); // NO CAMBIA
        // Restauración de colores y fuentes
        //$this->SetFillColor(229, 255, 211);
        $this->SetFillColor(239, 252, 229);
        $this->SetTextColor(0);
        $this->SetFont('');

        // Datos
        $fill = false;
        $j = 1;
        $total = 0;
        if (count($pagos) == 0) {
            $this->Cell(0, 7, "NO HAY DATOS", 0, 0, 'C', true); // NO CAMBIA
            $this->Ln(); // NO CAMBIA
        } else {
            foreach ($pagos as $row) {
                $this->Cell(10, 7, $j, 0, 0, 'C', $fill); // NO CAMBIA
                $this->Cell(50, 7, utf8_decode($row[0]->getDescripcion()), 0, 0, 'L', $fill);
                $this->Cell(25, 7, utf8_decode("$" . number_format($row[0]->getMonto(), 2, ".", ",")), 0, 0, 'R', $fill);
                $this->Cell(25, 7, utf8_decode("$" . number_format($row[1], 2, ".", ",")), 0, 0, 'R', $fill);
                $total += $row[1];
                if ($row[0]->getMonto() == $row[1]) {
                    $this->SetFont('', 'B', '');
                    $this->Cell(25, 7, utf8_decode("**PAGADO**"), 0, 0, 'R', $fill);
                    $this->SetFont('', '', '');
                } else {
                    $this->Cell(25, 7, utf8_decode("NO PAGADO"), 0, 0, 'R', $fill);
                }
                $this->Ln(); // NO CAMBIA
                $fill = !$fill; // NO CAMBIA
                $j++; // NO CAMBIA
            }
            $this->SetFont('', 'B', '');
            $this->Cell(85, 7, "TOTAL", "T", 0, 'C', true); // NO CAMBIA
            $this->Cell(25, 7, "$ " . number_format($total, 2, ".", ","), "T", 0, 'R', true); // NO CAMBIA
        }

        // Línea de cierre
        $this->Ln();

        $this->AddPage();

        $this->SetFont('', '', 10);
        $this->Cell(0, 9, 'Nombre del Alumno: ' . utf8_decode($a->getApePat() . " " . $a->getApeMat() . " " . $a->getNomAlu()));
        $this->Ln();
        $this->Cell(50, 9, 'No. de Control.: ' . $a->getCveCtl());
        $this->Ln();
        $this->Cell(50, 9, 'Bachilletaro: ' . utf8_decode($a->getCveLic()->getNomLic()));
        $this->Ln();
        //$this->Cell(50, 9, 'Colegiatura: ' . utf8_decode("$ " . number_format($a->getCostoMensualidad(), 2, ".", ",")));
        $this->Cell(0, 9, 'PAGOS REALIZADOS', 0, 0, 'C', false);
        //$this->Ln();
        // Colores, ancho de línea y fuente en negrita
        $this->SetFillColor(165, 204, 138); //Fondo verde del table-header
        $this->SetTextColor(255);
        $this->SetDrawColor(165, 204, 138); //Linea verde
        $this->SetLineWidth(.3);
        $this->SetFont('', 'B', 8);
        $this->Ln(); // NO CAMBIA
        // Cabecera
        $this->Cell(10, 7, utf8_decode("NP"), 0, 0, 'C', true); // NO CAMBIA
        $this->Cell(50, 7, utf8_decode("CONCEPTO"), 0, 0, 'C', true); // NO CAMBIA
        $this->Cell(25, 7, utf8_decode("MONTO"), 0, 0, 'C', true); // NO CAMBIA
        $this->Cell(25, 7, utf8_decode("RECIBO"), 0, 0, 'C', true); // NO CAMBIA
        $this->Cell(25, 7, utf8_decode("FECHA"), 0, 0, 'C', true); // NO CAMBIA
        $this->Ln(); // NO CAMBIA
        // Restauración de colores y fuentes
        //$this->SetFillColor(229, 255, 211);
        $this->SetFillColor(239, 252, 229);
        $this->SetTextColor(0);
        $this->SetFont('');
        // Datos INGRESOS
        $fill = false;
        $j = 1;
        $total = 0;
        if (count($pagos) == 0) {
            $this->Cell(0, 7, "NO HAY DATOS", 0, 0, 'C', true); // NO CAMBIA
            $this->Ln(); // NO CAMBIA
        } else {
            foreach ($ingresos as $row) {
                $this->Cell(10, 7, $j, 0, 0, 'C', $fill); // NO CAMBIA
                $this->Cell(50, 7, utf8_decode($row->getDescripcion()), 0, 0, 'L', $fill);
                $this->Cell(25, 7, utf8_decode("$" . number_format($row->getMonto(), 2, ".", ",")), 0, 0, 'R', $fill);
                $this->Cell(25, 7, utf8_decode($row->getNumRecibo()), 0, 0, 'R', $fill);
                $this->Cell(25, 7, utf8_decode($row->getFecMov()->format('d-m-Y')), 0, 0, 'R', $fill);
                $total += $row->getMonto();
                $this->Ln(); // NO CAMBIA
                $fill = !$fill; // NO CAMBIA
                $j++; // NO CAMBIA
            }
            $this->SetFont('', 'B', '');
            $this->Cell(85, 7, "TOTAL", "T", 0, 'C', true); // NO CAMBIA
            $this->Cell(25, 7, "$ " . number_format($total, 2, ".", ","), "T", 0, 'R', true); // NO CAMBIA
        }

        // Línea de cierre
        $this->Ln();
    }

    // Recibo Pagado
    function ReciboPagado($data)
    {
        $this->SetLeftMargin(20);
        $this->SetRightMargin(20);
        setlocale(LC_ALL, 'spanish');

        $this->SetFont('', '', 10);
        $this->Cell(25, 9, 'Recibo No. ' . $data->getIdeIng(), 'LT', 0, 'L', false);
        $this->Cell(0, 9, 'Bueno por: $ ' . $data->getTotal(), 'TR', 0, 'R', false);
        $this->Ln();
        $this->Cell(40, 9, 'Num Ctl: ' . $data->getCveAlu()->getCveCtl(), 'L', 0, 'L', false);
        $this->Cell(0, 9, utf8_decode('Nombre: ' . $data->getCveAlu()->getApePat() . " " . $data->getCveAlu()->getApeMat() . " " . $data->getCveAlu()->getNomAlu()), 'R', 0, 'L', false);
        $this->Ln();
        $this->Cell(0, 9, utf8_decode('Descripción: ' . $data->getDescripcion()), 'LR', 0, 'L', false);
        $this->Ln();
        $this->Cell(40, 9, utf8_decode('Fecha: ' . $data->getFecMov()->format('d-M-Y')), 'L', 0, 'L', false);

        $this->Cell(70, 9, utf8_decode('Forma de Pago: DEPÓSITO EN BANCO'), 0, 0, 'L', false);

        $this->Cell(0, 9, utf8_decode('SELLO'), 'R', 0, 'C', false);
        $this->Ln();
        $this->Cell(0, 4, "", 'LBR', 0, 'C', false);

        $this->Ln(15);
        $this->Cell(0, 0, "", 1, 0, 'C', false);
        $this->Ln(11);

        $this->Cell(25, 9, 'Recibo No. ' . $data->getIdeIng(), 'LT', 0, 'L', false);
        $this->Cell(0, 9, 'Bueno por: $ ' . $data->getTotal(), 'TR', 0, 'R', false);
        $this->Ln();
        $this->Cell(40, 9, 'Num Ctl: ' . $data->getCveAlu()->getCveCtl(), 'L', 0, 'L', false);
        $this->Cell(0, 9, utf8_decode('Nombre: ' . $data->getCveAlu()->getApePat() . " " . $data->getCveAlu()->getApeMat() . " " . $data->getCveAlu()->getNomAlu()), 'R', 0, 'L', false);
        $this->Ln();
        $this->Cell(0, 9, utf8_decode('Descripción: ' . $data->getDescripcion()), 'LR', 0, 'L', false);
        $this->Ln();
        $this->Cell(40, 9, utf8_decode('Fecha: ' . $data->getFecMov()->format('d-M-Y')), 'L', 0, 'L', false);

        $this->Cell(70, 9, utf8_decode('Forma de Pago: DEPÓSITO EN BANCO'), 0, 0, 'L', false);

        $this->Cell(0, 9, utf8_decode('SELLO'), 'R', 0, 'C', false);
        $this->Ln();
        $this->Cell(0, 4, "", 'LBR', 0, 'C', false);
    }

    function LineaDePago($alu, $pago, $recargoA, $b)
    {
        $this->Ln(6);
        // EMPIEZA LA LÍNEA DE CAPTURA
        $this->SetLeftMargin(10);
        $this->SetRightMargin(10);
        $this->SetFont('', 'B', 14);
        $this->Cell(0, 7, utf8_decode("DATOS DEL USUARIO"), "TB", 0, 'C', FALSE);
        $this->Ln(10);
        $this->SetFont('', '', 10);
        $this->Cell(100, 7, utf8_decode($alu->getNomAlu() . " " . $alu->getApePat() . " " . $alu->getApeMat()), 1, 0, 'C', FALSE);
        $this->Image("images/tmpB.png", 130, 46, 50);
        $this->Ln();
        $this->SetFont('', 'B', 8);
        $this->Cell(100, 7, utf8_decode("Nombre completo del usuario"), 0, 0, 'C', FALSE);
        $this->SetFont('', 'B', 10);
        $this->Cell(0, 7, utf8_decode($alu->getCveCtl()), 0, 0, 'C', FALSE);
        $this->Ln(10);
        $this->SetFont('', 'B', 14);
        $this->Cell(0, 7, utf8_decode("DETALLE DEL PAGO"), "TB", 0, 'C', FALSE);
        $this->Ln(10);
        $this->SetFont('', 'B', 10);
        $this->Cell(30, 7, utf8_decode("CONCEPTO"), 0, 0, 'C', FALSE);
        $this->Cell(30, 7, utf8_decode("DESCRIPCIÓN"), 0, 0, 'C', FALSE);
        $this->Cell(25, 7, utf8_decode("IMPORTE"), 0, 0, 'C', FALSE);
        $this->Cell(25, 7, utf8_decode("BECA"), 0, 0, 'C', FALSE);
        $this->Cell(25, 7, utf8_decode("SUBTOTAL"), 0, 0, 'C', FALSE);
        $this->Cell(25, 7, utf8_decode("RECARGOS"), 0, 0, 'C', FALSE);
        $this->Cell(25, 7, utf8_decode("TOTAL"), 0, 0, 'C', FALSE);
        $this->Ln();

        $neto = 0;
        /**
         * AHORA, AGREGAR LA INFORMACIÓN DE LAS DISCIPLINAS
         * Y SU COSTO
         */
        /**
         * LÓGICA POR SI LA CATEGORÍA DE LA DISCIPLINA ES NATACIÓN
         */
        if ($pago != null) {
            if ($b == 1) {
                $this->SetFont('', '', 8);
                $this->Cell(30, 7, utf8_decode("INSCRIPCIÓN"), 0, 0, 'C', FALSE);
                $this->Cell(30, 7, utf8_decode("COSTO INSCRIPCIÓN"), 0, 0, 'C', FALSE);
                $this->Cell(25, 7, utf8_decode("$ " . number_format(1500, 2, ".", ",")), 0, 0, 'C', FALSE);
                $this->Cell(25, 7, utf8_decode("$ " . number_format(0, 2, ".", ",")), 0, 0, 'C', FALSE);
                $this->Cell(25, 7, utf8_decode("$ " . number_format(1500, 2, ".", ",")), 0, 0, 'C', FALSE);
                $this->Cell(25, 7, utf8_decode("$ " . number_format(0, 2, ".", ",")), 0, 0, 'C', FALSE);
                $this->Cell(25, 7, utf8_decode("$ " . number_format(1500, 2, ".", ",")), 0, 0, 'C', FALSE);
                $this->Ln();
                $neto = $neto + 1500;
            }
            $cosDis = $alu->getCveCol()->getMonto();
            $subtotal = 0;
            $recargos = 0;
            $descuento = $alu->getCveBeca()->getMonto();
            $total = 0;
            $this->SetFont('', '', 8);
            $this->Cell(30, 7, utf8_decode("COLEGIATURA"), 0, 0, 'C', FALSE);
            $this->Cell(30, 7, utf8_decode("MENSUALIDAD " . $pago->getSemestre()), 0, 0, 'C', FALSE);
            $this->Cell(25, 7, utf8_decode("$ " . number_format($cosDis, 2, ".", ",")), 0, 0, 'C', FALSE);
            $this->Cell(25, 7, utf8_decode("$ " . number_format($descuento, 2, ".", ",")), 0, 0, 'C', FALSE);
            $subtotal = $cosDis - $descuento;
            $this->Cell(25, 7, utf8_decode("$ " . number_format($subtotal, 2, ".", ",")), 0, 0, 'C', FALSE);
            $recargos = $subtotal * $recargoA;
            $this->Cell(25, 7, utf8_decode("$ " . number_format($recargos, 2, ".", ",")), 0, 0, 'C', FALSE);
            $total = $subtotal + $recargos;
            $this->Cell(25, 7, utf8_decode("$ " . number_format($total, 2, ".", ",")), 0, 0, 'C', FALSE);
            $this->Ln();
            $neto = $neto + $total;
        } else {
            $this->Cell(0, 7, utf8_decode("NO HAY PAGOS POR REALIZAR"), 1, 0, 'C', FALSE);
            $this->Ln();
        }
        $this->SetFont('', 'B', 10);
        $this->Cell(160, 7, utf8_decode("TOTAL A PAGAR:"), 1, 0, 'C', FALSE);
        $this->Cell(0, 7, utf8_decode("$ " . number_format($neto, 2, ".", ",")), 1, 0, 'C', FALSE);
        $this->Ln();
        $this->Ln();
        $this->Ln();
        $this->Ln();

        $this->SetFillColor(215, 215, 215);
        $this->Cell(50, 7, "", 1, 0, 'C', TRUE);
        $this->Cell(50, 7, utf8_decode("FECHA IMPRESIÓN"), 1, 0, 'C', TRUE);
        $this->Cell(00, 7, "VIGENCIA", 1, 0, 'C', TRUE);
        $this->Ln();
        $this->Cell(50, 14, "", 0, 0, 'C', FALSE);
        $this->SetFont('', 'B', 12);
        $fechaAA = date('d-F-Y');
        $mesesIngles = array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
        $mesesMexico = array('Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre');
        $newFechaAA = str_replace($mesesIngles, $mesesMexico, $fechaAA);
        $this->Cell(50, 14, $newFechaAA, 1, 0, 'C', FALSE);
        //$fecTer = strtotime('+1 month', strtotime(date('d-F-Y')));

        $fecTer = strtotime('01-08-2017');
        $fecTerB = strtotime('06-08-2017');
        if ($recargoA > 0) {
            $fecTer = strtotime('07-08-2017');
            $fecTerB = strtotime('31-08-2017');
        }
        $fecTer = date('d-F-Y', $fecTer);
        $fecTerB = date('d-F-Y', $fecTerB);
        $newFecTer = str_replace($mesesIngles, $mesesMexico, $fecTer);
        $newFecTerB = str_replace($mesesIngles, $mesesMexico, $fecTerB);
        $this->Cell(00, 14, $newFecTer . " al " . $newFecTerB, 1, 0, 'C', FALSE);
        $this->Ln();
        $this->SetFont('Arial', 'B', 20);
        $this->Cell(100, 14, utf8_decode(""), 0, 0, 'C', FALSE);
        $this->Cell(50, 14, utf8_decode("No. cuenta"), 1, 0, 'C', TRUE);
        $this->Cell(0, 14, utf8_decode("0201309504"), 1, 0, 'C', FALSE);
        //$this->AddPage();
    }

    function Otros($data)
    {
        $this->Ln(6);
        // EMPIEZA OTROS
        $this->SetLeftMargin(10);
        $this->SetRightMargin(10);
        $this->SetFont('', 'B', 14);
        $this->Cell(0, 7, utf8_decode("DATOS DEL USUARIO"), "TB", 0, 'C', FALSE);
        $this->Ln(10);
        $this->SetFont('', '', 10);
        $this->Cell(100, 7, utf8_decode($data->getCveAlu()->getNomAlu() . " " . $data->getCveAlu()->getApePat() . " " . $data->getCveAlu()->getApeMat()), 1, 0, 'C', FALSE);
        //$this->Image($imgCodigoBarras, 130, 46, 50);
        $this->Ln();
        $this->Cell(0, 7, utf8_decode("CONCEPTO: " . $data->getCveTra()->getDesTra()), 0, 0, 'L', FALSE);
        $this->Ln();
        $this->Cell(0, 7, utf8_decode("MONTO: $" . $data->getCveTra()->getMonto()), 0, 0, 'L', FALSE);
        $this->Ln();
        $fecha = date('d-m-Y');
        $this->Cell(0, 7, utf8_decode("FECHA: " . $fecha), 0, 0, 'L', FALSE);
        $this->Ln();
        $this->Cell(0, 1, utf8_decode(""), 1, 0, 'L', FALSE);
    }

    function Credencial($a)
    {
        $this->SetLeftMargin(10);
        $this->SetRightMargin(10);
        $this->SetFillColor(0, 0, 0);
        $this->SetTextColor(0, 0, 0);
        setlocale(LC_ALL, 'spanish');
        $this->Ln(10);
        // Colores, ancho de línea y fuente en negrita
        $this->SetFont('Arial', 'B', 10);
        $this->Image('images/sep.png', 83, 42, 13);
        $this->Image('images/logoTec.png', 10, 42, 48);

        $this->Cell(98, 7, "", "LTR", 0, 'C', FALSE);
        $this->Cell(0, 7, "", "LTR", 0, 'C', FALSE);
        $this->Ln();
        $this->Cell(98, 7, utf8_decode(""), "LR", 0, 'C', FALSE);
        $this->Cell(0, 7, "", "LR", 0, 'C', FALSE);
        $this->Ln();
        $this->Cell(98, 7, "", "L", 0, 'C', FALSE);
        $this->Cell(0, 7, "", "LR", 0, 'C', FALSE);
        $this->SetFont('Arial', '', 10);
        $this->Ln();
        //$this->Image("images/titulo.png", 30, 40, 60); // TITULO

        $rutaFoto = "fotos/" . $a->getCveCtl() . ".jpg";
        $nombre_fichero = $rutaFoto;
        $img = "";

        if (file_exists($nombre_fichero)) {
            $img = "fotos/" . $a->getCveCtl() . ".jpg";
        } else {
            $img = "images/usuario.png";
        }

        $this->Image($img, 75, 60, 25); // FOTOGRAFÍA
        $this->Image("images/contorno.png", 75, 60, 25); // FOTOGRAFÍA
        $this->Image($img, 50, 90, 10); // FOTOGRAFÍA
        $this->Image("images/contorno.png", 50, 90, 10); // FOTOGRAFÍA

        $this->Image("barras/" . $a->getCveCtl() . ".png", 132, 88, 50); //CODIGO DE BARRAS
        //$this->Image("images/agua.png", 132, 50, 50); //MARCA DE AGUA
        //$this->Image("images/directora.png", 116, 80, 80); //NOMBRE DE LA DIRECTORA
        //$this->Image('images/firma.png', 138, 70, 35); //FIRMA
        $this->SetFont('Arial', 'B', 13);
        $this->Cell(5, 7, "", "L", 0, 'L', FALSE);
        $this->Cell(50, 7, utf8_decode($a->getApePat() . " " . $a->getApeMat()), 0, 0, 'L', FALSE);
        $this->Cell(43, 7, "", 0, 0, 'L', FALSE);
        $this->Cell(0, 7, "", "LR", 0, 'C', FALSE);
        $this->Ln();
        $this->Cell(5, 7, "", "L", 0, 'L', FALSE);
        $this->Cell(50, 7, utf8_decode($a->getNomAlu()), 0, 0, 'L', FALSE);
        $this->Cell(43, 7, utf8_decode(""), 0, 0, 'L', FALSE);
        $this->Cell(0, 7, "", "LR", 0, 'C', FALSE);
        $this->Ln();

        $vigencia = strtotime('+6 month -1 day', strtotime($a->getFecIns()->format('d-F-Y')));
        $vigencia = date('d/F/Y', $vigencia);
        $mesesIngles = array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
        $mesesMexico = array('Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre');
        $newFechaAA = str_replace($mesesIngles, $mesesMexico, $a->getFecIns()->format('d/F/Y'));
        $newFechaBB = str_replace($mesesIngles, $mesesMexico, $vigencia);

        $this->SetFont('Arial', '', 10);
        $this->Cell(5, 7, "", "L", 0, 'L', FALSE);
        $this->Cell(50, 7, "VALIDO DESDE:", 0, 0, 'L', FALSE);
        $this->Cell(43, 7, "", 0, 0, 'L', FALSE);
        $this->Cell(0, 7, "", "LR", 0, 'C', FALSE);
        $this->Ln();
        $this->SetFont('', 'B', '');
        $this->Cell(5, 7, "", "L", 0, 'L', FALSE);
        $this->Cell(50, 7, utf8_decode($newFechaAA), 0, 0, 'L', FALSE);
        $this->Cell(43, 7, "", 0, 0, 'L', FALSE);
        $this->Cell(0, 7, "", "LR", 0, 'C', FALSE);
        $this->Ln();
        $this->SetFont('Arial', '', 10);
        $this->Cell(5, 7, "", "L", 0, 'L', FALSE);
        $this->Cell(50, 7, "VALIDO HASTA:", 0, 0, 'L', FALSE);
        $this->Cell(43, 7, "", 0, 0, 'L', FALSE);
        $this->Cell(0, 7, "", "LR", 0, 'C', FALSE);
        $this->Ln();
        $this->SetFont('', 'B', '');
        $this->Cell(5, 7, "", "L", 0, 'L', FALSE);
        $this->Cell(50, 7, utf8_decode($newFechaBB), 0, 0, 'L', FALSE);
        $this->Cell(43, 7, "", 0, 0, 'L', FALSE);
        $this->Cell(0, 7, $a->getCveCtl(), "LR", 0, 'C', FALSE);
        $this->Ln();
        $this->SetFont('Arial', 'B', 8);
        $this->SetTextColor(0, 133, 66);
        $this->Cell(98, 7, utf8_decode($a->getCveLic()->getNomLic()), "LBR", 0, 'C', FALSE);
        $this->Cell(0, 7, "", "BR", 0, 'C', FALSE);
        $bandera = 0;
    }

    function CredencialDos($a)
    {
        $this->SetLeftMargin(10);
        $this->SetRightMargin(10);
        $this->SetFillColor(0, 0, 0);
        $this->SetTextColor(0, 0, 0);
        setlocale(LC_ALL, 'spanish');
        $this->Ln(10);

        //$this->Image("barras/" . $a->getCveCtl() . ".png", 132, 90, 50); //CODIGO DE BARRAS

        $mesesIngles = array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
        $mesesMexico = array('Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre');
        $mesUno = str_replace($mesesIngles, $mesesMexico, $a->getFecIns()->format('F-Y'));

        $vigencia = strtotime('+1 month', strtotime($a->getFecIns()->format('d-F-Y')));
        $vigencia = date('F-Y', $vigencia);

        $mesDos = str_replace($mesesIngles, $mesesMexico, $vigencia);
        $vigencia = strtotime('+2 month', strtotime($a->getFecIns()->format('d-F-Y')));
        $vigencia = date('F-Y', $vigencia);
        $mesTres = str_replace($mesesIngles, $mesesMexico, $vigencia);
        $vigencia = strtotime('+3 month', strtotime($a->getFecIns()->format('d-F-Y')));
        $vigencia = date('F-Y', $vigencia);
        $mesCuatro = str_replace($mesesIngles, $mesesMexico, $vigencia);
        $vigencia = strtotime('+4 month', strtotime($a->getFecIns()->format('d-F-Y')));
        $vigencia = date('F-Y', $vigencia);
        $mesCinco = str_replace($mesesIngles, $mesesMexico, $vigencia);
        $vigencia = strtotime('+5 month', strtotime($a->getFecIns()->format('d-F-Y')));
        $vigencia = date('F-Y', $vigencia);
        $mesSeis = str_replace($mesesIngles, $mesesMexico, $vigencia);

        $this->Cell(5, 10, "", "LT", 0, 'L', FALSE);
        $this->Cell(50, 10, "", "T", 0, 'L', FALSE);
        $this->Cell(43, 10, "", "T", 0, 'L', FALSE);
        $this->Cell(0, 10, "", "LRT", 0, 'C', FALSE);
        $this->Ln();
        $this->SetFont('Arial', '', 12);
        $this->Cell(5, 10, "", "LB", 0, 'L', FALSE);
        $this->Cell(50, 10, utf8_decode("MES"), "B", 0, 'L', FALSE);
        $this->Cell(43, 10, utf8_decode($mesUno), "B", 0, 'L', FALSE);
        $this->Cell(5, 10, "", "LB", 0, 'C', FALSE);
        $this->Cell(50, 10, utf8_decode("MES"), "B", 0, 'L', FALSE);
        $this->Cell(0, 10, utf8_decode($mesCuatro), "BR", 0, 'L', FALSE);
        $this->Ln();
        $this->SetFont('Arial', '', 12);
        $this->Cell(5, 10, "", "L", 0, 'L', FALSE);
        $this->Cell(50, 10, utf8_decode(""), 0, 0, 'L', FALSE);
        $this->Cell(43, 10, utf8_decode(""), 0, 0, 'L', FALSE);
        $this->Cell(0, 10, "", "LR", 0, 'C', FALSE);
        $this->Ln();
        $this->SetFont('Arial', '', 12);
        $this->Cell(5, 10, "", "LB", 0, 'L', FALSE);
        $this->Cell(50, 10, utf8_decode("MES"), "B", 0, 'L', FALSE);
        $this->Cell(43, 10, utf8_decode($mesDos), "B", 0, 'L', FALSE);
        $this->Cell(5, 10, "", "LB", 0, 'C', FALSE);
        $this->Cell(50, 10, utf8_decode("MES"), "B", 0, 'L', FALSE);
        $this->Cell(0, 10, utf8_decode($mesCinco), "BR", 0, 'L', FALSE);
        $this->Ln();
        $this->SetFont('Arial', '', 12);
        $this->Cell(5, 10, "", "L", 0, 'L', FALSE);
        $this->Cell(50, 10, utf8_decode(""), 0, 0, 'L', FALSE);
        $this->Cell(43, 10, utf8_decode(""), 0, 0, 'L', FALSE);
        $this->Cell(0, 10, "", "LR", 0, 'C', FALSE);
        $this->Ln();
        $this->SetFont('Arial', '', 12);
        $this->SetFont('Arial', '', 12);
        $this->Cell(5, 10, "", "LB", 0, 'L', FALSE);
        $this->Cell(50, 10, utf8_decode("MES"), "B", 0, 'L', FALSE);
        $this->Cell(43, 10, utf8_decode($mesTres), "B", 0, 'L', FALSE);
        $this->Cell(5, 10, "", "LB", 0, 'C', FALSE);
        $this->Cell(50, 10, utf8_decode("MES"), "B", 0, 'L', FALSE);
        $this->Cell(0, 10, utf8_decode($mesSeis), "BR", 0, 'L', FALSE);
    }

    function Reglamento($data)
    {
        $this->SetLeftMargin(20);
        $this->SetRightMargin(20);
        setlocale(LC_ALL, 'spanish');


        $nombre_fichero = "fotos/" . $data->getCveCtl() . ".jpg";

        if (file_exists($nombre_fichero)) {
            $this->Image($nombre_fichero, 165, 30, 30);
        } else {
            $this->Image("images/usuario.png", 165, 30, 30);
        }
        $this->SetFillColor(200, 200, 200);
        $this->SetFont('', 'B', 10);
        $this->Cell(0, 9, 'Datos del Alumno', 0, 0, 'L', false);
        $this->SetFont('', '', 10);
        $this->Ln();
        $this->Cell(20, 9, 'Matricula: ', 1, 0, 'L', true);
        $this->SetFont('', 'B', 10);
        $this->Cell(50, 9, $data->getCveAnterior(), 1, 0, 'C', false);
        $this->SetFont('', '', 10);
        $this->Cell(30, 9, 'Num Control: ', 1, 0, 'L', true);
        $this->SetFont('', 'B', 10);
        $this->Cell(40, 9, $data->getCveCtl(), 1, 0, 'C', false);
        $this->SetFont('', '', 10);
        $this->Ln();
        $this->Cell(20, 9, utf8_decode('Nombre: '), 1, 0, 'L', true);
        $this->SetFont('', 'B', 10);
        $this->Cell(120, 9, utf8_decode($data->getApePat() . " " . $data->getApeMat() . " " . $data->getNomAlu()), 1, 0, 'C', false);
        $this->SetFont('', '', 10);
        $this->Ln();
        if ($data->getSexo() == 0) {// HOMBRE
            $this->Cell(15, 9, 'Sexo: ', 1, 0, 'L', true);
            $this->SetFont('', 'B', 10);
            $this->Cell(20, 9, 'Hombre', 1, 0, 'C', false);
            $this->SetFont('', '', 10);
        } elseif ($data->getSexo() == 1) {//MUJER
            $this->Cell(15, 9, 'Sexo: ', 1, 0, 'L', true);
            $this->SetFont('', 'B', 10);
            $this->Cell(20, 9, 'Mujer', 1, 0, 'C', false);
            $this->SetFont('', '', 10);
        } else {
            $this->Cell(15, 9, 'Sexo: ', 1, 0, 'L', true);
            $this->Cell(20, 9, '', 1, 0, 'C', false);
        }
        $this->Cell(40, 9, utf8_decode('Fecha de Nacimiento: '), 1, 0, 'L', true);
        $this->SetFont('', 'B', 10);
        $this->Cell(30, 9, utf8_decode($data->getFecNac()->format('d-m-Y')), 1, 0, 'C', false);
        $this->SetFont('', '', 10);
        $this->Cell(15, 9, utf8_decode('Edad: '), 1, 0, 'L', true);
        $this->SetFont('', 'B', 10);
        $this->Cell(20, 9, utf8_decode($data->getEdad()), 1, 0, 'C', false);
        $this->SetFont('', '', 10);
        $this->Ln();
        $this->Cell(15, 9, utf8_decode('CURP: '), 1, 0, 'L', true);
        $this->SetFont('', 'B', 10);
        $this->Cell(125, 9, utf8_decode($data->getCurp()), 1, 0, 'C', false);
        $this->SetFont('', '', 10);
        $this->Ln();
        $this->Cell(15, 9, utf8_decode('Calle: '), 1, 0, 'L', true);
        $this->SetFont('', 'B', 10);
        $this->Cell(115, 9, utf8_decode($data->getCalle()), 1, 0, 'C', false);
        $this->SetFont('', '', 10);
        $this->Cell(10, 9, utf8_decode('Ext: '), 1, 0, 'L', true);
        $this->SetFont('', 'B', 10);
        $this->Cell(15, 9, utf8_decode($data->getNumExt()), 1, 0, 'C', false);
        $this->SetFont('', '', 10);
        $this->Cell(10, 9, utf8_decode('Int: '), 1, 0, 'L', true);
        $this->SetFont('', 'B', 10);
        $this->Cell(15, 9, utf8_decode($data->getNumInt()), 1, 0, 'C', false);
        $this->SetFont('', '', 10);
        $this->Ln();
        $this->Cell(20, 9, utf8_decode('Colonia: '), 1, 0, 'L', true);
        $this->SetFont('', 'B', 10);
        $this->Cell(75, 9, utf8_decode($data->getColLoc()), 1, 0, 'C', false);
        $this->SetFont('', '', 10);
        $this->Cell(10, 9, utf8_decode('CP: '), 1, 0, 'L', true);
        $this->SetFont('', 'B', 10);
        $this->Cell(15, 9, utf8_decode($data->getCp()), 1, 0, 'C', false);
        $this->SetFont('', '', 10);
        $this->Cell(15, 9, utf8_decode('Estado: '), 1, 0, 'L', true);
        $this->SetFont('', 'B', 10);
        $this->Cell(45, 9, utf8_decode($data->getEdo()), 1, 0, 'C', false);
        $this->SetFont('', '', 10);
        $this->Ln();
        $this->Cell(20, 9, utf8_decode('Municipio: '), 1, 0, 'L', true);
        $this->SetFont('', 'B', 10);
        $this->Cell(50, 9, utf8_decode($data->getMunDel()), 1, 0, 'C', false);
        $this->SetFont('', '', 10);
        $this->Cell(25, 9, utf8_decode('Nacionalidad: '), 1, 0, 'L', true);
        $this->SetFont('', 'B', 10);
        $this->Cell(25, 9, utf8_decode($data->getNacionalidad()), 1, 0, 'C', false);
        $this->SetFont('', '', 10);
        $this->Cell(20, 9, utf8_decode('Telefono: '), 1, 0, 'L', true);
        $this->SetFont('', 'B', 10);
        $this->Cell(40, 9, utf8_decode($data->getTelefono()), 1, 0, 'C', false);
        $this->SetFont('', '', 10);
        $this->Ln();
        $this->Cell(15, 9, utf8_decode('Email: '), 1, 0, 'L', true);
        $this->SetFont('', 'B', 10);
        $this->Cell(100, 9, utf8_decode($data->getCorreo()), 1, 0, 'C', false);
        $this->SetFont('', '', 10);
        $this->Ln();

        $this->Cell(0, 9, 'Datos de Contacto', 0, 0, 'L', false);
        $this->Ln();
        $this->Cell(15, 9, utf8_decode('Nombre: '), 1, 0, 'L', true);
        $this->SetFont('', 'B', 10);
        $this->Cell(100, 9, utf8_decode($data->getPatTut() . " " . $data->getMatTut() . " " . $data->getNomTut()), 1, 0, 'C', false);
        $this->SetFont('', '', 10);
        $this->Cell(25, 9, utf8_decode('Parentesco: '), 1, 0, 'L', true);
        $this->SetFont('', 'B', 10);
        $this->Cell(40, 9, utf8_decode($data->getParentesco()), 1, 0, 'C', false);
        $this->SetFont('', '', 10);
        $this->Ln();
        $this->Cell(35, 9, utf8_decode('Vive con el alumno: '), 1, 0, 'L', true);
        $this->SetFont('', 'B', 10);
        if ($data->getViveAlu() == 1) {
            $this->Cell(10, 9, utf8_decode("SI"), 1, 0, 'C', false);
        } elseif ($data->getViveAlu() == 0) {
            $this->Cell(10, 9, utf8_decode("NO"), 1, 0, 'C', false);
        } else {
            $this->Cell(10, 9, utf8_decode(""), 1, 0, 'C', false);
        }
        $this->SetFont('', '', 10);
        $this->Cell(30, 9, utf8_decode('Lugar de Trabajo: '), 1, 0, 'L', true);
        $this->SetFont('', 'B', 10);
        $this->Cell(40, 9, utf8_decode($data->getOcupacion()), 1, 0, 'C', false);
        $this->SetFont('', '', 10);
        $this->Cell(25, 9, utf8_decode('Tel. Trabajo: '), 1, 0, 'L', true);
        $this->SetFont('', 'B', 10);
        $this->Cell(40, 9, utf8_decode($data->getTelCelTut()), 1, 0, 'C', false);
        $this->SetFont('', '', 10);
        $this->Ln();
        $this->Cell(25, 9, utf8_decode('Email: '), 1, 0, 'L', true);
        $this->SetFont('', 'B', 10);
        $this->Cell(100, 9, utf8_decode($data->getEmailTut()), 1, 0, 'C', false);
        $this->SetFont('', '', 10);
        $this->Ln();
        $this->Cell(15, 9, utf8_decode('Nombre: '), 1, 0, 'L', true);
        $this->SetFont('', 'B', 10);
        $this->Cell(100, 9, utf8_decode($data->getPatTutDos() . " " . $data->getMatTutDos() . " " . $data->getNomTutDos()), 1, 0, 'C', false);
        $this->SetFont('', '', 10);
        $this->Cell(25, 9, utf8_decode('Parentesco: '), 1, 0, 'L', true);
        $this->SetFont('', 'B', 10);
        $this->Cell(40, 9, utf8_decode($data->getParentescoDos()), 1, 0, 'C', false);
        $this->SetFont('', '', 10);
        $this->Ln();
        $this->Cell(35, 9, utf8_decode('Vive con el alumno: '), 1, 0, 'L', true);
        $this->SetFont('', 'B', 10);
        if ($data->getViveAluDos() == 1) {
            $this->Cell(10, 9, utf8_decode("SI"), 1, 0, 'C', false);
        } elseif ($data->getViveAluDos() == 0) {
            $this->Cell(10, 9, utf8_decode("NO"), 1, 0, 'C', false);
        } else {
            $this->Cell(10, 9, utf8_decode(""), 1, 0, 'C', false);
        }
        $this->SetFont('', '', 10);
        $this->Cell(30, 9, utf8_decode('Lugar de Trabajo: '), 1, 0, 'L', true);
        $this->SetFont('', 'B', 10);
        $this->Cell(40, 9, utf8_decode($data->getOcupacionDos()), 1, 0, 'C', false);
        $this->SetFont('', '', 10);
        $this->Cell(25, 9, utf8_decode('Tel. Trabajo: '), 1, 0, 'L', true);
        $this->SetFont('', 'B', 10);
        $this->Cell(40, 9, utf8_decode($data->getTelCelTutDos()), 1, 0, 'C', false);
        $this->SetFont('', '', 10);
        $this->Ln();
        $this->Cell(25, 9, utf8_decode('Email: '), 1, 0, 'L', true);
        $this->SetFont('', 'B', 10);
        $this->Cell(100, 9, utf8_decode($data->getEmailTutDos()), 1, 0, 'C', false);
        $this->SetFont('', '', 10);
        $this->Ln();
        $this->Cell(0, 9, 'Datos Academicos', 0, 0, 'L', false);
        $this->Ln();
        if ($data->getTipoAlumno() == 1) {
            $this->Cell(25, 9, utf8_decode('Bachillerato: '), 1, 0, 'L', true);
        } elseif ($data->getTipoAlumno() == 2) {
            $this->Cell(25, 9, utf8_decode('Bachillerato: '), 1, 0, 'L', true);
        } elseif ($data->getTipoAlumno() == 3) {
            $this->Cell(25, 9, utf8_decode('Licenciatura: '), 1, 0, 'L', true);
        } elseif ($data->getTipoAlumno() == 4) {
            $this->Cell(25, 9, utf8_decode('Maestria: '), 1, 0, 'L', true);
        }
        $this->SetFont('', 'B', 10);
        $this->Cell(100, 9, utf8_decode($data->getCveLic()->getNomLic()), 1, 0, 'C', false);
        $this->SetFont('', '', 10);
        $this->Cell(25, 9, utf8_decode('Modalidad: '), 1, 0, 'L', true);
        $this->SetFont('', 'B', 10);
        $this->Cell(30, 9, utf8_decode($data->getModalidad()), 1, 0, 'C', false);
        $this->SetFont('', '', 10);
        $this->Ln();
        $this->Cell(20, 9, utf8_decode('Turno: '), 1, 0, 'L', true);
        $this->SetFont('', 'B', 10);
        $this->Cell(30, 9, utf8_decode($data->getTurno()), 1, 0, 'C', false);
        $this->SetFont('', '', 10);
        $this->Cell(20, 9, utf8_decode('Beca: '), 1, 0, 'L', true);
        $this->SetFont('', 'B', 10);
        $this->Cell(40, 9, utf8_decode($data->getCveBeca()->getDesBec()), 1, 0, 'C', false);
        $this->SetFont('', '', 10);
        $this->Cell(25, 9, utf8_decode('Colegiatura: '), 1, 0, 'L', true);
        $this->SetFont('', 'B', 10);
        $this->Cell(45, 9, utf8_decode("$ " . number_format($data->getCostoMensualidad(), 2, ".", ",")), 1, 0, 'C', false);
        $this->SetFont('', '', 10);
        $this->Ln();
        if ($data->getModalidad() == 'SEMESTRAL') {
            $this->Cell(25, 9, utf8_decode('SEMESTRE: '), 1, 0, 'L', true);
        } elseif ($data->getModalidad() == 'CUATRIMESTRAL') {
            $this->Cell(25, 9, utf8_decode('CUATRIMESTRE: '), 1, 0, 'L', true);
        }
        $this->SetFont('', 'B', 10);
        $this->Cell(25, 9, utf8_decode($data->getNumero()), 1, 0, 'C', false);
        $this->SetFont('', '', 10);
        $this->Cell(30, 9, utf8_decode('Fecha de Ingreso: '), 1, 0, 'L', true);
        $this->SetFont('', 'B', 10);
        $this->Cell(25, 9, utf8_decode($data->getFecIns()->format('d-m-Y')), 1, 0, 'C', false);
        $this->SetFont('', '', 10);
        $this->Cell(20, 9, utf8_decode('Estatus: '), 1, 0, 'L', true);
        $this->SetFont('', 'B', 10);
        $this->Cell(55, 9, utf8_decode($data->getEstatus()->getDesEst()), 1, 0, 'C', false);
        $this->SetFont('', '', 10);
        $this->Ln();
        $this->Cell(20, 9, utf8_decode('Plantel: '), 1, 0, 'L', true);
        $this->SetFont('', 'B', 10);
        $this->Cell(150, 9, utf8_decode($data->getCvePla()->getNomPla()), 1, 0, 'C', false);
        $this->SetFont('', '', 10);
        $this->Ln();
        $this->Cell(40, 9, utf8_decode('Fecha de Registro: '), 1, 0, 'L', true);
        $this->SetFont('', 'B', 10);
        $this->Cell(40, 9, utf8_decode($data->getFecMov()->format('d-m-Y')), 1, 0, 'C', false);
        $this->SetFont('', '', 10);
        $this->Ln();
    }

    function HistorialIngresos($datos, $fA, $fB)
    {
        setlocale(LC_ALL, 'spanish');
        $this->Cell(100, 7, "FECHA INICIAL: " . $fA, 1, 0, 'C', false); // NO CAMBIA
        $this->Cell(100, 7, "FECHA FINAL: " . $fB, 1, 0, 'C', false); // NO CAMBIA
        $this->Ln(); // NO CAMBIA
        $this->SetLeftMargin(10);
        $this->SetRightMargin(10);
        //$this->Ln(-40);
        // Datos
        $fill = false;
        $concepto = "";
        $suma = 0;
        $sumaBanco = 0;
        $sumaTransferencia = 0;
        $sumaTerminal = 0;
        $granSuma = 0;
        $granSumaBanco = 0;
        $granSumaTransferencia = 0;
        $granSumaTerminal = 0;
        $j = 1;
        $tCaja = 0;
        $tBanco = 0;
        $tTransfernecia = 0;
        $tTerminal = 0;
        $granTCaja = 0;
        $granTBanco = 0;
        $granTTransfernecia = 0;
        $granTTerminal = 0;

        if (count($datos) == 0) {
            $this->Cell(0, 7, "NO HAY DATOS", 0, 0, 'C', true); // NO CAMBIA
            $this->Ln(); // NO CAMBIA
        } else {
            foreach ($datos as $row) {
                if ($concepto == $row->getDescripcion()) {
                    //$this->Cell(ancho,alto,texto,borde,no me acuerdo pero ponle 0,alinacion,fondo)
                    $this->Cell(10, 7, $j, 0, 0, 'C', $fill); // NO CAMBIA
                    $this->Cell(30, 7, utf8_decode($row->getCveAlu()->getCveAnterior()), 0, 0, 'C', $fill);
                    $this->Cell(30, 7, utf8_decode($row->getCveAlu()->getCveCtl()), 0, 0, 'C', $fill);
                    $this->Cell(30, 7, utf8_decode($row->getFecMov()->format('d-m-Y')), 0, 0, 'R', $fill);
                    if ($row->getMonto() == null | $row->getMonto() == 0) {
                        $this->Cell(25, 7, utf8_decode("0.00"), 0, 0, 'R', $fill);
                    } else {
                        $this->Cell(25, 7, utf8_decode("$ " . number_format($row->getMonto(), 2, ".", ",")), 0, 0, 'R', $fill);
                    }
                    if ($row->getRecargos() == null | $row->getRecargos() == 0) {
                        $this->Cell(25, 7, utf8_decode("0.00"), 0, 0, 'R', $fill);
                    } else {
                        $this->Cell(25, 7, utf8_decode("$ " . number_format($row->getRecargos(), 2, ".", ",")), 0, 0, 'R', $fill);
                    }
                    $this->Cell(25, 7, utf8_decode("$ " . number_format($row->getTotal(), 2, ".", ",")), 0, 0, 'R', $fill);
                    if ($row->getTipPag() == 1) {
                        $this->Cell(0, 7, utf8_decode("EFECTIVO"), 0, 0, 'R', $fill);
                    } elseif ($row->getTipPag() == 0) {
                        $this->Cell(0, 7, utf8_decode("BOUCHER"), 0, 0, 'R', $fill);
                    } elseif ($row->getTipPag() == 2) {
                        $this->SetFont('', '', 6);
                        $this->Cell(0, 7, utf8_decode("TRANSFERENCIA"), 0, 0, 'R', $fill);
                        $this->SetFont('', '', 8);
                    } elseif ($row->getTipPag() == 3) {
                        $this->Cell(0, 7, utf8_decode("TERMINAL"), 0, 0, 'R', $fill);
                    }
                    $this->Ln(); // NO CAMBIA
                    $fill = !$fill; // NO CAMBIA
                    $j++; // NO CAMBIA
                    if ($row->getTipPag() == 1) { // EFECTIVO
                        $suma = $suma + $row->getTotal();
                        $granSuma = $granSuma + $row->getTotal();
                        $tCaja = $tCaja + 1;
                        $granTCaja = $granTCaja + 1;
                    } elseif ($row->getTipPag() == 0) { // BOUCHER
                        $sumaBanco = $sumaBanco + $row->getTotal();
                        $granSumaBanco = $granSumaBanco + $row->getTotal();
                        $tBanco = $tBanco + 1;
                        $granTBanco = $granTBanco + 1;
                    } elseif ($row->getTipPag() == 2) { // TRANSFERENCIA
                        $sumaTransferencia = $sumaTransferencia + $row->getTotal();
                        $granSumaTransferencia = $granSumaTransferencia + $row->getTotal();
                        $tTransfernecia = $tTransfernecia + 1;
                        $granTTransfernecia = $granTTransfernecia + 1;
                    } elseif ($row->getTipPag() == 3) { // TERMINAL
                        $sumaTerminal = $sumaTerminal + $row->getTotal();
                        $granSumaTerminal = $granSumaTerminal + $row->getTotal();
                        $tTerminal = $tTerminal + 1;
                        $granTTerminal = $granTTerminal + 1;
                    }
                } else {
                    if ($j > 1) {
                        $this->SetFont('', 'B', '');
                        $this->Cell(40, 7, utf8_decode("EFECTIVO = " . $tCaja), 1, 0, 'R', true);
                        $this->Cell(50, 7, utf8_decode("TOTAL EFECTIVO  $ " . number_format($suma, 2, ".", ",")), 1, 0, 'R', true);
                        $this->Cell(35, 7, utf8_decode("BOUCHER = " . $tBanco), 1, 0, 'R', true);
                        $this->Cell(50, 7, utf8_decode("TOTAL BOUCHER  $ " . number_format($sumaBanco, 2, ".", ",")), 1, 0, 'R', true);
                        $this->Ln(); // NO CAMBIA
                        $this->Cell(40, 7, utf8_decode("TRANSFERENCIA = " . $tTransfernecia), 1, 0, 'R', true);
                        $this->Cell(50, 7, utf8_decode("T. TRANSFERENCIA  $ " . number_format($sumaTransferencia, 2, ".", ",")), 1, 0, 'R', true);
                        $this->Cell(35, 7, utf8_decode("TERMINAL = " . $tTerminal), 1, 0, 'R', true);
                        $this->Cell(50, 7, utf8_decode("TOTAL TERMINAL  $ " . number_format($sumaTerminal, 2, ".", ",")), 1, 0, 'R', true);
                        $this->Ln(); // NO CAMBIA
                        $this->SetFont('');
                    }
                    $concepto = $row->getDescripcion();
                    $j = 1;
                    $suma = 0;
                    $tCaja = 0;
                    $sumaBanco = 0;
                    $tBanco = 0;
                    $sumaTransferencia = 0;
                    $tTransfernecia = 0;
                    $sumaTerminal = 0;
                    $tTerminal = 0;

                    // Colores, ancho de línea y fuente en negrita
                    $this->SetFillColor(165, 204, 138); //Fondo verde del table-header
                    $this->SetTextColor(255);
                    $this->SetDrawColor(165, 204, 138); //Linea verde
                    $this->SetLineWidth(.3);
                    $this->SetFont('', 'B', 8);
                    $this->Ln(); // NO CAMBIA
                    $this->Cell(160, 7, utf8_decode($concepto), 0, 0, 'C', true); // NO CAMBIA
                    $this->Ln(); // NO CAMBIA
                    // Cabecera
                    $this->Cell(10, 7, utf8_decode("NP"), 0, 0, 'C', true); // NO CAMBIA
                    $this->Cell(30, 7, utf8_decode("MATRICULA"), 0, 0, 'C', true); // NO CAMBIA
                    $this->Cell(30, 7, utf8_decode("CVE ALUMNOS"), 0, 0, 'C', true); // NO CAMBIA
                    $this->Cell(30, 7, utf8_decode("FEC. DE REGISTRO"), 0, 0, 'C', true); // NO CAMBIA
                    $this->Cell(25, 7, utf8_decode("MONTO"), 0, 0, 'C', true); // NO CAMBIA
                    $this->Cell(25, 7, utf8_decode("RECARGOS"), 0, 0, 'C', true); // NO CAMBIA
                    $this->Cell(25, 7, utf8_decode("TOTAL"), 0, 0, 'C', true); // NO CAMBIA
                    $this->Cell(0, 7, utf8_decode("*"), 0, 0, 'C', true); // NO CAMBIA
                    $this->Ln(); // NO CAMBIA
                    // Restauración de colores y fuentes
                    //$this->SetFillColor(229, 255, 211);
                    $this->SetFillColor(239, 252, 229);
                    $this->SetTextColor(0);
                    $this->SetFont('');

                    //$this->Cell(ancho,alto,texto,borde,no me acuerdo pero ponle 0,alinacion,fondo)
                    $this->Cell(10, 7, $j, 0, 0, 'C', $fill); // NO CAMBIA
                    $this->Cell(30, 7, utf8_decode($row->getCveAlu()->getCveAnterior()), 0, 0, 'C', $fill);
                    $this->Cell(30, 7, utf8_decode($row->getCveAlu()->getCveCtl()), 0, 0, 'C', $fill);
                    $this->Cell(30, 7, utf8_decode($row->getFecMov()->format('d-m-Y')), 0, 0, 'R', $fill);
                    if ($row->getMonto() == null | $row->getMonto() == 0) {
                        $this->Cell(25, 7, utf8_decode("0.00"), 0, 0, 'R', $fill);
                    } else {
                        $this->Cell(25, 7, utf8_decode("$ " . number_format($row->getMonto(), 2, ".", ",")), 0, 0, 'R', $fill);
                    }
                    if ($row->getRecargos() == null | $row->getRecargos() == 0) {
                        $this->Cell(25, 7, utf8_decode("0.00"), 0, 0, 'R', $fill);
                    } else {
                        $this->Cell(25, 7, utf8_decode("$ " . number_format($row->getRecargos(), 2, ".", ",")), 0, 0, 'R', $fill);
                    }
                    $this->Cell(25, 7, utf8_decode("$ " . number_format($row->getTotal(), 2, ".", ",")), 0, 0, 'R', $fill);
                    if ($row->getTipPag() == 1) {
                        $this->Cell(0, 7, utf8_decode("EFECTIVO"), 0, 0, 'R', $fill);
                    } elseif ($row->getTipPag() == 0) {
                        $this->Cell(0, 7, utf8_decode("BOUCHER"), 0, 0, 'R', $fill);
                    } elseif ($row->getTipPag() == 2) {
                        $this->SetFont('', '', 6);
                        $this->Cell(0, 7, utf8_decode("TRANSFERENCIA"), 0, 0, 'R', $fill);
                        $this->SetFont('', '', 8);
                    } elseif ($row->getTipPag() == 3) {
                        $this->Cell(0, 7, utf8_decode("TERMINAL"), 0, 0, 'R', $fill);
                    }
                    $this->Ln(); // NO CAMBIA
                    $fill = !$fill; // NO CAMBIA
                    $j++; // NO CAMBIA

                    if ($row->getTipPag() == 1) { // EFECTIVO
                        $suma = $suma + $row->getTotal();
                        $granSuma = $granSuma + $row->getTotal();
                        $tCaja = $tCaja + 1;
                        $granTCaja = $granTCaja + 1;
                    } elseif ($row->getTipPag() == 0) { // BOUCHER
                        $sumaBanco = $sumaBanco + $row->getTotal();
                        $granSumaBanco = $granSumaBanco + $row->getTotal();
                        $tBanco = $tBanco + 1;
                        $granTBanco = $granTBanco + 1;
                    } elseif ($row->getTipPag() == 2) { // TRANSFERENCIA
                        $sumaTransferencia = $sumaTransferencia + $row->getTotal();
                        $granSumaTransferencia = $granSumaTransferencia + $row->getTotal();
                        $tTransfernecia = $tTransfernecia + 1;
                        $granTTransfernecia = $granTTransfernecia + 1;
                    } elseif ($row->getTipPag() == 3) { // TERMINAL
                        $sumaTerminal = $sumaTerminal + $row->getTotal();
                        $granSumaTerminal = $granSumaTerminal + $row->getTotal();
                        $tTerminal = $tTerminal + 1;
                        $granTTerminal = $granTTerminal + 1;
                    }
                }
            }
            if ($j > 1) {
                $this->SetFont('', 'B', '');
                $this->Cell(40, 7, utf8_decode("EFECTIVO = " . $tCaja), 1, 0, 'R', true);
                $this->Cell(50, 7, utf8_decode("TOTAL EFECTIVO  $ " . number_format($suma, 2, ".", ",")), 1, 0, 'R', true);
                $this->Cell(35, 7, utf8_decode("BOUCHER = " . $tBanco), 1, 0, 'R', true);
                $this->Cell(50, 7, utf8_decode("TOTAL BOUCHER  $ " . number_format($sumaBanco, 2, ".", ",")), 1, 0, 'R', true);
                $this->Ln(); // NO CAMBIA
                $this->Cell(40, 7, utf8_decode("TRANSFERENCIA = " . $tTransfernecia), 1, 0, 'R', true);
                $this->Cell(50, 7, utf8_decode("T. TRANSFERENCIA  $ " . number_format($sumaTransferencia, 2, ".", ",")), 1, 0, 'R', true);
                $this->Cell(35, 7, utf8_decode("TERMINAL = " . $tTerminal), 1, 0, 'R', true);
                $this->Cell(50, 7, utf8_decode("TOTAL TERMINAL  $ " . number_format($sumaTerminal, 2, ".", ",")), 1, 0, 'R', true);
                $this->Ln(); // NO CAMBIA
                $this->SetFont('');
            }
        }

        // Línea de cierre
        $this->SetFont('', 'B', '10');
        $this->AddPage();
        $this->Ln();
        $this->Cell(0, 2, utf8_decode(""), 1, 0, 'R', true);
        $this->Ln();
        $this->Cell(0, 5, utf8_decode("TOTALES TOTALES"), 1, 0, 'C', false);
        $this->Ln();
        $this->Cell(0, 2, utf8_decode(""), 1, 0, 'R', true);
        $this->Ln();
        $this->SetFont('', 'B', '');
        $this->Cell(45, 7, utf8_decode("EFECTIVO = " . $granTCaja), 1, 0, 'R', true);
        $this->Cell(60, 7, utf8_decode("TOTAL EFECTIVO  $ " . number_format($granSuma, 2, ".", ",")), 1, 0, 'R', true);
        $this->Cell(35, 7, utf8_decode("BOUCHER = " . $granTBanco), 1, 0, 'R', true);
        $this->Cell(0, 7, utf8_decode("TOTAL BOUCHER  $ " . number_format($granSumaBanco, 2, ".", ",")), 1, 0, 'R', true);
        $this->Ln(); // NO CAMBIA
        $this->Cell(45, 7, utf8_decode("TRANSFERENCIA = " . $granTTransfernecia), 1, 0, 'R', true);
        $this->Cell(60, 7, utf8_decode("T. TRANSFERENCIA  $ " . number_format($granSumaTransferencia, 2, ".", ",")), 1, 0, 'R', true);
        $this->Cell(35, 7, utf8_decode("TERMINAL = " . $granTTerminal), 1, 0, 'R', true);
        $this->Cell(0, 7, utf8_decode("TOTAL TERMINAL  $ " . number_format($granSumaTerminal, 2, ".", ",")), 1, 0, 'R', true);
        $this->Ln(); // NO CAMBIA
        $this->Cell(0, 2, utf8_decode(""), 1, 0, 'R', true);
        $this->Ln();
        $this->Cell(0, 5, utf8_decode(""), 1, 0, 'C', false);
        $this->Ln();
        $this->Cell(0, 2, utf8_decode(""), 1, 0, 'R', true);
        $this->Ln();
    }

    function HistorialIngresosDetalles($datos, $fA, $fB, $plantel)
    {
        $this->SetAutoPageBreak(true, 10);
        setlocale(LC_ALL, 'spanish');
        $this->Cell(100, 7, "FECHA INICIAL: " . $fA, 1, 0, 'C', false); // NO CAMBIA
        $this->Cell(100, 7, "FECHA FINAL: " . $fB, 1, 0, 'C', false); // NO CAMBIA
        $this->Ln(); // NO CAMBIA
        $this->SetLeftMargin(10);
        $this->SetRightMargin(10);
        $this->SetAutoPageBreak('auto', 25);
        //$this->Ln(-40);
        // Datos
        $fill = false;
        $concepto = "";
        $sumaConcepto = 0;
        $sumaRecargosConcepto = 0;
        $suma = 0;
        $sumaBanco = 0;
        $sumaTransferencia = 0;
        $sumaTerminal = 0;
        $granSuma = 0;
        $granSumaBanco = 0;
        $granSumaTransferencia = 0;
        $granSumaTerminal = 0;
        $j = 1;
        $tCaja = 0;
        $tBanco = 0;
        $tTransfernecia = 0;
        $tTerminal = 0;
        $granTCaja = 0;
        $granTBanco = 0;
        $granTTransfernecia = 0;
        $granTTerminal = 0;

        $this->Cell(0, 7, utf8_decode("PLANTEL: " . $plantel), 0, 0, 'C', false); // NO CAMBIA

        if (count($datos) == 0) {
            $this->Ln();
            $this->SetFillColor(165, 204, 138); //Fondo verde del table-header
            $this->Cell(0, 7, "NO HAY DATOS", 0, 0, 'C', true); // NO CAMBIA
            $this->Ln(); // NO CAMBIA
        } else {
            foreach ($datos as $row) {
                if ($concepto == $row->getDescripcion()) {
                    //$this->Cell(ancho,alto,texto,borde,no me acuerdo pero ponle 0,alinacion,fondo)
                    $this->Cell(5, 7, $j, 1, 0, 'C', $fill); // NO CAMBIA
                    $this->Cell(16, 7, utf8_decode($row->getFecMov()->format('d-m-Y')), 1, 0, 'C', $fill);
                    $this->SetFont('', '', '6');
                    $this->Cell(15, 7, utf8_decode($row->getCveUsu()), 1, 0, 'C', $fill);
                    $this->SetFont('', 'B', '8');
                    $this->Cell(15, 7, utf8_decode($row->getNumRecibo()), 1, 0, 'R', $fill);
                    $this->SetFont('', '', '8');
                    $this->Cell(15, 7, utf8_decode($row->getCveAlu()->getCveCtl()), 1, 0, 'R', $fill);
                    /*
                    $nombre = $row->getCveAlu()->getNomAlu() . " " . $row->getCveAlu()->getApePat() . " " . $row->getCveAlu()->getApeMat();
                    if (strlen($nombre) > 30) {
                        $this->SetFont('', '', '7');
                        $this->Cell(63, 7, utf8_decode($row->getCveAlu()->getNomAlu() . " " . $row->getCveAlu()->getApePat() . " " . $row->getCveAlu()->getApeMat()), 1, 0, 'L', $fill);
                        $this->SetFont('', '', '8');
                    } else {
                        $this->Cell(63, 7, utf8_decode($row->getCveAlu()->getNomAlu() . " " . $row->getCveAlu()->getApePat() . " " . $row->getCveAlu()->getApeMat()), 1, 0, 'L', $fill);
                    }
                    */
                    $this->SetFont('', '', '6');
                    $this->Cell(78, 7, utf8_decode($row->getReferencia()), 1, 0, 'R', $fill);
                    $this->SetFont('', '', '8');
                    $this->Cell(18, 7, utf8_decode("$ " . number_format($row->getTotal() - $row->getRecargos(), 2, ".", ",")), 1, 0, 'R', $fill);
                    $this->Cell(15, 7, utf8_decode("$ " . number_format($row->getRecargos(), 2, ".", ",")), 1, 0, 'R', $fill);
                    if ($row->getTipPag() == 1) {
                        $this->SetFont('', 'B', '');
                        $this->Cell(0, 7, utf8_decode("EFECTIVO"), 1, 0, 'R', $fill);
                        $this->SetFont('');
                    } elseif ($row->getTipPag() == 0) {
                        $this->Cell(0, 7, utf8_decode("BOUCHER"), 1, 0, 'R', $fill);
                    } elseif ($row->getTipPag() == 2) {
                        $this->SetFont('', '', 6);
                        $this->Cell(0, 7, utf8_decode("TRANSFERENCIA"), 1, 0, 'R', $fill);
                        $this->SetFont('', '', 8);
                    } elseif ($row->getTipPag() == 3) {
                        $this->Cell(0, 7, utf8_decode("TERMINAL"), 1, 0, 'R', $fill);
                    }
                    $this->Ln(); // NO CAMBIA
                    $fill = !$fill; // NO CAMBIA
                    $j++; // NO CAMBIA
                    $sumaConcepto = $sumaConcepto + $row->getTotal();
                    $sumaRecargosConcepto = $sumaRecargosConcepto + $row->getRecargos();
                    if ($row->getTipPag() == 1) { // EFECTIVO
                        $suma = $suma + $row->getTotal();
                        $granSuma = $granSuma + $row->getTotal();
                        $tCaja = $tCaja + 1;
                        $granTCaja = $granTCaja + 1;
                    } elseif ($row->getTipPag() == 0) { // BOUCHER
                        $sumaBanco = $sumaBanco + $row->getTotal();
                        $granSumaBanco = $granSumaBanco + $row->getTotal();
                        $tBanco = $tBanco + 1;
                        $granTBanco = $granTBanco + 1;
                    } elseif ($row->getTipPag() == 2) { // TRANSFERENCIA
                        $sumaTransferencia = $sumaTransferencia + $row->getTotal();
                        $granSumaTransferencia = $granSumaTransferencia + $row->getTotal();
                        $tTransfernecia = $tTransfernecia + 1;
                        $granTTransfernecia = $granTTransfernecia + 1;
                    } elseif ($row->getTipPag() == 3) { // TERMINAL
                        $sumaTerminal = $sumaTerminal + $row->getTotal();
                        $granSumaTerminal = $granSumaTerminal + $row->getTotal();
                        $tTerminal = $tTerminal + 1;
                        $granTTerminal = $granTTerminal + 1;
                    }
                } else {
                    if ($j > 1) {
                        $this->SetFont('', 'B', '');
                        $this->Cell(0, 0, "", 1, 0, 'C', false);
                        $this->Ln();
                        $this->Cell(144, 7, "TOTAL", "R", 0, 'R', false);
                        $this->Cell(18, 7, "$" . number_format(($sumaConcepto - $sumaRecargosConcepto), 2, ".", ","), 1, 0, 'R', false);
                        $this->Cell(15, 7, "$" . number_format($sumaRecargosConcepto, 2, ".", ","), 1, 0, 'R', false);
                        $this->Ln();
                        $this->Cell(0, 1, "", 1, 0, 'C', false);
                        $this->Ln();
                        $this->Cell(40, 7, utf8_decode("EFECTIVO = " . $tCaja), 1, 0, 'R', true);
                        $this->Cell(60, 7, utf8_decode("TOTAL EFECTIVO  $ " . number_format($suma, 2, ".", ",")), 1, 0, 'R', true);
                        $this->Cell(10, 7, "", 0, 0, 'R', false);
                        $this->Cell(35, 7, utf8_decode("BOUCHER = " . $tBanco), 1, 0, 'R', true);
                        //$this->Cell(50, 7, utf8_decode("TOTAL BOUCHER  $ " . number_format($sumaBanco, 2, ".", ",")), 1, 0, 'R', true);
                        $this->Cell(0, 7, utf8_decode("TOTAL BOUCHER  $ " . number_format($sumaBanco, 2, ".", ",")), 1, 0, 'R', true);
                        $this->Ln(); // NO CAMBIA
                        $this->Cell(40, 7, utf8_decode("TRANSFERENCIA = " . $tTransfernecia), 1, 0, 'R', true);
                        $this->Cell(60, 7, utf8_decode("T. TRANSFERENCIA  $ " . number_format($sumaTransferencia, 2, ".", ",")), 1, 0, 'R', true);
                        $this->Cell(10, 7, "", 0, 0, 'R', false);
                        $this->Cell(35, 7, utf8_decode("TERMINAL = " . $tTerminal), 1, 0, 'R', true);
                        //$this->Cell(50, 7, utf8_decode("TOTAL TERMINAL  $ " . number_format($sumaTerminal, 2, ".", ",")), 1, 0, 'R', true);
                        $this->Cell(0, 7, utf8_decode("TOTAL TERMINAL  $ " . number_format($sumaTerminal, 2, ".", ",")), 1, 0, 'R', true);

                        $this->Ln(); // NO CAMBIA
                        $this->SetFont('');
                    }
                    $concepto = $row->getDescripcion();
                    $sumaConcepto = 0;
                    $sumaRecargosConcepto = 0;
                    $j = 1;
                    $suma = 0;
                    $tCaja = 0;
                    $sumaBanco = 0;
                    $tBanco = 0;
                    $sumaTransferencia = 0;
                    $tTransfernecia = 0;
                    $sumaTerminal = 0;
                    $tTerminal = 0;

                    // Colores, ancho de línea y fuente en negrita
                    $this->SetFillColor(165, 204, 138); //Fondo verde del table-header
                    $this->SetTextColor(0);
                    $this->SetDrawColor(165, 204, 138); //Linea verde
                    $this->SetLineWidth(.3);
                    $this->SetFont('', 'B', 8);
                    $this->Ln(); // NO CAMBIA
                    $this->Cell(0, 7, utf8_decode($concepto), 1, 0, 'C', false); // NO CAMBIA
                    $this->Ln(); // NO CAMBIA
                    // Cabecera
                    $this->SetTextColor(255);
                    $this->Cell(5, 7, utf8_decode("NP"), 1, 0, 'C', true); // NO CAMBIA
                    $this->Cell(16, 7, utf8_decode("FECHA"), 1, 0, 'C', true); // NO CAMBIA
                    $this->SetFont('', '', '6');
                    $this->Cell(15, 7, utf8_decode("USUARIO"), 1, 0, 'C', true); // NO CAMBIA
                    $this->SetFont('', '', '8');
                    $this->Cell(15, 7, utf8_decode("RECIBO"), 1, 0, 'C', true); // NO CAMBIA
                    $this->Cell(15, 7, utf8_decode("CVE CTL"), 1, 0, 'C', true); // NO CAMBIA
                    $this->Cell(78, 7, utf8_decode("REF"), 1, 0, 'C', true); // NO CAMBIA
                    $this->Cell(18, 7, utf8_decode("MONTO"), 1, 0, 'C', true); // NO CAMBIA
                    $this->Cell(15, 7, utf8_decode("REC."), 1, 0, 'C', true); // NO CAMBIA
                    $this->Cell(0, 7, utf8_decode("*"), 1, 0, 'C', true); // NO CAMBIA
                    $this->Ln(); // NO CAMBIA
                    // Restauración de colores y fuentes
                    //$this->SetFillColor(229, 255, 211);
                    $this->SetFillColor(239, 252, 229);
                    $this->SetTextColor(0);
                    $this->SetFont('');

                    //$this->Cell(ancho,alto,texto,borde,no me acuerdo pero ponle 0,alinacion,fondo)
                    $this->Cell(5, 7, $j, 1, 0, 'C', $fill); // NO CAMBIA
                    $this->Cell(16, 7, utf8_decode($row->getFecMov()->format('d-m-Y')), 1, 0, 'C', $fill);
                    $this->SetFont('', '', '6');
                    $this->Cell(15, 7, utf8_decode($row->getCveUsu()), 1, 0, 'C', $fill);
                    $this->SetFont('', 'B', '8');
                    $this->Cell(15, 7, utf8_decode($row->getNumRecibo()), 1, 0, 'R', $fill);
                    $this->SetFont('', '', '8');
                    $this->Cell(15, 7, utf8_decode($row->getCveAlu()->getCveCtl()), 1, 0, 'R', $fill);
                    /*
                    $nombre = $row->getCveAlu()->getNomAlu() . " " . $row->getCveAlu()->getApePat() . " " . $row->getCveAlu()->getApeMat();
                    if (strlen($nombre) > 30) {
                        $this->SetFont('', '', '7');
                        $this->Cell(63, 7, utf8_decode($row->getCveAlu()->getNomAlu() . " " . $row->getCveAlu()->getApePat() . " " . $row->getCveAlu()->getApeMat()), 1, 0, 'L', $fill);
                        $this->SetFont('', '', '8');
                    } else {
                        $this->Cell(63, 7, utf8_decode($row->getCveAlu()->getNomAlu() . " " . $row->getCveAlu()->getApePat() . " " . $row->getCveAlu()->getApeMat()), 1, 0, 'L', $fill);
                    }
                    */
                    $this->SetFont('', '', '6');
                    $this->Cell(78, 7, utf8_decode($row->getReferencia()), 1, 0, 'R', $fill);
                    $this->SetFont('', '', '8');
                    $this->Cell(18, 7, utf8_decode("$ " . number_format($row->getTotal() - $row->getRecargos(), 2, ".", ",")), 1, 0, 'R', $fill);
                    $this->Cell(15, 7, utf8_decode("$ " . number_format($row->getRecargos(), 2, ".", ",")), 1, 0, 'R', $fill);
                    if ($row->getTipPag() == 1) {
                        $this->SetFont('', 'B', '');
                        $this->Cell(0, 7, utf8_decode("EFECTIVO"), 1, 0, 'R', $fill);
                        $this->SetFont('');
                    } elseif ($row->getTipPag() == 0) {
                        $this->Cell(0, 7, utf8_decode("BOUCHER"), 1, 0, 'R', $fill);
                    } elseif ($row->getTipPag() == 2) {
                        $this->SetFont('', '', 6);
                        $this->Cell(0, 7, utf8_decode("TRANSFERENCIA"), 1, 0, 'R', $fill);
                        $this->SetFont('', '', 8);
                    } elseif ($row->getTipPag() == 3) {
                        $this->Cell(0, 7, utf8_decode("TERMINAL"), 1, 0, 'R', $fill);
                    }
                    $this->Ln(); // NO CAMBIA
                    $fill = !$fill; // NO CAMBIA
                    $j++; // NO CAMBIA
                    $sumaConcepto = $sumaConcepto + $row->getTotal();
                    $sumaRecargosConcepto = $sumaRecargosConcepto + $row->getRecargos();
                    if ($row->getTipPag() == 1) { // EFECTIVO
                        $suma = $suma + $row->getTotal();
                        $granSuma = $granSuma + $row->getTotal();
                        $tCaja = $tCaja + 1;
                        $granTCaja = $granTCaja + 1;
                    } elseif ($row->getTipPag() == 0) { // BOUCHER
                        $sumaBanco = $sumaBanco + $row->getTotal();
                        $granSumaBanco = $granSumaBanco + $row->getTotal();
                        $tBanco = $tBanco + 1;
                        $granTBanco = $granTBanco + 1;
                    } elseif ($row->getTipPag() == 2) { // TRANSFERENCIA
                        $sumaTransferencia = $sumaTransferencia + $row->getTotal();
                        $granSumaTransferencia = $granSumaTransferencia + $row->getTotal();
                        $tTransfernecia = $tTransfernecia + 1;
                        $granTTransfernecia = $granTTransfernecia + 1;
                    } elseif ($row->getTipPag() == 3) { // TERMINAL
                        $sumaTerminal = $sumaTerminal + $row->getTotal();
                        $granSumaTerminal = $granSumaTerminal + $row->getTotal();
                        $tTerminal = $tTerminal + 1;
                        $granTTerminal = $granTTerminal + 1;
                    }
                }
            }
            if ($j > 1) {
                $this->SetFont('', 'B', '');
                $this->Cell(0, 0, "", 1, 0, 'C', false);
                $this->Ln();
                $this->Cell(144, 7, "TOTAL", "R", 0, 'R', false);
                $this->Cell(18, 7, "$" . number_format(($sumaConcepto - $sumaRecargosConcepto), 2, ".", ","), 1, 0, 'R', false);
                $this->Cell(15, 7, "$" . number_format($sumaRecargosConcepto, 2, ".", ","), 1, 0, 'R', false);
                $this->Ln();
                $this->Cell(0, 1, "", 1, 0, 'C', false);
                $this->Ln();
                $this->Cell(40, 7, utf8_decode("EFECTIVO = " . $tCaja), 1, 0, 'R', true);
                $this->Cell(60, 7, utf8_decode("TOTAL EFECTIVO  $ " . number_format($suma, 2, ".", ",")), 1, 0, 'R', true);
                $this->Cell(10, 7, "", 0, 0, 'R', false);
                $this->Cell(35, 7, utf8_decode("BOUCHER = " . $tBanco), 1, 0, 'R', true);
                $this->Cell(0, 7, utf8_decode("TOTAL BOUCHER  $ " . number_format($sumaBanco, 2, ".", ",")), 1, 0, 'R', true);
                $this->Ln(); // NO CAMBIA
                $this->Cell(40, 7, utf8_decode("TRANSFERENCIA = " . $tTransfernecia), 1, 0, 'R', true);
                $this->Cell(60, 7, utf8_decode("T. TRANSFERENCIA  $ " . number_format($sumaTransferencia, 2, ".", ",")), 1, 0, 'R', true);
                $this->Cell(10, 7, "", 0, 0, 'R', false);
                $this->Cell(35, 7, utf8_decode("TERMINAL = " . $tTerminal), 1, 0, 'R', true);
                $this->Cell(0, 7, utf8_decode("TOTAL TERMINAL  $ " . number_format($sumaTerminal, 2, ".", ",")), 1, 0, 'R', true);
                $this->Ln(); // NO CAMBIA
                $this->SetFont('');

            }

            // Línea de cierre
            $this->SetFont('', 'B', '10');
            $this->AddPage();
            $this->Ln();
            $this->Cell(0, 2, utf8_decode(""), 1, 0, 'R', true);
            $this->Ln();
            $this->Cell(0, 5, utf8_decode("TOTALES TOTALES"), 1, 0, 'C', false);
            $this->Ln();
            $this->Cell(0, 2, utf8_decode(""), 1, 0, 'R', true);
            $this->Ln();
            $this->SetFont('', 'B', '');
            $this->Cell(45, 7, utf8_decode("EFECTIVO = " . $granTCaja), 1, 0, 'R', true);
            $this->Cell(60, 7, utf8_decode("TOTAL EFECTIVO  $ " . number_format($granSuma, 2, ".", ",")), 1, 0, 'R', true);
            $this->Cell(35, 7, utf8_decode("BOUCHER = " . $granTBanco), 1, 0, 'R', true);
            $this->Cell(0, 7, utf8_decode("TOTAL BOUCHER  $ " . number_format($granSumaBanco, 2, ".", ",")), 1, 0, 'R', true);
            $this->Ln(); // NO CAMBIA
            $this->Cell(45, 7, utf8_decode("TRANSFERENCIA = " . $granTTransfernecia), 1, 0, 'R', true);
            $this->Cell(60, 7, utf8_decode("T. TRANSFERENCIA  $ " . number_format($granSumaTransferencia, 2, ".", ",")), 1, 0, 'R', true);
            $this->Cell(35, 7, utf8_decode("TERMINAL = " . $granTTerminal), 1, 0, 'R', true);
            $this->Cell(0, 7, utf8_decode("TOTAL TERMINAL  $ " . number_format($granSumaTerminal, 2, ".", ",")), 1, 0, 'R', true);
            $this->Ln(); // NO CAMBIA
            $this->Cell(0, 2, utf8_decode(""), 1, 0, 'R', true);
            $this->Ln();
            $this->Cell(0, 5, utf8_decode(""), 1, 0, 'C', false);
            $this->Ln();
            $this->Cell(0, 2, utf8_decode(""), 1, 0, 'R', true);
            $this->Ln();
            $this->ingresosTitutlacion = $granSuma;
        }
    }

    function historialIngresosMatriculacion($datos)
    {
        $this->AddPage();
        $this->SetFont('', 'B', '10');
        $this->Cell(0, 10, utf8_decode("INGRESOS MATRICULACIÓN"), 0, 0, "C", false);
        $this->Ln();
        $this->SetFont('', '', '8');
        $nomPla = "";
        $auxFecha = "";
        $this->SetDrawColor(97, 97, 97);
        $this->SetFillColor(112, 174, 57);

        $granSuma = 0;
        $granSumaBanco = 0;
        $granSumaTransferencia = 0;
        $granSumaTerminal = 0;
        $tCaja = 0;
        $tBanco = 0;
        $tTransfernecia = 0;
        $tTerminal = 0;
        $granTCaja = 0;
        $granTBanco = 0;
        $granTTransfernecia = 0;
        $granTTerminal = 0;

        foreach ($datos as $i => $d) {
            $fill = false;
            $this->Cell(5, 6, utf8_decode($i + 1), 1, 0, "C", false);

            if ($auxFecha != $d['fecMov']->format('d-m-Y')) {
                $auxFecha = $d['fecMov']->format('d-m-Y');
                $this->SetFont('', 'B', '8');
                $this->Cell(20, 6, utf8_decode($d['fecMov']->format('d-m-Y')), 1, 0, "C", true);
            } else {
                $this->SetFont('', '', '8');
                $this->Cell(20, 6, utf8_decode($d['fecMov']->format('d-m-Y')), 1, 0, "C", false);
            }
            /*
            $this->SetFont('', 'B', '8');
            $this->Cell(15, 6, utf8_decode("PLANTEL"), 1, 0, "C", false);
            $this->SetFont('', '', '8');
            $this->Cell(0, 6, utf8_decode($d['nomPla']), 1, 0, "C", false);
            $this->Ln();
            $this->Cell(5, 6, utf8_decode(""), 0, 0, "C", false);
            */

            $this->SetFont('', '', '8');
            $this->Cell(20, 6, utf8_decode($d['numRecibo']), 1, 0, "C", false);
            $this->SetFont('', 'B', '8');
            $this->Cell(10, 6, utf8_decode("MES"), 1, 0, "C", false);
            $this->SetFont('', '', '8');
            $this->Cell(28, 6, utf8_decode($d['mesMatriculacion'] . " " . $d['anioMatriculacion']), 1, 0, "L", false);
            $this->SetFont('', '', '6');
            $this->Cell(70, 6, utf8_decode($d['referencia']), 1, 0, "L", false);

            $this->SetFont('', '', '8');
            $this->Cell(20, 6, utf8_decode("$ " . number_format($d['total'], 2, ".", ",")), 1, 0, "R", false);
            if ($d['tipPag'] == 1) {
                $this->SetFont('', 'B', '');
                $this->Cell(0, 6, utf8_decode("EFECTIVO"), 1, 0, 'R', $fill);

                $this->SetFont('');
                $granSuma = $granSuma + $d['total'];
                $tCaja = $tCaja + 1;
                $granTCaja = $granTCaja + 1;
            } elseif ($d['tipPag'] == 0) {
                $this->Cell(0, 6, utf8_decode("BOUCHER"), 1, 0, 'R', $fill);

                $granSumaBanco = $granSumaBanco + $d['total'];
                $tBanco = $tBanco + 1;
                $granTBanco = $granTBanco + 1;
            } elseif ($d['tipPag'] == 2) {
                $this->SetFont('', '', 6);
                $this->Cell(0, 6, utf8_decode("TRANSFERENCIA"), 1, 0, 'R', $fill);
                $this->SetFont('', '', 8);

                $granSumaTransferencia = $granSumaTransferencia + $d['total'];
                $tTransfernecia = $tTransfernecia + 1;
                $granTTransfernecia = $granTTransfernecia + 1;
            } elseif ($d['tipPag'] == 3) {
                $this->Cell(0, 6, utf8_decode("TERMINAL"), 1, 0, 'R', $fill);

                $granSumaTerminal = $granSumaTerminal + $d['total'];
                $tTerminal = $tTerminal + 1;
                $granTTerminal = $granTTerminal + 1;
            }

            $this->Ln();
        }

        // Línea de cierre
        $this->SetFont('', 'B', '10');
        $this->AddPage();
        $this->Ln();
        $this->Cell(0, 2, utf8_decode(""), 1, 0, 'R', true);
        $this->Ln();
        $this->Cell(0, 5, utf8_decode("TOTALES TOTALES"), 1, 0, 'C', false);
        $this->Ln();
        $this->Cell(0, 2, utf8_decode(""), 1, 0, 'R', true);
        $this->Ln();
        $this->SetFont('', 'B', '');
        $this->Cell(45, 7, utf8_decode("EFECTIVO = " . $granTCaja), 1, 0, 'R', true);
        $this->Cell(60, 7, utf8_decode("TOTAL EFECTIVO  $ " . number_format($granSuma, 2, ".", ",")), 1, 0, 'R', true);
        $this->Cell(35, 7, utf8_decode("BOUCHER = " . $granTBanco), 1, 0, 'R', true);
        $this->Cell(0, 7, utf8_decode("TOTAL BOUCHER  $ " . number_format($granSumaBanco, 2, ".", ",")), 1, 0, 'R', true);
        $this->Ln(); // NO CAMBIA
        $this->Cell(45, 7, utf8_decode("TRANSFERENCIA = " . $granTTransfernecia), 1, 0, 'R', true);
        $this->Cell(60, 7, utf8_decode("T. TRANSFERENCIA  $ " . number_format($granSumaTransferencia, 2, ".", ",")), 1, 0, 'R', true);
        $this->Cell(35, 7, utf8_decode("TERMINAL = " . $granTTerminal), 1, 0, 'R', true);
        $this->Cell(0, 7, utf8_decode("TOTAL TERMINAL  $ " . number_format($granSumaTerminal, 2, ".", ",")), 1, 0, 'R', true);
        $this->Ln(); // NO CAMBIA
        $this->ingresosMatricualcion = $granSuma;
        $this->Cell(0, 2, utf8_decode(""), 1, 0, 'R', true);
        $this->Ln();
        $this->Cell(0, 5, utf8_decode(""), 1, 0, 'C', false);
        $this->Ln();
        $this->Cell(0, 2, utf8_decode(""), 1, 0, 'R', true);

        $this->Ln(40);
        $this->Cell(0, 2, utf8_decode(""), 1, 0, 'R', true);
        $this->Ln();
        $this->Cell(0, 5, utf8_decode("CORTE EFECTIVO"), 1, 0, 'C', false);
        $this->Ln();
        $this->Cell(0, 2, utf8_decode(""), 1, 0, 'R', true);
        $this->Ln();
        $this->SetFont('', 'B', '');
        $this->Cell(60, 7, utf8_decode("EFECTIVO TITULACIÓN"), 1, 0, 'R', true);
        $this->Cell(60, 7, utf8_decode("$ " . number_format($this->ingresosTitutlacion, 2, ".", ",")), 1, 0, 'R', false);
        $this->Ln();
        $this->SetFont('', 'B', '');
        $this->Cell(60, 7, utf8_decode("EFECTIVO MATRICUALCIÓN"), 1, 0, 'R', true);
        $this->Cell(60, 7, utf8_decode(" $ " . number_format($this->ingresosMatricualcion, 2, ".", ",")), 1, 0, 'R', false);
        $this->Ln();
        $this->SetFont('', 'B', '');
        $this->Cell(60, 7, utf8_decode("TOTAL EFECTIVO"), 1, 0, 'R', true);
        $this->Cell(60, 7, utf8_decode(" $ " . number_format(($this->ingresosTitutlacion + $this->ingresosMatricualcion), 2, ".", ",")), 1, 0, 'R', false);
    }

    function listaAlumnos($alumnos, $lic, $pla)
    {
        $this->Ln(-8);
        // EMPIEZA OTROS
        $this->SetLeftMargin(10);
        $this->SetRightMargin(10);
        $this->SetFont('', 'B', 10);
        if ($lic->getCveNivAca()->getideNivAca() == 1) {
            $this->Cell(100, 7, utf8_decode("BACHILLERATO:"), 0, 0, 'R', FALSE);
        } elseif ($lic->getCveNivAca()->getideNivAca() == 2) {
            $this->Cell(100, 7, utf8_decode("BACHILLERATO EXAMEN ÚNICO:"), 0, 0, 'R', FALSE);
        } elseif ($lic->getCveNivAca()->getideNivAca() == 3) {
            $this->Cell(100, 7, utf8_decode("LICENCIATURA: " . $lic->getNomLic()), 0, 0, 'R', FALSE);
        } elseif ($lic->getCveNivAca()->getideNivAca() == 4) {
            $this->Cell(100, 7, utf8_decode("MAESTRÍA: " . $lic->getNomLic()), 0, 0, 'R', FALSE);
        } elseif ($lic->getCveNivAca()->getideNivAca() == 5) {
            $this->Cell(100, 7, utf8_decode("DOCTORADO: " . $lic->getNomLic()), 0, 0, 'R', FALSE);
        } elseif ($lic->getCveNivAca()->getideNivAca() == 6) {
            $this->Cell(100, 7, utf8_decode("TITULACIÓN: " . $lic->getNomLic()), 0, 0, 'R', FALSE);
        }
        $this->Cell(100, 7, utf8_decode("PLANTEL: " . $pla->getNomPla()), 0, 0, 'R', FALSE);

        $this->Ln(10);
        $this->SetFont('', 'B', 10);
        $this->Cell(0, 7, utf8_decode("LISTA GENERAL"), 0, 0, 'C', FALSE);
        $this->Ln();
        $this->SetFont('', '', 8);

        $this->Cell(5, 5, utf8_decode(""), "LT", 0, 'C', FALSE);
        $this->Cell(30, 5, utf8_decode(""), 1, 0, 'C', FALSE);
        $this->Cell(70, 5, utf8_decode(""), "TR", 0, 'L', FALSE);
        $this->Cell(1, 5, utf8_decode(""), 0, 0, 'C', FALSE);
        $this->Cell(25, 5, utf8_decode("NÚMERO"), 1, 0, 'C', FALSE);
        $this->Cell(1, 5, utf8_decode(""), 0, 0, 'C', FALSE);
        $this->Cell(0, 5, utf8_decode("OBSERVACIONES"), 1, 0, 'C', FALSE);
        $this->Ln();
        $this->Cell(5, 5, utf8_decode(""), "L", 0, 'C', FALSE);
        $this->Cell(30, 5, utf8_decode("CVE. CTL."), 1, 0, 'C', FALSE);
        $this->Cell(70, 5, utf8_decode("NOMBRE DEL ALUMNO"), "R", 0, 'L', FALSE);
        $this->Cell(1, 5, utf8_decode(""), 0, 0, 'C', FALSE);
        $this->Cell(25, 5, utf8_decode("SEMESTRE"), 1, 0, 'C', FALSE);
        $this->Cell(1, 5, utf8_decode(""), 0, 0, 'C', FALSE);
        $this->Cell(0, 5, utf8_decode(""), 1, 0, 'C', FALSE);
        $this->Ln();
        $this->Cell(5, 5, utf8_decode(""), "LB", 0, 'C', FALSE);
        $this->Cell(30, 5, utf8_decode(""), 1, 0, 'C', FALSE);
        $this->Cell(70, 5, utf8_decode(""), "BR", 0, 'L', FALSE);
        $this->Cell(1, 5, utf8_decode(""), 0, 0, 'C', FALSE);
        $this->Cell(25, 5, utf8_decode("CUATRIMESTRE"), 1, 0, 'C', FALSE);
        $this->Cell(1, 5, utf8_decode(""), 0, 0, 'C', FALSE);
        $this->Cell(0, 5, utf8_decode(""), 1, 0, 'C', FALSE);


        $this->Ln(8);
        $cK = 0;
        $numero = 0;
        $indice = 0;
        foreach ($alumnos as $key => $v) {
            if ($numero == $v->getNumero()) {

            } else {
                if ($key > 0) {
                    $this->AddPage();
                }

                $numero = $v->getNumero();
                $indice = 0;
            }
            $indice++;
            $this->Cell(5, 5, utf8_decode($indice), 1, 0, 'C', FALSE);
            $this->Cell(30, 5, utf8_decode($v->getCveCtl()), 1, 0, 'C', FALSE);
            $this->Cell(70, 5, utf8_decode($v->getApePat() . " " . $v->getApeMat() . " " . $v->getNomAlu()), 1, 0, 'L', FALSE);
            $this->Cell(1, 5, utf8_decode(""), 0, 0, 'C', FALSE);
            $this->Cell(12.5, 5, utf8_decode($v->getNumero()), 1, 0, 'C', FALSE);
            $this->Cell(12.5, 5, utf8_decode(""), 1, 0, 'C', FALSE);
            $this->Cell(1, 5, utf8_decode(""), 0, 0, 'C', FALSE);
            $this->Cell(0, 5, utf8_decode(""), 1, 0, 'C', FALSE);

            $this->Ln();
            $cK = $key;
        }

        /* while ($cK <= 21) {
          $cK = $cK + 1;

          $this->Cell(5, 5, utf8_decode($cK), 1, 0, 'C', FALSE);
          $this->Cell(70, 5, utf8_decode(""), 1, 0, 'L', FALSE);
          $this->Cell(1, 5, utf8_decode(""), 0, 0, 'C', FALSE);
          $this->Cell(5, 5, utf8_decode(""), 1, 0, 'C', FALSE);
          $this->Cell(12.5, 5, utf8_decode(""), 1, 0, 'C', FALSE);
          $this->Cell(12.5, 5, utf8_decode(""), 1, 0, 'C', FALSE);
          $this->Cell(1, 5, utf8_decode(""), 0, 0, 'C', FALSE);
          $this->Cell(0, 5, utf8_decode(""), 1, 0, 'C', FALSE);
          $this->Ln();
          } */
    }

    function listaAsistenciaAlumnos($alumnos, $lic, $pla)
    {
        $this->Ln(-8);
        // EMPIEZA OTROS
        /* $this->SetXY(150, 5);
          $this->SetTextColor(255, 255, 255);
          $this->SetFont('Arial', 'B', 10);

          $this->MultiCell(0, 5, utf8_decode("LISTA DE ASISTENCIA" . $lic->getNomLic() . " DEL X° CUATRIMESTRE"), 1, 'C', false);
          $this->SetLeftMargin(10);
          $this->SetRightMargin(10);

          $this->SetFont('', 'B', 10);
          $this->SetTextColor(0, 0, 0);
          if ($lic->getCveNivAca()->getideNivAca() == 1) {
          $this->Cell(100, 7, utf8_decode("BACHILLERATO:"), 0, 0, 'R', FALSE);
          } elseif ($lic->getCveNivAca()->getideNivAca() == 2) {
          $this->Cell(100, 7, utf8_decode("BACHILLERATO EXAMEN ÚNICO:"), 0, 0, 'R', FALSE);
          } elseif ($lic->getCveNivAca()->getideNivAca() == 3) {
          $this->Cell(100, 7, utf8_decode("LICENCIATURA: " . $lic->getNomLic()), 0, 0, 'R', FALSE);
          } elseif ($lic->getCveNivAca()->getideNivAca() == 4) {
          $this->Cell(100, 7, utf8_decode("MAESTRÍA: " . $lic->getNomLic()), 0, 0, 'R', FALSE);
          } elseif ($lic->getCveNivAca()->getideNivAca() == 5) {
          $this->Cell(100, 7, utf8_decode("DOCTORADO: " . $lic->getNomLic()), 0, 0, 'R', FALSE);
          } elseif ($lic->getCveNivAca()->getideNivAca() == 6) {
          $this->Cell(100, 7, utf8_decode("TITULACIÓN: " . $lic->getNomLic()), 0, 0, 'R', FALSE);
          }
          $this->Cell(100, 7, utf8_decode("PLANTEL: " . $pla->getNomPla()), 0, 0, 'R', FALSE);
          $this->Cell(0, 7, date('d-M-Y'), 0, 0, 'R', false);

          $this->Ln(10);
          $this->SetFont('', 'B', 10);
          $this->Cell(0, 7, utf8_decode("LISTA ASISTENCIA"), 0, 0, 'C', FALSE);
          $this->Ln();
          $this->SetFont('', '', 8);

          $this->Cell(5, 5, utf8_decode(""), "LT", 0, 'C', FALSE);
          $this->Cell(30, 5, utf8_decode(""), 1, 0, 'C', FALSE);
          $this->Cell(70, 5, utf8_decode(""), "TR", 0, 'L', FALSE);
          $this->Cell(1, 5, utf8_decode(""), 0, 0, 'C', FALSE);
          $this->Cell(25, 5, utf8_decode("NÚMERO"), 1, 0, 'C', FALSE);
          $this->Cell(1, 5, utf8_decode(""), 0, 0, 'C', FALSE);
          $this->Cell(0, 5, utf8_decode("OBSERVACIONES"), 1, 0, 'C', FALSE);
          $this->Ln();
          $this->Cell(5, 5, utf8_decode(""), "L", 0, 'C', FALSE);
          $this->Cell(30, 5, utf8_decode("CVE. CTL."), 1, 0, 'C', FALSE);
          $this->Cell(70, 5, utf8_decode("NOMBRE DEL ALUMNO"), "R", 0, 'L', FALSE);
          $this->Cell(1, 5, utf8_decode(""), 0, 0, 'C', FALSE);
          $this->Cell(25, 5, utf8_decode("SEMESTRE"), 1, 0, 'C', FALSE);
          $this->Cell(1, 5, utf8_decode(""), 0, 0, 'C', FALSE);
          $this->Cell(0, 5, utf8_decode(""), 1, 0, 'C', FALSE);
          $this->Ln();
          $this->Cell(5, 5, utf8_decode(""), "LB", 0, 'C', FALSE);
          $this->Cell(30, 5, utf8_decode(""), 1, 0, 'C', FALSE);
          $this->Cell(70, 5, utf8_decode(""), "BR", 0, 'L', FALSE);
          $this->Cell(1, 5, utf8_decode(""), 0, 0, 'C', FALSE);
          $this->Cell(25, 5, utf8_decode("CUATRIMESTRE"), 1, 0, 'C', FALSE);
          $this->Cell(1, 5, utf8_decode(""), 0, 0, 'C', FALSE);
          $this->Cell(0, 5, utf8_decode(""), 1, 0, 'C', FALSE);

         */
        $this->Ln(8);
        $cK = 0;
        $numero = 0;
        $indice = 0;
        $this->SetDrawColor(112, 173, 71);
        foreach ($alumnos as $key => $v) {
            if ($numero == $v->getCveAlu()->getNumero()) {

            } else {
                $numero = $v->getCveAlu()->getNumero();
                if ($key > 0) {
                    $this->AddPage();

                    $this->SetXY(140, 5);
                    $this->SetTextColor(255, 255, 255);
                    $this->SetFont('Arial', 'B', 12);

                    $this->SetRightMargin(5);
                    $this->MultiCell(0, 5, utf8_decode("LISTA DE ASISTENCIA " . $lic->getNomLic() . " " . $numero . "° CUATRIMESTRE"), 0, 'C', false);
                    $this->SetLeftMargin(5);
                    $this->SetRightMargin(5);

                    $this->SetFont('', 'B', 10);
                    $this->SetXY(5, 26);
                    //TABLA HEADER
                    $this->SetFillColor(146, 208, 80);
                    $this->Cell(8, 8, utf8_decode("N.C."), 1, 0, 'C', true);
                    $this->SetFont('', 'B', 6);
                    $this->Cell(15, 8, utf8_decode("MATRICULA"), 1, 0, 'C', true);
                    $this->SetFont('', 'B', 10);
                    $this->Cell(70, 8, utf8_decode("NOMBRE DEL ALUMNO"), 1, 0, 'L', true);
                    $this->Cell(20, 8, utf8_decode("ENTRADA"), 1, 0, 'C', true);
                    $this->Cell(20, 8, utf8_decode("SALIDA"), 1, 0, 'C', true);
                    $this->Cell(20, 8, utf8_decode("FECHA"), 1, 0, 'C', true);
                    $this->Cell(0, 8, utf8_decode("OBSERVACIONES"), 1, 0, 'C', true);
                    $this->Ln();
                    $this->SetTextColor(0, 0, 0);
                    //FIN TABLA HEADER
                } elseif ($key == 0) {
                    $this->SetXY(140, 5);
                    $this->SetTextColor(255, 255, 255);
                    $this->SetFont('Arial', 'B', 12);

                    $this->SetRightMargin(5);
                    $this->MultiCell(0, 5, utf8_decode("LISTA DE ASISTENCIA " . $lic->getNomLic() . " " . $numero . "° CUATRIMESTRE"), 0, 'C', false);
                    $this->SetLeftMargin(5);
                    $this->SetRightMargin(5);

                    $this->SetFont('', 'B', 10);
                    $this->SetXY(5, 26);
                    //TABLA HEADER
                    $this->SetFillColor(146, 208, 80);
                    $this->Cell(8, 8, utf8_decode("N.C."), 1, 0, 'C', true);
                    $this->SetFont('', 'B', 6);
                    $this->Cell(15, 8, utf8_decode("MATRICULA"), 1, 0, 'C', true);
                    $this->SetFont('', 'B', 10);
                    $this->Cell(70, 8, utf8_decode("NOMBRE DEL ALUMNO"), 1, 0, 'L', true);
                    $this->Cell(20, 8, utf8_decode("ENTRADA"), 1, 0, 'C', true);
                    $this->Cell(20, 8, utf8_decode("SALIDA"), 1, 0, 'C', true);
                    $this->Cell(20, 8, utf8_decode("FECHA"), 1, 0, 'C', true);
                    $this->Cell(0, 8, utf8_decode("OBSERVACIONES"), 1, 0, 'C', true);
                    $this->Ln();
                    $this->SetTextColor(0, 0, 0);
                    //FIN TABLA HEADER
                }


                $indice = 0;
            }
            $this->SetFont('', '', 8);
            $indice++;
            $this->Cell(8, 5, utf8_decode($indice), 1, 0, 'C', FALSE);
            $this->Cell(15, 5, utf8_decode($v->getCveAlu()->getCveCtl()), 1, 0, 'C', FALSE);
            $this->Cell(70, 5, utf8_decode($v->getCveAlu()->getApePat() . " " . $v->getCveAlu()->getApeMat() . " " . $v->getCveAlu()->getNomAlu()), 1, 0, 'L', FALSE);
            //$this->Cell(12.5, 5, utf8_decode($v->getCveAlu()->getNumero()), 1, 0, 'C', FALSE);
            $this->Cell(20, 5, utf8_decode($v->getHorEnt()->format('H:i:s A')), 1, 0, 'C', FALSE);
            if ($v->getHorSal() == null) {
                $this->Cell(20, 5, utf8_decode("- : -"), 1, 0, 'C', FALSE);
            } else {
                $this->Cell(20, 5, utf8_decode($v->getHorSal()->format('H:i:s A')), 1, 0, 'C', FALSE);
            }

            $this->Cell(20, 5, utf8_decode($v->getFecMov()->format('d-M-Y')), 1, 0, 'C', FALSE);
            if ($v->getEstatus() == 0) {
                $this->Cell(0, 5, utf8_decode("EL ALUMNO NO REGISTRÓ SALIDA"), 1, 0, 'C', FALSE);
            } else {
                $this->Cell(0, 5, utf8_decode(""), 1, 0, 'C', FALSE);
            }


            $this->Ln();
            $cK = $key;
        }
    }

    function HistorialEgresosDetalles($datos, $fA, $fB, $plantel)
    {
        setlocale(LC_ALL, 'spanish');
        $this->Cell(130, 7, "FECHA INICIAL: " . $fA, 1, 0, 'C', false); // NO CAMBIA
        $this->Cell(0, 7, "FECHA FINAL: " . $fB, 1, 0, 'C', false); // NO CAMBIA
        $this->Ln(); // NO CAMBIA       
        $this->SetLeftMargin(10);
        $this->SetRightMargin(10);
        //$this->Ln(-40);
        // Datos

        $total = 0;
        $fill = false;
        $j = 1;

        $this->Cell(0, 7, utf8_decode("PLANTEL: " . $plantel), 0, 0, 'C', false); // NO CAMBIA

        if (count($datos) == 0) {
            $this->Ln();
            $this->SetFillColor(165, 204, 138); //Fondo verde del table-header
            $this->Cell(0, 7, "NO HAY DATOS", 0, 0, 'C', true); // NO CAMBIA
            $this->Ln(); // NO CAMBIA
        } else {
            $this->SetFont('', 'B', 10);
            $this->Ln();
            $this->SetFillColor(165, 204, 138); //Fondo verde del table-header
            $this->Cell(6, 10, utf8_decode("#"), 1, 0, "C", true);
            $this->Cell(16, 10, utf8_decode("FECHA"), 1, 0, "C", true);
            $this->SetFont('', 'B', 8);
            $this->Cell(14, 10, utf8_decode("RECIBO"), 1, 0, "C", true);
            $this->SetFont('', 'B', 10);
            $this->Cell(80, 10, utf8_decode("DESCRIPCIÓN"), 1, 0, "C", true);
            $this->Cell(45, 10, utf8_decode("ENTREGA"), 1, 0, "C", true);
            $this->Cell(75, 10, utf8_decode("RECIBE"), 1, 0, "C", true);
            $this->Cell(0, 10, utf8_decode("MONTO"), 1, 0, "C", true);
            $this->Ln();
            $this->SetFont('', '', 8);
            $this->SetFillColor(239, 252, 229); // FONDO DE LAS LINEAS DEL CUERPO DE LA TABLA
            foreach ($datos as $key => $row) {
                $this->Cell(6, 5, utf8_decode($key + 1), 1, 0, "C", $fill);
                $this->Cell(16, 5, utf8_decode($row->getFecMov()->format('d-m-Y')), 1, 0, "R", $fill);
                $this->Cell(14, 5, utf8_decode($row->getNumRecibo()), 1, 0, "C", $fill);
                if (strlen($row->getDescripcion()) > 48) {
                    $this->SetFont('', '', 6);
                    $this->Cell(80, 5, utf8_decode($row->getDescripcion()), 1, 0, "L", $fill);
                    $this->SetFont('', '', 8);
                } else {
                    $this->Cell(80, 5, utf8_decode($row->getDescripcion()), 1, 0, "L", $fill);
                }
                $this->SetFont('', '', 6);
                $this->Cell(45, 5, utf8_decode($row->getEntrega()), 1, 0, "L", $fill);
                $this->SetFont('', '', 7);
                $this->Cell(75, 5, utf8_decode($row->getRecibe()), 1, 0, "L", $fill);
                $this->SetFont('', '', 8);
                $this->Cell(0, 5, utf8_decode("$ " . number_format($row->getMonto(), 2, ".", ",")), 1, 0, "R", $fill);

                $this->Ln(); // NO CAMBIA
                $fill = !$fill; // NO CAMBIA
                $total = $total + $row->getMonto();
            }
            $this->SetFont('', 'B', 10);
            $this->SetFillColor(165, 204, 138); //Fondo verde del table-header
            $this->Cell(161, 5, utf8_decode(""), 0, 0, "R", false);
            $this->Cell(75, 5, utf8_decode("TOTAL"), 1, 0, "R", true);
            $this->Cell(0, 5, utf8_decode("$ " . number_format($total, 2, ".", ",")), 1, 0, "R", true);
        }
    }

    function HistorialEgresosCorporativoDetalles($datos, $fA, $fB)
    {
        setlocale(LC_ALL, 'spanish');
        $this->Cell(130, 7, "FECHA INICIAL: " . $fA, 1, 0, 'C', false); // NO CAMBIA
        $this->Cell(0, 7, "FECHA FINAL: " . $fB, 1, 0, 'C', false); // NO CAMBIA
        $this->Ln(); // NO CAMBIA       
        $this->SetLeftMargin(10);
        $this->SetRightMargin(10);
        //$this->Ln(-40);
        // Datos

        $total = 0;
        $fill = false;
        $j = 1;

        $this->Cell(0, 7, utf8_decode("CORPORATIVO"), 0, 0, 'C', false); // NO CAMBIA

        if (count($datos) == 0) {
            $this->Ln();
            $this->SetFillColor(165, 204, 138); //Fondo verde del table-header
            $this->Cell(0, 7, "NO HAY DATOS", 0, 0, 'C', true); // NO CAMBIA
            $this->Ln(); // NO CAMBIA
        } else {
            $this->SetFont('', 'B', 10);
            $this->Ln();
            $this->SetFillColor(165, 204, 138); //Fondo verde del table-header
            $this->Cell(6, 10, utf8_decode("#"), 1, 0, "C", true);
            $this->Cell(16, 10, utf8_decode("FECHA"), 1, 0, "C", true);
            $this->SetFont('', 'B', 8);
            $this->Cell(14, 10, utf8_decode("RECIBO"), 1, 0, "C", true);
            $this->SetFont('', 'B', 10);
            $this->Cell(80, 10, utf8_decode("DESCRIPCIÓN"), 1, 0, "C", true);
            $this->Cell(45, 10, utf8_decode("ENTREGA"), 1, 0, "C", true);
            $this->Cell(75, 10, utf8_decode("RECIBE"), 1, 0, "C", true);
            $this->Cell(0, 10, utf8_decode("MONTO"), 1, 0, "C", true);
            $this->Ln();
            $this->SetFont('', '', 8);
            $this->SetFillColor(239, 252, 229); // FONDO DE LAS LINEAS DEL CUERPO DE LA TABLA
            foreach ($datos as $key => $row) {
                $this->Cell(6, 5, utf8_decode($key + 1), 1, 0, "C", $fill);
                $this->Cell(16, 5, utf8_decode($row->getFecMov()->format('d-m-Y')), 1, 0, "R", $fill);
                $this->Cell(14, 5, utf8_decode($row->getNumRecibo()), 1, 0, "C", $fill);
                if (strlen($row->getDescripcion()) > 48) {
                    $this->SetFont('', '', 6);
                    $this->Cell(80, 5, utf8_decode($row->getDescripcion()), 1, 0, "L", $fill);
                    $this->SetFont('', '', 8);
                } else {
                    $this->Cell(80, 5, utf8_decode($row->getDescripcion()), 1, 0, "L", $fill);
                }
                $this->SetFont('', '', 6);
                $this->Cell(45, 5, utf8_decode($row->getEntrega()), 1, 0, "L", $fill);
                $this->SetFont('', '', 7);
                $this->Cell(75, 5, utf8_decode($row->getRecibe()), 1, 0, "L", $fill);
                $this->SetFont('', '', 8);
                $this->Cell(0, 5, utf8_decode("$ " . number_format($row->getMonto(), 2, ".", ",")), 1, 0, "R", $fill);

                $this->Ln(); // NO CAMBIA
                $fill = !$fill; // NO CAMBIA
                $total = $total + $row->getMonto();
            }
            $this->SetFont('', 'B', 10);
            $this->SetFillColor(165, 204, 138); //Fondo verde del table-header
            $this->Cell(161, 5, utf8_decode(""), 0, 0, "R", false);
            $this->Cell(75, 5, utf8_decode("TOTAL"), 1, 0, "R", true);
            $this->Cell(0, 5, utf8_decode("$ " . number_format($total, 2, ".", ",")), 1, 0, "R", true);
        }
    }

    function TextWithDirection($x, $y, $txt, $direction = 'R')
    {
        if ($direction == 'R')
            $s = sprintf('BT %.2F %.2F %.2F %.2F %.2F %.2F Tm (%s) Tj ET', 1, 0, 0, 1, $x * $this->k, ($this->h - $y) * $this->k, $this->_escape($txt));
        elseif ($direction == 'L')
            $s = sprintf('BT %.2F %.2F %.2F %.2F %.2F %.2F Tm (%s) Tj ET', -1, 0, 0, -1, $x * $this->k, ($this->h - $y) * $this->k, $this->_escape($txt));
        elseif ($direction == 'U')
            $s = sprintf('BT %.2F %.2F %.2F %.2F %.2F %.2F Tm (%s) Tj ET', 0, 1, -1, 0, $x * $this->k, ($this->h - $y) * $this->k, $this->_escape($txt));
        elseif ($direction == 'D')
            $s = sprintf('BT %.2F %.2F %.2F %.2F %.2F %.2F Tm (%s) Tj ET', 0, -1, 1, 0, $x * $this->k, ($this->h - $y) * $this->k, $this->_escape($txt));
        else
            $s = sprintf('BT %.2F %.2F Td (%s) Tj ET', $x * $this->k, ($this->h - $y) * $this->k, $this->_escape($txt));
        if ($this->ColorFlag)
            $s = 'q ' . $this->TextColor . ' ' . $s . ' Q';
        $this->_out($s);
    }

    function TextWithRotation($x, $y, $txt, $txt_angle, $font_angle = 0)
    {
        $font_angle += 90 + $txt_angle;
        $txt_angle *= M_PI / 180;
        $font_angle *= M_PI / 180;

        $txt_dx = cos($txt_angle);
        $txt_dy = sin($txt_angle);
        $font_dx = cos($font_angle);
        $font_dy = sin($font_angle);

        $s = sprintf('BT %.2F %.2F %.2F %.2F %.2F %.2F Tm (%s) Tj ET', $txt_dx, $txt_dy, $font_dx, $font_dy, $x * $this->k, ($this->h - $y) * $this->k, $this->_escape($txt));
        if ($this->ColorFlag)
            $s = 'q ' . $this->TextColor . ' ' . $s . ' Q';
        $this->_out($s);
    }

}
