FIX: Precio Unidad no existe en venta y facturacion

This commit is contained in:
2023-12-13 13:28:19 -03:00
parent 94906eea8c
commit 1ba53c9e12
3 changed files with 7 additions and 7 deletions

View File

@ -187,7 +187,7 @@
$IPC->readjust($venta->proyecto()->terreno->valor, $venta->proyecto()->terreno->fecha, $venta->currentEstado()->fecha) : 0}},
uf: {{$UF->get($venta->currentEstado()->fecha)}},
unidades: JSON.parse('{!! json_encode(array_map(function(Incoviba\Model\Venta\PropiedadUnidad $unidad) use ($venta, $UF, $format) {
$precio = ($unidad->valor > 0) ? $unidad->valor : $unidad->precio($venta->currentEstado()->fecha)->valor;
$precio = ($unidad->valor > 0) ? $unidad->valor : ($unidad->precio($venta->currentEstado()->fecha) ? $unidad->precio($venta->currentEstado()->fecha)->valor : 0);
return [
'id' => $unidad->id,
'pid' => $unidad->pu_id,

View File

@ -23,6 +23,9 @@
</thead>
<tbody>
@foreach($venta->propiedad()->unidades as $unidad)
@php
$precio = $unidad->precio($venta->fecha) ? $unidad->precio($venta->fecha)->valor : 0;
@endphp
<tr>
<td>
{{ucwords($unidad->proyectoTipoUnidad->tipoUnidad->descripcion)}}
@ -40,14 +43,14 @@
{{$format->number($unidad->proyectoTipoUnidad->vendible(), 2)}}
</td>
<td class="right aligned">
{{$format->ufs($unidad->precio($venta->fecha)->valor)}}
{{$format->ufs($precio)}}
</td>
<td class="right aligned">
{{$format->ufs($unidad->valor)}}
</td>
<td class="right aligned">
@if ($unidad->proyectoTipoUnidad->tipoUnidad->descripcion === 'departamento')
{{$format->number(($unidad->valor ?? ($unidad->precio($venta->fecha)->valor ?? 0)) / $unidad->proyectoTipoUnidad->vendible(), 2)}} UF/
{{$format->number(($unidad->valor ?? $precio) / $unidad->proyectoTipoUnidad->vendible(), 2)}} UF/
@endif
</td>
<td class="center aligned">