public function generarTurnos($agenda_id = NULL)
 {
     $errores = true;
     if (empty($agenda_id)) {
         $agendas = Agenda::whereNotIn('id', function ($query) {
             $query->select('agenda_id')->from('turnos');
         })->where('habilitado_turnos', '=', 1)->get();
     } else {
         $agendas = Agenda::where('id', $agenda_id)->get();
     }
     foreach ($agendas as $agenda) {
         $coe = $agenda->centroOdontologoEspecialidad;
         $horario_desde = date('H:i', strtotime(substr_replace($coe->horario_desde, ':', 2, 0)));
         $horario_hasta = date('H:i', strtotime(substr_replace($coe->horario_hasta, ':', 2, 0)));
         $duracion = $coe->duracion_turno;
         $hora = $horario_desde;
         $hora_hasta = date('H:i', strtotime("+" . $duracion . " minutes", strtotime($hora)));
         $turnos = array();
         while (strtotime($hora) < strtotime($horario_hasta)) {
             $turno = array();
             $turno["agenda_id"] = $agenda->id;
             $turno["hora_desde"] = str_replace(":", "", $hora);
             $turno["hora_hasta"] = str_replace(":", "", $hora_hasta);
             $turno["tipo_turno"] = 'T';
             // turno
             $turno["estado"] = 'L';
             // libre
             $turno["created_at"] = date("Y-m-d H:i:s");
             $turno["updated_at"] = date("Y-m-d H:i:s");
             $turnos[] = $turno;
             $hora = $hora_hasta;
             $hora_hasta = date('H:i', strtotime("+" . $duracion . " minutes", strtotime($hora)));
         }
         $e = Turno::insert($turnos);
         if (!$e) {
             $errores = false;
         }
     }
     return $errores;
 }
Exemplo n.º 2
0
 function accionIniciar()
 {
     sesionNivel('a', 'e', 'g');
     include_once 'Modelos/' . $this->modelo . '.php';
     $modelo = $this->modelo;
     $condiciones = array();
     $condiciones[] =& $_SESSION['usuario']->id_usuario;
     $tipos = 'i';
     $condicion = 'where id_usuario=? and finalizado="n"';
     $turno = Turno::obtenerTodos($condicion, $condiciones, $tipos);
     if (count($turno) === 0) {
         if (isset($_SESSION['usuario'], $_POST['cantidad_inicial'])) {
             $turno = new Turno();
             $turno->id_usuario = $_SESSION['usuario']->id_usuario;
             $turno->cantidad_inicial = $_POST['cantidad_inicial'];
             if ($turno->iniciar() == "") {
                 $id = $turno->insert_id();
                 $_SESSION['turno'] = Turno::obtenerTodos(' where id_turno=' . $id)[0];
                 header("Location: /Abarrotes/");
             } else {
                 echo "-3";
             }
         } else {
             echo "-4";
         }
     } else {
         echo 'Hay turno pendiente!';
     }
 }
 function accionIndex()
 {
     if (isset($_SESSION['usuario'])) {
         if (isset($_SESSION['turno'])) {
             $condiciones = array();
             $condiciones[] =& $_SESSION['turno']->id_turno;
             $tipos = 'i';
             $condicion = 'where id_turno=? and finalizado="n"';
             $turno = Turno::obtenerTodos($condicion, $condiciones, $tipos);
             if (count($turno) === 1) {
                 include_once 'Vistas/Aplicacion/index.php';
             } else {
                 include_once 'Vistas/Turno/crearTurno.php';
             }
         } else {
             $condiciones = array();
             $condiciones[] =& $_SESSION['usuario']->id_usuario;
             $tipos = 'i';
             $condicion = 'where id_usuario=? and finalizado="n"';
             $turno = Turno::obtenerTodos($condicion, $condiciones, $tipos);
             if (count($turno) >= 1) {
                 $_SESSION['turno'] = $turno[0];
                 include_once 'Vistas/Aplicacion/index.php';
             } else {
                 include_once 'Vistas/Turno/crearTurno.php';
             }
         }
     } else {
         header("Location: /Abarrotes/Sesion/Ingresar");
     }
 }
Exemplo n.º 4
0
 public function destroy($id)
 {
     $turno = Turno::find($id);
     $turno->delete();
     Session::flash('message', "El turno Eliminado Correctamente...!");
     Session::flash('class', 'success');
     return Redirect::to('turno');
 }
