diff --git a/.env b/.env index f5ae48a..c40ebfb 100755 --- a/.env +++ b/.env @@ -9,7 +9,7 @@ LOG_DEPRECATIONS_CHANNEL=null LOG_LEVEL=debug DB_CONNECTION=mysql -DB_HOST=localhost +DB_HOST=195.35.32.59 DB_PORT=3306 DB_DATABASE=sirpremium DB_USERNAME=pym diff --git a/app/Http/Livewire/ShowServicios.php b/app/Http/Livewire/ShowServicios.php index eb0f44f..f44da35 100755 --- a/app/Http/Livewire/ShowServicios.php +++ b/app/Http/Livewire/ShowServicios.php @@ -171,7 +171,7 @@ class ShowServicios extends Component $cantidad_solicitada = (int) $this->cantidad_tarjetaPlan * (int) $this->pantallas_tarjetaPlan; $cantidad_restante = $servicio_tarifa->pantallas - $cantidad_solicitada; - //Traer todas las cuentas completas 'pendiente' de los ultimos 15 dias. solo disponibles + //Traer todas las cuentas por pantalla 'activo' de los ultimos 15 dias. solo disponibles $cuentas_pantallas = Cuentas::whereDate('inicio', '>=', $this->fecha) ->whereDate('vencimiento', '>=', $this->fecha_final_1) ->whereDate('vencimiento', '<=', $this->fecha_final_2) @@ -184,6 +184,7 @@ class ShowServicios extends Component ->havingRaw("COUNT(*) >= $cantidad_restante"); }) ->get(); + //dd($cuentas_pantallas); $cuentas_pantallas_tomadas = Historial_cuenta::whereIn('cuenta_id', $cuentas_pantallas ->pluck('id')) @@ -290,15 +291,15 @@ class ShowServicios extends Component ->whereDate('vencimiento', '<=', $this->fecha_final_2) // ->whereDate('vencimiento','>=', $this->fechaFinal) ->Orderby('created_at', 'ASC') - //->withCount('historiales') + ->withCount('historiales') ->where('estado', 'activo') - //->having('historiales_count', '<=', $suma) - ->with('perfil') - ->whereDoesntHave('perfil', function ($query) use ($suma) { - $query->select('cuenta_id') - ->groupBy('cuenta_id') - ->havingRaw("COUNT(*) >= $suma"); - }) + ->having('historiales_count', '<=', $suma) + //->with('perfil') + //->whereDoesntHave('perfil', function ($query) use ($suma) { + // $query->select('cuenta_id') + // ->groupBy('cuenta_id') + // ->havingRaw("COUNT(*) >= $suma"); + //}) ->get(); // dd($cuenta); } elseif ((int) $pantalla_servicio_completa == (int) $this->pantallas_tarjetaPlan) { @@ -319,15 +320,15 @@ class ShowServicios extends Component $cuenta = Cuentas::where('servicio_id', $this->servicio_id) ->whereDate('inicio', '>=', $this->fecha) ->Orderby('created_at', 'ASC') - //->withCount('historiales') + ->withCount('historiales') ->where('estado', 'activo') - //->having('historiales_count', '<=', $suma2) - ->with('perfil') - ->whereDoesntHave('perfil', function ($query) use ($suma2) { - $query->select('cuenta_id') - ->groupBy('cuenta_id') - ->havingRaw("COUNT(*) >= $suma2"); - }) + ->having('historiales_count', '<=', $suma2) + //->with('perfil') + //->whereDoesntHave('perfil', function ($query) use ($suma2) { + //$query->select('cuenta_id') + // ->groupBy('cuenta_id') + // ->havingRaw("COUNT(*) >= $suma2"); + //}) ->get(); } else { $cuenta = null;