Facturacion

This commit is contained in:
2023-11-22 19:08:19 -03:00
parent b4742a501e
commit 9ab0515954
45 changed files with 1846 additions and 71 deletions

View File

@ -0,0 +1,123 @@
<?php
namespace Incoviba\Controller\API;
use DateTimeInterface;
use DateTimeImmutable;
use DateInterval;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Incoviba\Common\Implement\Exception\EmptyRedis;
use Incoviba\Service;
class Money
{
use withJson, withRedis;
private int $time = 60 * 60 * 24 * 30;
public function get(ServerRequestInterface $request, ResponseInterface $response, Service\Redis $redisService, Service\Money $moneyService): ResponseInterface
{
$data = $request->getParsedBody();
$output = [
'input' => $data
];
$output[$data['provider']] = 0;
$redisKey = $data['provider'];
$date = new DateTimeImmutable($data['fecha']);
if (isset($data['start'])) {
$start = new DateTimeImmutable($data['start']);
}
$value = $this->getValue($redisService, $redisKey, $moneyService, $date, $data['provider']);
if (isset($start)) {
$months = $date->diff($start)->m;
$current = clone $start;
$value = $this->getValue($redisService, $redisKey, $moneyService, $current, $data['provider']);
for ($i = 1; $i <= $months; $i ++) {
$current = $current->add(new DateInterval("P{$i}M"));
$value += $this->getValue($redisService, $redisKey, $moneyService, $current, $data['provider']);
}
}
$output[$data['provider']] = $value;
return $this->withJson($response, $output);
}
protected array $data;
protected function getValue(Service\Redis $redisService, string $redisKey, Service\Money $moneyService, DateTimeInterface $date, string $provider): float
{
if (isset($this->data[$date->format('Y-m-d')])) {
return $this->data[$date->format('Y-m-d')];
}
try {
$this->data = (array) $this->fetchRedis($redisService, $redisKey);
if (!isset($this->data[$date->format('Y-m-d')])) {
throw new EmptyRedis($redisKey);
}
} catch (EmptyRedis) {
$result = $moneyService->get($provider, $date);
$this->data[$date->format('Y-m-d')] = $result;
$this->saveRedis($redisService, $redisKey, $this->data, $this->time);
}
return $this->data[$date->format('Y-m-d')];
}
/*public function uf(ServerRequestInterface $request, ResponseInterface $response, Service\Redis $redisService, Service\Money $moneyService): ResponseInterface
{
$body = $request->getParsedBody();
$output = [
'input' => $body,
'uf' => 0
];
$redisKey = 'uf';
$date = new DateTimeImmutable($body['fecha']);
try {
$ufs = $this->fetchRedis($redisService, $redisKey);
if (!isset($ufs[$date->format('Y-m-d')])) {
throw new EmptyRedis($redisKey);
}
} catch (EmptyRedis) {
error_log(var_export($ufs,true));
if (!isset($ufs)) {
$ufs = [];
}
$uf = $moneyService->getUF($date);
$ufs[$date->format('Y-m-d')] = $uf;
$this->saveRedis($redisService, $redisKey, $ufs, 60 * 60 * 24 * 30);
}
$output['uf'] = $ufs[$date->format('Y-m-d')];
return $this->withJson($response, $output);
}*/
public function ipc(ServerRequestInterface $request, ResponseInterface $response, Service\Redis $redisService, Service\Money $moneyService): ResponseInterface
{
$data = $request->getParsedBody();
$output = [
'input' => $data,
'date_string' => '',
'ipc' => 0
];
$redisKey = 'ipc';
$start = new DateTimeImmutable($data['start']);
$end = new DateTimeImmutable($data['end']);
$now = new DateTimeImmutable();
if ($end > $now) {
return $this->withJson($response, $output);
}
$dateKey = "{$start->format('Y-m')}-{$end->format('Y-m')}";
$months = $start->diff($end)->m;
$current = new DateTimeImmutable((($start <= $end) ? $start : $end)->format('Y-m-15'));
$value = 0;
$ipcs = [];
try {
$ipcs = (array) $this->fetchRedis($redisService, $redisKey);
} catch (EmptyRedis) {}
for ($i = 1; $i < $months; $i ++) {
$current = $current->add(new DateInterval("P1M"));
if (!isset($ipcs[$current->format('Y-m')])) {
$ipcs[$current->format('Y-m')] = $moneyService->getIPC($current);
$this->saveRedis($redisService, $redisKey, $ipcs, $this->time);
}
$value += $ipcs[$current->format('Y-m')];
}
$output['date_string'] = $dateKey;
$output['ipc'] = $value;
return $this->withJson($response, $output);
}
}

