Update ShowServicios.php

This commit is contained in:
lizandrogd
2024-05-13 15:20:15 -05:00
parent d68d769782
commit 94c6cd3ed7
+21
View File
@@ -310,6 +310,25 @@ class ShowServicios extends Component
// ->havingRaw("COUNT(*) >= $suma");
//})
->get();
if ($cuenta->isEmpty()) {
$suma3 = $pantalla_servicio - $pantallas;
$cantidad_necesaria = $this->cantidad_tarjetaPlan;
$cuenta = Cuentas::where('servicio_id', $this->servicio_id)
->whereDate('inicio', '>=', $this->fecha)
->whereDate('vencimiento', '>=', $this->fecha_final_1)
->whereDate('vencimiento', '<=', $this->fecha_final_2)
->Orderby('created_at', 'ASC')
->withCount('historiales')
->where('estado', 'activo')
->having('historiales_count', '<=', $suma3)
//->with('perfil')
//->whereDoesntHave('perfil', function ($query) use ($suma2) {
//$query->select('cuenta_id')
// ->groupBy('cuenta_id')
// ->havingRaw("COUNT(*) >= $suma2");
//})
->get();
}
// dd($cuenta);
} elseif ((int) $pantalla_servicio_completa == (int) $this->pantallas_tarjetaPlan) {
//Cuentas completas
@@ -328,6 +347,8 @@ class ShowServicios extends Component
$cantidad_necesaria = $this->cantidad_tarjetaPlan;
$cuenta = Cuentas::where('servicio_id', $this->servicio_id)
->whereDate('inicio', '>=', $this->fecha)
->whereDate('vencimiento', '>=', $this->fecha_final_1)
->whereDate('vencimiento', '<=', $this->fecha_final_2)
->Orderby('created_at', 'ASC')
->withCount('historiales')
->where('estado', 'activo')