From a55f9f28dca6ef647ef7e5ec738374e9cb221f64 Mon Sep 17 00:00:00 2001 From: lizandrogd <77708265+lizandrogd@users.noreply.github.com> Date: Wed, 2 Apr 2025 01:02:56 -0500 Subject: [PATCH] Update ShowServicios.php --- app/Http/Livewire/ShowServicios.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Livewire/ShowServicios.php b/app/Http/Livewire/ShowServicios.php index 77a91d2..4ddd841 100755 --- a/app/Http/Livewire/ShowServicios.php +++ b/app/Http/Livewire/ShowServicios.php @@ -178,13 +178,13 @@ class ShowServicios extends Component $cantidad_restante = $servicio_tarifa->pantallas - $cantidad_solicitada; //Traer todas las cuentas por pantalla 'activo' de los ultimos 15 dias. solo disponibles - $cuentas_pantallas = Cuentas::withCount('historiales') // ✅ Primero contar historiales + $cuentas_pantallas = Cuentas::withCount('historiales') ->whereDate('inicio', '>=', $this->fecha) ->whereDate('vencimiento', '>=', $this->fecha_final_1) ->whereDate('vencimiento', '<=', $this->fecha_final_2) ->where('servicio_id', $servicio_tarifa->id) ->where('estado', 'activo') - ->having('historiales_count', '<=', $cantidad_restante) // ✅ Filtrar usando la cuenta + ->havingRaw('historiales_count <= ?', [$cantidad_restante]) // Usar havingRaw ->get();