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'); }
/** * 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); } }
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); } }
public function parteDiario() { $salida = []; $params = Input::all(); $coes = CentroOdontologoEspecialidad::where('odontologo_id', $params['odontologo_id'])->where('centro_id', $params['centro_id'])->where('especialidad_id', $params['especialidad_id'])->get(); foreach ($coes as $coe) { //$agendas = $coe->agendas()->where('habilitado_turnos','=',1)->where('fecha','=',$params["fecha"])->get(); $agendas = $coe->agendas()->where('fecha', '=', $params["fecha"])->get(); foreach ($agendas as $agenda) { $turnos = $agenda->vistaTurnos(); foreach ($turnos as $t) { $pp = PacientePrepaga::find($t->paciente_prepaga_id); $tt = Turno::find($t->id); $trata = $tt->tratamientos()->get(); if (!empty($pp)) { $t->fecha_agenda = $agenda->fecha; $t->tiene_fichados = $pp->paciente->tieneFichados() > 0; $ver_queja = $pp->paciente->getPresentoQuejaAttribute(); $t->presento_queja = $ver_queja == "1" ? "S" : "N"; //$t->presento_queja = $pp->paciente->getPresentoQuejaAttribute(); // Este Va $ver_hiv = $pp->paciente->getTieneHivAttribute(); $t->hiv = $ver_hiv == "1" ? "S" : "N"; $t->edad = $pp->paciente->getEdadAttribute(); $t->presupuestos_con_saldo = $pp->presupuestosConSaldo(); $t->facturas_con_saldo = $pp->facturasConSaldo(); $t->es_vip = $pp->paciente->vip ? "S" : "N"; $t->cant_tratam = count($trata); } else { $t->fecha_agenda = $agenda->fecha; $t->tiene_fichados = False; $t->presento_queja = NULL; $t->hiv = NULL; $t->edad = NULL; $t->presupuestos_con_saldo = False; $t->facturas_con_saldo = False; $t->es_vip = NULL; $t->cant_tratam = 0; } $salida[] = $t; } } } return Response::json(array('error' => false, 'listado' => $salida), 200); }
@extends('layoutsadministrador.baseturno') @section('content') <center><h1>Informacion sobre asignacion de turnos</h1> <?php $turnos = Turno::all()->lists('fechaturno'); if (count($turnos) > 0) { $primerturno = Turno::where('fechaturno', '=', $turnos[0])->first(); $farmacias = Turno::find($primerturno->id)->farmacias; } else { $farmacias = array(); } ?> @if(count($turnos)!=0) <h2>Turnos</h2> <p>Las fechas de turnos ya fueron asignados, si desea asignarlos nuevamente eliminelos!</p> @endif @if(count($turnos)==0) <h2>Turnos</h2> <p>Turnos vacios puede asignarlos hacendo click en Asignar fechas para turnos</p> @endif @if(count($farmacias)!=0) <h2>Sorteo de turnos</h2> <p>Los turnos ya fueron sorteados, elimine los sorteos si desea sortear nuevamente los turnos</p> @endif @if(count($farmacias)==0) <h2>Sorteo de turnos</h2> <p> El sorteo de turnos esta disponible.</p> @endif </center>
function cancelarservicio(Request $request, Response $response) { $response = $response->withHeader('Content-type', 'application/json'); $data = json_decode($request->getBody(), true); try { $id = $request->getAttribute("id"); $turno = Turno::find($id); $turno->estado = 'INACTIVO'; $turno->save(); $respuesta = json_encode(array('msg' => "Turno cancelado", "std" => 1)); $response = $response->withStatus(200); } catch (Exception $err) { $respuesta = json_encode(array('msg' => "error", "std" => 0, "err" => $err->getMessage())); $response = $response->withStatus(404); } $response->getBody()->write($respuesta); return $response; }
public function Rdehoy() { try { $fecha = date("Y-m-j"); $fe = Turno::where('fechaturno', '=', $fecha)->first(); $farmacias = Turno::find($fe->id)->farmacias; //foreach ($farmacias as $key) { // echo $key->nombre."<br>"; //} $html = View::make('administrador.turnos.reportehoy')->with('farmacias', $farmacias)->with('fecha', $fecha); return PDF::load($html, 'A4', 'portrait')->download('zonasreporte'); } catch (Exception $e) { $error = "No existen fechas de turnos asignadas todava, o esta tratand de realizar acciones incorrectas"; return View::make('administrador.turnos.errores')->with('error', $error); } }