Ejemplo n.º 1
0
 public function getMantenimiento()
 {
     $habitaciones = Habitacion::with(['mantenimiento' => function ($q) {
         $q->where('detallemantenimiento.estado', '=', 1);
         $q->get();
     }, 'mantenimiento.persona'])->orderby('nombre', 'asc')->get();
     return View::make('habitaciones.mantenimiento', compact('habitaciones'));
 }
Ejemplo n.º 2
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);
 }