public function getAuxVentanilla() { /* Consulto todas las auxiliares de ventanilla. Sino existen en la tabla * Auxventanilla, las creo en la misma */ $data = DB::connection('ccv')->select("SELECT noDocumento FROM empleados where cargos_id= :id", ['id' => self::$id_cargo_auxventanilla]); foreach ($data as &$value) { $a = Auxventanilla::where("noDocumento", "=", $value->noDocumento)->first(); if (empty($a)) { $a = new Auxventanilla(); $a->noDocumento = $value->noDocumento; $a->save(); } } $aux = Auxventanilla::all(); $list = array(); foreach ($aux as &$value) { $auxventanilla["noDocumento"] = $value->noDocumento; $data = DB::connection('ccv')->select("SELECT Cargos_id,nombres,apellidos,nombre as cargo FROM empleados as e\n INNER JOIN cargos as c ON e.Cargos_id = c.id \n where noDocumento= :d", ['d' => $value->noDocumento]); $auxventanilla["nombre"] = $data[0]->nombres . " " . $data[0]->apellidos; //return $auxventanilla["nombre"]; $auxventanilla["inicioStiker"] = $value->inicioStiker; $auxventanilla["finStiker"] = $value->finStiker; $auxventanilla["Cargos_id"] = $data[0]->Cargos_id; $auxventanilla["cargo"] = $data[0]->cargo; $auxventanilla["Entregados"] = DB::connection('mysql')->select('select count(id) as count from registro_asignacion ' . 'where idAuxVentanilla = :id' . '&& YEAR(fecha) <= YEAR(now())', ['id' => $value->id])[0]->count; DB::connection('mysql')->table("registro_asignacion")->where('idAuxVentanilla', '=', $value->id)->count(); array_push($list, $auxventanilla); } return $list; }
public function getAuxVentanilla() { $data = DB::connection('ccv')->select("SELECT noDocumento,nombres,apellidos FROM empleados where cargos_id= :id", ['id' => 36]); $list = array(); foreach ($data as &$value) { //return $value->noDocumento; $auxventanilla["noDocumento"] = $value->noDocumento; $auxventanilla["nombre"] = $value->nombres . " " . $value->apellidos; $auxventanilla["inicioStiker"] = ""; $auxventanilla["finStiker"] = ""; $auxventanilla["Entregados"] = ""; $aux = Auxventanilla::where('noDocumento', '=', $value->noDocumento)->first(); if (!empty($aux)) { $auxventanilla["inicioStiker"] = $aux->inicioStiker; $auxventanilla["finStiker"] = $aux->finStiker; $auxventanilla["Entregados"] = DB::connection('mysql')->table("registro_asignacion")->where('idAuxVentanilla', '=', $aux->id)->count(); } array_push($list, $auxventanilla); } return $list; }
public function consecutivoAux(Request $request) { $data = $request->all(); $auxVen = Auxventanilla::where('noDocumento', '=', $data['noDocumento'])->first(); if (empty($auxVen)) { return ""; } else { $reg = DB::connection('mysql')->select("SELECT stiker as max \n FROM registro_asignacion \n where idAuxVentanilla=" . $auxVen->id . " and YEAR(fecha) <= YEAR(now())\n order by cast(stiker as unsigned) desc limit 1"); return intval($reg[0]->max) + 1; } }