2 Commits

Author SHA1 Message Date
1f076bc2f1 FIX: IPC y factura 2024-01-18 13:15:26 -03:00
ad003c7dcf Cleanup 2024-01-18 13:05:36 -03:00
4 changed files with 6 additions and 22 deletions

View File

@ -62,7 +62,8 @@
</div>
@endif
</form>
@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)
<div class="ui compact icon error message">
<i class="exclamation triangle icon"></i>
<div class="content">
@ -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()
})

View File

@ -21,14 +21,6 @@ class Itau extends Banco
protected function parseFile(UploadedFileInterface $uploadedFile): array
{
function log(mixed $elem): void
{
if (!is_string($elem)) {
$elem = var_export($elem,true);
}
error_log($elem.PHP_EOL,3,'/logs/debug');
}
$filename = '/tmp/cartola.xls';
$uploadedFile->moveTo($filename);
@ -74,7 +66,6 @@ class Itau extends Banco
if ($col === 'Fecha') {
list($d, $m) = explode('/', $value);
$value = "{$year}-{$m}-{$d}";
log($value);
}
$rowData[$col] = $value;
$colIndex ++;

View File

@ -21,14 +21,6 @@ class Santander extends Banco
}
protected function parseFile(UploadedFileInterface $uploadedFile): array
{
function log(mixed $elem): void
{
if (!is_string($elem)) {
$elem = var_export($elem,true);
}
error_log($elem.PHP_EOL,3,'/logs/debug');
}
$filename = '/tmp/cartola.xlsx';
$uploadedFile->moveTo($filename);
@ -57,7 +49,6 @@ class Santander extends Banco
$value = $col->getCalculatedValue();
$col = $columns[$colIndex];
if ($col === 'FECHA') {
log($value);
list($d,$m,$Y) = explode('/', $value);
$value = "{$Y}-{$m}-{$d}";
}

View File

@ -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);
}