예제 #1
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();
         $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->rpe_presto = Session::get('clave');
         $prestamo->save();
         $res['success'] = true;
         $res['id_prestamo'] = $prestamo->id_prestamo;
     } catch (Exception $e) {
         $res['msj'] = $e->getMessage();
     }
     $id_lab = Session::get('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();
 }
예제 #2
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();
 }