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) {

View File

@ -39,17 +39,16 @@ function uf($date, $async = false) {
return (object) ['total' => 0];
}
$url = 'http://' . config('locations.money') . '/api/uf/value/' . $date->format('Y-m-d');
$client = new \Goutte\Client();
$client->setHeader('Accept', 'application/json');
$client->request('GET', $url);
$client = new \GuzzleHttp\Client(['base_uri' => 'http://' . config('locations.money') . '/', 'headers' => ['Accept' => 'application/json']]);
$response = $client->get('api/uf/value/' . $date->format('Y-m-d'));
$response = $client->getResponse();
//$response = $client->getResponse();
if (!$response) {
return (object) ['total' => 0];
}
$status = $response->getStatusCode();
if ($status >= 200 and $status < 300) {
$data = json_decode($response->getContent());
$data = json_decode($response->getBody()->getContents());
return $data;
}
return (object) ['total' => 0];

View File

@ -11,6 +11,6 @@ return [
'controllers' => '{locations.app}/Controller',
'money' => 'provm.cl/optimus/money',
'api' => '192.168.1.100/intranet/api',
'api_url' => '/incoviba/api'
'api_url' => '/api'
];
?>

View File

@ -66,9 +66,11 @@
</tr>
</thead>
<tbody>
@if (isset($results) and is_array($results) and count($results) > 0)
@foreach ($results as $resultado)
@include('buscar.resultado')
@include('buscar.resultado', ['resultado' => $resultado])
@endforeach
@endif
</tbody>
</table>
</div>