Пример #1
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $req)
 {
     $Id = $req->input("id_area");
     $Laboratorio = LabArea::where("id_area", $Id)->first();
     $res = $Laboratorio->capacidad;
     return view("laboratorio.controlAlumnos.Modal_Espacios", array("cantidad" => $res));
 }
Пример #2
0
 function registrarPrestamo(Request $r)
 {
     $res = ['success' => false];
     try {
         $date = Carbon::now();
         $prestamo = new LabPrestamoItem();
         $prestamo->cve_solicitante = $r->input('cve_solicitante');
         $prestamo->tipo_solicitante = $r->input('tipo_solicitante');
         $prestamo->fecha_prestamo = $date;
         $date->timezone("America/Mexico_City");
         $invitem = InvItem::where('id_area', $r->input('id_area'))->where('codigo_lab', $r->input('codigo_lab'))->first();
         if ($invitem) {
             $prestamo->id_item = $invitem->id_item;
         }
         $prestamo->save();
         $res['success'] = true;
         $res['id_prestamo'] = $prestamo->id_prestamo;
     } catch (Exception $e) {
         $res['msj'] = $e->getMessage();
     }
     $id_lab = $r->input('id_lab');
     $laboratorio = Laboratorio::find($id_lab);
     $labAreas = LabArea::where('id_laboratorio', $id_lab)->lists('id_area');
     $items = InvItem::whereIn('id_area', $labAreas)->lists('id_item');
     $prestamos = LabPrestamoItem::whereIn('id_item', $items)->whereNull('fecha_entrega')->paginate(6);
     return view('laboratorio.tablaPrestamos', array('prestamos' => $prestamos))->render();
 }
Пример #3
0
 function dameEquiposArea(Request $r)
 {
     $id_area = $r->input('id_area');
     $labArea = LabArea::find($id_area);
     $items = InvItem::where('id_area', $id_area)->get();
     $cadena = "";
     foreach ($items as $item => $i) {
         if ($i->id_item_principal == null) {
             $cadena = $cadena . "<option>" . $i->codigo_lab . "</option> ";
         }
     }
     return $cadena;
 }
Пример #4
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $res = ["success" => false];
     try {
         LabArea::create(['area' => $request['area'], 'capacidad' => $request['capacidad'], 'salon' => $request['salon'], 'id_laboratorio' => Session::get('id_lab')]);
         $res["success"] = true;
         $res["msg"] = "El Area se ha registrado <strong>correctamente!</strong>";
         $res["tipo"] = "success";
     } catch (Exception $e) {
         $res["tipo"] = "danger";
         $res["msg"] = "Los datos son incorrectos";
     }
     return response()->json($res);
     //
 }
Пример #5
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $r)
 {
     $res = ['success' => false];
     try {
         $date = Carbon::now();
         $date->timezone("America/Mexico_City");
         $mantenimiento = LabMantenimiento::create($r->all());
         $mantenimiento->fecha_realizado = $date;
         $mantenimiento->cve_responsable = Session::get('clave');
         $mantenimiento->save();
         $res['success'] = true;
     } catch (Exception $e) {
         $res['msj'] = $e->getMessage();
     }
     $id_lab = Session::get('id_lab');
     $labAreas = LabArea::where('id_laboratorio', $id_lab)->lists('id_area');
     $mantenimientos = LabMantenimiento::whereIn('id_area', $labAreas)->get();
     return view('laboratorio.controlEquipos.tabla_mantenimientos', array('mantenimientos' => $mantenimientos));
 }
