Fixes for upgrade

This commit is contained in:
Aldarien
2023-02-10 15:14:14 +00:00
parent de6100a546
commit 87643a5b99
4 changed files with 19 additions and 12 deletions

View File

@ -486,7 +486,10 @@ class Informes
$info['Tipo'] = $venta->unidad()->abreviacion;
$info['m² Ponderados'] = $venta->unidad()->m2('vendible');
$info['Valor Promesa'] = $venta->valor_uf;
$info['Pie'] = $venta->pie()->valor;
$info['Pie'] = 0;
if ($venta->pie()) {
$info['Pie'] = $venta->pie()->valor;
}
$info['Pie Pagado'] = 0;
$info['% Pie Pagado'] = 0;
if ($venta->pie()) {
@ -510,10 +513,10 @@ class Informes
}
$info['Credito'] = 0;
$info['Banco'] = '';
if ($venta->credito != 0) {
$info['Credito'] = $venta->credito()->pago()->valor('ufs');
if ($venta->credito()->pago()->banco != 0) {
$info['Banco'] = $venta->credito()->pago()->banco()->nombre;
if ($venta->credito != 0 and $venta->credito()->pago()) {
$info['Credito'] = $venta->credito()?->pago()->valor('ufs');
if ($venta->credito()?->pago()->banco != 0) {
$info['Banco'] = $venta->credito()?->pago()->banco()->nombre;
}
}
$info['Valor Ests & Bods'] = $venta->valorEstacionamientosYBodegas();
@ -525,6 +528,9 @@ class Informes
$info['Precio'] = 0;
try {
$info['Precio'] = array_reduce($venta->propiedad()->departamentos(), function($sum, $item) use ($fecha) {
if (!$item->precio($fecha)) {
return $sum;
}
return $sum + $item->precio($fecha)->valor;
});
} catch (\Exception $e) {