2023-11-22 19:08:19 -03:00
|
|
|
<?php
|
|
|
|
namespace Incoviba\Controller\Ventas;
|
|
|
|
|
|
|
|
use Psr\Http\Message\ResponseInterface;
|
|
|
|
use Psr\Http\Message\ServerRequestInterface;
|
|
|
|
use Incoviba\Common\Alias\View;
|
|
|
|
use Incoviba\Service;
|
|
|
|
|
|
|
|
class Facturacion
|
|
|
|
{
|
2024-04-15 20:13:15 -04:00
|
|
|
public function __invoke(ServerRequestInterface $request, ResponseInterface $response, View $view,
|
2024-04-19 23:19:35 -04:00
|
|
|
Service\Proyecto $proyectoService, Service\Proyecto\Terreno $terrenoService): ResponseInterface
|
2023-11-22 19:08:19 -03:00
|
|
|
{
|
|
|
|
$proyectos = $proyectoService->getEscriturando();
|
2024-04-19 23:19:35 -04:00
|
|
|
foreach ($proyectos as &$proyecto) {
|
|
|
|
$proyecto->terreno = $terrenoService->valor($proyecto->id) ?? $proyecto->terreno;
|
|
|
|
}
|
2023-11-22 19:08:19 -03:00
|
|
|
return $view->render($response, 'ventas.facturacion', compact('proyectos'));
|
|
|
|
}
|
2024-04-15 20:13:15 -04:00
|
|
|
public function show(ServerRequestInterface $request, ResponseInterface $response, View $view,
|
|
|
|
Service\Venta $ventaService, Service\Proyecto\Terreno $terrenoService,
|
|
|
|
int $venta_id): ResponseInterface
|
2023-11-22 19:08:19 -03:00
|
|
|
{
|
|
|
|
$venta = $ventaService->getById($venta_id);
|
2024-04-15 20:13:15 -04:00
|
|
|
$terreno = $terrenoService->valor($venta->proyecto()->id);
|
|
|
|
return $view->render($response, 'ventas.facturacion.show', compact('venta', 'terreno'));
|
2023-11-22 19:08:19 -03:00
|
|
|
}
|
|
|
|
}
|