예제 #1
0
 public function getSeleccionRequerimientos($id)
 {
     $cargo = Cargo::find($id);
     $funciones = Funcion::where('cargo_id', $id)->get();
     $requisitos = ContratarRequisito::where('cargo_id', $id)->get();
     return view('personal.seleccion.requerimientos')->with(compact(['cargo', 'funciones', 'requisitos']));
 }
예제 #2
0
 public function consultarFestivales(Request $request)
 {
     // dd($request);
     if ($request->FechaFinal != "" && $request->FechaInicio != "") {
         $fecha = $request->FechaInicio . " 00:00:00";
         $fechaInf = Carbon::createFromFormat("d/m/Y H:i:s", $fecha);
         $fecha = $request->FechaFinal . " 23:59:59";
         $fechaSup = Carbon::createFromFormat("d/m/Y H:i:s", $fecha);
         //dd($fechaInf,$fechaSup);
         Funcion::whereBetween('fecha', array($fechaInf, $fechaSup))->orderBy('titulo', 'asc')->get();
         $Funciones = Funcion::where('status', 'Realizada')->whereBetween('fecha', array($fechaInf, $fechaSup))->orderBy('titulo', 'asc')->get();
         $resultado = [];
         $i = 0;
         $resultado[0]['Festival'] = "";
         $resultado[0]['Peliculas'] = "";
         $resultado[0]['Asistencia'] = 0;
         $resultado[0]['Duracion'] = 0;
         $resultado[0]["      "] = "";
         $resultado[0]['Total Peliculas'] = 0;
         $resultado[0]['Largometrajes'] = 0;
         $resultado[0]['Cortometrajes'] = 0;
         $resultado[0]['Festivales'] = 0;
         $resultado[0]['Total espectadores'] = 0;
         $resultado[0]['Total minutos'] = 0;
         $resultado[0]['Fecha inicial'] = $request->FechaInicio;
         $resultado[0]['Fecha final'] = $request->FechaFinal;
         $festivales = array();
         $aux = array();
         $j = 0;
         foreach ($Funciones as $funcion) {
             $resultado[0]['Total espectadores'] += $funcion->asistencia;
             $peliculas = $funcion->peliculas;
             $festival = $funcion->festivales->titulo;
             if (isset($aux[$festival . 'asistencia'])) {
                 $aux[$festival . 'asistencia'] += $funcion->asistencia;
             } else {
                 $aux[$festival . 'asistencia'] = $funcion->asistencia;
             }
             foreach ($peliculas as $pelicula) {
                 $resultado[0]['Total Peliculas']++;
                 if ($pelicula->tipo == 'Largometraje') {
                     $resultado[0]['Largometrajes']++;
                 }
                 if ($pelicula->tipo == 'Cortometraje') {
                     $resultado[0]['Cortometrajes']++;
                 }
                 $resultado[0]['Total minutos'] += $pelicula->duracion;
                 if (isset($aux[$festival . 'peliculas'])) {
                     $aux[$festival . 'peliculas']++;
                 } else {
                     $aux[$festival . 'peliculas'] = 1;
                 }
                 if (isset($aux[$festival . 'duracion'])) {
                     $aux[$festival . 'duracion'] += $pelicula->duracion;
                 } else {
                     $aux[$festival . 'duracion'] = $pelicula->duracion;
                 }
                 $festivales[$j] = $festival;
                 $j++;
             }
             $i++;
         }
         $resultadoFestivales = array_unique($festivales);
         $resultado[0]['Festivales'] = count($resultadoFestivales);
         $i = 0;
         foreach ($resultadoFestivales as $festival) {
             $resultado[$i]['Festival'] = $festival;
             if (isset($aux[$festival . 'peliculas'])) {
                 $resultado[$i]['Peliculas'] = $aux[$festival . 'peliculas'];
             } else {
                 $resultado[$i]['Peliculas'] = 0;
             }
             if (isset($aux[$festival . 'asistencia'])) {
                 $resultado[$i]['Asistencia'] = $aux[$festival . 'asistencia'];
             } else {
                 $resultado[$i]['Asistencia'] = 0;
             }
             if (isset($aux[$festival . 'duracion'])) {
                 $resultado[$i]['Duracion'] = $aux[$festival . 'duracion'];
             } else {
                 $resultado[$i]['Duracion'] = 0;
             }
             $i++;
         }
         //  dd($resultado,$aux,$festivales,$resultadoFestivales);
         $request->session()->put('festivales', $resultado);
     }
     if (!isset($resultado[0]['Festivales'])) {
         $resultado[0]['Festivales'] = 0;
     }
     if ($resultado[0]['Festivales'] > 0) {
         return view('Reportes/ReporteFestival')->with(['resultados' => $resultado, 'FechaIni' => $request->FechaInicio, 'FechaFin' => $request->FechaFinal]);
     } else {
         Session::flash('error', 'No se encontraron resultados');
         return redirect('reportes/festivales');
     }
 }
예제 #3
0
 public function getEditarCargo($id)
 {
     $cargo = Cargo::find($id);
     $rel = 0;
     $relaciones = Relacion::where('cargo_id', $id)->get();
     $atr = 0;
     $atribuciones = Atribucion::where('cargo_id', $id)->get();
     $fun = 0;
     $funciones = Funcion::where('cargo_id', $id)->get();
     $req = 0;
     $requisitos = Requisito::where('cargo_id', $id)->get();
     return view('mof.editar-cargo')->with(compact('cargo', 'rel', 'relaciones', 'atr', 'atribuciones', 'fun', 'funciones', 'req', 'requisitos'));
 }