View File

@ -2,9 +2,9 @@
namespace Incoviba\Controller\API;
use DateTimeImmutable;
use Incoviba\Common\Implement\Exception\EmptyRedis;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Incoviba\Common\Implement\Exception\EmptyRedis;
use Incoviba\Common\Implement\Exception\EmptyResult;
use Incoviba\Model;
use Incoviba\Repository;
@ -153,4 +153,21 @@ class Ventas
}
return $this->withJson($response, $output);
}
public function unidades(ServerRequestInterface $request, ResponseInterface $response, Service\Venta\Unidad $unidadService, int $venta_id): ResponseInterface
{
$output = [
'venta_id' => $venta_id,
'unidades' => []
];
try {
$unidades = $unidadService->getByVenta($venta_id);
$output['unidades'] = json_decode(json_encode($unidades));
array_walk($output['unidades'], function($unidad, $index, $unidades) {
$unidad->prorrateo = $unidades[$index]->prorrateo;
$unidad->precios = $unidades[$index]->precios;
$unidad->current_precio = $unidades[$index]->currentPrecio;
}, $unidades);
} catch (EmptyResult) {}
return $this->withJson($response, $output);
}
}

View File

@ -0,0 +1,36 @@
<?php
namespace Incoviba\Controller\API\Ventas;
use DateTimeImmutable;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Incoviba\Service;
use Incoviba\Controller\API\withJson;
use Incoviba\Controller\API\withRedis;
use Incoviba\Controller\API\emptyBody;
use Incoviba\Common\Implement\Exception\EmptyResult;
use Incoviba\Common\Implement\Exception\EmptyRedis;
class Facturacion
{
use withJson, withRedis, emptyBody;
public function proyecto(ServerRequestInterface $request, ResponseInterface $response, Service\Redis $redisService, Service\Venta $ventaService, int $proyecto_id): ResponseInterface
{
$output = [
'proyecto_id' => $proyecto_id,
'ventas' => []
];
$today = new DateTimeImmutable();
$redisKey = "ventas_facturacion-proyecto-{$proyecto_id}-{$today->format('Y-m-d')}";
try {
$output['ventas'] = $this->fetchRedis($redisService, $redisKey);
} catch (EmptyRedis) {
try {
$output['ventas'] = $ventaService->getActivaByProyecto($proyecto_id);
$this->saveRedis($redisService, $redisKey, $output['ventas']);
} catch (EmptyResult) {}
}
return $this->withJson($response, $output);
}
}

View File

@ -14,11 +14,15 @@ trait withRedis
}
return json_decode($jsonString);
}
public function saveRedis(Service\Redis $redisService, string $redisKey, mixed $value): void
public function saveRedis(Service\Redis $redisService, string $redisKey, mixed $value, ?int $expiration = null): void
{
if (is_array($value) or is_object($value)) {
$value = json_encode($value);
}
if ($expiration !== null) {
$redisService->set($redisKey, $value, $expiration);
return;
}
$redisService->set($redisKey, $value);
}
}

View File

