diff --git a/app/resources/views/search.blade.php b/app/resources/views/search.blade.php
index 55bdcd6..198fe62 100644
--- a/app/resources/views/search.blade.php
+++ b/app/resources/views/search.blade.php
@@ -58,6 +58,7 @@
if (!this.venta.current_estado.tipo_estado_venta.activa) {
unidad.html(unidad.html() + ' (I)')
}
+ unidad.html(unidad.html() + ' ')
propietario = $('')
.attr('href','{{$urls->base}}/search/"' + encodeURIComponent(this.venta.propietario.nombre_completo) + '"/propietario')
.html(this.venta.propietario.nombre_completo)
diff --git a/app/resources/views/ventas/pies/cuotas.blade.php b/app/resources/views/ventas/pies/cuotas.blade.php
index 49f734a..ae5c08b 100644
--- a/app/resources/views/ventas/pies/cuotas.blade.php
+++ b/app/resources/views/ventas/pies/cuotas.blade.php
@@ -167,7 +167,8 @@
}, 0.0))}}
- {{$format->number(($total > 0) ? $pagado / $total * 100 : 0, 2)}}%
+ {{ $format->percent(($total > 0) ? $pagado / $total : 0, 2, true) }} Pie
+ {{ $format->percent($pagado / $venta->valor, 2, true) }} Promesa
|
|
diff --git a/app/resources/views/ventas/show/forma_pago/anticipo.blade.php b/app/resources/views/ventas/show/forma_pago/anticipo.blade.php
index d9f3095..5bb9fbf 100644
--- a/app/resources/views/ventas/show/forma_pago/anticipo.blade.php
+++ b/app/resources/views/ventas/show/forma_pago/anticipo.blade.php
@@ -1,6 +1,6 @@
Anticipo |
- |
+ {{ $format->percent($anticipo['uf'] / $venta->valor, 2, true) }} |
{{$format->ufs($anticipo['uf'])}} |
{{$format->pesos($anticipo['pesos'])}} |
|
diff --git a/app/resources/views/ventas/show/forma_pago/bono_pie.blade.php b/app/resources/views/ventas/show/forma_pago/bono_pie.blade.php
index adae804..1201915 100644
--- a/app/resources/views/ventas/show/forma_pago/bono_pie.blade.php
+++ b/app/resources/views/ventas/show/forma_pago/bono_pie.blade.php
@@ -14,7 +14,7 @@
@endif
@if ($bonoPie !== null)
- |
+ {{ $format->percent($bonoPie->pago->valor() / $venta->valor, 2, true) }} |
{{$format->ufs($bonoPie->pago->valor())}} |
{{$format->pesos($bonoPie->pago->valor)}} |
|
diff --git a/app/resources/views/ventas/show/forma_pago/credito.blade.php b/app/resources/views/ventas/show/forma_pago/credito.blade.php
index 0310043..6a34bb9 100644
--- a/app/resources/views/ventas/show/forma_pago/credito.blade.php
+++ b/app/resources/views/ventas/show/forma_pago/credito.blade.php
@@ -14,7 +14,7 @@
@endif
@if ($credito !== null)
- |
+ {{ $format->percent($credito->pago->valor() / $venta->valor, 2, true) }} |
{{$format->ufs($credito->pago->valor())}}
|
diff --git a/app/resources/views/ventas/show/forma_pago/pie.blade.php b/app/resources/views/ventas/show/forma_pago/pie.blade.php
index 6f3df32..5e81861 100644
--- a/app/resources/views/ventas/show/forma_pago/pie.blade.php
+++ b/app/resources/views/ventas/show/forma_pago/pie.blade.php
@@ -8,7 +8,7 @@
- |
+ {{ $format->percent($pie->valor / $venta->valor, 2, true) }} |
{{$format->ufs($pie->valor)}} |
{{$format->pesos($pie->valor * $pie->uf)}} |
Cuotas |
@@ -25,7 +25,7 @@
Pagado |
- |
+ {{$format->percent($pie->pagado() / $venta->valor, 2, true)}} |
{{$format->ufs($pie->pagado())}} |
{{$format->pesos($pie->pagado('pesos'))}} |
|
diff --git a/app/src/Model/Venta/Pago.php b/app/src/Model/Venta/Pago.php
index 8474d11..669955d 100644
--- a/app/src/Model/Venta/Pago.php
+++ b/app/src/Model/Venta/Pago.php
@@ -24,8 +24,15 @@ class Pago extends Model
public function valor(string $moneda = Pago::UF): float
{
- $uf = $this->uf ?? ($this->uf > 0.0 ? $this->uf : 1);
- return $this->valor / (($moneda === Pago::UF) ? $uf : 1);
+ $multiplier = 1;
+ if ($moneda === Pago::UF) {
+ if ($this->uf === null or $this->uf === 0.0) {
+ return 0;
+ }
+ $uf = $this->uf;
+ $multiplier = 1 / $uf;
+ }
+ return $this->valor * $multiplier;
}
public function estado(?string $tipoEstado = null): ?EstadoPago
diff --git a/app/src/Service/Format.php b/app/src/Service/Format.php
index 69bde98..c2119c5 100644
--- a/app/src/Service/Format.php
+++ b/app/src/Service/Format.php
@@ -6,12 +6,12 @@ use IntlDateFormatter;
class Format
{
- public function localDate(string $valor, string $format, bool $print = false): string
+ public function localDate(string $valor, ?string $format = null, bool $print = false): string
{
$date = new DateTimeImmutable($valor);
$formatter = new IntlDateFormatter('es_ES');
if ($format == null) {
- $format = 'DD [de] MMMM [de] YYYY';
+ $format = "dd 'de' MMMM 'de' YYYY";
}
$formatter->setPattern($format);
return $formatter->format($date);
@@ -21,9 +21,9 @@ class Format
{
return number_format($number, $decimal_places, ',', '.');
}
- public function percent(float|string $number, int $decimal_places = 2): string
+ public function percent(float|string $number, int $decimal_places = 2, bool $multiply = false): string
{
- return "{$this->number($number, $decimal_places)}%";
+ return "{$this->number(($multiply) ? $number * 100 : $number, $decimal_places)}%";
}
public function pesos(string $valor, int $decimal_places = 0): string
{