Exemplo n.º 5
0
 public function genera($attivita, $turno)
 {
     $att = Attivita::id($attivita);
     $turno = Turno::id($turno);
     $ref = Volontario::id($att->referente);
     $c = $att->comitato();
     $name = '' . date('Ymd_THis', $turno->inizio) . '_' . $turno->id . '_.ics';
     /* Strutturo il file */
     $this->autore = $sessione->utente;
     $this->nome = $name;
     $this->mime = 'text/calendar; charset=utf-8; method=REQUEST';
     /* Inserisco le informazioni */
     $s = "BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:-//Croce Rossa Italiana//Progetto GAIA//IT\nMETHOD:REQUEST\nBEGIN:VTIMEZONE\nTZID:Europe/Rome\nBEGIN:DAYLIGHT\nTZOFFSETFROM:+0100\nTZOFFSETTO:+0200\nTZNAME:CEST\nDTSTART:19700329T020000\nRRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU\nEND:DAYLIGHT\nBEGIN:STANDARD\nTZOFFSETFROM:+0200\nTZOFFSETTO:+0100\nTZNAME:CET\nDTSTART:19701025T030000\nRRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU\nEND:STANDARD\nEND:VTIMEZONE\nBEGIN:VEVENT\nDTSTAMP:" . date('Ymd\\THis', time()) . "\nDTSTART;TZID=Europe/Rome:" . date('Ymd\\THis', $turno->inizio) . "\nDTEND;TZID=Europe/Rome:" . date('Ymd\\THis', $turno->fine) . "\nSUMMARY:" . $att->nome . ": " . $turno->nome . "\nLOCATION:" . $att->luogo . "\nUID:" . $turno->id . "\nDESCRIPTION:\nTurno organizzato da " . $c->nomeCompleto() . ",\ndettagli: " . strip_tags($att->descrizione) . "\nORGANIZER;CN=\"" . $ref->nomeCompleto() . "\":mailto:" . $ref->email . "\nEND:VEVENT\nEND:VCALENDAR\n";
     file_put_contents($this->percorso(), utf8_encode($s));
 }
