public function executeCalidadServicio()
 {
     //Obtener los datos para el reporte
     if ($this->getUser()->getAttribute('esValido') === 'no') {
         $this->redirect('reportes/error');
     } else {
         $datepicker = $this->getUser()->getAttribute('datepicker');
         $datepicker2 = $this->getUser()->getAttribute('datepicker2');
         $date2 = Operaciones::convertirFecha($datepicker2);
         $date = Operaciones::convertirFecha($datepicker);
         $carreras = Doctrine_Core::getTable('carrera')->createQuery('a')->where('a.fecha>=?', $date)->andWhere('a.fecha<=?', $date2)->andWhereNotIn('a.calidad', array(-1, -2))->execute();
         // Configurar el reporte
         $doc_title = "Reporte de Carreras - Radiotaxi \"Benjamín Carrión\" ";
         $doc_subject = "Reporte de Carreras - Radiotaxi \"Benjamín Carrión\"";
         $doc_keywords = "Reporte";
         $config = sfTCPDFPluginConfigHandler::loadConfig();
         sfTCPDFPluginConfigHandler::includeLangFile($this->getUser()->getCulture());
         //crear nuevo documento PDF (unidades del documento se establecen de forma predeterminada en milímetros)
         $pdf = new sfTCPDF("l", PDF_UNIT, PDF_PAGE_FORMAT, true);
         // configurar la información del documento
         $pdf->SetCreator(PDF_CREATOR);
         $pdf->SetAuthor('Cooperativa de taxis "Benjamín Carrión"');
         $pdf->SetTitle('INFORME GENERAL DE CARRERAS REALIZADAS');
         $pdf->SetSubject('Radio-taxi');
         $pdf->SetKeywords('Radio-taxi, PDF, Benjamín Carrión, reporte carreras');
         $pdf->SetHeaderData("", 0, PDF_HEADER_TITLE, PDF_HEADER_STRING);
         //establecer los margenes
         $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
         //establecer saltos de página automático
         $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
         $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
         $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
         $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
         //establecido factor de escala de imagen
         $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
         $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
         //inicializar el documento
         $pdf->AliasNbPages();
         $pdf->AddPage();
         //diseñar el contenido del reporte
         $htmlcontent = "<h1 style=\"text-align:center;\"> Informe de Calidad de Carreras Realizadas</h1> \n    <p>Carreras realizadas desde {$datepicker} hasta {$datepicker2}.</p> ";
         //Detalle de carreras
         $htmlcontent .= "<h3>Detalle de Carreras</h3>\n            <table style=\"font:normal 76%/150% \"Lucida Grande\", \"Lucida Sans Unicode\", Verdana, Arial, Helvetica, sans-serif;border-collapse:separate;border-spacing:0;border-left:1px solid #686868;    border-right:1px solid #686868;    border-bottom: 1px solid #686868;    color:#000;\">    \n        <thead>\n            <tr bgcolor=\"#ffff73\" style=\"font-weight:bold;line-height:normal;padding:0.25em 0.5em;text-align:left;\">\n                <th style=\"border:1px solid #523A0B;border-width:1px 0; width:6%;text-align: center;\">N° </th>\n                <th style=\"border:1px solid #523A0B;border-width:1px 0;width:10%;text-align: center;\">Código</th>\n                <th style=\"border:1px solid #523A0B;border-width:1px 0;width:10%;text-align: center;\">Unidad</th>\n                <th style=\"border:1px solid #523A0B;border-width:1px 0;width:11%;text-align: center;\">Fecha</th>\n                <th style=\"border:1px solid #523A0B;border-width:1px 0;width:10%;text-align: center;\">Hora</th>\n                <th style=\"border:1px solid #523A0B;border-width:1px 0;width:10%;text-align: center;\">Tiempo</th>\n                <th style=\"border:1px solid #523A0B;border-width:1px 0;width:11%;text-align: center;\">Atención</th>\n                <th style=\"border:1px solid #523A0B;border-width:1px 0;width:11%;text-align: center;\">Aproximado<br />Destino</th>\n                <th style=\"border:1px solid #523A0B;border-width:1px 0;width:11%;text-align: center;\">Llegada</th>\n                <th style=\"border:1px solid #523A0B;border-width:1px 0;width:10%;text-align: center;\">Calificación<br />Cliente</th>\n            </tr>\n        </thead>\n        <tbody>";
         foreach ($carreras as $i => $carrera) {
             $htmlcontent .= "<tr ";
             if (fmod($i, 2)) {
                 $htmlcontent .= "bgcolor=\"#fcfca0\"";
             } else {
                 $htmlcontent .= "";
             }
             $htmlcontent .= " style= \"border-color:#EBE5D9;padding:0.25em 0.5em;text-align:left;vertical-align:top;\"> \n                <td  style= \"border:1px solid #523A0B;border-width:1px 0;width:6%;\">" . ($i + 1) . "</td>\n                <td style= \"border:1px solid #523A0B;border-width:1px 0;width:10%;\">" . $carrera->getNumCodigo() . "</td>\n                <td style= \"border:1px solid #523A0B;border-width:1px 0;width:10%;\">" . $carrera->getVehiculo() . "</td>\n                <td style= \"border:1px solid #523A0B;border-width:1px 0;width:11%;\">" . $carrera->getFecha() . "</td>\n                <td style= \"border:1px solid #523A0B;border-width:1px 0;width:10%;\">" . substr($carrera->getHora(), 0, 5) . "</td>\n                <td style= \"border:1px solid #523A0B;border-width:1px 0;width:10%;text-align: center;\">" . $carrera->getTiempo() . " min</td>\n                <td style= \"border:1px solid #523A0B;border-width:1px 0;width:11%;\">" . $carrera->getAtencion() . "</td>\n                <td style= \"border:1px solid #523A0B;border-width:1px 0;width:11%;text-align: center;\">" . $carrera->getTiempoAproxDest() . " min</td>\n                <td style= \"border:1px solid #523A0B;border-width:1px 0;width:11%;\">" . $carrera->getLlegada() . "</td>\n                <td style= \"border:1px solid #523A0B;border-width:1px 0;width:10%;text-align: center;\">" . $carrera->getCalidad() . "</td>\n            </tr>";
         }
         $htmlcontent .= "</tbody>\n        </table>";
         $pdf->writeHTML($htmlcontent, true, 0);
         // Cerrar y presentar el documento PDF
         $pdf->Output('Reporte.pdf', 'I');
         // Detener el proceso de Symfony
         throw new sfStopException();
     }
 }