/** * @Route("/tour/detail/id/{id}", name="web_tour_detail") * @Method("GET") */ public function detailTourAction($id, Request $request) { $datos = $this->getParamsTour($request); $tour = $this->getDoctrine()->getRepository('VisitaYucatanBundle:Tour')->getTourById($id, $datos[Generalkeys::NUMBER_ZERO], $datos[Generalkeys::NUMBER_ONE]); $imagesTour = $this->getDoctrine()->getRepository('VisitaYucatanBundle:Tourimagen')->findTourImagesByIdTour($id); return $this->render('VisitaYucatanBundle:web/pages:detalle-tour.html.twig', array('tour' => TourUtils::getTourTO($tour, $imagesTour), 'claseImg' => Generalkeys::CLASS_HEADER_TOUR_DETAIL, 'fechaReserva' => DateUtil::formatDateToString(DateUtil::summDayToDate(DateUtil::Now(), Generalkeys::NUMBER_TWO)))); }
public function createDataReserva($hotelPickUp, $checkIn, $checkOut) { $dataReservation = new DatosReserva(); $dataReservation->setHotelPickUp($hotelPickUp); $dataReservation->setCheckIn(new \DateTime(DateUtil::formatDateMysql($checkIn))); $dataReservation->setCheckOut(is_null($checkOut) ? $checkOut : new \DateTime(DateUtil::formatDateMysql($checkOut))); return $dataReservation; }
public function createDatosVuelo(VentaCompletaTO $ventaCompletaTO) { $datosVuelo = new DatosVuelo(); $datosVuelo->setAerolinea($ventaCompletaTO->getAerolinea()); $datosVuelo->setNumeroVuelo($ventaCompletaTO->getNumeroVuelo()); if ($ventaCompletaTO->getFechaLlegada() != '') { $datosVuelo->setFechaLlegada(new \DateTime(DateUtil::formatDateMysql($ventaCompletaTO->getFechaLlegada()))); } $datosVuelo->setHoraLlegada(new \DateTime(date("H:i", strtotime($ventaCompletaTO->getHoraLlegada())))); return $datosVuelo; }
public function saveRate($tarifaTO) { $em = $this->getEntityManager(); $nextDate = true; // asigna primera fecha a guardar $fechaActual = $tarifaTO->getFechaInicio(); // Elimina las tarifas en el rango de fechas seleccionadas $eliminado = $this->deleteRateByDates($tarifaTO->getIdContrato(), $tarifaTO->getIdHabitacion(), $tarifaTO->getIdHotel(), $tarifaTO->getFechaInicio(), $tarifaTO->getFechaFin()); // Si se eliminaron los registro procede a guardar los nuevos if ($eliminado) { // Mientras no se llege a la fecha final se crean o modifican los registros while ($nextDate) { // Crea la fecha con la informacion capturada $this->createRateHotel($tarifaTO->getIdContrato(), $tarifaTO->getIdHabitacion(), $tarifaTO->getIdHotel(), $fechaActual, $tarifaTO->getSencillo(), $tarifaTO->getDoble(), $tarifaTO->getTriple(), $tarifaTO->getCuadruple()); // Si la fecha actual es la misma a la fecha final sale del ciclo, termina if (DateUtil::isSammeDate($fechaActual, $tarifaTO->getFechaFin())) { $nextDate = false; } else { // Si no es igual le suma un dia a la fecha actual $fechaActual = DateUtil::summOneDayToDate($fechaActual); } } } }
/** * @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'); } }
public static function getHotelReserva($fechaInicio, $fechaFin, $adultos, $menores, $hotel, $tarifa) { $reserva = new HotelReservaTO(); $reserva->setNombreHotel($hotel['nombrehotel']); $reserva->setTipoHabitacion($tarifa['nombre']); $reserva->setSimboloMoneda($tarifa['simbolomoneda']); $reserva->setIdIdioma($tarifa['ididioma']); $reserva->setIdMoneda($tarifa['moneda']); $reserva->setTipoCambio($tarifa['tipocambiomoneda']); $reserva->setFechaInicio($fechaInicio); $reserva->setFechaFin($fechaFin); $reserva->setAdultos($adultos); $reserva->setMenores($menores); $costo = self::getRateByPersons($adultos, $tarifa['costosencillo'], $tarifa['costodoble'], $tarifa['costotriple'], $tarifa['costocuadruple']); $costoTotal = self::getTotalRate($costo, $tarifa['ish'], $tarifa['markup'], $tarifa['iva'], $tarifa['fee'], $tarifa['aplicaimpuesto']); $reserva->setTarifaAdulto(number_format($costoTotal, 2)); $reserva->setTarifaMenor(floatval(0)); $dias = DateUtil::diffDays(DateUtil::formatDate($fechaInicio), DateUtil::formatDate($fechaFin)); $reserva->setEstadiaDias($dias); $reserva->setCostoTotal(ceil($costoTotal * ($dias - 1))); $reserva->setEstadiaNoches($dias - Generalkeys::NUMBER_ONE); return $reserva; }
/** * @Route("/admin/hotel/find/tarifas/by/dates", name="hotel_find_tarifas_by_date") * @Method("POST") */ public function findRateHotelByDateAction(Request $request) { $fechaInicio = DateUtil::formatDate($request->get('fechaInicio')); $fechaFin = DateUtil::formatDate($request->get('fechaFin')); $idContrato = $request->get('idContrato'); $idHabitacion = $request->get('idHabitacion'); $idHotel = $request->get('idHotel'); $rateList = $this->getDoctrine()->getRepository('VisitaYucatanBundle:HotelTarifa')->findRateByRangeDate($fechaInicio, $fechaFin, $idHotel, $idContrato, $idHabitacion); return new Response($this->get('serializer')->serialize($rateList, Generalkeys::JSON_STRING)); }
/** * @Route("/hotel/find/rates", name="web_hotel_rates") * @Method("POST") */ public function getPricesRoom(Request $request) { try { // obtiene los datos de session moneda e idioma $datos = $this->getParamsTour($request); $adults = $request->get('adults'); $minors = $request->get('minors'); $dateFrom = $request->get('from'); $dateTo = $request->get('to'); $idHotel = $request->get('idHotel'); //echo "adultos = ".$adults; //TODO path test = http://localhost/visitayucatan2.0/hotel/find/rates?adults=2&minors=3&from=08/05/2016&to=31/05/2016&idHotel=1 $idContract = $this->getDoctrine()->getRepository('VisitaYucatanBundle:HotelContrato')->findIdContractActiveByHotel($idHotel); //echo "idcontrado activo = ".$idContract." <br>"; $dateClosing = $this->getDoctrine()->getRepository('VisitaYucatanBundle:HotelFechaCierre')->findClosingDateByContractAndHotel($idHotel, $idContract); //echo "fechas cierre = ".print_r($dateClosing); echo " <br>"; $costosRoom = $this->getDoctrine()->getRepository('VisitaYucatanBundle:HotelTarifa')->getRateByRooms(DateUtil::formatDate($dateFrom), DateUtil::subtractOneDayTodate(DateUtil::formatDate($dateTo)), $idHotel, $datos[Generalkeys::NUMBER_ZERO], $datos[Generalkeys::NUMBER_ONE], $idContract); $costs = HotelUtils::getCotizationRoom($costosRoom, $adults, $minors, $dateClosing); //print_r($costs); $response = new ResponseTO(Generalkeys::RESPONSE_TRUE, Generalkeys::EMPTY_STRING, Generalkeys::RESPONSE_SUCCESS, Generalkeys::RESPONSE_CODE_OK); $response->setData($costs); // TODO siguiente codigo comentado para impresion de fechas y costos mas rapido /*foreach ($response->getData() as $value) { echo "habitacion = ".$value->getNombre()."<br> descripcion = ".$value->getDescripcion()."<br>"; echo "<br><br>"; foreach ($value->getHotelTarifasTOCollection() as $item) { echo "capacidad maxima = ".$item->getCapacidadMaxima()." fecha = ".$item->getSmallDate()." costo = ".$item->getCosto()." disponible = ".$item->getIsAvailable()." msj = ".$item->getMsjAvailable(); echo "<br>"; } echo "GRAND TOTAL = ".$value->getTotalCostoHabitacion(); echo "<br><br>"; echo "cambio de habitacion *****************************************************************************************************************************"; echo "<br><br>"; }*/ return new Response($this->get('serializer')->serialize($response, Generalkeys::JSON_STRING)); } catch (\Exception $e) { return new Response($this->get('serializer')->serialize(new ResponseTO(Generalkeys::RESPONSE_FALSE, $e->getMessage(), Generalkeys::RESPONSE_ERROR, $e->getCode()), Generalkeys::JSON_STRING)); } }