Ventas->Listado->Ventas

This commit is contained in:
Juan Pablo Vial
2023-07-28 16:22:20 -04:00
parent 38383f5295
commit ef30ae67d2
52 changed files with 1496 additions and 17 deletions

22
app/src/Service/Venta.php Normal file
View File

@ -0,0 +1,22 @@
<?php
namespace Incoviba\Service;
use Incoviba\Repository;
class Venta
{
public function __construct(
protected Repository\Venta $ventaRepository,
protected Repository\Venta\EstadoVenta $estadoVentaRepository
) {}
public function getByProyecto(int $proyecto_id): array
{
$ventas = $this->ventaRepository->fetchByProyecto($proyecto_id);
foreach ($ventas as &$venta) {
$venta->estados = $this->estadoVentaRepository->fetchByVenta($venta->id);
$venta->currentEstado = $this->estadoVentaRepository->fetchCurrentByVenta($venta->id);
}
return $ventas;
}
}