Compare commits
19 Commits
d6f58893b6
...
907c756aa2
Author | SHA1 | Date | |
---|---|---|---|
907c756aa2 | |||
84d50e0209 | |||
87643a5b99 | |||
de6100a546 | |||
b6c0c90943 | |||
726bdaec4c | |||
009ba01e69 | |||
bb1d2b2159 | |||
0550ff11a4 | |||
66a128663d | |||
a5940019bc | |||
4971570474 | |||
85be709ab0 | |||
52bead5104 | |||
66dbf54714 | |||
d2e6a11e0b | |||
9d13a193b6 | |||
b0c587532f | |||
68ab19b874 |
@ -2,7 +2,7 @@ FROM php:8.1-fpm
|
|||||||
|
|
||||||
RUN apt-get update && apt-get install -y libzip-dev libicu-dev git libpng-dev unzip
|
RUN apt-get update && apt-get install -y libzip-dev libicu-dev git libpng-dev unzip
|
||||||
|
|
||||||
RUN docker-php-ext-install pdo pdo_mysql zip intl gd
|
RUN docker-php-ext-install pdo pdo_mysql zip intl gd bcmath
|
||||||
|
|
||||||
RUN pecl install xdebug-3.1.3 \
|
RUN pecl install xdebug-3.1.3 \
|
||||||
&& docker-php-ext-enable xdebug
|
&& docker-php-ext-enable xdebug
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
"aldarien/contract" : "*"
|
"aldarien/contract" : "*"
|
||||||
},
|
},
|
||||||
"require-dev" : {
|
"require-dev" : {
|
||||||
"phpunit/phpunit" : "^6.3"
|
"phpunit/phpunit" : "*"
|
||||||
},
|
},
|
||||||
"license" : "MIT",
|
"license" : "MIT",
|
||||||
"authors" : [{
|
"authors" : [{
|
||||||
|
@ -122,7 +122,11 @@ class Config
|
|||||||
$ini = strpos($value, '{') + 1;
|
$ini = strpos($value, '{') + 1;
|
||||||
$end = strpos($value, '}', $ini);
|
$end = strpos($value, '}', $ini);
|
||||||
$rep = substr($value, $ini, $end - $ini);
|
$rep = substr($value, $ini, $end - $ini);
|
||||||
$value = str_replace('{' . $rep . '}', $this->get($rep), $value);
|
$new = $this->get($rep);
|
||||||
|
if ($new === null) {
|
||||||
|
$new = '';
|
||||||
|
}
|
||||||
|
$value = str_replace('{' . $rep . '}', $new, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $value;
|
return $value;
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
"require": {
|
"require": {
|
||||||
"aldarien/contract": "*",
|
"aldarien/contract": "*",
|
||||||
"aldarien/root": "*",
|
"aldarien/root": "*",
|
||||||
"symfony/yaml": "^3.3"
|
"symfony/yaml": "*"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"description" : "Module for formatting data, mostly numbers",
|
"description" : "Module for formatting data, mostly numbers",
|
||||||
"type" : "library",
|
"type" : "library",
|
||||||
"require-dev" : {
|
"require-dev" : {
|
||||||
"phpunit/phpunit" : "^6",
|
"phpunit/phpunit" : "*",
|
||||||
"aldarien/config": "*"
|
"aldarien/config": "*"
|
||||||
},
|
},
|
||||||
"license" : "MIT",
|
"license" : "MIT",
|
||||||
|
@ -59,4 +59,4 @@ class Response
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -3,11 +3,11 @@
|
|||||||
"description" : "Response handler module for my apps",
|
"description" : "Response handler module for my apps",
|
||||||
"type" : "library",
|
"type" : "library",
|
||||||
"require" : {
|
"require" : {
|
||||||
"wixel/gump" : "^1.5",
|
"wixel/gump" : "^2.0",
|
||||||
"aldarien/contract" : "*"
|
"aldarien/contract" : "*"
|
||||||
},
|
},
|
||||||
"require-dev" : {
|
"require-dev" : {
|
||||||
"phpunit/phpunit" : "^6.3"
|
"phpunit/phpunit" : "*"
|
||||||
},
|
},
|
||||||
"license" : "MIT",
|
"license" : "MIT",
|
||||||
"authors" : [{
|
"authors" : [{
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"require-dev" : {
|
"require-dev" : {
|
||||||
"phpunit/phpunit" : "~6",
|
"phpunit/phpunit" : "*",
|
||||||
"kint-php/kint" : "~2"
|
"kint-php/kint" : "*"
|
||||||
},
|
},
|
||||||
"autoload" : {
|
"autoload" : {
|
||||||
"psr-4" : {
|
"psr-4" : {
|
||||||
@ -18,4 +18,4 @@
|
|||||||
"app/Helper/functions.php"
|
"app/Helper/functions.php"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,11 +3,11 @@
|
|||||||
"description": "Session wrapper for aura/session",
|
"description": "Session wrapper for aura/session",
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"require": {
|
"require": {
|
||||||
"aura/session": "^2.1",
|
"aura/session": "*",
|
||||||
"aldarien/contract": "*"
|
"aldarien/contract": "*"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "^6.3"
|
"phpunit/phpunit": "*"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"authors": [
|
"authors": [
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace App\Service;
|
namespace App\Service;
|
||||||
|
|
||||||
use League\Uri\Http;
|
use League\Uri\Uri as Http;
|
||||||
use League\Uri\Components\Host;
|
use League\Uri\Components\Domain as Host;
|
||||||
use League\Uri\Components\HierarchicalPath;
|
use League\Uri\Components\HierarchicalPath;
|
||||||
|
|
||||||
class URL
|
class URL
|
||||||
@ -19,7 +19,14 @@ class URL
|
|||||||
protected function findRoot()
|
protected function findRoot()
|
||||||
{
|
{
|
||||||
$base = $_SERVER['HTTP_HOST'] . ((isset($_SERVER['HTTP_PORT'])) ? ':' . $_SERVER['HTTP_PORT'] : '');
|
$base = $_SERVER['HTTP_HOST'] . ((isset($_SERVER['HTTP_PORT'])) ? ':' . $_SERVER['HTTP_PORT'] : '');
|
||||||
$uri = Http::createFromString(\Sabre\Uri\resolve($_SERVER['REQUEST_SCHEME'] . '://' . $base, $_SERVER['SCRIPT_NAME']));
|
$scheme = 'http';
|
||||||
|
if (isset($_SERVER['REQUEST_SCHEME'])) {
|
||||||
|
$scheme = $_SERVER['REQUEST_SCHEME'];
|
||||||
|
}
|
||||||
|
if (isset($_SERVER['HTTPS'])) {
|
||||||
|
$scheme = 'https';
|
||||||
|
}
|
||||||
|
$uri = Http::createFromString(\Sabre\Uri\resolve($scheme . '://' . $base, $_SERVER['SCRIPT_NAME']));
|
||||||
$host = new Host($uri->getHost());
|
$host = new Host($uri->getHost());
|
||||||
if ($host->isAbsolute()) {
|
if ($host->isAbsolute()) {
|
||||||
return $host->getRegistrableDomain();
|
return $host->getRegistrableDomain();
|
||||||
@ -73,4 +80,4 @@ class URL
|
|||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -5,11 +5,12 @@
|
|||||||
"require" : {
|
"require" : {
|
||||||
"aldarien/contract" : "*",
|
"aldarien/contract" : "*",
|
||||||
"aldarien/root" : "*",
|
"aldarien/root" : "*",
|
||||||
"league/uri": "^5.2",
|
"league/uri": "*",
|
||||||
"sabre/uri": "^2.1"
|
"league/uri-components": "*",
|
||||||
|
"sabre/uri": "*"
|
||||||
},
|
},
|
||||||
"require-dev" : {
|
"require-dev" : {
|
||||||
"phpunit/phpunit" : "^6.3"
|
"phpunit/phpunit" : "*"
|
||||||
},
|
},
|
||||||
"license" : "MIT",
|
"license" : "MIT",
|
||||||
"authors" : [{
|
"authors" : [{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace App\Service;
|
namespace App\Service;
|
||||||
|
|
||||||
use Philo\Blade\Blade;
|
use eftec\bladeone\BladeOne;
|
||||||
|
|
||||||
class View
|
class View
|
||||||
{
|
{
|
||||||
@ -14,14 +14,14 @@ class View
|
|||||||
$this->views = config('locations.views');
|
$this->views = config('locations.views');
|
||||||
$this->cache = config('locations.cache');
|
$this->cache = config('locations.cache');
|
||||||
|
|
||||||
$this->blade = new Blade($this->views, $this->cache);
|
$this->blade = new BladeOne($this->views, $this->cache);
|
||||||
}
|
}
|
||||||
public function show($template, $vars = null)
|
public function show($template, $vars = null)
|
||||||
{
|
{
|
||||||
if ($vars) {
|
if ($vars) {
|
||||||
return $this->blade->view()->make($template, $vars)->render();
|
return $this->blade->run($template, $vars);
|
||||||
}
|
}
|
||||||
return $this->blade->view()->make($template)->render();
|
return $this->blade->run($template);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"description": "View module for my apps",
|
"description": "View module for my apps",
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"require": {
|
"require": {
|
||||||
"philo/laravel-blade": "^3.1",
|
"eftec/bladeone": "*",
|
||||||
"aldarien/contract": "*",
|
"aldarien/contract": "*",
|
||||||
"aldarien/config": "*"
|
"aldarien/config": "*"
|
||||||
},
|
},
|
||||||
@ -23,6 +23,6 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "^6.3"
|
"phpunit/phpunit": "*"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -486,7 +486,10 @@ class Informes
|
|||||||
$info['Tipo'] = $venta->unidad()->abreviacion;
|
$info['Tipo'] = $venta->unidad()->abreviacion;
|
||||||
$info['m² Ponderados'] = $venta->unidad()->m2('vendible');
|
$info['m² Ponderados'] = $venta->unidad()->m2('vendible');
|
||||||
$info['Valor Promesa'] = $venta->valor_uf;
|
$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;
|
||||||
$info['% Pie Pagado'] = 0;
|
$info['% Pie Pagado'] = 0;
|
||||||
if ($venta->pie()) {
|
if ($venta->pie()) {
|
||||||
@ -510,10 +513,10 @@ class Informes
|
|||||||
}
|
}
|
||||||
$info['Credito'] = 0;
|
$info['Credito'] = 0;
|
||||||
$info['Banco'] = '';
|
$info['Banco'] = '';
|
||||||
if ($venta->credito != 0) {
|
if ($venta->credito != 0 and $venta->credito()->pago()) {
|
||||||
$info['Credito'] = $venta->credito()->pago()->valor('ufs');
|
$info['Credito'] = $venta->credito()?->pago()->valor('ufs');
|
||||||
if ($venta->credito()->pago()->banco != 0) {
|
if ($venta->credito()?->pago()->banco != 0) {
|
||||||
$info['Banco'] = $venta->credito()->pago()->banco()->nombre;
|
$info['Banco'] = $venta->credito()?->pago()->banco()->nombre;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$info['Valor Ests & Bods'] = $venta->valorEstacionamientosYBodegas();
|
$info['Valor Ests & Bods'] = $venta->valorEstacionamientosYBodegas();
|
||||||
@ -525,6 +528,9 @@ class Informes
|
|||||||
$info['Precio'] = 0;
|
$info['Precio'] = 0;
|
||||||
try {
|
try {
|
||||||
$info['Precio'] = array_reduce($venta->propiedad()->departamentos(), function($sum, $item) use ($fecha) {
|
$info['Precio'] = array_reduce($venta->propiedad()->departamentos(), function($sum, $item) use ($fecha) {
|
||||||
|
if (!$item->precio($fecha)) {
|
||||||
|
return $sum;
|
||||||
|
}
|
||||||
return $sum + $item->precio($fecha)->valor;
|
return $sum + $item->precio($fecha)->valor;
|
||||||
});
|
});
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
@ -39,17 +39,16 @@ function uf($date, $async = false) {
|
|||||||
return (object) ['total' => 0];
|
return (object) ['total' => 0];
|
||||||
}
|
}
|
||||||
$url = 'http://' . config('locations.money') . '/api/uf/value/' . $date->format('Y-m-d');
|
$url = 'http://' . config('locations.money') . '/api/uf/value/' . $date->format('Y-m-d');
|
||||||
$client = new \Goutte\Client();
|
$client = new \GuzzleHttp\Client(['base_uri' => 'http://' . config('locations.money') . '/', 'headers' => ['Accept' => 'application/json']]);
|
||||||
$client->setHeader('Accept', 'application/json');
|
$response = $client->get('api/uf/value/' . $date->format('Y-m-d'));
|
||||||
$client->request('GET', $url);
|
|
||||||
|
|
||||||
$response = $client->getResponse();
|
//$response = $client->getResponse();
|
||||||
if (!$response) {
|
if (!$response) {
|
||||||
return (object) ['total' => 0];
|
return (object) ['total' => 0];
|
||||||
}
|
}
|
||||||
$status = $response->getStatusCode();
|
$status = $response->getStatusCode();
|
||||||
if ($status >= 200 and $status < 300) {
|
if ($status >= 200 and $status < 300) {
|
||||||
$data = json_decode($response->getContent());
|
$data = json_decode($response->getBody()->getContents());
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
return (object) ['total' => 0];
|
return (object) ['total' => 0];
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
if (config('app.debug')) {
|
/*if (config('app.debug')) {
|
||||||
$whoops = new \Whoops\Run;
|
$whoops = new \Whoops\Run;
|
||||||
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
|
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
|
||||||
$whoops->register();
|
$whoops->register();
|
||||||
}
|
}*/
|
||||||
?>
|
?>
|
||||||
|
@ -11,24 +11,25 @@
|
|||||||
"aldarien/session" : "*",
|
"aldarien/session" : "*",
|
||||||
"aldarien/url": "*",
|
"aldarien/url": "*",
|
||||||
"j4mie/paris" : "^1.5",
|
"j4mie/paris" : "^1.5",
|
||||||
"danielstjules/stringy" : "^3.1",
|
"voku/stringy" : "^6",
|
||||||
"phpoffice/phpspreadsheet": "^1",
|
"phpoffice/phpspreadsheet": "^1",
|
||||||
"nesbot/carbon": "^2",
|
"nesbot/carbon": "^2",
|
||||||
"phpoffice/phpword": "^0",
|
"phpoffice/phpword": "^0",
|
||||||
"slam/php-excel": "^4.4",
|
"slam/php-excel": "^4.4",
|
||||||
"fabpot/goutte": "^3.2",
|
"guzzlehttp/guzzle": "*",
|
||||||
"incoviba/modelos": "*",
|
"incoviba/modelos": "*",
|
||||||
"slim/slim": "4.x-dev",
|
"slim/slim": "^4",
|
||||||
"php-di/slim-bridge": "dev-master",
|
"php-di/slim-bridge": "*",
|
||||||
"rubellum/slim-blade-view": "dev-master",
|
"rubellum/slim-blade-view": "*",
|
||||||
"nyholm/psr7": "1.4.x-dev",
|
"nyholm/psr7": "*",
|
||||||
"nyholm/psr7-server": "dev-master",
|
"nyholm/psr7-server": "*",
|
||||||
"vlucas/phpdotenv": "^5.3"
|
"vlucas/phpdotenv": "^5.3",
|
||||||
|
"monolog/monolog": "^3"
|
||||||
},
|
},
|
||||||
"require-dev" : {
|
"require-dev" : {
|
||||||
"phpunit/phpunit" : "^8",
|
"phpunit/phpunit" : "*",
|
||||||
"kint-php/kint" : "^2.1",
|
"kint-php/kint" : "*",
|
||||||
"filp/whoops" : "^2.1"
|
"filp/whoops" : "*"
|
||||||
},
|
},
|
||||||
"license" : "GNU AGPLv3",
|
"license" : "GNU AGPLv3",
|
||||||
"authors" : [{
|
"authors" : [{
|
||||||
@ -52,12 +53,15 @@
|
|||||||
"type": "path",
|
"type": "path",
|
||||||
"url": "./aldarien/**",
|
"url": "./aldarien/**",
|
||||||
"options": {
|
"options": {
|
||||||
"symlink": false
|
"symlink": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "path",
|
"type": "path",
|
||||||
"url": "./incoviba/modelos"
|
"url": "./incoviba/modelos"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"config": {
|
||||||
|
"sort-packages": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,6 @@ return [
|
|||||||
'controllers' => '{locations.app}/Controller',
|
'controllers' => '{locations.app}/Controller',
|
||||||
'money' => 'provm.cl/optimus/money',
|
'money' => 'provm.cl/optimus/money',
|
||||||
'api' => '192.168.1.100/intranet/api',
|
'api' => '192.168.1.100/intranet/api',
|
||||||
'api_url' => '/incoviba/api'
|
'api_url' => '/api'
|
||||||
];
|
];
|
||||||
?>
|
?>
|
||||||
|
@ -27,6 +27,8 @@ services:
|
|||||||
- .db.env
|
- .db.env
|
||||||
volumes:
|
volumes:
|
||||||
- .:/code
|
- .:/code
|
||||||
|
- ./php-errors.ini:/usr/local/etc/php/conf.d/docker-php-errors.ini
|
||||||
|
- ./logs:/logs
|
||||||
|
|
||||||
db:
|
db:
|
||||||
profiles:
|
profiles:
|
||||||
|
118
public/index.php
118
public/index.php
@ -2,11 +2,27 @@
|
|||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Incoviba\old\Proyecto\Proyecto;
|
use Incoviba\old\Proyecto\Proyecto;
|
||||||
use App\Contract\Auth;
|
use App\Contract\Auth;
|
||||||
|
use Monolog\Level;
|
||||||
|
use Monolog\Handler;
|
||||||
|
use Monolog\Processor;
|
||||||
|
use Monolog\Formatter;
|
||||||
|
|
||||||
include_once dirname(__DIR__) . '/bootstrap/autoload.php';
|
include_once dirname(__DIR__) . '/bootstrap/autoload.php';
|
||||||
|
|
||||||
header("Access-Control-Allow-Origin: *");
|
header("Access-Control-Allow-Origin: *");
|
||||||
|
|
||||||
|
$logger = new Monolog\Logger('global');
|
||||||
|
$logger->pushHandler(new Handler\RotatingFileHandler('/logs/php.log'));
|
||||||
|
$handler = new Handler\NativeMailerHandler('jpvial@incoviba.cl', 'Incoviba Error', 'alert@incoviba.cl');
|
||||||
|
$handler->setFormatter(new Formatter\HtmlFormatter());
|
||||||
|
$logger->pushHandler(new Handler\FilterHandler($handler, Level::Error));
|
||||||
|
$logger->pushProcessor(new Processor\PsrLogMessageProcessor());
|
||||||
|
$logger->pushProcessor(new Processor\IntrospectionProcessor());
|
||||||
|
$logger->pushProcessor(new Processor\WebProcessor());
|
||||||
|
$logger->pushProcessor(new Processor\MemoryPeakUsageProcessor());
|
||||||
|
|
||||||
|
Monolog\ErrorHandler::register($logger);
|
||||||
|
|
||||||
if (config('app.debug') == true) {
|
if (config('app.debug') == true) {
|
||||||
if (config('app.benchmark') == true) {
|
if (config('app.benchmark') == true) {
|
||||||
$benchmark = (object) ['time' => microtime(true)];
|
$benchmark = (object) ['time' => microtime(true)];
|
||||||
@ -21,65 +37,77 @@ sanitize();
|
|||||||
try {
|
try {
|
||||||
Auth::isIn();
|
Auth::isIn();
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
|
$logger->error($e);
|
||||||
header('Location: install');
|
header('Location: install');
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
if (Auth::isIn()) {
|
|
||||||
if ((get('p') !== false or get('page') !== false or get('m') !== false or get('module') !== false)) {
|
|
||||||
if (($route = route()) !== false) {
|
try {
|
||||||
|
if (Auth::isIn()) {
|
||||||
|
if ((get('p') !== false or get('page') !== false or get('m') !== false or get('module') !== false)) {
|
||||||
|
if (($route = route()) !== false) {
|
||||||
|
echo $route;
|
||||||
|
} else {
|
||||||
|
echo view('construccion');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$proyectos = model(Proyecto::class)->findMany();
|
||||||
|
$dias = [];
|
||||||
|
$cierres = [];
|
||||||
|
$pendientes = 0;
|
||||||
|
$hoy = 0;
|
||||||
|
foreach ($proyectos as $proyecto) {
|
||||||
|
$pendientes += $proyecto->cuotasPendientes();
|
||||||
|
$hoy += $proyecto->cuotasHoy();
|
||||||
|
foreach ($proyecto->cuotasMes() as $cuota) {
|
||||||
|
$f = $cuota->pago()->fecha();
|
||||||
|
if ($f->isoWeekday() == 6 or $f->isoWeekDay() == 7) {
|
||||||
|
$f = $f->copy()->addDays(2)->startOfWeek();
|
||||||
|
}
|
||||||
|
$dia = $f->format('Y-m-d');
|
||||||
|
if (!isset($dias[$dia])) {
|
||||||
|
$dias[$dia] = [$proyecto->descripcion => 0];
|
||||||
|
}
|
||||||
|
if (!isset($dias[$dia][$proyecto->descripcion])) {
|
||||||
|
$dias[$dia][$proyecto->descripcion] = 0;
|
||||||
|
}
|
||||||
|
$dias[$dia][$proyecto->descripcion] ++;
|
||||||
|
}
|
||||||
|
if (count($proyecto->cierres()) > 0) {
|
||||||
|
$cierres[$proyecto->descripcion] = (object) ['total' => count($proyecto->cierres()),'vigentes' => $proyecto->cierres(3), 'rechazados' => $proyecto->cierres(-1), 'pendientes' => $proyecto->cierres(2)];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
uksort($dias, function($a, $b) {
|
||||||
|
return strcmp($a, $b);
|
||||||
|
});
|
||||||
|
uksort($cierres, function($a, $b) {
|
||||||
|
return strcmp($a, $b);
|
||||||
|
});
|
||||||
|
echo view('home', compact('pendientes', 'hoy', 'dias', 'cierres'));
|
||||||
|
}
|
||||||
|
} elseif (get('p') == 'auth' or get('page') == 'auth') {
|
||||||
|
$route = route();
|
||||||
|
if ($route !== false) {
|
||||||
echo $route;
|
echo $route;
|
||||||
} else {
|
} else {
|
||||||
echo view('construccion');
|
echo view('guest');
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$proyectos = model(Proyecto::class)->findMany();
|
|
||||||
$dias = [];
|
|
||||||
$cierres = [];
|
|
||||||
$pendientes = 0;
|
|
||||||
$hoy = 0;
|
|
||||||
foreach ($proyectos as $proyecto) {
|
|
||||||
$pendientes += $proyecto->cuotasPendientes();
|
|
||||||
$hoy += $proyecto->cuotasHoy();
|
|
||||||
foreach ($proyecto->cuotasMes() as $cuota) {
|
|
||||||
$f = $cuota->pago()->fecha();
|
|
||||||
if ($f->isoWeekday() == 6 or $f->isoWeekDay() == 7) {
|
|
||||||
$f = $f->copy()->addDays(2)->startOfWeek();
|
|
||||||
}
|
|
||||||
$dia = $f->format('Y-m-d');
|
|
||||||
if (!isset($dias[$dia])) {
|
|
||||||
$dias[$dia] = [$proyecto->descripcion => 0];
|
|
||||||
}
|
|
||||||
if (!isset($dias[$dia][$proyecto->descripcion])) {
|
|
||||||
$dias[$dia][$proyecto->descripcion] = 0;
|
|
||||||
}
|
|
||||||
$dias[$dia][$proyecto->descripcion] ++;
|
|
||||||
}
|
|
||||||
if (count($proyecto->cierres()) > 0) {
|
|
||||||
$cierres[$proyecto->descripcion] = (object) ['total' => count($proyecto->cierres()),'vigentes' => $proyecto->cierres(3), 'rechazados' => $proyecto->cierres(-1), 'pendientes' => $proyecto->cierres(2)];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
uksort($dias, function($a, $b) {
|
|
||||||
return strcmp($a, $b);
|
|
||||||
});
|
|
||||||
uksort($cierres, function($a, $b) {
|
|
||||||
return strcmp($a, $b);
|
|
||||||
});
|
|
||||||
echo view('home', compact('pendientes', 'hoy', 'dias', 'cierres'));
|
|
||||||
}
|
|
||||||
} elseif (get('p') == 'auth' or get('page') == 'auth') {
|
|
||||||
$route = route();
|
|
||||||
if ($route !== false) {
|
|
||||||
echo $route;
|
|
||||||
} else {
|
} else {
|
||||||
echo view('guest');
|
echo view('guest');
|
||||||
}
|
}
|
||||||
} else {
|
} catch (Exception $e) {
|
||||||
echo view('guest');
|
$logger->warning($e);
|
||||||
|
echo "";
|
||||||
|
} catch (Error $e) {
|
||||||
|
$logger->error($e);
|
||||||
|
echo "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config('app.debug') == 'true') {
|
if (config('app.debug') == 'true') {
|
||||||
if (config('app.benchmark') == 'true') {
|
if (config('app.benchmark') == 'true') {
|
||||||
$benchmark->time = microtime(true) - $benchmark->time;
|
$benchmark->time = microtime(true) - $benchmark->time;
|
||||||
|
$logger->debug("Time {$benchmark->time}");
|
||||||
if (get('ajax') != '1' and get('p') != 'ajax' and get('p') != 'informes') {
|
if (get('ajax') != '1' and get('p') != 'ajax' and get('p') != 'informes') {
|
||||||
echo view('benchmark', compact('benchmark'));
|
echo view('benchmark', compact('benchmark'));
|
||||||
}
|
}
|
||||||
|
@ -66,9 +66,11 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@if (isset($results) and is_array($results) and count($results) > 0)
|
||||||
@foreach ($results as $resultado)
|
@foreach ($results as $resultado)
|
||||||
@include('buscar.resultado')
|
@include('buscar.resultado', ['resultado' => $resultado])
|
||||||
@endforeach
|
@endforeach
|
||||||
|
@endif
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
@ -82,7 +82,7 @@
|
|||||||
?>
|
?>
|
||||||
@foreach ($venta->pie()->cuotas() as $cuota)
|
@foreach ($venta->pie()->cuotas() as $cuota)
|
||||||
<tr>
|
<tr>
|
||||||
<td class="@include('ventas.pies.cuotas.estado')">
|
<td class="@include('ventas.pies.cuotas.estado', compact('cuota'))">
|
||||||
<a href="{{url('', ['p' => 'cuotas', 'a' => 'show', 'cuota' => $cuota->id])}}">{{++$cnt}} <span class="glyphicon glyphicon-edit small"></span></a>
|
<a href="{{url('', ['p' => 'cuotas', 'a' => 'show', 'cuota' => $cuota->id])}}">{{++$cnt}} <span class="glyphicon glyphicon-edit small"></span></a>
|
||||||
</td>
|
</td>
|
||||||
<td>{{\App\Helper\Format::shortDate($cuota->pago()->fecha)}}</td>
|
<td>{{\App\Helper\Format::shortDate($cuota->pago()->fecha)}}</td>
|
||||||
@ -96,7 +96,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td class="text-right">$ {{\App\Helper\Format::pesos($cuota->valor())}}</td>
|
<td class="text-right">$ {{\App\Helper\Format::pesos($cuota->valor())}}</td>
|
||||||
<td class="text-right">{{\App\Helper\Format::ufs($cuota->valor('ufs'))}} UF</td>
|
<td class="text-right">{{\App\Helper\Format::ufs($cuota->valor('ufs'))}} UF</td>
|
||||||
<td class="text-center @include('ventas.pies.cuotas.estado')">
|
<td class="text-center @include('ventas.pies.cuotas.estado', ['cuota' => $cuota])">
|
||||||
{{\App\Helper\Format::shortDate($cuota->pago()->estado()->fecha)}}
|
{{\App\Helper\Format::shortDate($cuota->pago()->estado()->fecha)}}
|
||||||
<a href="{{url('', ['p' => 'pagos', 'a' => 'edit', 'pago' => $cuota->pago()->id, 'asociado' => 'venta', 'venta' => $venta->id])}}"><span class="glyphicon glyphicon-edit small"></span></a>
|
<a href="{{url('', ['p' => 'pagos', 'a' => 'edit', 'pago' => $cuota->pago()->id, 'asociado' => 'venta', 'venta' => $venta->id])}}"><span class="glyphicon glyphicon-edit small"></span></a>
|
||||||
</td>
|
</td>
|
||||||
@ -179,25 +179,25 @@
|
|||||||
'ufs' => $total->pagado_uf
|
'ufs' => $total->pagado_uf
|
||||||
];
|
];
|
||||||
?>
|
?>
|
||||||
@include('ventas.pies.totales')
|
@include('ventas.pies.totales', compact('valores'))
|
||||||
<?php
|
<?php
|
||||||
$valores->titulo = 'Por Pagar';
|
$valores->titulo = 'Por Pagar';
|
||||||
$valores->pesos = $total->por_pagar;
|
$valores->pesos = $total->por_pagar;
|
||||||
$valores->ufs = $total->por_pagar_uf;
|
$valores->ufs = $total->por_pagar_uf;
|
||||||
?>
|
?>
|
||||||
@include('ventas.pies.totales')
|
@include('ventas.pies.totales', compact('valores'))
|
||||||
<?php
|
<?php
|
||||||
$valores->titulo = 'Total Cuotas';
|
$valores->titulo = 'Total Cuotas';
|
||||||
$valores->pesos = $total->cuotas;
|
$valores->pesos = $total->cuotas;
|
||||||
$valores->ufs = $total->cuotas_uf;
|
$valores->ufs = $total->cuotas_uf;
|
||||||
?>
|
?>
|
||||||
@include('ventas.pies.totales')
|
@include('ventas.pies.totales', compact('valores'))
|
||||||
<?php
|
<?php
|
||||||
$valores->titulo = 'Diferencia c/Pie';
|
$valores->titulo = 'Diferencia c/Pie';
|
||||||
$valores->pesos = $total->dif;
|
$valores->pesos = $total->dif;
|
||||||
$valores->ufs = $total->dif_uf;
|
$valores->ufs = $total->dif_uf;
|
||||||
?>
|
?>
|
||||||
@include('ventas.pies.totales')
|
@include('ventas.pies.totales', compact('valores'))
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<a href="{{nUrl('informes', 'cuotas', ['venta' => $venta->id])}}">Exportar</a>
|
<a href="{{nUrl('informes', 'cuotas', ['venta' => $venta->id])}}">Exportar</a>
|
||||||
|
Reference in New Issue
Block a user