Update ShowServicios.php

This commit is contained in:
lizandrogd
2025-04-02 00:58:10 -05:00
parent 8266de9d5f
commit f24ab68358
+3 -2
View File
@@ -183,10 +183,11 @@ class ShowServicios extends Component
->whereDate('vencimiento', '<=', $this->fecha_final_2) ->whereDate('vencimiento', '<=', $this->fecha_final_2)
->where('servicio_id', $servicio_tarifa->id) ->where('servicio_id', $servicio_tarifa->id)
->where('estado', 'activo') ->where('estado', 'activo')
->withCount('historiales') ->withCount('historiales') // ✅ Contamos los historiales
->havingRaw("(SELECT COUNT(*) FROM historiales WHERE historiales.cuenta_id = cuentas.id) <= ?", [$cantidad_restante]) ->having('historiales_count', '<=', $cantidad_restante) // ✅ Filtramos los historiales
->get(); ->get();
//dd($cuentas_pantallas); // con count da un numero entero //dd($cuentas_pantallas); // con count da un numero entero
$cuentas_pantallas_tomadas = Historial_cuenta::whereIn('cuenta_id', $cuentas_pantallas $cuentas_pantallas_tomadas = Historial_cuenta::whereIn('cuenta_id', $cuentas_pantallas