@ -0,0 +1,21 @@
<?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
{
public function __invoke(ServerRequestInterface $request, ResponseInterface $response, View $view, Service\Proyecto $proyectoService): ResponseInterface
{
$proyectos = $proyectoService->getEscriturando();
return $view->render($response, 'ventas.facturacion', compact('proyectos'));
}
public function show(ServerRequestInterface $request, ResponseInterface $response, View $view, Service\Venta $ventaService, int $venta_id): ResponseInterface
{
$venta = $ventaService->getById($venta_id);
return $view->render($response, 'ventas.facturacion.show', compact('venta'));
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace Incoviba\Middleware;
use Error;
use Exception;
use Psr\Http\Message\ResponseFactoryInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Psr\Log\LoggerInterface;
use Incoviba\Common\Alias\View;
class Errors
{
public function __construct(protected LoggerInterface $logger, protected ResponseFactoryInterface $responseFactory, protected View $view) {}
public function __invoke(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
try {
return $handler->handle($request);
} catch (Exception $exception) {
$this->logger->notice($exception);
} catch (Error $error) {
$this->logger->error($error);
}
$response = $this->responseFactory->createResponse(404);
if (str_contains($request->getUri()->getPath(), '/api')) {
return $response;
}
return $this->view->render($response, 'construccion');
}
}

View File

@ -1,7 +1,9 @@
<?php
namespace Incoviba\Model\Proyecto;
class Superficie
use JsonSerializable;
class Superficie implements JsonSerializable
{
public float $sobre_nivel;
public float $bajo_nivel;
@ -10,4 +12,13 @@ class Superficie
{
return $this->bajo_nivel + $this->sobre_nivel;
}
public function jsonSerialize(): mixed
{
return [
'sobre_nivel' => $this->sobre_nivel,
'bajo_nivel' => $this->bajo_nivel,
'total' => $this->total()
];
}
}

View File

@ -1,8 +1,21 @@
<?php
namespace Incoviba\Model\Proyecto;
class Terreno
use DateTimeInterface;
use JsonSerializable;
class Terreno implements JsonSerializable
{
public float $superficie;
public float $valor;
public ?DateTimeInterface $date;
public function jsonSerialize(): mixed
{
return [
'superficie' => $this->superficie,
'valor' => $this->valor,
'date' => $this->date?->format('Y-m-d')
];
}
}

View File

@ -12,6 +12,7 @@ class Unidad extends Ideal\Model
public string $descripcion;
public ?string $orientacion = '';
public Model\Proyecto\ProyectoTipoUnidad $proyectoTipoUnidad;
public ?float $prorrateo;
public array $precios = [];
public ?Precio $currentPrecio = null;
@ -50,7 +51,8 @@ class Unidad extends Ideal\Model
'piso' => $this->piso,
'descripcion' => $this->descripcion,
'orientacion' => $this->orientacion,
'proyecto_tipo_unidad' => $this->proyectoTipoUnidad
'proyecto_tipo_unidad' => $this->proyectoTipoUnidad,
'prorrateo' => $this->prorrateo
]);
}
}

View File

