Example #1
0
 public function getOrdenesEmpresa(Request $request)
 {
     $protocolos = Protocolo::where('empresa_id', $request->get('id'))->get();
     return response()->json($protocolos);
 }
 public function calcIndiceAceptacion(Request $request)
 {
     $inicio = $request->get('inicio');
     $fin = $request->get('fin');
     $verificados = Protocolo::where('created_at', '>=', $inicio)->where('created_at', '<=', $fin)->where('estado', 'Verificado')->count();
     $cancelados = Protocolo::where('created_at', '>=', $inicio)->where('created_at', '<=', $fin)->where('estado', 'Cancelado')->count();
     $pendientes = Protocolo::where('created_at', '>=', $inicio)->where('created_at', '<=', $fin)->where('estado', 'Pendiente')->count();
     $total = $verificados + $cancelados + $pendientes;
     $respuesta['verificados'] = 100 * $verificados / $total;
     $respuesta['cancelados'] = 100 * $cancelados / $total;
     $respuesta['pendientes'] = 100 - $respuesta['verificados'] - $respuesta['cancelados'];
     return $respuesta;
 }