Пример #6
0
 function consultaPrestamo(Request $r)
 {
     $id_lab = Session::get('id_lab');
     $fechaIni = $r->input('fechaIni');
     $fechaFin = $r->input('fechaFin');
     $nuevafecha = strtotime('+1 day', strtotime($fechaFin));
     $fechaFin = date('Y-m-d', $nuevafecha);
     $fechaIni = date_format(date_create($fechaIni), 'Y-m-d');
     $fechaFin = date_format(date_create($fechaFin), 'Y-m-d');
     $prestamos = null;
     $laboratorio = Laboratorio::find($id_lab);
     $labAreas = LabArea::where('id_laboratorio', $id_lab)->lists('id_area');
     $entradas = "";
     if ($r->input('op') == "equipo") {
         $dato = $r->input('dato');
         //$query = "SELECT count(`cve_alumno`) as `cant`,`cve_alumno` FROM `lab_entradas`,
         //  `alumnos` where `cve_alumno` = `clave_unica` group by (`clave_unica`) order by `cant` desc limit 5";
         //select count(`cve_alumno`) as `cant` from `lab_entradas` inner join `alumnos` on `alumnos`.`clave_unica` = `lab_entradas`.`cve_alumno`
         // where `id_area` in (1, 2, 3, 4, 5, 6) group by `cve_alumno` order by `cant` desc limit 4 offset 0
         $item = InvItem::whereIn('id_area', $labAreas)->where('codigo_lab', 'LIKE', '%' . $dato . '%')->first();
         $prestamos = LabPrestamoItem::where('id_item', $item->id_item)->where('fecha_prestamo', '>', $fechaIni)->where('fecha_prestamo', '<', $fechaFin)->get();
     } else {
         if ($r->input('op') == "clave") {
             $clave = $r->input('dato');
             $prestamos = LabPrestamoItem::where('cve_solicitante', 'LIKE', '%' . $clave . '%')->where('fecha_prestamo', '>=', $fechaIni)->where('fecha_prestamo', '<', $fechaFin)->get();
         }
     }
     return view('laboratorio.tablaConsulta', array('prestamos' => $prestamos));
 }
Пример #7
0
 function consultaAlumno(Request $r)
 {
     $clave = $r->input('cve_alumno');
     $id_lab = Session::get('id_lab');
     $laboratorio = Laboratorio::find($id_lab);
     $labAreas = LabArea::where('id_laboratorio', $id_lab)->lists('id_area');
     $entradas = LabEntrada::whereIn('id_area', $labAreas)->where('cve_alumno', $clave)->paginate(10);
     $id_lab = $r->input('id_lab');
     $fechaIni = $r->input('fechaIni');
     $fechaFin = $r->input('fechaFin');
     $nuevafecha = strtotime('+1 day', strtotime($fechaFin));
     $fechaFin = date('Y-m-d', $nuevafecha);
     $fechaIni = date_format(date_create($fechaIni), 'Y-m-d');
     $fechaFin = date_format(date_create($fechaFin), 'Y-m-d');
     $laboratorio = Laboratorio::find($id_lab);
     $labAreas = LabArea::where('id_laboratorio', $id_lab)->lists('id_area');
     $entradas = "";
     if ($r->input('op') == "frecuentes") {
         $dato = $r->input('dato');
         //$query = "SELECT count(`cve_alumno`) as `cant`,`cve_alumno` FROM `lab_entradas`,
         //  `alumnos` where `cve_alumno` = `clave_unica` group by (`clave_unica`) order by `cant` desc limit 5";
         //select count(`cve_alumno`) as `cant` from `lab_entradas` inner join `alumnos` on `alumnos`.`clave_unica` = `lab_entradas`.`cve_alumno`
         // where `id_area` in (1, 2, 3, 4, 5, 6) group by `cve_alumno` order by `cant` desc limit 4 offset 0
         $entradas = LabEntrada::whereIn('id_area', $labAreas)->where('fecha_entrada', '>', $fechaIni)->where('fecha_entrada', '<', $fechaFin)->join('alumnos', 'alumnos.clave_unica', '=', 'lab_entradas.cve_alumno')->groupBy('cve_alumno')->orderBy('duracion', 'desc')->skip($dato)->take($dato)->get();
     } else {
         if ($r->input('op') == "clave") {
             $clave = $r->input('dato');
             $entradas = LabEntrada::whereIn('id_area', $labAreas)->where('cve_alumno', 'LIKE', '%' . $clave . '%')->where('fecha_entrada', '>', $fechaIni)->where('fecha_entrada', '<', $fechaFin)->get();
         }
     }
     return view('laboratorio.controlAlumnos.tablaConsulta', array('laboratorio' => $laboratorio, 'entradas' => $entradas));
 }