diff --git a/app/resources/views/ventas/facturacion/show.blade.php b/app/resources/views/ventas/facturacion/show.blade.php index 2efebea..e8f7c03 100644 --- a/app/resources/views/ventas/facturacion/show.blade.php +++ b/app/resources/views/ventas/facturacion/show.blade.php @@ -62,7 +62,8 @@ @endif - @if ($IPC->get($venta->proyecto()->terreno->fecha, $venta->currentEstado()->fecha) === 0.0) + @if ($venta->currentEstado()->fecha->sub(new DateInterval('P1M')) > $venta->proyecto()->terreno->fecha + and $IPC->get($venta->proyecto()->terreno->fecha, $venta->currentEstado()->fecha->sub(new DateInterval('P1M'))) === 0.0)
@@ -314,7 +315,7 @@ return } const idx = this.unidades.findIndex(unidad => unidad.pid === json.propiedad_unidad_id) - this.unidades[idx].precio = parseInt(json.input.valor) + this.unidades[idx].precio = parseFloat(json.input.valor) this.unidades[idx].base = parseFloat(json.input.valor * this.unidades[idx].base / old_value) this.build() }) diff --git a/app/src/Service/IPC.php b/app/src/Service/IPC.php index 1c1acfc..f2e59c5 100644 --- a/app/src/Service/IPC.php +++ b/app/src/Service/IPC.php @@ -5,11 +5,12 @@ use DateTimeInterface; use DateTimeImmutable; use DateInterval; use Incoviba\Common\Implement\Exception\EmptyRedis; +use Psr\Log\LoggerInterface; class IPC { protected string $redisKey = 'ipc'; - public function __construct(protected Redis $redisService, protected Money $moneyService) {} + public function __construct(protected Redis $redisService, protected Money $moneyService, protected LoggerInterface $logger) {} public function get(DateTimeInterface $from, DateTimeInterface $to = new DateTimeImmutable()): float { @@ -38,7 +39,7 @@ class IPC public function readjust(float $base, DateTimeInterface $from, DateTimeInterface $to = new DateTimeImmutable()):float { if (($ipc = $this->get($from, $to->sub(new DateInterval('P1M')))) === 0.0) { - return 0; + return $base; } return $base * (1 + $ipc); }