24 lines
811 B
PHP
24 lines
811 B
PHP
![]() |
<?php
|
||
|
namespace Incoviba\Service\Ventas;
|
||
|
|
||
|
use Incoviba\Repository;
|
||
|
|
||
|
class Cierre
|
||
|
{
|
||
|
public function __construct(
|
||
|
protected Repository\Venta\Cierre $cierreRepository,
|
||
|
protected Repository\Venta\EstadoCierre $estadoCierreRepository,
|
||
|
protected Repository\Venta\Unidad $unidadRepository) {}
|
||
|
|
||
|
public function getByProyecto(int $proyecto_id): array
|
||
|
{
|
||
|
$cierres = $this->cierreRepository->fetchByProyecto($proyecto_id);
|
||
|
foreach ($cierres as &$cierre) {
|
||
|
$cierre->estados = $this->estadoCierreRepository->fetchByCierre($cierre->id);
|
||
|
$cierre->current = $this->estadoCierreRepository->fetchCurrentByCierre($cierre->id);
|
||
|
$cierre->unidades = $this->unidadRepository->fetchByCierre($cierre->id);
|
||
|
}
|
||
|
return $cierres;
|
||
|
}
|
||
|
}
|