public function buscar($campo, $parametro)
 {
     try {
         return Habitacion::getAll();
     } catch (Exception $e) {
         header("Location: ../buscar.php?respuesta=error");
     }
 }
Ejemplo n.º 2
0
 function getList($pagina = 1, $orden = "", $nrpp = Configuracion::NRPP)
 {
     $ordenPredeterminado = "{$orden}, id";
     if (trim($orden) === "" || trim($orden) === NULL) {
         $ordenPredeterminado = "id";
     }
     $registroInicial = ($pagina - 1) * $nrpp;
     $this->bd->select($this->tabla, "*", "1=1", array(), $ordenPredeterminado, "{$registroInicial}, {$nrpp}");
     $r = array();
     while ($fila = $this->bd->getRow()) {
         $habitacion = new Habitacion();
         $habitacion->set($fila);
         $r[] = $habitacion;
     }
     return $r;
     //Devuelve un array de usuarios;
 }
 public function habitacion($id_hotel, $max)
 {
     $proteccion = new Proteccion();
     $tp = new TemplatePower("templates/AltaHotel.html");
     $tp->prepare();
     $tp->gotoBlock("_ROOT");
     if ($max == 1) {
         $tp->newBlock("hotelcreado");
     } else {
         $capacidad = $proteccion->html($_POST['capacidad']);
         $disponibilidad = $proteccion->html($_POST['disponibilidad']);
         $piso = $proteccion->html($_POST['piso']);
         $ubicacion = $proteccion->html($_POST['ubicacion']);
         $habitacion = new Habitacion($capacidad, $disponibilidad, $piso, $ubicacion);
         $id_habitacion = $habitacion->insertarHabitacion();
         $hotel = new Hotel();
         $hotel->AgregarHabitacion($id_hotel, $id_habitacion);
         $max = (int) $max - 1;
         $tp->newBlock("habitacion");
         $tp->assign("id_hotel", $id_hotel);
         $tp->assign("max", $max);
     }
     echo $tp->getOutputContent();
 }
Ejemplo n.º 4
0
 public function getMantenimientoliberar($id = NULL)
 {
     if (isset($id)) {
         $habitacion = Habitacion::find($id);
         $control = $habitacion->mantenimiento()->where('detallemantenimiento.estado', '=', 1)->first();
         if (Auth::user()->perfil_id == 3 && $habitacion->estado == 'Limpieza' && $control->id == Auth::user()->id) {
             $control->pivot->estado = 0;
             $control->pivot->horatermino = date('Y-m-d H:i:s');
             $control->pivot->save();
             $flagpedido = $habitacion->pedidos()->where('pedido.estado', '=', 1)->first();
             if (count($flagpedido) > 0) {
                 $habitacion->estado = 'Ocupada';
             } else {
                 $habitacion->estado = 'Libre';
             }
             $habitacion->save();
             return Redirect::back();
         } else {
             return Redirect::back();
         }
     } else {
         return Redirect::back();
     }
 }
Ejemplo n.º 5
0
es “libre”. El método reserva debe poner el estado en “reservada” en caso de que esté libre (y debe
decrementar el total de habitaciones libres); por el contrario, en caso de estar ya “reservada” u
“ocupada”, se debe mostrar el correspondiente mensaje de error. El método ocupa debe poner el
estado en “ocupada”, independientemente del estado que tuviera anteriormente. El siguiente código
del programa principal debe dar la salida que se muestra:

Autor Juan Jose Fernandez Romero
-->
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php 
include 'Habitacion.php';
$h1 = new Habitacion(237, "clásica");
$h2 = new Habitacion(418, "suite");
$h3 = new Habitacion(217, "superior");
$h2->reserva();
$h3->ocupa();
echo "Hay " . Habitacion::getTotalHabitaciones() . " habitaciones.<br>";
echo "Quedan " . Habitacion::getHabitacionesLibres() . " libres.<br>";
echo $h2 . "<br>";
$h2->reserva();
echo $h3 . "<br>";
$h3->reserva();
?>
    </body>
</html>
Ejemplo n.º 6
0
 public function postCerrarCaja()
 {
     $caja = $this->detallecaja->caja;
     $ingresoscaja = $this->detallecaja->ingresos()->sum('importetotal');
     $montoinicial = $this->detallecaja->montoinicial;
     $encargado = Auth::user()->persona;
     $fechacierre = date('Y-m-d H:i:s');
     $detallecaja = $this->detallecaja;
     $diferencia = Input::get('diferencia');
     $habitaciones = Habitacion::with(['mantenimiento' => function ($q) {
         $q->whereBetween('horatermino', [$this->detallecaja->created_at, date('Y-m-d H:i:s')]);
         $q->get();
     }, 'mantenimiento.persona'])->orderby('nombre', 'asc')->get();
     $this->detallecaja->ventas = $this->detallecaja->ventas()->sum('importe');
     $this->detallecaja->gastos = $this->detallecaja->gastos()->sum('importetotal');
     $this->detallecaja->ingresos = $ingresoscaja;
     $this->detallecaja->arqueo = Input::get('arqueo');
     $this->detallecaja->diferencia = $diferencia;
     $this->detallecaja->estado = 'Cerrado';
     $this->detallecaja->fechacierre = $fechacierre;
     $this->detallecaja->save();
     $caja->estado = 1;
     $caja->save();
     $alquileres = $this->detallecaja->ventas()->with(['alquiler', 'alquiler.habitacion', 'productos'])->get();
     $creditos = $this->detallecaja->creditos()->with(['pedido', 'pedido.habitacion'])->get();
     $gastos = $this->detallecaja->gastos()->with(['tipogasto'])->get();
     $html = View::make('pdf.cierrecaja', compact('alquileres', 'gastos', 'ingresoscaja', 'montoinicial', 'encargado', 'fechacierre', 'detallecaja', 'habitaciones', 'diferencia', 'creditos'));
     $headers = array('Content-Type' => 'application/pdf');
     return Response::make(PDF::load($html, 'A4', 'portrait')->show(), 200, $headers);
 }