예제 #1
0
 /**
  * @Route("/index", name="page_home_admin")
  * @Method("GET")
  */
 public function indexAction(Request $request)
 {
     if (!$request->getSession()->get(Generalkeys::LABEL_STATUS)) {
         return $this->redirectToRoute('admin_login');
     }
     $ventas = $this->getDoctrine()->getRepository('VisitaYucatanBundle:Venta')->findBy([], ['id' => 'DESC']);
     return $this->render('VisitaYucatanBundle:Default:index.html.twig', array("ventas" => VentaUtils::getAllVentas($ventas)));
 }
예제 #2
0
 /**
  * @Route("/venta/send/voucher/paquete", name="web_voucher_paquete")
  * @Method("GET")
  */
 public function voucherPackage(Request $request)
 {
     $em = $this->getDoctrine()->getManager();
     $em->getConnection()->beginTransaction();
     try {
         $idVenta = $request->getSession()->get("idVentaGenerada");
         // limpia variable para no cargar otra vez la pagina
         $request->getSession()->set("idVentaGenerada", null);
         if (is_null($idVenta)) {
             return $this->redirectToRoute('web_home');
         }
         // renderiza la vista y manda la informacion
         $venta = $this->getDoctrine()->getRepository('VisitaYucatanBundle:Venta')->find($idVenta);
         $paquete = $this->getDoctrine()->getRepository('VisitaYucatanBundle:Paquete')->find($venta->getVentaDetalle()->get(0)->getPaquete()->getId());
         $ventaCompletaTO = VentaUtils::getVentaCompleteTOPackage($venta, $paquete);
         $mes = DateUtil::getFullNameMonth(date_format($venta->getFechaVenta(), 'm'));
         $mesReserva = DateUtil::getFullNameMonth(date_format($venta->getDatosReserva()->getCheckIn(), 'm'));
         $html = $this->renderView('@VisitaYucatan/web/pages/pdf/paquete/reserva-package-pdf.html.twig', array('ventaCompleta' => $ventaCompletaTO, 'mes' => $mes, 'mesReserva' => $mesReserva));
         $file = $this->getPdf($html, $ventaCompletaTO, Generalkeys::PATH_VOUCHER_PAQUETES, Generalkeys::NAME_VENTA_FILE);
         $this->sendMailSale($ventaCompletaTO->getEmail(), $file);
         return $this->render('@VisitaYucatan/web/pages/pdf/paquete/success-sale-paquete-html.twig', array('ventaCompleta' => $ventaCompletaTO, 'mes' => $mes, 'mesReserva' => $mesReserva));
     } catch (\Exception $e) {
         $em->getConnection()->rollback();
         return $this->redirectToRoute('web_home');
     }
 }