Exemplo n.º 6
0
    public function edit()
    {
        $alumno = Auth::user()->join('alumnos', 'users.id', '=', 'alumnos.usuario_id')->where('users.id', Auth::user()->id)->first();
        $alumnoGrupo = DB::table('alumnos')->join('grupos', 'alumnos.grupo_id', '=', 'grupos.id')->where('alumnos.usuario_id', Auth::user()->id)->first();
        $alumnoTurno = DB::select('select usuario_id, nombres, grupo, turno from alumnos
			join grupos on alumnos.grupo_id = grupos.id
			join turnos on grupos.turno_id = turnos.id
			where alumnos.usuario_id = ?', [Auth::user()->id]);
        $alumnoSemestre = DB::select('select usuario_id, nombres, grupo, semestre from alumnos
			join grupos on alumnos.grupo_id = grupos.id
			join semestres on grupos.semestre_id = semestres.id
			where alumnos.usuario_id = ? limit 1', [Auth::user()->id]);
        $grupo = Grupo::where('status', 1)->get();
        $turno = Turno::all();
        $semestre = Semestre::all();
        return View::make('datos_escolares.edit', compact('alumno', 'alumnoGrupo', 'alumnoTurno', 'alumnoSemestre', 'grupo', 'turno', 'semestre'));
    }
Exemplo n.º 7
0
 function contablidadempresa(Request $request, Response $response)
 {
     $response = $response->withHeader('Content-type', 'application/json');
     $idempresa = $request->getAttribute("idempresa");
     $fechainicial = $request->getAttribute("fechainicial");
     $fechafinal = $request->getAttribute("fechafinal");
     $sucu = Sucursal::select('id', 'nombre')->where('idEmpresa', '=', $idempresa)->get();
     for ($i = 0; $i < count($sucu); $i++) {
         $turno = Turno::select('turno.idEmpleado', 'turno.idServicio', 'turno.fechaSolicitud', 'empleado.nombres', 'empleado.apellidos', 'servicio.nombre as servicio')->join('empleado', 'empleado.id', '=', 'turno.idEmpleado')->join('servicio', 'servicio.id', '=', 'turno.idServicio')->where('turno.idSucursal', '=', $sucu[$i]->id)->where('turno.estadoTurno', '=', 'TERMINADO')->whereBetween('turno.fechaSolicitud', array($fechainicial, $fechafinal))->groupBy('turno.idServicio')->groupBy('turno.idEmpleado')->get();
         $sucu[$i]['sucursal'] = $turno;
         for ($j = 0; $j < count($turno); $j++) {
             $ingreso = Ingreso::select('valor', 'idServicio', 'idEmpleado')->where('idServicio', '=', $turno[$j]->idServicio)->where('idEmpleado', '=', $turno[$j]->idEmpleado)->sum('valor');
             $turno[$j]['suma'] = $ingreso;
         }
     }
     $response->getBody()->write($sucu);
     return $response;
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $fechahoy = date("Y-m-j");
     $fecha = Turno::where('fechaturno', '=', $fechahoy)->first();
     if (count($turnoo = Turno::all()) != 0) {
         $farmacias = Turno::find($fecha->id)->farmacias;
         $mensaje = "no esta de Turno";
         foreach ($farmacias as $key) {
             if ($key->id == Session::get('farmacia_id')) {
                 $mensaje = "Esta de turno";
             }
         }
         return View::make('farmacia.inicio')->with('mensaje', $mensaje)->with('fechahoy', $fechahoy);
     } else {
         $mensaje = "no esta de Turno";
         return View::make('farmacia.inicio')->with('mensaje', $mensaje)->with('fechahoy', $fechahoy);
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     try {
         //
         $modelo = $this->modelo->find($id);
         //turnos asignados
         $ta = $modelo->turnos()->where('estado', 'A')->get();
         if (count($ta) > 0) {
             return Response::json(array('error' => true, 'mensaje' => 'No se puede eliminar la agenda porque tiene turnos asignados', 'listado' => $modelo->toArray()), 200);
         } else {
             $affected_rows = Turno::where('agenda_id', $modelo->id)->delete();
             $this->eventoAuditar($modelo);
             $eliminado = $modelo->delete();
             $this->eventoAuditar($modelo);
             return Response::json(array('error' => false, 'listado' => $modelo->toArray()), 200);
         }
     } catch (Exception $e) {
         return Response::json(array('error' => true, 'mensaje' => $e->getMessage(), 'listado' => $modelo->toArray()), 200);
     }
 }
     $fichaTecnica = $_GET['fichaTecnica'];
 }
 if (!isset($_GET['maquina'])) {
     $nombreMaquina = '';
 } else {
     $nombreMaquina = $_GET['maquina'];
 }
 if (!isset($_GET['turno'])) {
     $nombreTurno = '';
 } else {
     $nombreTurno = $_GET['turno'];
 }
 $id_empresa = $_SESSION['k_empresa'];
 $objetoMaquina = new Maquina_refactorizada();
 $produccion = new Produccion();
 $turno = new Turno();
 $objetoMaquina->setIdEmpresa($id_empresa);
 $objetoMaquina->setNombreMaquina($nombreMaquina);
 $produccion->setIdEmpresa($id_empresa);
 $produccion->setIdMaquina($objetoMaquina->getId());
 $turno->setTurno();
 $turno->setIdEmpresa($id_empresa);
 $turno->setNombreTurno($nombreTurno);
 $produccion->setIdTurno($turno->getIdTurno());
 $produccion->setIdOrdenProduccion($OrdenProduccion);
 $turno->setIdEmpresa($_SESSION['k_empresa']);
 $consecutivoProduccion = preg_replace('/[a-zA-Z]/', '', $consecutivoProduccion);
 $produccion->setConsecutivoProduccion($consecutivoProduccion);
 $produccion->setTipoMaterialDigitadoPorElUsuario($fichaTecnica);
 $idFicha = $produccion->getIdFicha();
 $produccion->next_result();
 public function tomar_turno($paciente_prepaga_id)
 {
     $params = Input::all();
     unset($params['apikey']);
     $turno_id = $params["turno_id"];
     $tipo = isset($params["tipo"]) && !empty($params["tipo"]) ? $params["tipo"] : "T";
     $user_id = Auth::user()->id;
     $paciente_prepaga = PacientePrepaga::findOrFail($paciente_prepaga_id);
     $turnos = explode(",", $turno_id);
     //si son muchos turnos
     if (count($turnos) > 1) {
         $objTurnos = Turno::whereIn('id', $turnos)->where('estado', 'L')->get();
         if (count($objTurnos) == count($turnos)) {
             $affectedRows = Turno::whereIn('id', $turnos)->where('estado', 'L')->update(array('estado' => 'A', 'paciente_prepaga_id' => $paciente_prepaga->id, 'user_id' => $user_id));
             if ($affectedRows == count($turnos)) {
                 foreach ($objTurnos as $cadaTurno) {
                     $this->eventoAuditar($cadaTurno);
                 }
                 $turno = Turno::findOrFail($turnos[0]);
                 return Response::json(array('error' => false, 'listado' => array($turno->find($turno->id)->toArray())), 200);
             } else {
                 return Response::json(array('error' => true, 'mensaje' => 'No se pudieron asignar los turnos', 'envio' => $params), 200);
             }
         } else {
             return Response::json(array('error' => true, 'mensaje' => "alguno de los turnos está tomado"), 200);
         }
     } else {
         //es un solo turno
         $turno = Turno::findorFail($turno_id);
         //chequea entreturno
         if ($tipo == 'E') {
             $otros_entreturnos = Turno::where('padre', '=', $turno->id)->get();
             $new_turno = new Turno();
             $new_turno->fill($turno->toArray());
             $new_turno->id = null;
             $new_turno->padre = $turno->id;
             $turno = $new_turno;
             $turno->tipo_turno = 'E';
             $desde = strtotime(substr($turno->hora_desde, 0, 2) . ":" . substr($turno->hora_desde, -2));
             $hasta = strtotime(substr($turno->hora_hasta, 0, 2) . ":" . substr($turno->hora_hasta, -2));
             if (count($otros_entreturnos) == 0) {
                 $n_desde = $desde + ($hasta - $desde) / 2;
                 $turno->hora_desde = date('Hi', $n_desde);
             } else {
                 $intervalo = ($hasta - $desde) / (2 + count($otros_entreturnos));
                 $n_desde = $desde + $intervalo;
                 foreach ($otros_entreturnos as $entreturno) {
                     $entreturno->hora_desde = date('Hi', $n_desde);
                     $entreturno->save();
                     $n_desde += $intervalo;
                 }
                 $turno->hora_desde = date('Hi', $n_desde);
             }
             $turno->estado = 'L';
         }
         //falta verificar turno bloqueado x mismo usuario
         if ($turno->estado == 'L') {
             $turno->estado = 'A';
             $turno->paciente_prepaga_id = $paciente_prepaga->id;
             $turno->user_id = $user_id;
             if ($turno->save()) {
                 $this->eventoAuditar($turno);
                 return Response::json(array('error' => false, 'listado' => array($turno->find($turno->id)->toArray())), 200);
             } else {
                 return Response::json(array('error' => true, 'mensaje' => HerramientasController::getErrores($turno->validator), 'envio' => $params), 200);
             }
         } else {
             return Response::json(array('error' => true, 'mensaje' => "turno tomado"), 200);
         }
     }
 }
Exemplo n.º 12
0
 function reporteempleado(Request $request, Response $response)
 {
     $response = $response->withHeader('Content-type', 'application/json');
     $idsucursal = $request->getAttribute("idsucursal");
     $fechainicial = $request->getAttribute("fechainicial");
     $fechafinal = $request->getAttribute("fechafinal");
     $empl = Empleado::select('id', 'nombres', 'apellidos')->where('idSucursal', '=', $idsucursal)->get();
     for ($i = 0; $i < count($empl); $i++) {
         /*$suma = Ingreso::select('id')
           ->where('idEmpleado','=',$empl[$i]->id)
           ->sum('valor');*/
         $tur = Turno::select('turno.id')->where('turno.estadoTurno', '=', 'TERMINADO')->where('turno.idEmpleado', '=', $empl[$i]->id)->whereBetween('turno.fechaSolicitud', array($fechainicial, $fechafinal))->count();
         $empl[$i]['contador'] = $tur;
     }
     $response->getBody()->write($empl);
     return $response;
 }
Exemplo n.º 13
0
 public function liberar($id)
 {
     try {
         $turnos = explode(",", $id);
         //si son muchos turnos
         if (count($turnos) > 1) {
             $affectedRows = Turno::whereIn('id', $turnos)->where('estado', 'A')->update(array('estado' => 'L', 'paciente_prepaga_id' => NULL, 'user_id' => Auth::user()->id, "motivo_turno_id" => NULL, 'piezas' => NULL, 'derivado_por' => NULL, 'observaciones' => NULL, 'fuera_de_agenda' => NULL));
             if ($affectedRows == count($turnos)) {
                 $objTurnos = Turno::whereIn('id', $turnos)->where('estado', 'L')->get();
                 foreach ($objTurnos as $cadaTurno) {
                     $this->eventoAuditar($cadaTurno);
                 }
                 $turno = Turno::findOrFail($turnos[0]);
                 return Response::json(array('error' => false, 'listado' => array($turno->find($turno->id)->toArray())), 200);
             } else {
                 return Response::json(array('error' => true, 'mensaje' => 'No se pudieron desasignar los turnos', 'envio' => $turnos), 200);
             }
         } else {
             $modelo = $this->modelo->find($id);
             //elimina si es entreturno
             if ($modelo->tipo_turno == 'E') {
                 return $this->destroy($id);
             }
             $data = array("estado" => 'L', "paciente_prepaga_id" => null, "motivo_turno_id" => null, "piezas" => null, "derivado_por" => null, "observaciones" => null, "fuera_de_agenda" => null, "user_id" => Auth::user()->id);
             $modelo->fill($data);
             if ($modelo->save() !== false) {
                 $this->eventoAuditar($modelo);
                 return Response::json(array('error' => false, 'listado' => array($modelo->toArray())), 200);
             } else {
                 return Response::json(array('error' => true, 'mensaje' => HerramientasController::getErrores($modelo->validator), 'listado' => array($modelo->toArray())), 200);
             }
         }
     } catch (Exception $e) {
         return Response::json(array('error' => true, 'mensaje' => $e->getMessage()), 200);
     }
 }
Exemplo n.º 14
0
 /**
  * Filter the query by a related Turno object
  *
  * @param   Turno|PropelObjectCollection $turno  the related object to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return   JugadorMesaQuery The current query, for fluid interface
  * @throws   PropelException - if the provided filter is invalid.
  */
 public function filterByTurno($turno, $comparison = null)
 {
     if ($turno instanceof Turno) {
         return $this->addUsingAlias(JugadorMesaPeer::ID, $turno->getJugadorMesaId(), $comparison);
     } elseif ($turno instanceof PropelObjectCollection) {
         return $this->useTurnoQuery()->filterByPrimaryKeys($turno->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByTurno() only accepts arguments of type Turno or PropelCollection');
     }
 }
 public function damefarmaciasporturno()
 {
     if (Request::ajax()) {
         $fec = date('Y-m-j');
         $fechaa = Turno::where('fechaturno', '=', $fec)->first();
         $farmacias = Turno::find($fechaa->id)->farmacias;
         for ($i = 0; $i < count($farmacias); $i++) {
             $geolocalizacion = Farmacia::find($farmacias[$i]->id)->geolocalizacion;
             $array[$i] = array("nombre" => $farmacias[$i]->nombre, "telefono" => $farmacias[$i]->telefono, "direccion" => $farmacias[$i]->direccion, "puntox" => $geolocalizacion->puntox, "puntoy" => $geolocalizacion->puntoy);
         }
         echo json_encode($array);
     }
 }
Exemplo n.º 16
0
                     <tr><td colspan="3">
                            <input style="width:80px;"type="submit" name="button" id="button" value="Editar" class="button">
                            <input style="width:80px;" name="button" onclick="window.location.href='logado.php'" id="button" type="button" value="Cancelar" class="button">
                          </td>
                     </tr>
                     <?php 
    echo "<script>disableCampos();</script>";
    ?>
                  </table>
               </form>
                <?php 
} else {
    //fim if 1
    ?>
                  <?php 
    $turno = new Turno();
    // $turnos = $turno->get_func_by_name($_POST['name_search']);
    $turnos = $turno->get_name_all_turno_disponiveis();
    echo '<table class="exibe-pesquisa">';
    foreach ($turnos as $key => $turno) {
        echo '<tr>
                                      <td><a href="edita_turno.php?verificador=1&id=' . $turnos[$key][0] . '">' . $turnos[$key][2] . ' - ' . $turnos[$key][1] . '</a></td></tr>';
    }
    echo '</table>';
    ?>

                  <?php 
}
//fim else if 1
?>
Exemplo n.º 17
0
 protected function saveCiclolectivo($ciclolectivo)
 {
     //si se guarda el ciclo y se marca como actual
     //los demas ciclo del establecimiento tiene que quedar como ACUAL = false
     $con = Propel::getConnection();
     try {
         $con->beginTransaction();
         if ($ciclolectivo->getActual()) {
             $c1 = new Criteria();
             $c1->add(CiclolectivoPeer::FK_ESTABLECIMIENTO_ID, $this->getUser()->getAttribute('fk_establecimiento_id'));
             $c2 = new Criteria();
             $c2->add(CiclolectivoPeer::ACTUAL, false);
             BasePeer::doUpdate($c1, $c2, $con);
         }
         $ciclolectivo->setFkEstablecimientoId($this->getUser()->getAttribute('fk_establecimiento_id'));
         $isNew = $ciclolectivo->isNew();
         $ciclolectivo->save();
         if ($isNew) {
             # Codigo para copiar las divisiones del ciclo lectivo actual al nuevo
             # La consulta debe contemplar que lo haga desde el ciclo lectivo actual
             if ($this->getRequestParameter('importar')) {
                 $ciclo_actual = CiclolectivoPeer::retrieveByPk($this->getUser()->getAttribute('fk_ciclolectivo_id'));
                 if ($ciclo_actual) {
                     $this->logMessage('ciclo_actual: ' . $ciclo_actual, 'debug');
                     //clonar turnos
                     foreach ($ciclo_actual->getTurnos() as $turno) {
                         $nt = new Turno();
                         $nt->setFkCiclolectivoId($ciclolectivo->getId());
                         $nt->setHoraInicio($turno->getHoraInicio());
                         $nt->setHoraFin($turno->getHoraFin());
                         $nt->setDescripcion($turno->getDescripcion());
                         $nt->save();
                         //clonar las divisiones
                         foreach ($turno->getDivisions() as $division) {
                             $this->logMessage('division: ' . $division, 'debug');
                             $nd = new Division();
                             $nd->setFkAnioId($division->getFkAnioId());
                             $nd->setDescripcion($division->getDescripcion());
                             $nd->setFkTurnoId($nt->getId());
                             $nd->setFkOrientacionId($division->getFkOrientacionId());
                             $nd->setOrden($division->getOrden());
                             $nd->save();
                         }
                     }
                 } else {
                     //no existe el ciclo actual
                     $this->getUser()->setFlash('error', 'No hay un ciclo actual seleccionado');
                 }
             }
         }
         $con->commit();
         if ($ciclolectivo->getActual()) {
             //cambio el attributo porque se cambio el ciclo actual
             $this->getUser()->setAttribute('fk_ciclolectivo_id', $ciclolectivo->getId());
             $this->getUser()->setAttribute('ciclolectivo_descripcion', $ciclolectivo->getDescripcion());
         }
     } catch (Exception $e) {
         $con->rollBack();
         throw $e;
     }
 }
Exemplo n.º 18
0
 /**
  * Exclude object from result
  *
  * @param   Turno $turno Object to remove from the list of results
  *
  * @return TurnoQuery The current query, for fluid interface
  */
 public function prune($turno = null)
 {
     if ($turno) {
         $this->addUsingAlias(TurnoPeer::ID, $turno->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
Exemplo n.º 19
0
<?php

/*
 * ©2013 Croce Rossa Italiana
 */
paginaPrivata();
controllaParametri(['turno']);
$t = Turno::id($_GET['turno']);
$a = $t->attivita();
/* Se non posso partecipare torna alla scheda... */
if (!$t->chiediPartecipazione($me)) {
    redirect("attivita.scheda&id={$a->id}");
}
redirect("attivita.storico&okpending&id={$a->id}");
Exemplo n.º 20
0
                           <option>Selecione UF</option>
                           <?php 
 foreach ($estados as $key => $estado) {
     echo '<option value="' . $estados[$key][0] . '">' . $estados[$key][1] . '</option>';
 }
 ?>
                        </select>
                     </td>
                  </tr> <!-- numero da carteira de trabalho -->
                  <!-- <tr> <td><span>Num. Série Cart. Trab.:</span></td> <td><input type="text" id="num_serie_cart_trab" name="num_serie_cart_trab"></td></tr>  numero da carteira de trabalho -->
                  <tr>
                     <td><span>Turno:*</span></td>
                     <td colspan="3">
                        <?php 
 //buscar array de CBO
 $turno = new Turno();
 $turnos = $turno->get_name_all_turno();
 ?>
                        <select name="turno" id="turno">
                           <option>Selecione um turno</option>
                           <?php 
 foreach ($turnos as $key => $turno) {
     echo '<option value="' . $turnos[$key][0] . '">' . $turnos[$key][2] . ' - ' . $turnos[$key][1] . '</option>';
 }
 ?>
                        </select>
                        <!-- <a href="">Pesquisar</a> -->
                     </td>
                     <td><a href="#divturno" id="mostraturno"><img style="cursor: pointer" width="25px" height="25px"src="../images/add.png"></a></td>
                  </tr>
                  <tr>
Exemplo n.º 21
0
 public function turno()
 {
     return Turno::id($this->turno);
 }
if ($op == 27) {
    require_once '../modelo/Database.php';
    require_once '../modelo/GenerarListaDesplegable.php';
    require_once "../modelo/Maquina_refactorizada.php";
    require_once '../modelo/validar_usuario.php';
    $selects = new Maquina_refactorizada();
    $selects->setidEmpresa($_SESSION['k_empresa']);
    $array = $selects->cargar_maquinas();
    cargarArchivos($array);
}
if ($op == 28) {
    require '../modelo/Database.php';
    require '../modelo/GenerarListaDesplegable.php';
    require '../modelo/Turno.php';
    require_once '../modelo/validar_usuario.php';
    $turno = new Turno();
    $turno->setidEmpresa($_SESSION['k_empresa']);
    $array = $turno->getListadoDeTurno();
    cargarArchivos($array);
}
if ($op == 29) {
    require '../modelo/Database.php';
    require '../modelo/GenerarListaDesplegable.php';
    require '../modelo/Hora.php';
    require_once '../modelo/validar_usuario.php';
    $hora = new Reloj(0, 0);
    $database = new Database();
    $generarListadoDesplegable = new GenerarListaDesplegable();
    $hora->setIdEmpresa($_SESSION['k_empresa']);
    $consulta = $database->query($hora->getListadoDeTiempoProductivo());
    $array = $generarListadoDesplegable->generarListadoDesplegable($consulta, 'id', 'tiempo_laboral');
Exemplo n.º 23
0
 /**
  * @param	Turno $turno The turno object to add.
  */
 protected function doAddTurno($turno)
 {
     $this->collTurnos[] = $turno;
     $turno->setJugadorMesa($this);
 }
Exemplo n.º 24
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      Turno $obj A Turno object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool($obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         TurnoPeer::$instances[$key] = $obj;
     }
 }
Exemplo n.º 25
0
 public function printFunc()
 {
     $empresa = new Empresa();
     $empresa->get_empresa_by_id($this->id_empresa);
     $valor_custo = new Valor_custo();
     $valor_custo->get_valor_custo_id($this->id_valor_custo);
     $vlr = $this->verificaValor($valor_custo->valor);
     if ($vlr == "") {
         $vlr = 0.0;
     }
     $sal = $this->verificaValor($this->salario_base);
     $filial = Filial::get_filial_id($this->id_empresa_filial);
     $cbo = new Cbo();
     $cbo->get_cbo_by_id($this->id_cbo);
     $turno = new Turno();
     $turno->getTurnoById($this->id_turno);
     $u = new Epi();
     $epi_func = $u->get_epi_func($this->id);
     $texto = "";
     $texto .= "<table class='table_pesquisa'><tr>";
     $texto .= "<td colspan='2'><b><span>ID: <span></b></td><td><span><span>" . $this->id . "</span><td><span>Cod_Serie</span></td><td><span>" . $this->cod_serie . "</span></td></td>";
     $texto .= "</tr>";
     $texto .= "<tr>";
     $texto .= "<td colspan='2'><b><span>Nome: <span></b></td><td colspan='3'><span>" . $this->nome . "</span></td>";
     $texto .= "</tr>";
     $texto .= "<tr>";
     $texto .= "<td colspan='2'><b><span>Telefone: <span></b></td><td colspan='3'><span>" . $this->telefone . "</span></td>";
     $texto .= "</tr>";
     $texto .= "<tr>";
     $texto .= "<td colspan='2'><b><span>CPF: <span></b></td><td colspan='3'><span>" . $this->cpf . "</span></td>";
     $texto .= "</tr>";
     $texto .= "<tr>";
     $texto .= "<td colspan='2'><b><span>Data de Nascimento: <span></b></td><td colspan='3'><span>" . $this->data_nasc . "</span></td>";
     $texto .= "</tr>";
     $texto .= "<tr>";
     $texto .= "<td colspan='2'><b><span>Email:<span> </b></td><td colspan='3'><span>" . $this->email . "</span></td>";
     $texto .= "</tr>";
     $texto .= "<tr>";
     $texto .= "<td colspan='2'><b><span>Empresa: <span></b></td><td colspan='3'><span>" . $empresa->nome_fantasia . "</span></td>";
     $texto .= "</tr>";
     if ($filial) {
         $texto .= "<tr>";
         $texto .= "<td colspan='2'><b><span>Filial: <span></b></td><td colspan='3><span>" . $filial->nome . "</span></td>";
         $texto .= "</tr>";
     }
     $texto .= "<tr>";
     $texto .= "<td colspan='2'><b><span>Salário base: <span></b></td><td colspan='3'><span>R\$ " . number_format($sal, 2, ',', '.') . "</span></td>";
     $texto .= "</tr>";
     $texto .= "<tr>";
     $texto .= "<td colspan='2'><b><span>Valor de Custo: <span></b></td><td colspan='3'><span>R\$ " . number_format($vlr, 2, ',', '.') . "</span></td>";
     $texto .= "</tr>";
     $texto .= "<tr>";
     if (isset($cbo->descricao)) {
         $texto .= "<td colspan='2'><b><span>CBO: <span></b></td><td colspan='3'><span>" . $cbo->descricao . "</span></td>";
     }
     $texto .= "</tr>";
     $texto .= "<tr>";
     $texto .= "<td colspan='2'><b><span>Turno: <span></b></td><td colspan='3'><span>" . $turno->nome . " - " . $turno->desc . "</span></td>";
     $texto .= "</tr>";
     if (count($epi_func) > 0) {
         $texto .= '<tr> <td colspan="5"><span><b>Equipamentos do funcionário:</b></span></td></tr>';
         $texto .= '<tr> <td><span>ID</span></td> <td><span>Nome</span></td> <td><span>Data da entrega</span></td><td><span>Quantidade</span></td></tr>';
         foreach ($epi_func as $key => $value) {
             $texto .= '<tr><td><span>' . $epi_func[$key]->id . '</span></td><td><span>' . $epi_func[$key]->nome_epi . '</span></td><td><span>' . $epi_func[$key]->data_entrega . '</span></td><td><span>' . $epi_func[$key]->quantidade . '</span></td></tr>';
         }
     }
     $texto .= "</table>";
     return $texto;
 }
Exemplo n.º 26
0
Arquivo: Turno.php Projeto: pizar/gaia
 public static function neltempo(DT $inizio, DT $fine)
 {
     global $db;
     $q = "\n            SELECT\n                turni.id\n            FROM\n                turni, attivita\n            WHERE\n                turni.fine    <= :fine\n            AND\n                turni.inizio  >= :inizio\n            AND\n                attivita.id = turni.attivita\n            AND\n                attivita.stato = :stato\n            ORDER BY\n                inizio ASC";
     $q = $db->prepare($q);
     $inizio = $inizio->getTimestamp();
     $fine = $fine->getTimestamp();
     $q->bindParam(':fine', $fine);
     $q->bindParam(':inizio', $inizio);
     $q->bindValue(':stato', ATT_STATO_OK);
     $q->execute();
     $r = [];
     while ($k = $q->fetch(PDO::FETCH_NUM)) {
         $r[] = Turno::id($k[0]);
     }
     return $r;
 }
Exemplo n.º 27
0
 function getServiciosBySucursal(Request $request, Response $response)
 {
     $response = $response->withHeader('Content-type', 'application/json');
     $idSucursal = $request->getAttribute("idSucursal");
     $data = Servicio::select('servicio.*')->join("serviciossucursal", "serviciossucursal.idServicio", "=", "servicio.id")->where('serviciossucursal.idSucursal', '=', $idSucursal)->where('servicio.estado', '=', 'ACTIVO')->get();
     if (count($data) == 0) {
         $response = $response->withStatus(404);
     } else {
         for ($i = 0; $i < count($data); $i++) {
             $tur = Turno::select('turno.turno')->join("empleado", "empleado.id", "=", "turno.idEmplado")->where('turno.idSucursal', '=', $idSucursal)->where('turno.idServicio', '=', $data[$i]->idServicio)->where('turno.estadoTurno', '=', 'CONFIRMADO')->orwhere('turno.estadoTurno', '=', 'ATENDIENDO')->orderBy("turno.fechaSolicitud", "Desc")->first();
             $turno = 1;
             if ($tur != null) {
                 $turno = $tur->turno;
             }
         }
     }
     $response->getBody()->write($data);
     return $response;
 }
     if ($_SESSION['k_userName'] == strtoupper('reproceso')) {
         if ($key == "material") {
             $tipoMaterial = (double) $numero;
         }
     } else {
         if ($key == "material") {
             $tipoMaterial = $numero;
         }
     }
 }
 $id_empresa = $_SESSION['k_empresa'];
 $Objetofecha = new Fecha($fecha, '');
 $produccion = new Produccion();
 $objetoMaquina = new Maquina_refactorizada();
 $ObjetoOperador = new Operador_refactorizado();
 $ObjetoTurno = new Turno();
 $produccion->setIdEmpresa($id_empresa);
 $ObjetoOperador->setIdEmpresa($id_empresa);
 $objetoMaquina->setIdEmpresa($id_empresa);
 $objetoMaquina->setIdMaquina($maquina);
 $objetoMaquina->existsMaquina();
 $objetoMaquina->next_result();
 $produccion->setIdMaquina($objetoMaquina->getIdMaquina());
 $ObjetoOperador->setIdOperador($operador);
 $ObjetoOperador->existsOperador();
 $ObjetoOperador->next_result();
 $produccion->setIdOperador($ObjetoOperador->getIdOperador());
 $produccion->setIdOrdenProduccion($op);
 $produccion->compruebaConsecutivoDuplicado();
 $ObjetoTurno->setIdTurnoManual($turno);
 $produccion->setIdTurno($ObjetoTurno->getTurno());
Exemplo n.º 29
0
 public function turnos_libres($especialidad_id)
 {
     $parametros = Input::all();
     unset($parametros['apikey']);
     if (!isset($parametros["param"]) || empty($parametros["param"])) {
         $param = array("odontologos" => '', "centros" => '', "turnos" => '', "dias" => '');
     } else {
         $param = $parametros["param"];
         $param = json_decode($param, true);
     }
     //var_dump($param);
     //die();
     $listado = Turno::turnos_libres($especialidad_id, $param);
     //$queries = DB::getQueryLog();
     //$last_query = end($queries);
     //var_dump($last_query);die();
     return Response::json(array('error' => false, 'listado' => $listado), 200);
 }
Exemplo n.º 30
0
            $sem_hor_almoco = 0;
        }
        $turno->cadTurno($nome, $desc, $ini_exp, $ini_alm, $fim_alm, $fim_exp, $sem_hor_almoco);
        if ($turno->add_turno_bd() == true) {
            if (isset($_POST['voltar'])) {
                echo '<script>window.history.back()</script>';
            }
            echo '<div class="msg">Turno editado com sucesso!</div>';
        } else {
            echo '<div class="msg">Adicionado com Sucesso!</div>';
        }
    }
}
if (isset($_POST['tipo']) && $_POST['tipo'] == "editar") {
    if (validate()) {
        $turno = new Turno();
        $id = $_POST['id_turno'];
        $nome = $_POST['nome'];
        $ini_exp = $_POST['ini_exp_h'] . ":" . $_POST['ini_exp_m'] . ":00";
        $ini_alm = $_POST['ini_alm_h'] . ":" . $_POST['ini_alm_m'] . ":00";
        $fim_alm = $_POST['fim_alm_h'] . ":" . $_POST['fim_alm_m'] . ":00";
        $fim_exp = $_POST['fim_exp_h'] . ":" . $_POST['fim_exp_m'] . ":00";
        $desc = "Das " . $_POST['ini_exp_h'] . ":" . $_POST['ini_exp_m'] . " às " . $_POST['ini_alm_h'] . ":" . $_POST['ini_alm_m'] . " e das " . $_POST['fim_alm_h'] . ":" . $_POST['fim_alm_m'] . " às " . $_POST['fim_exp_h'] . ":" . $_POST['fim_exp_m'];
        if ($turno->atualiza_turno($nome, $id, $desc, $ini_exp, $ini_alm, $fim_alm, $fim_exp)) {
            echo '<div class="msg">Turno atualizado com sucesso!</div>';
            echo '<script>alert("Turno atualizado com sucesso")</script>';
        } else {
            echo '<div class="msg">Falha ao editar turno!</div>';
        }
    }
}