Exemplo n.º 1
0
 function registrarEntrada(Request $r)
 {
     $date = Carbon::now();
     $date->timezone("America/Mexico_City");
     $entrada = new LabEntrada();
     $entrada->id_area = $r->input('id_area');
     $entrada->cve_alumno = $r->input('cve_alumno');
     $entrada->cve_materia = $r->input('cve_materia');
     $entrada->fecha_entrada = $date;
     $entrada->hora_entrada = $date;
     $entrada->notas = $r->input('nota');
     if ($r->input('codigo_lab') != "") {
         $prestamo = new LabPrestamoItem();
         $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->cve_solicitante = $r->input('cve_alumno');
             $prestamo->tipo_solicitante = 1;
             $prestamo->fecha_prestamo = $date;
             $prestamo->save();
             $entrada->id_prestamo_item = $prestamo->id_prestamo;
         }
     }
     $entrada->save();
     $id_lab = Session::get('id_lab');
     $labAreas = LabArea::where('id_laboratorio', $id_lab)->lists('id_area');
     $entradas = LabEntrada::whereIn('id_area', $labAreas)->whereNull('hora_salida')->paginate(8);
     return view('laboratorio.controlAlumnos.tablaAcceso', array('entradas' => $entradas))->render();
 }
Exemplo n.º 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();
 }
Exemplo n.º 3
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));
 }
Exemplo n.º 4
0
 function guardarCambiosEquipo(Request $r)
 {
     $item = InvItem::find($r->input('id_item'));
     $item->fill($r->all());
     $item->save();
     return view('laboratorio.controlEquipos.tablasInventario.detalle', array('i' => $item));
 }