public function __construct(Asso $asso, $title = 'BDE-UTC: Outil de trésorerie', $culture = 'en') { $this->config = sfTCPDFPluginConfigHandler::loadConfig(); sfTCPDFPluginConfigHandler::includeLangFile($culture); $this->pdf = new simdePdf($asso, 'Association ' . $asso->getName(), $title); $this->asso = $asso; $this->pdf->SetCreator(PDF_CREATOR . 'e'); $this->pdf->SetAuthor(PDF_AUTHOR . 'd'); $this->pdf->SetTitle($title . 'a'); $this->pdf->SetSubject($title . 'b'); $this->pdf->SetKeywords($title . 'c'); $this->pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $this->pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $this->pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $this->pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $this->pdf->SetFooterMargin(PDF_MARGIN_FOOTER); $this->pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); //set image scale factor $this->pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $this->pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); $this->pdf->setFooterMargin(20); }
/** * Full test. */ public function executeTest2() { $config = sfTCPDFPluginConfigHandler::loadConfig(); sfTCPDFPluginConfigHandler::includeLangFile($this->getUser()->getCulture()); $doc_title = "test title"; $doc_subject = "test description"; $doc_keywords = "test keywords"; $htmlcontent = "< € € € & è è © ><br /><h1>heading 1</h1><h2>heading 2</h2><h3>heading 3</h3><h4>heading 4</h4><h5>heading 5</h5><h6>heading 6</h6>ordered list:<br /><ol><li><b>bold text</b></li><li><i>italic text</i></li><li><u>underlined text</u></li><li><a href=\"http://www.tecnick.com\">link to http://www.tecnick.com</a></li><li>test break<br />second line<br />third line</li><li><font size=\"+3\">font + 3</font></li><li><small>small text</small></li><li>normal <sub>subscript</sub> <sup>superscript</sup></li></ul><hr />table:<br /><table border=\"1\" cellspacing=\"1\" cellpadding=\"1\"><tr><th>#</th><th>A</th><th>B</th></tr><tr><th>1</th><td bgcolor=\"#cccccc\">A1</td><td>B1</td></tr><tr><th>2</th><td>A2 € € € & è è </td><td>B2</td></tr><tr><th>3</th><td>A3</td><td><font color=\"#FF0000\">B3</font></td></tr></table><hr />image:<br /><img src=\"sfTCPDFPlugin/images/logo_example.png\" alt=\"test alt attribute\" width=\"100\" height=\"100\" border=\"0\" />"; //create new PDF document (document units are set by default to millimeters) $pdf = new sfTCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true); // set document information $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor(PDF_AUTHOR); $pdf->SetTitle($doc_title); $pdf->SetSubject($doc_subject); $pdf->SetKeywords($doc_keywords); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); //set margins $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); //set auto page breaks $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); //set image scale factor $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); $pdf->setLanguageArray($l); //set language items //initialize document $pdf->AliasNbPages(); $pdf->AddPage(); // set barcode $pdf->SetBarcode(date("Y-m-d H:i:s", time())); // output some HTML code $pdf->writeHTML($htmlcontent, true, 0); // output two html columns $first_column_width = 80; $current_y_position = $pdf->getY(); $pdf->writeHTMLCell($first_column_width, 0, 0, $current_y_position, "<b>hello</b>", 0, 0, 0); $pdf->writeHTMLCell(0, 0, $first_column_width, $current_y_position, "<i>world</i>", 0, 1, 0); // output some content $pdf->Cell(0, 10, "TEST Bold-Italic Cell", 1, 1, 'C'); // output some UTF-8 test content $pdf->AddPage(); $pdf->SetFont("FreeSerif", "", 12); $utf8text = file_get_contents(K_PATH_CACHE . "utf8test.txt", false); // get utf-8 text form file $pdf->SetFillColor(230, 240, 255, true); $pdf->Write(5, $utf8text, '', 1); // remove page header/footer $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); // Two HTML columns test $pdf->AddPage(); $right_column = "<b>right column</b> right column right column right column right column\n right column right column right column right column right column right column\n right column right column right column right column right column right column"; $left_column = "<b>left column</b> left column left column left column left column left\n column left column left column left column left column left column left column\n left column left column left column left column left column left column left\n column"; $first_column_width = 80; $second_column_width = 80; $column_space = 20; $current_y_position = $pdf->getY(); $pdf->writeHTMLCell($first_column_width, 0, 0, 0, $left_column, 1, 0, 0); $pdf->Cell(0); $pdf->writeHTMLCell($second_column_width, 0, $first_column_width + $column_space, $current_y_position, $right_column, 0, 0, 0); // add page header/footer $pdf->setPrintHeader(true); $pdf->setPrintFooter(true); $pdf->AddPage(); // Multicell test $pdf->MultiCell(40, 5, "A test multicell line 1\ntest multicell line 2\ntest multicell line 3", 1, 'J', 0, 0); $pdf->MultiCell(40, 5, "B test multicell line 1\ntest multicell line 2\ntest multicell line 3", 1, 'J', 0); $pdf->MultiCell(40, 5, "C test multicell line 1\ntest multicell line 2\ntest multicell line 3", 1, 'J', 0, 0); $pdf->MultiCell(40, 5, "D test multicell line 1\ntest multicell line 2\ntest multicell line 3", 1, 'J', 0, 2); $pdf->MultiCell(40, 5, "F test multicell line 1\ntest multicell line 2\ntest multicell line 3", 1, 'J', 0); //Close and output PDF document $pdf->Output(); return sfView::NONE; }
public function encabezado($titulo = null, $entidad = null, $fecha = null) { $config = sfTCPDFPluginConfigHandler::loadConfig('orange'); // pdf object $pdf = new sfTCPDF(); $pdf->setPageFormat('LETTER'); $pdf->SetFontSize(8); $pdf->SetTextColor(255, 255, 255, 0); $pdf->SetDrawColor(192, 192, 192, 0); //$pdf->SetCellPadding(30); $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', 8)); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, 'Generado por:' . $entidad, 'Reporte de Pago' . "\n" . $fecha); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', 8)); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); $pdf->SetFontSize(9.5); $pdf->setPageFormat('A4'); return $pdf; }
public function printEtiquetes($idL) { $config = sfTCPDFPluginConfigHandler::loadConfig(); //create new PDF document (document units are set by default to millimeters) $pdf = new sfTCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true); // set document information $pdf->SetCreator('Intranet CCG'); $pdf->SetAuthor('Intranet CCG'); $pdf->SetTitle('Llistat de mailing postal'); $pdf->SetSubject("Llistat correu"); $pdf->SetFont('helvetica', '', 8); $pdf->SetMargins(0, 0, 0, 0); $pdf->setPrintHeader(false); $pdf->setAutoPageBreak(false); //Consultem tots els usuaris de la llista que volem imprimir. $fila = 1; $columna = 1; $pagina = 1; $pdf->AddPage(); $OL = LlistesPeer::retrieveByPK($idL); foreach ($OL->getUsuarisllistess() as $UL) { $OU = $UL->getUsuaris(); $text = "<br><br><br> <b>" . $OU->getNomComplet() . "</b>"; $text .= "<br> " . $OU->getAdreca(); $text .= "<br> " . $OU->getCodiPostal() . ' - ' . $OU->getPoblacioString(); if ($fila == 9) { $pdf->AddPage(); $fila = 1; } if ($columna == 1 && $fila == 1) { $pdf->MultiCell(70, 37, $text, 1, 'L', 0, 0, 0, 0, true, 0, true, true, 0); $columna++; } elseif ($columna == 1 && $fila != 1) { $pdf->MultiCell(70, 37, $text, 1, 'L', 0, 0, '', '', true, 0, true, true, 0); $columna++; } elseif ($columna == 2) { $pdf->MultiCell(70, 37, $text, 1, 'L', 0, 0, '', '', true, 0, true, true, 0); $columna++; } elseif ($columna == 3) { $pdf->MultiCell(70, 37, $text, 1, 'L', 0, 1, '', '', true, 0, true, true, 0); $columna = 1; $fila++; } } $pdf->Output(); return sfView::NONE; }
public function executeIndex(sfWebRequest $request) { $i18n = sfContext::getInstance()->getI18N(); // Disable CSRF protection $this->form = new ReportingForm(array(), array(), false); $formName = $this->form->getName(); $this->step = sfConfig::get('app_max_reservations_on_reporting'); $this->getUser()->syncParameters($this, 'reporting', 'index', array('offset', 'limit', $formName, 'sort_column', 'sort_direction'), $request); if (is_null($this->sort_column)) { $this->sort_column = 'date'; $this->sort_direction = 'up'; } if (is_null($this->offset)) { $this->offset = 0; } if (is_null($this->limit) || $this->limit <= 0) { $this->limit = $this->step; } $c = new Criteria(); SortCriteria::addSortCriteria($c, $this->sort_column, ReservationPeer::getSortAliases(), $this->sort_direction); $this->filtered = false; if (!is_null($this->{$formName})) { $this->filtered = true; $this->form->bind($this->{$formName}, $request->getFiles($formName)); if ($this->form->isValid()) { $this->reservation_list = ReservationPeer::report($this->form->getValue('users'), $this->form->getValue('usergroups'), $this->form->getValue('activities'), $this->form->getValue('zones'), $this->form->getValue('rooms'), strtotime($this->form->getValue('begin_date')), strtotime($this->form->getValue('end_date')), $c); $this->count = count($this->reservation_list); $this->entire_reservation_list = $this->reservation_list; $this->reservation_list = array_slice($this->reservation_list, $this->offset, $this->limit); } else { $this->count = 0; $this->reservation_list = array(); } } else { $this->count = 0; $this->reservation_list = array(); } if ($this->offset < 0 || $this->offset >= $this->count && $this->count > 0) { $this->forward404('Invalid offset/count values.'); } if (!is_null($export = $request->getParameter('export'))) { $this->forward404Unless(in_array($export, array('csv', 'pdf')), sprintf('Unhandled value "%s" for export', $export)); sfConfig::set('sf_web_debug', false); $activity_name = ConfigurationHelper::getParameter('Rename', 'activity_label'); if (empty($activity_name)) { $activity_name = $i18n->__('Activity'); } $free_field_1_name = ConfigurationHelper::getParameter('Rename', 'reservation_custom_field_1'); $free_field_2_name = ConfigurationHelper::getParameter('Rename', 'reservation_custom_field_2'); $free_field_3_name = ConfigurationHelper::getParameter('Rename', 'reservation_custom_field_3'); $this->all_rows = array(); $fields = $this->form->getValue('fields'); foreach ($this->entire_reservation_list as $reservation) { //If there's is a temporary group, we modify the name to display "Perso. (first user, ...)" $resa_group_name = null; $ug = $reservation->getUsergroup(); if (!is_null($ug)) { $resa_group_name = $ug->getName(); } $this->all_rows[] = array(); end($this->all_rows); // Check which field we need to display. foreach ($fields as $field_id) { // See lib\form\ReportingForm.class.php for indexes switch ($field_id) { case 0: $this->all_rows[key($this->all_rows)][] = array($i18n->__('Date'), $reservation->getDate()); break; case 1: $this->all_rows[key($this->all_rows)][] = array($i18n->__('User'), $reservation->getUser()->getFullName()); break; case 2: $this->all_rows[key($this->all_rows)][] = array($activity_name, $reservation->getActivity()->getName()); break; case 3: $this->all_rows[key($this->all_rows)][] = array($i18n->__('Duration'), number_format($reservation->getDuration())); break; case 4: $this->all_rows[key($this->all_rows)][] = array($i18n->__('Room'), $reservation->getRoomprofile()->getRoom()->getName()); break; case 5: $this->all_rows[key($this->all_rows)][] = array($i18n->__('Reason'), !is_null($reservation->getReservationreason()) ? $reservation->getReservationreason()->getName() : null); break; case 6: $this->all_rows[key($this->all_rows)][] = array($i18n->__('Comment'), $reservation->getComment()); break; case 7: $this->all_rows[key($this->all_rows)][] = array($i18n->__('Group'), $resa_group_name); break; case 8: $this->all_rows[key($this->all_rows)][] = array($i18n->__('Members count'), number_format($reservation->getMembersCount())); break; case 9: $this->all_rows[key($this->all_rows)][] = array($i18n->__('Guests count'), number_format($reservation->getGuestsCount())); break; case 10: $this->all_rows[key($this->all_rows)][] = array($i18n->__('Status'), number_format($reservation->getStatus())); break; case 11: $this->all_rows[key($this->all_rows)][] = array($i18n->__('Price'), number_format($reservation->getPrice())); break; case 12: $valuedFeaturesArray = $reservation->getRoomprofile()->getRoom()->getValuedFeaturesArray(); $concat = ''; foreach ($valuedFeaturesArray as $featureName => $values) { $concat .= $featureName . '=' . $values . ' | '; } $concat = rtrim($concat, ' | '); $this->all_rows[key($this->all_rows)][] = array($i18n->__('Features'), $concat); break; case 90: $this->all_rows[key($this->all_rows)][] = array($free_field_1_name, $reservation->getCustom1()); break; case 91: $this->all_rows[key($this->all_rows)][] = array($free_field_2_name, $reservation->getCustom2()); break; case 92: $this->all_rows[key($this->all_rows)][] = array($free_field_3_name, $reservation->getCustom3()); break; } } } if ($export == 'csv') { $this->setLayout(false); $this->getResponse()->clearHttpHeaders(); $this->getResponse()->setHttpHeader('Pragma: public', true); $this->getResponse()->setHttpHeader('Content-disposition', sprintf('attachment; filename="%s"', 'reporting-' . date('Y-m-d') . '.csv')); $this->getResponse()->setContentType('text/csv; charset=utf-8'); $this->getResponse()->sendHttpHeaders(); $this->setTemplate('exportCSV'); } else { if ($export == 'pdf') { $config = sfTCPDFPluginConfigHandler::loadConfig(); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); // set document information $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor('ISLOG Tempos'); $pdf->SetTitle('Tempos report export'); $pdf->SetSubject('Tempos export'); $pdf->SetKeywords('Tempos, report, ISLOG'); $pdf->SetHeaderData(sfConfig::get('app_has_logo'), PDF_HEADER_LOGO_WIDTH, $i18n->__('Report'), sprintf($i18n->__('Usage report from %s to %s'), $this->form->getValue('begin_date'), $this->form->getValue('end_date'))); $pdf->setFooterData(array(0, 64, 0), array(0, 64, 128)); $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setFontSubsetting(true); $pdf->SetFont('dejavusans', '', 10, '', true); $pdf->AddPage(); $this->writeHtmlTable($pdf, $this->all_rows); $pdf->Output('reporting-' . date('Y-m-d') . '.pdf', 'I'); exit; } } } }
private function init_pdf() { $config = sfTCPDFPluginConfigHandler::loadConfig(); return new sfTCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true); }
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(); } }
public function executePermiso() { $config = sfTCPDFPluginConfigHandler::loadConfig(); // create new PDF document $pdf = new MyPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); //set margins $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); //set auto page breaks $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); //set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); //set some language-dependent strings //$pdf->setLanguageArray($l); // --------------------------------------------------------- // add a page $pdf->AddPage(); // print a line using Cell() $pdf->SetFont(PDF_FONT_NAME_MAIN, 'B U', PDF_FONT_SIZE_MAIN + 2); $pdf->Cell(0, 20, 'PERMISO DE CONTRUCCION', 0, 1, 'C'); $pdf->SetFont(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN); $pdf->Cell(70, 0, 'EXPEDIENTE:', 0, 0, 'L'); $pdf->Cell(0, 0, 'EXPEDIENTE', 0, 1, 'L'); $pdf->Cell(70, 0, 'PROPIETARIO:', 0, 0, 'L'); $pdf->Cell(0, 0, 'PROPIETARIO', 0, 1, 'L'); $pdf->Cell(70, 0, 'DOMICILIO DEL INMUEBLE:', 0, 0, 'L'); $pdf->Cell(0, 0, 'DOMICILIO DEL INMUEBLE', 0, 1, 'L'); $pdf->Cell(70, 0, 'BARRIO:', 0, 0, 'L'); $pdf->Cell(0, 0, 'BARRIO', 0, 1, 'L'); $pdf->Cell(70, 0, 'NOMECLATURA CATASTRAL:', 0, 0, 'L'); $pdf->Cell(0, 0, 'NOMECLATURA CATASTRAL', 0, 1, 'L'); $pdf->Ln(3); $pdf->Cell(0, 0, 'OBSERVACIONES PENDIENTES/DOCUMENTACION A ANEXAR CON EL PLANO:', 0, 1, 'L'); $pdf->MultiCell(0, 0, 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent sed nulla nibh. Etiam porta fermentum pellentesque.', 0, 1, 'L'); $pdf->Ln(10); $pdf->Cell(0, 0, 'DOMICILIO Y TELEFONO:', 0, 1, 'L'); $pdf->Cell(0, 0, 'MATRICULA:', 0, 1, 'L'); $pdf->Cell(0, 0, 'CALCULO:', 0, 1, 'L'); $pdf->Cell(150, 0, 'Firma: ', 0, 1, 'R'); $pdf->Cell(0, 0, 'DOMICILIO Y TELEFONO:', 0, 1, 'L'); $pdf->Cell(0, 0, 'MATRICULA:', 0, 1, 'L'); $pdf->Cell(0, 0, 'DIRECTOR DE OBRA:', 0, 1, 'L'); $pdf->Cell(150, 0, 'Firma: ', 0, 1, 'R'); $pdf->Cell(0, 0, 'DOMICILIO Y TELEFONO:', 0, 1, 'L'); $pdf->Cell(0, 0, 'MATRICULA:', 0, 1, 'L'); $pdf->Cell(0, 0, 'EJECUTOR:', 0, 1, 'L'); $pdf->Cell(0, 0, 'DOMICILIO Y TELEFONO:', 0, 1, 'L'); $pdf->Cell(0, 0, 'MATRICULA:', 0, 1, 'L'); $pdf->Cell(150, 0, 'Firma: ', 0, 1, 'R'); $pdf->Ln(20); $pdf->SetFont(PDF_FONT_NAME_MAIN, 'B', PDF_FONT_SIZE_MAIN); $pdf->Cell(150, 0, 'Arq.Roberto A. Bianchi', 0, 1, 'R'); $pdf->SetFont(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN); $pdf->Cell(147, 0, 'Dep. Obras Privadas', 0, 1, 'R'); $pdf->Ln(5); $pdf->SetFont(PDF_FONT_NAME_MAIN, 'B', PDF_FONT_SIZE_MAIN - 2); $pdf->Cell(0, 0, 'NOTAS', 0, 1, 'L'); $pdf->SetFont(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN - 2); $pdf->MultiCell(0, 0, '-Es obligación colocar letrero sobre el frente de la obra con los datos que constan en este certificado.- -Recuerde mantener el espacio público (vereda y calle) en perfectas condiciones de orden y limpieza. El presente permiso no habilita la ocupación del mismo, en caso de ser necesaria debe tramitarlo por separado. Resguarde la seguridad de los bienes y personas en general y en particular en lo que respecta a los inmuebles linderos, y en la vía pública utilice de bandejas protectoras y demás elementos de seguridad y señalización.- -Si necesita deprimir napa prevea el asesoramiento municipal para la evacuación del agua sin volcado a la vía pública. -Prevea las condiciones necesarias y obligatorias de seguridad y sanitarias del personal afectado a la obra. -Concluida la obra deberá tramitar certificado parcial/final de obra, requisito necesario para la obtención del permiso de conexión de gas. Si surgieran ampliaciones o modificaciones en el transcurso de la ejecución de la misma deberá presentar planos previo a su inicio, caso contrario adjuntar planos conforme a obra para la obtención del certificado.- -El presente permiso exime del pago de impuesto al baldío y multas por falta de cerco y vereda durante la vigencia del mismo.- ', 0, 1, 'L'); $pdf->SetFont(PDF_FONT_NAME_MAIN, 'b', PDF_FONT_SIZE_MAIN - 1); $pdf->MultiCell(0, 0, 'Recibió: Firma: Aclaración:', 0, 1, 'L'); // --------------------------------------------------------- //Close and output PDF document $pdf->Output('permiso.pdf', 'I'); }
public function executeConstancia(sfWebRequest $request) { $procedure = Doctrine::getTable('Procedure')->find($request->getParameter('id')); $last_control_revision = $procedure->getLastControlRevision(); $last_items = $last_control_revision->getRevisionItem(); $rev_itemsGroup = array(); foreach ($last_items as $rev_item) { if ($rev_item->getState() == "error") { if (!array_key_exists($rev_item->getItem()->getGroup()->getName(), $rev_itemsGroup)) { $rev_itemsGroup[$rev_item->getItem()->getGroup()->getName()] = array(); } array_push($rev_itemsGroup[$rev_item->getItem()->getGroup()->getName()], $rev_item); } } $config = sfTCPDFPluginConfigHandler::loadConfig(); // create new PDF document $pdf = new MyPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); //set margins $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); //set auto page breaks $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); //set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); //set some language-dependent strings //$pdf->setLanguageArray($l); // --------------------------------------------------------- // add a page $pdf->AddPage(); // print a line using Cell() $pdf->SetFont(PDF_FONT_NAME_MAIN, 'B U', PDF_FONT_SIZE_MAIN + 2); $pdf->Cell(0, 20, 'CONSTANCIA', 0, 1, 'C'); $pdf->SetFont(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN); $pdf->MultiCell(0, 0, 'La presente constancia habilita al profesional actuante a iniciar el expediente municipal para el registro del plano de obra, en las condiciones descriptas y según los datos que a continuación se detallan.', 0, 1, 'L'); $pdf->Ln(1); $pdf->Cell(70, 0, 'EXPEDIENTE:', 0, 0, 'L'); $pdf->SetFont(PDF_FONT_NAME_MAIN, 'B', PDF_FONT_SIZE_MAIN); $pdf->Cell(0, 0, $procedure->getDossier(), 0, 1, 'L'); $pdf->SetFont(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN); $pdf->Cell(70, 0, 'PROPIETARIO:', 0, 0, 'L'); $pdf->SetFont(PDF_FONT_NAME_MAIN, 'B', PDF_FONT_SIZE_MAIN); $propietarios = $procedure->getOwner(); $string = ""; foreach ($propietarios as $propietario) { $string .= $propietario . ', '; } $string = substr($string, 0, strlen($string) - 2); $string = ucfirst($string) . '. '; $pdf->Cell(0, 0, $string, 0, 1, 'L'); $pdf->SetFont(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN); $pdf->Cell(70, 0, 'TIPO TRAMITE:', 0, 0, 'L'); $pdf->SetFont(PDF_FONT_NAME_MAIN, 'B', PDF_FONT_SIZE_MAIN); $pdf->Cell(0, 0, $procedure->getFormu(), 0, 1, 'L'); $pdf->SetFont(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN); $pdf->Cell(70, 0, 'DOMICILIO DEL INMUEBLE:', 0, 0, 'L'); $pdf->SetFont(PDF_FONT_NAME_MAIN, 'B', PDF_FONT_SIZE_MAIN); $pdf->Cell(0, 0, $procedure->getCadastralData()->getAddress(), 0, 1, 'L'); $pdf->SetFont(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN); $pdf->Cell(70, 0, 'BARRIO:', 0, 0, 'L'); $pdf->SetFont(PDF_FONT_NAME_MAIN, 'B', PDF_FONT_SIZE_MAIN); $pdf->Cell(0, 0, $procedure->getCadastralData()->getNeighborhood(), 0, 1, 'L'); $pdf->SetFont(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN); $pdf->Cell(70, 0, 'NOMECLATURA CATASTRAL:', 0, 0, 'L'); $pdf->SetFont(PDF_FONT_NAME_MAIN, 'B', PDF_FONT_SIZE_MAIN); $pdf->Cell(0, 0, $procedure->getCadastralData(), 0, 1, 'L'); $pdf->SetFont(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN); $pdf->Ln(3); $pdf->Cell(0, 0, 'OBSERVACIONES PENDIENTES/DOCUMENTACION A ANEXAR CON EL PLANO:', 0, 1, 'L'); foreach ($rev_itemsGroup as $key => $group) { $pdf->SetFont(PDF_FONT_NAME_MAIN, 'B', PDF_FONT_SIZE_MAIN); $pdf->Cell(70, 0, $key . ': ', 0, 1, 'L'); $pdf->SetFont(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN); $observ = ''; foreach ($group as $item) { $observ .= $item->getItem() . ', '; } $observ = substr($observ, 0, strlen($observ) - 2); $observ = ucfirst($observ) . '. '; $pdf->MultiCell(0, 0, $observ, 0, 1, 'L'); } if ($procedure->getComments() != "" && !is_null($procedure->getComments())) { $pdf->SetFont(PDF_FONT_NAME_MAIN, 'B', PDF_FONT_SIZE_MAIN); $pdf->Cell(40, 0, 'Observaciones generales:', 0, 1, 'L'); $pdf->SetFont(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN); $pdf->MultiCell(0, 0, $procedure->getComments(), 0, 1, 'L'); } $pdf->Ln(30); $pdf->SetFont(PDF_FONT_NAME_MAIN, 'B', PDF_FONT_SIZE_MAIN); $pdf->Cell(40, 0, 'FIRMA DEL PROPIETARIO', 0, 0, 'L'); $pdf->Cell(0, 0, 'FIRMA DEL PROFESIONAL ACTUANTE', 0, 1, 'R'); $pdf->Ln(60); $pdf->SetFont(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN); $pdf->Cell(0, 0, 'DIRECCION DE DESARROLLO URBANO Y CATASTRO', 0, 1, 'C'); $pdf->Cell(0, 0, 'MUNICIPALIDAD DE CIPOLLETTI', 0, 1, 'C'); // --------------------------------------------------------- //Close and output PDF document $pdf->Output('constancia.pdf', 'I'); }
protected function doGeneratePdf(sfContext $context, $chartBuilder, $file) { // definition of chart builder class $this->setChartBuilder($chartBuilder); // creation of a context $context->getConfiguration()->loadHelpers('Partial'); $context->getRequest()->setRequestFormat('html'); $config = sfTCPDFPluginConfigHandler::loadConfig(); sfTCPDFPluginConfigHandler::includeLangFile($context->getUser()->getCulture()); $doc_title = $this->getName() . " Report"; $doc_subject = $this->getName() . " Report generated by Otokou"; $doc_keywords = "report, otokou"; //create new PDF document (document units are set by default to millimeters) $pdf = new sfTCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true); // set document information $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor(PDF_AUTHOR); $pdf->SetTitle($doc_title); $pdf->SetSubject($doc_subject); $pdf->SetKeywords($doc_keywords); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); //set margins $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); //set auto page breaks $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); //set image scale factor $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); //initialize document $pdf->AliasNbPages(); // report informations $pdf->AddPage(); $html = get_partial('report/general_info', array('report' => $this)); $pdf->writeHTML($html, true, false, true, false, ''); // vehicles overall performances $html = '<h1>Vehicles performances</h1>' . '<p>The values presented below are calculated overall the entire life period of the vehicle(s).</p>' . get_partial('report/vehicles_performances', array('vehicles' => $this->getVehicles())); $pdf->writeHTML($html, true, false, true, false, ''); // charts $pdf->AddPage(); $html = '<h1>Costs</h1>'; $pdf->writeHTML($html, true, false, true, false, ''); $counter = 0; $options = array(); $attributes = array('absolute' => true); $charts = $this->defineCharts($options, $attributes); $nc = count($charts); foreach ($charts as $c) { $counter++; //$html = get_partial('report/chart', array('chart' => $c)); //$pdf->writeHTML($html, true, false, true, false, ''); $html = '<h2>' . $c['title'] . '</h2><p>' . $c['comment'] . '</p>'; $pdf->writeHTML($html); $c['chart']->generate(); $pdf->Image($c['chart']->getChartFileSystemPath()); if ($counter < $nc) { $pdf->AddPage(); } } // Close and output PDF document $pdf->Output($file, 'F'); }