Compare commits
2 Commits
53115b085f
...
e6892ee085
Author | SHA1 | Date | |
---|---|---|---|
e6892ee085 | |||
86b8d6b3c7 |
@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Incoviba\Controller\Ventas;
|
namespace Incoviba\Controller\Ventas;
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use DateInterval;
|
use DateInterval;
|
||||||
use DateTimeImmutable;
|
use DateTimeImmutable;
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
@ -23,9 +22,6 @@ class Facturacion extends Ideal\Controller
|
|||||||
return $view->render($response, 'ventas.facturacion', compact('proyectos'));
|
return $view->render($response, 'ventas.facturacion', compact('proyectos'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public function show(ServerRequestInterface $request, ResponseInterface $response, View $view,
|
public function show(ServerRequestInterface $request, ResponseInterface $response, View $view,
|
||||||
Service\Venta $ventaService, Service\Proyecto\Terreno $terrenoService,
|
Service\Venta $ventaService, Service\Proyecto\Terreno $terrenoService,
|
||||||
Service\IPC $ipcService, Service\UF $ufService,
|
Service\IPC $ipcService, Service\UF $ufService,
|
||||||
|
@ -4,14 +4,15 @@ namespace Incoviba\Service\Venta;
|
|||||||
use PDOException;
|
use PDOException;
|
||||||
use Incoviba\Common\Implement\Exception\EmptyResult;
|
use Incoviba\Common\Implement\Exception\EmptyResult;
|
||||||
use Incoviba\Exception\ServiceAction\{Create, Read, Update};
|
use Incoviba\Exception\ServiceAction\{Create, Read, Update};
|
||||||
use Incoviba\Repository;
|
|
||||||
use Incoviba\Model;
|
use Incoviba\Model;
|
||||||
|
use Incoviba\Repository;
|
||||||
|
use Incoviba\Service;
|
||||||
|
|
||||||
class PropiedadUnidad
|
class PropiedadUnidad
|
||||||
{
|
{
|
||||||
public function __construct(protected Repository\Venta\PropiedadUnidad $propiedadUnidadRepository,
|
public function __construct(protected Repository\Venta\PropiedadUnidad $propiedadUnidadRepository,
|
||||||
protected Repository\Venta\Unidad $unidadRepository,
|
protected Repository\Venta\Unidad $unidadRepository,
|
||||||
protected Precio $precioService) {}
|
protected Precio $precioService, protected Service\Valor $valorService) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $unidad_id
|
* @param int $unidad_id
|
||||||
@ -93,7 +94,11 @@ class PropiedadUnidad
|
|||||||
public function edit(Model\Venta\PropiedadUnidad $propiedadUnidad, array $data): Model\Venta\PropiedadUnidad
|
public function edit(Model\Venta\PropiedadUnidad $propiedadUnidad, array $data): Model\Venta\PropiedadUnidad
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
return $this->process($this->propiedadUnidadRepository->edit($propiedadUnidad, $data));
|
$filteredData = $this->propiedadUnidadRepository->filterData($data);
|
||||||
|
if (array_key_exists('valor', $filteredData)) {
|
||||||
|
$filteredData['valor'] = $this->valorService->clean($filteredData['valor']);
|
||||||
|
}
|
||||||
|
return $this->process($this->propiedadUnidadRepository->edit($propiedadUnidad, $filteredData));
|
||||||
} catch (PDOException $exception) {
|
} catch (PDOException $exception) {
|
||||||
throw new Update(__CLASS__, $exception);
|
throw new Update(__CLASS__, $exception);
|
||||||
}
|
}
|
||||||
@ -104,7 +109,9 @@ class PropiedadUnidad
|
|||||||
try {
|
try {
|
||||||
$unidad->precios = $this->precioService->getByUnidad($unidad->id);
|
$unidad->precios = $this->precioService->getByUnidad($unidad->id);
|
||||||
$unidad->currentPrecio = $this->precioService->getVigenteByUnidad($unidad->id);
|
$unidad->currentPrecio = $this->precioService->getVigenteByUnidad($unidad->id);
|
||||||
$unidad->valor = $unidad->currentPrecio->valor;
|
if ($unidad->valor === null) {
|
||||||
|
$unidad->valor = $unidad->currentPrecio->valor;
|
||||||
|
}
|
||||||
} catch (Read) {}
|
} catch (Read) {}
|
||||||
return $unidad;
|
return $unidad;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user