@ -1,6 +1,7 @@
<?php
namespace Incoviba\Repository;
use DateTimeImmutable;
use Incoviba\Common\Define;
use Incoviba\Common\Ideal;
use Incoviba\Common\Implement;
@ -36,6 +37,10 @@ class Proyecto extends Ideal\Repository
$terreno = new Model\Proyecto\Terreno();
$terreno->superficie = $data['superficie_terreno'];
$terreno->valor = $data['valor_terreno'];
$terreno->date = null;
if (isset($data['fecha_terreno']) and $data['fecha_terreno'] !== '') {
$terreno->date = new DateTimeImmutable($data['fecha_terreno']);
}
return $terreno;
}))
->register('superficie_sobre_nivel', (new Implement\Repository\Mapper())
@ -67,36 +72,55 @@ class Proyecto extends Ideal\Repository
}
public function fetchByName(string $name): Define\Model
{
$query = "SELECT * FROM `{$this->getTable()}` WHERE `name` = ?";
$query = $this->connection->getQueryBuilder()
->select($this->columns())
->from("{$this->getTable()} a")
->joined($this->joinTerreno())
->where("name = ?");
return $this->fetchOne($query, [$name]);
}
public function fetchAllActive(): array
{
$etapaProyecto = $this->etapaRepository->fetchByDescripcion('Proyecto');
$etapaTerminado = $this->etapaRepository->fetchByDescripcion('Terminado');
$query = "SELECT a.*
FROM `{$this->getTable()}` a
{$this->joinEstado()}
WHERE et.`orden` BETWEEN {$etapaProyecto->orden} AND ({$etapaTerminado->orden} - 1)
ORDER BY a.`descripcion`";
$query = $this->connection->getQueryBuilder()
->select($this->columns())
->from("{$this->getTable()} a")
->joined($this->joinTerreno())
->joined($this->joinEstado())
->where("et.orden BETWEEN {$etapaProyecto->orden} AND ({$etapaTerminado->orden} - 1)")
->order('a.descripcion');
return $this->fetchMany($query);
}
public function fetchAllEscriturando(): array
{
$etapaRecepcion = $this->etapaRepository->fetchByDescripcion('Recepción');
$etapaTerminado = $this->etapaRepository->fetchByDescripcion('Terminado');
$query = "SELECT a.*
FROM `{$this->getTable()}` a
{$this->joinEstado()}
WHERE et.`orden` BETWEEN {$etapaRecepcion->orden} AND ({$etapaTerminado->orden} - 1)
ORDER BY a.`descripcion`";
$query = $this->connection->getQueryBuilder()
->select($this->columns())
->from("{$this->getTable()} a")
->joined($this->joinTerreno())
->joined($this->joinEstado())
->where("et.orden BETWEEN {$etapaRecepcion->orden} AND ({$etapaTerminado->orden} - 1)")
->order('a.descripcion');
return $this->fetchMany($query);
}
public function fetchSuperficieVendido(int $proyecto_id): float
/*public function fetchSuperficieVendido(int $proyecto_id): float
{
}
}*/
protected function columns(): string
{
return "a.id, a.inmobiliaria, a.descripcion, a.direccion, a.superficie_terreno,
COALESCE(pt.valor, a.valor_terreno) AS valor_terreno, COALESCE(pt.fecha, '') AS fecha_terreno, a.corredor,
a.superficie_sobre_nivel, a.superficie_bajo_nivel, a.pisos, a.subterraneos";
}
protected function joinTerreno(): string
{
return "LEFT OUTER JOIN (SELECT pt1.* FROM proyecto_terreno pt1 JOIN (
SELECT MAX(id) AS id, proyecto_id FROM proyecto_terreno) pt0 ON pt0.id = pt1.id) pt ON pt.proyecto_id = a.id";
}
protected function joinEstado(): string
{
return "JOIN (

View File

@ -17,7 +17,7 @@ class Unidad extends Ideal\Repository
public function create(?array $data = null): Model\Venta\Unidad
{
$map = (new Implement\Repository\MapperParser(['subtipo', 'piso', 'descripcion', 'orientacion']))
$map = (new Implement\Repository\MapperParser(['subtipo', 'piso', 'descripcion', 'orientacion', 'prorrateo']))
->register('pt', (new Implement\Repository\Mapper())
->setProperty('proyectoTipoUnidad')
->setFunction(function($data) {
@ -38,62 +38,88 @@ class Unidad extends Ideal\Repository
return $this->update($model, ['subtipo', 'piso', 'descripcion', 'orientacion', 'pt'], $new_data);
}
public function fetchByVenta(int $venta_id): array
{
$query = $this->connection->getQueryBuilder()
->select('a.*, up.prorrateo')
->from("{$this->getTable()} a")
->joined($this->joinProrrateo())
->joined('JOIN propiedad_unidad pu ON pu.unidad = a.id
JOIN venta ON venta.propiedad = pu.propiedad')
->where('venta.id = ?');
return $this->fetchMany($query, [$venta_id]);
}
public function fetchByPropiedad(int $propiedad_id): array
{
$query = "SELECT a.*
FROM `{$this->getTable()}` a
JOIN `propiedad_unidad` pu ON pu.`unidad` = a.`id`
WHERE pu.`propiedad` = ?
GROUP BY a.`id`";
$query = $this->connection->getQueryBuilder()
->select('a.*, up.prorrateo')
->from("{$this->getTable()} a")
->joined($this->joinProrrateo())
->joined('JOIN `propiedad_unidad` pu ON pu.`unidad` = a.`id`')
->where('pu.propiedad = ?')
->group('a.id');
return $this->fetchMany($query, [$propiedad_id]);
}
public function fetchByCierre(int $cierre_id): array
{
$query = "SELECT a.*
FROM `{$this->getTable()}` a
JOIN `unidad_cierre` uc ON uc.`unidad` = a.`id`
$query = $this->connection->getQueryBuilder()
->select('a.*, up.prorrateo')
->from("{$this->getTable()} a")
->joined($this->joinProrrateo())
->joined("JOIN `unidad_cierre` uc ON uc.`unidad` = a.`id`
JOIN `proyecto_tipo_unidad` ptu ON ptu.`id` = a.`pt`
JOIN `tipo_unidad` tu ON tu.`id` = ptu.`tipo`
WHERE uc.`cierre` = ?
GROUP BY a.`id`
ORDER BY tu.`orden`, LPAD(a.`descripcion`, 4, '0')";
JOIN `tipo_unidad` tu ON tu.`id` = ptu.`tipo`")
->where('uc.cierre = ?')
->group('a.id')
->order("tu.orden, LPAD(a.descripcion, 4, '0')");
return $this->fetchMany($query, [$cierre_id]);
}
public function fetchByProyecto(int $proyecto_id): array
{
$query = "SELECT a.*
FROM `{$this->getTable()}` a
JOIN `proyecto_tipo_unidad` ptu ON ptu.`id` = a.`pt`
JOIN `tipo_unidad` tu ON tu.`id` = ptu.`tipo`
WHERE ptu.`proyecto` = ?
ORDER BY tu.`orden`";
$query = $this->connection->getQueryBuilder()
->select('a.*, up.prorrateo')
->from("{$this->getTable()} a")
->joined($this->joinProrrateo())
->joined("JOIN `proyecto_tipo_unidad` ptu ON ptu.`id` = a.`pt`
JOIN `tipo_unidad` tu ON tu.`id` = ptu.`tipo`")
->where('ptu.proyecto = ?')
->order('tu.orden');
return $this->fetchMany($query, [$proyecto_id]);
}
public function fetchDisponiblesByProyecto(int $proyecto_id): array
{
$query = "SELECT DISTINCT a.*
FROM `{$this->getTable()}` a
JOIN `proyecto_tipo_unidad` ptu ON ptu.`id` = a.`pt`
$query = $this->connection->getQueryBuilder()
->select('DISTINCT a.*, up.prorrateo')
->from("{$this->getTable()} a")
->joined($this->joinProrrateo())
->joined("JOIN `proyecto_tipo_unidad` ptu ON ptu.`id` = a.`pt`
JOIN `tipo_unidad` tu ON tu.`id` = ptu.`tipo`
LEFT OUTER JOIN `propiedad_unidad` pu ON pu.`unidad` = a.`id`
LEFT OUTER JOIN `venta` ON `venta`.`propiedad` = `pu`.`propiedad`
LEFT OUTER JOIN (SELECT ev1.* FROM `estado_venta` ev1 JOIN (SELECT MAX(`id`) as 'id', `venta` FROM `estado_venta`) ev0 ON ev0.`id` = ev1.`id`) ev ON ev.`venta` = `venta`.`id`
LEFT OUTER JOIN `tipo_estado_venta` tev ON tev.`id` = ev.`estado`
WHERE ptu.`proyecto` = ? AND (pu.`id` IS NULL OR `venta`.`id` IS NULL OR tev.`activa` = 0)
ORDER BY tu.`orden`";
LEFT OUTER JOIN `tipo_estado_venta` tev ON tev.`id` = ev.`estado`")
->where("ptu.`proyecto` = ? AND (pu.`id` IS NULL OR `venta`.`id` IS NULL OR tev.`activa` = 0)")
->order('tu.orden');
return $this->fetchMany($query, [$proyecto_id]);
}
public function fetchDisponiblesByDescripcionAndTipo(string $descripcion, string $tipo): array
{
$query = "SELECT DISTINCT a.*
FROM `{$this->getTable()}` a
JOIN `proyecto_tipo_unidad` ptu ON ptu.`id` = a.`pt`
$query = $this->connection->getQueryBuilder()
->select('DISTINCT a.*, up.prorrateo')
->from("{$this->getTable()} a")
->joined($this->joinProrrateo())
->joined("JOIN `proyecto_tipo_unidad` ptu ON ptu.`id` = a.`pt`
JOIN `tipo_unidad` tu ON tu.`id` = ptu.`tipo`
LEFT OUTER JOIN `propiedad_unidad` pu ON pu.`unidad` = a.`id`
LEFT OUTER JOIN `venta` ON `venta`.`propiedad` = pu.`propiedad`
LEFT OUTER JOIN (SELECT ev1.* FROM `estado_venta` ev1 JOIN (SELECT MAX(`id`) as 'id', `venta` FROM `estado_venta`) ev0 ON ev0.`id` = ev1.`id`) ev ON ev.`venta` = `venta`.`id`
LEFT OUTER JOIN `tipo_estado_venta` tev ON tev.`id` = ev.`estado`
WHERE a.`descripcion` LIKE ? AND tu.`descripcion` = ? AND (pu.`id` IS NULL OR `venta`.`id` IS NULL OR tev.`activa` = 0)";
LEFT OUTER JOIN `tipo_estado_venta` tev ON tev.`id` = ev.`estado`")
->where("a.`descripcion` LIKE ? AND tu.`descripcion` = ? AND (pu.`id` IS NULL OR `venta`.`id` IS NULL OR tev.`activa` = 0)");
return $this->fetchMany($query, [$descripcion, $tipo]);
}
protected function joinProrrateo(): string
{
return "LEFT OUTER JOIN unidad_prorrateo up ON up.unidad_id = a.id";
}
}

View File

@ -2,6 +2,8 @@
namespace Incoviba\Service;
use DateTimeInterface;
use DateTimeImmutable;
use DateInterval;
use Incoviba\Common\Define\Money\Provider;
use Incoviba\Common\Implement\Exception\EmptyResponse;
use Incoviba\Service\Money\MiIndicador;
@ -22,6 +24,15 @@ class Money
return $this->providers[$name];
}
public function get(string $provider, DateTimeInterface $dateTime): float
{
try {
$upper = strtoupper($provider);
return $this->getProvider($provider)->get(MiIndicador::getSymbol($provider), $dateTime);
} catch (EmptyResponse) {
return 0;
}
}
public function getUF(DateTimeInterface $dateTime): float
{
try {

View File

@ -36,4 +36,11 @@ class MiIndicador implements Provider
}
return $json->serie[0]->valor;
}
public static function getSymbol(string $identifier): string
{
$upper = strtoupper($identifier);
$output = '';
eval("\$output = self::{$upper};");
return $output;
}
}

View File

@ -15,6 +15,10 @@ class Proyecto
{
return $this->proyectoRepository->fetchAllActive();
}
public function getEscriturando(): array
{
return $this->proyectoRepository->fetchAllEscriturando();
}
public function getById(int $venta_id): Model\Proyecto
{
return $this->process($this->proyectoRepository->fetchById($venta_id));

View File

@ -15,35 +15,32 @@ class Unidad
public function getById(int $unidad_id): Model\Venta\Unidad
{
$unidad = $this->unidadRepository->fetchById($unidad_id);
$this->fillPrecios($unidad);
return $unidad;
return $this->process($this->unidadRepository->fetchById($unidad_id));
}
public function getByVenta(int $venta_id): array
{
return array_map([$this, 'process'], $this->unidadRepository->fetchByVenta($venta_id));
}
public function getByPropiedad(int $propiedad_id): array
{
$unidades = $this->unidadRepository->fetchByPropiedad($propiedad_id);
array_walk($unidades, [$this, 'fillPrecios']);
return $unidades;
return array_map([$this, 'process'], $this->unidadRepository->fetchByPropiedad($propiedad_id));
}
public function getByCierre(int $cierre_id): array
{
$unidades = $this->unidadRepository->fetchByCierre($cierre_id);
array_walk($unidades, [$this, 'fillPrecios']);
return $unidades;
return array_map([$this, 'process'], $this->unidadRepository->fetchByCierre($cierre_id));
}
public function getDisponiblesByProyecto(int $proyecto_id): array
{
$unidades = $this->unidadRepository->fetchDisponiblesByProyecto($proyecto_id);
//array_walk($unidades, [$this, 'fillPrecios']);
return $unidades;
return $this->unidadRepository->fetchDisponiblesByProyecto($proyecto_id);
}
protected function fillPrecios(&$unidad): void
protected function process($unidad): Model\Venta\Unidad
{
try {
$unidad->precios = $this->precioService->getByUnidad($unidad->id);
$unidad->currentPrecio = $this->precioService->getVigenteByUnidad($unidad->id);
} catch (EmptyResult) {
}
return $unidad;
}
}