/**
  * Genera una factura para la inscripción indicada.
  *
  * @param Registration $registration
  * @param $filename
  *
  * @return string
  */
 public function generateInvoiceDraft(Registration $registration, &$filename)
 {
     $filename = sprintf('factura-%s-%d-%s.pdf', $registration->getConvention()->getSlug(), $registration->getId(), $registration->getUser()->getUniversity()->getSlug());
     $html = $this->twig->render('themes/invoice/invoice_draft.html.twig', array('registration' => $registration, 'fecha' => new \DateTime('today')));
     return $this->loggableGenerator->getOutputFromHtml($html);
 }
Ejemplo n.º 2
0
 /**
  * @Route("/descargar_factura/{registration}", name="invoice_download")
  */
 public function downloadInvoiceAction(Registration $registration)
 {
     $this->get('kernel')->getRootDir();
     $fileToDownload = $this->get('kernel')->getRootDir() . '/../private/documents/invoices/' . $registration->getId() . '.pdf';
     $response = new BinaryFileResponse($fileToDownload);
     $response->trustXSendfileTypeHeader();
     $response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $registration->getConvention()->getName() . '_factura.pdf', iconv('UTF-8', 'ASCII//TRANSLIT', $registration->getId()));
     return $response;
 }