From a9503bb780ff355c5f34292cbcc7d7466b995bef Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Fri, 11 Oct 2024 15:24:07 -0500 Subject: [PATCH] reparar cuentas por pantalla --- app/Http/Livewire/ShowServicios.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/Http/Livewire/ShowServicios.php b/app/Http/Livewire/ShowServicios.php index b68f116..49d0f2f 100755 --- a/app/Http/Livewire/ShowServicios.php +++ b/app/Http/Livewire/ShowServicios.php @@ -186,17 +186,18 @@ class ShowServicios extends Component ->where('estado', 'activo') ->having('historiales_count', '<=', $cantidad_restante) ->get(); - - //dd($cuentas_pantallas); + //dd($cuentas_pantallas); // con count da un numero entero + $cuentas_pantallas_tomadas = Historial_cuenta::whereIn('cuenta_id', $cuentas_pantallas - ->pluck('id')) + ->pluck('id'))->whereNotNull('historial_id') ->count(); //dd($cuentas_pantallas_tomadas); //Validar si el numero pantallas del servicio es igual o mayor que lo solicitado if ($servicio_tarifa->pantallas >= $cantidad_solicitada) { + //dd($servicio_tarifa->pantallas * $cuentas_pantallas->count()); //Cantidad de cuentas restantes * cantidad de pantallas del servicio / en las pantalla de la tarifa. $this->disponibles = (($cuentas_pantallas->count() * $servicio_tarifa->pantallas) - $cuentas_pantallas_tomadas) / $tarifa_seleccionada->pantallas; - //dd($this->disponibles) ; + dd($this->disponibles) ; } else { $this->disponibles = $cuentas_pantallas; }