From 1c5467e8fbce8124731dec26a113d4261ccd91a1 Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Thu, 10 Mar 2022 15:11:26 -0300 Subject: [PATCH 01/10] Python docker --- Pipfile | 12 - Python.Dockerfile | 9 + app/Controller/Informes.php | 4 +- app/Controller/Informes.php.save | 901 ------------------------------- bin/Pipfile | 1 + docker-compose.yml | 25 +- 6 files changed, 31 insertions(+), 921 deletions(-) delete mode 100644 Pipfile create mode 100644 Python.Dockerfile delete mode 100644 app/Controller/Informes.php.save diff --git a/Pipfile b/Pipfile deleted file mode 100644 index 8108982..0000000 --- a/Pipfile +++ /dev/null @@ -1,12 +0,0 @@ -[[source]] -name = "pypi" -url = "https://pypi.org/simple" -verify_ssl = true - -[dev-packages] - -[packages] -gunicorn = "*" - -[requires] -python_version = "3.8" diff --git a/Python.Dockerfile b/Python.Dockerfile new file mode 100644 index 0000000..32c4b71 --- /dev/null +++ b/Python.Dockerfile @@ -0,0 +1,9 @@ +FROM python:3.8 + +COPY ./bin /usr/opt/incoviba + +WORKDIR /usr/opt/incoviba/informes + +RUN pip install gunicorn pandas xlsxwriter httpx flask numpy + +CMD ["gunicorn", "-w", "4", "app:app"] diff --git a/app/Controller/Informes.php b/app/Controller/Informes.php index cdace2c..e4c4a12 100644 --- a/app/Controller/Informes.php +++ b/app/Controller/Informes.php @@ -461,7 +461,7 @@ class Informes ['name' => 'Valor Neto', 'style' => 'amount'], ['name' => 'UF/m²*', 'style' => 'amount'], ['name' => 'Comision', 'style' => 'amount'], - ['name' => 'Venta s/Comision', 'style' => 'amount']. + ['name' => 'Venta s/Comision', 'style' => 'amount'], ['name' => 'Precio', 'style' => 'Amount'] ]; //$informe->addColumns($columnas); @@ -538,7 +538,7 @@ class Informes "Compañía" => $proyecto->inmobiliaria()->abreviacion, "data" => $data ]; - $client = new Client(['base_uri' => 'localhost:8011']); + $client = new Client(['base_uri' => "{$_ENV['PYTHON_HOST']}"]); $response = $client->post('/ventas', ['json' => $body]); header("Content-Type: application/octet-stream; charset=utf-8"); diff --git a/app/Controller/Informes.php.save b/app/Controller/Informes.php.save deleted file mode 100644 index efd5035..0000000 --- a/app/Controller/Informes.php.save +++ /dev/null @@ -1,901 +0,0 @@ -find_one($id_proyecto); - $ini = \Carbon\Carbon::parse($proyecto->estado()->fecha, config('app.timezone')); - #$informe = new Informador('Carta Gantt Proyecto - ' . $proyecto->descripcion); - $name = 'Carta Gantt Proyecto - ' . $proyecto->descripcion; - $hoy = Carbon::now(config('app.timezone')); - $filename = str_replace('ñ', 'n', $name . ' - ' . $hoy->format('Y-m-d') . '.xls'); - $informe = new PHPExcel($name, $filename); - - $columnas = ['Departamento', 'Propietario', 'Entrega', 'Estado']; - $today = \Carbon\Carbon::today(config('app.timezone')); - $end = $today->copy()->addDays(30); - $dif = $end->diffInDays($ini); - for ($i = 0; $i <= $dif; $i ++) { - $f = $ini->copy()->addDays($i); - if ($f->isWeekend()) { - continue; - } - $columnas []= $f->format('Y-m-d'); - } - $informe->addColumns($columnas); - - $data = []; - foreach ($proyecto->entregas() as $venta) { - $info = []; - $info []= $venta->unidad()->descripcion; - $info []= $venta->propietario()->findOne()->nombreCompleto(); - $fe = Carbon::parse($venta->entrega()->find_one()->fecha, config('app.timezone')); - $info []= $fe->format('Y-m-d'); - $info []= ''; - - for ($i = 0; $i <= $dif; $i ++) { - $f = $ini->copy()->addDays($i); - if ($f->isWeekend()) { - continue; - } - if ($f >= $fe and $f <= $fe->copy()->addDays(14)) { - $info []= 'X'; - } else { - $info []= ''; - } - } - - $data []= $info; - } - $informe->addDatas($data); - - return $informe->informe(); - } else { - $proyectos = model(Proyecto::class)->order_by_asc('descripcion')->find_many(); - return view('informes.gantt_entregas', compact('proyectos')); - } - } - public static function escrituras() - { - if (get('proyecto')) { - set_time_limit(60); - $id_proyecto = get('proyecto'); - $proyecto = model(Proyecto::class)->find_one($id_proyecto); - - #$informe = new Informador('Escrituras - ' . $proyecto->descripcion); - $name = 'Escrituras'; - $hoy = Carbon::now(config('app.timezone')); - $filename = str_replace('ñ', 'n', $name . ' - ' . $proyecto->descripcion . ' - ' . $hoy->format('Y-m-d') . '.xls'); - $informe = new PHPExcel($name, $filename); - - $columnas = [ - 'Departamento', - 'Estacionamientos', - 'Bodegas', - 'Propietario', - (object) ['name' => 'Promesa', 'style' => 'number'], - ['name' => 'Bono Pie', 'style' => 'amount'], - ['name' => 'Pie Pagado', 'style' => 'amount'], - ['name' => 'Reajuste', 'style' => 'amount'], - ['name' => 'Abono Contado', 'style' => 'amount'], - ['name' => 'Subsidio', 'style' => 'amount'], - 'Estado Subsidio', - ['name' => 'Credito', 'style' => 'amount'], - 'Banco', - 'Estado Credito', - ['name' => 'Saldo', 'style' => 'amount'], - ['name' => 'Escritura', 'style' => 'amount'], - ['name' => 'Entrega', 'style' => 'date'] - ]; - $informe->addColumns($columnas); - - //$ventas = $proyecto->escrituras(); - $ventas = $proyecto->ventas(); - - $data = []; - foreach ($ventas as $venta) { - $info = []; - $info['Departamento'] = $venta->unidad()->descripcion; - $ests = []; - foreach ($venta->propiedad()->estacionamientos() as $e) { - $ests []= $e->descripcion; - } - $bods = []; - foreach ($venta->propiedad()->bodegas() as $b) { - $bods []= $b->descripcion; - } - $info['Estacionamientos'] = implode(' - ', $ests); - $info['Bodegas'] = implode(' - ', $bods); - $info['Propietario'] = $venta->propietario()->nombreCompleto(); - $info['Promesa'] = $venta->valor_uf; - $saldo = $venta->valor_uf; - $info['Bono Pie'] = ''; - if ($venta->bono_pie != 0) { - $info['Bono Pie'] = $venta->bonoPie()->pago()->valor('ufs'); - $saldo -= $venta->bonoPie()->pago()->valor('ufs'); - } - $info['Pie'] = ''; - $info['Reajuste'] = ''; - if ($venta->pie != 0) { - $info['Pie'] = $venta->pie()->valorPagado(); - $saldo -= $venta->pie()->valorPagado(); - if ($venta->pie()->reajuste != 0) { - $info['Reajuste'] = $venta->pie()->reajuste()->valor('ufs'); - $saldo -= $venta->pie()->reajuste()->valor('ufs'); - } - } - $info['Abono Contado'] = ''; - if ($venta->escritura != 0) { - $info['Abono Contado'] = $venta->escritura()->pago()->valor('ufs'); - $saldo -= $venta->escritura()->pago()->valor('ufs'); - } - $info['Subsidio'] = ''; - $info['Estado Subsidio'] = ''; - if ($venta->subsidio != 0) { - $info['Subsidio'] = $venta->subsidio()->total('ufs'); - $info['Estado Subsidio'] = implode(' - ', [ - $venta->subsidio()->subsidio()->estado()->tipo()->descripcion, - $venta->subsidio()->pago()->estado()->tipo()->descripcion - ]); - $saldo -= $venta->subsidio()->total('ufs'); - } - $info['Credito'] = ''; - $info['Banco'] = ''; - $info['Estado Credito'] = ''; - if ($venta->credito != 0) { - $info['Credito'] = $venta->credito()->pago()->valor('ufs'); - $saldo -= $venta->credito()->pago()->valor('ufs'); - if ($venta->credito()->pago()->banco != 0) { - $info['Banco'] = $venta->credito()->pago()->banco()->nombre; - } - $info['Estado Credito'] = $venta->credito()->pago()->estado()->tipo()->descripcion; - } - $info['Saldo'] = -$saldo; - $info['Escritura'] = ''; - if ($venta->escriturado != 0) { - $info['Escritura'] = $venta->escriturado; - } - $info['Entrega'] = ''; - if ($venta->entregado != 0) { - $info['Entrega'] = $venta->entregado; - } - - $data []= $info; - } - $informe->addData($data); - - return $informe->informe(); - } else { - $proyectos = model(Proyecto::class)->order_by_asc('descripcion')->find_many(); - return view('informes.escrituras', compact('proyectos')); - } - } - public static function consolidacion() - { - $id_proyecto = get('proyecto'); - $proyecto = model(Proyecto::class)->findOne($id_proyecto); - - $ventas = $proyecto->ventas(); - set_time_limit(count($ventas)); - - $f = Carbon::today(config('app.timezone')); - setlocale(LC_TIME, 'es'); - - $data = [ - [$proyecto->descripcion], - [strftime('%d de %B de %Y', $f->timestamp)], - [''], - [''] - ]; - $columns = [ - ['name' => 'Fecha', 'style' => 'date'], - 'Glosa', - ['name' => 'Debe', 'style' => 'number'], - ['name' => 'Haber', 'style' => 'number'], - ['name' => 'Saldo', 'style' => 'number'], - 'Comentario' - ]; - $bold_rows = []; - - foreach ($ventas as $venta) { - $data []= ['Departamento ' . $venta->unidad()->descripcion . ' (' . format('ufs', $venta->valor_uf) . ' UF)']; - $data []= $columns; - $bold_rows []= count($data) - 1; - $ufs = 0; - $debe = 0; - $haber = 0; - $sum = 0; - if ($venta->pie != 0) { - $cuotas = $venta->pie()->cuotas(); - foreach ($cuotas as $cuota) { - $sum += $cuota->pago()->valor(); - $ufs += $cuota->pago()->valor('ufs'); - $haber += $cuota->pago()->valor(); - $info = [ - $cuota->pago()->estado()->fecha, - 'Pie - Cuota ' . $cuota->numero() . ' - ' . $venta->pie()->cuotas . ' (' . format('ufs', $cuota->pago()->valor('ufs')) . ' UF)', - '', - $cuota->pago()->valor(), - $sum - ]; - if ($cuota->pago()->estado()->estado < 2) { - $info []= 'No ha sido abonada.'; - } - $data []= $info; - } - if ($venta->pie()->reajuste != 0) { - $sum += $venta->pie()->reajuste()->valor(); - $ufs += $venta->pie()->reajuste()->valor('ufs'); - $haber += $venta->pie()->reajuste()->valor(); - $info = [ - $venta->pie()->reajuste()->estado()->fecha, - 'Reajuste (' . format('ufs', $venta->pie()->reajuste()->valor('ufs')) . ' UF)', - '', - $venta->pie()->reajuste()->valor(), - $sum - ]; - if ($venta->pie()->reajuste()->estado()->estado < 2) { - $info []= 'No ha sido abonado.'; - } - $data []= $info; - } - } - if ($venta->escritura != 0) { - $sum += $venta->escritura()->pago()->valor(); - $ufs += $venta->escritura()->pago()->valor('ufs'); - $haber += $venta->escritura()->pago()->valor(); - $info = [ - $venta->escritura()->pago()->estado()->fecha, - 'Abono Escritura (' . format('ufs', $venta->escritura()->pago()->valor('ufs')) . ' UF)', - '', - $venta->escritura()->pago()->valor(), - $sum - ]; - if ($venta->escritura()->pago()->estado()->estado < 2) { - $info []= 'No ha sido abonado.'; - } - $data []= $info; - } - if ($venta->credito != 0) { - $sum += $venta->credito()->pago()->valor(); - $ufs += $venta->credito()->pago()->valor('ufs'); - $haber += $venta->credito()->pago()->valor(); - $info = [ - $venta->credito()->pago()->estado()->fecha, - 'Crédito (' . format('ufs', $venta->credito()->pago()->valor('ufs')) . ' UF)', - '', - $venta->credito()->pago()->valor(), - $sum - ]; - if ($venta->credito()->pago()->estado()->estado < 2) { - $info []= 'No ha sido pagado.'; - } - $data []= $info; - } - if ($venta->bono_pie != 0) { - try { - $sum -= $venta->bonoPie()->pago()->valor(); - $debe += $venta->bonoPie()->pago()->valor(); - $info = [ - $venta->bonoPie()->pago()->estado()->fecha, - 'Bono Pie (' . format('ufs', $venta->bonoPie()->pago()->valor('ufs')) . ' UF)'. - $venta->bonoPie()->pago()->valor(), - '', - $sum - ]; - $data []= $info; - $sum += $venta->bonoPie()->pago()->valor(); - $haber += $venta->bonoPie()->pago()->valor(); - $info = [ - $venta->bonoPie()->pago()->estado()->fecha, - 'Bono Pie (' . format('ufs', $venta->bonoPie()->pago()->valor('ufs')) . ' UF)'. - '', - $venta->bonoPie()->pago()->valor(), - $sum - ]; - $data []= $info; - } catch (\Exception $e) { - - } - } - $info = [ - '', - 'TOTAL (' . format('ufs', $ufs) . ' UF)', - $debe, - $haber, - $sum - ]; - $data []= $info; - $bold_rows []= count($data) - 1; - - $data []= ['']; - } - /** - * Departamento # - * Fecha |Glosa |Debe |Haber |Saldo - * |Pie - Cuota 1 - n (# UF) |- |$# | - * |Reajuste (# UF) |- |$# | - * |Abono Escritura (# UF) |- |$# | - * |Crédito (# UF) |- |$# | - * |Bono Pie (# UF) |$# |- | - * |Bono Pie (# UF) |- |$# | - * |Devolución (# UF) |$# |- | - * - |TOTAL (# UF) | | | - */ - - array_walk($data, function(&$e, $i) use ($columns) { - if (count($e) < count($columns)) { - $n = count($columns) - count($e); - for ($j = 0; $j < $n; $j ++) { - $e []= ''; - } - } - }); - - #$informe = new Informador('Consolidación - ' . $proyecto->descripcion); - $name = 'Consolidación'; - $hoy = Carbon::now(config('app.timezone')); - $filename = str_replace('ñ', 'n', $name . ' - ' . $proyecto->descripcion . ' - ' . $hoy->format('Y-m-d') . '.xls'); - $informe = new PHPExcel($name, $filename); - $informe->addColumns($columns); - $informe->addData($data); - - return $informe->informe(); - } - public static function creditos_pendientes() - { - function creditos() { - $creditos = model(Credito::class) - ->select('credito.*') - ->join('venta', ['venta.credito', '=', 'credito.id']) - ->join('pago', ['pago.id', '=', 'credito.pago']) - ->rawJoin('JOIN (SELECT ep.* FROM (SELECT pago, MAX(id) AS id FROM estado_pago GROUP BY pago) e0 JOIN estado_pago ep ON ep.id = e0.id)', ['estado_pago.pago', '=', 'pago.id'], 'estado_pago') - ->whereLt('estado_pago.estado', 2) - ->where('venta.estado', 1) - ->orderByAsc('estado_pago.fecha') - ->findMany(); - foreach ($creditos as $credito) { - yield $credito; - } - } - $informe = new Informador('Créditos Pendientes'); - - $columnas = ['Proyecto', 'Departamento', 'Valor', 'Fecha Escritura', 'Estado']; - $informe->addColumns($columnas); - - $row = 0; - foreach (creditos() as $credito) { - $informe->addData($row, $credito->venta()->proyecto()->descripcion, 'Proyecto'); - $informe->addData($row, $credito->venta()->unidad()->descripcion, 'Departamento'); - $informe->addData($row, $credito->pago()->valor('ufs'), 'Valor'); - $informe->addData($row, (($credito->venta()->escriturado) ? $credito->venta()->escriturado : $credito->pago()->estado()->fecha), 'Fecha Escritura'); - $informe->addData($row, ucwords($credito->pago()->estado()->tipo()->descripcion), 'Estado'); - - $row ++; - } - - $date = [ - 'numberFormat' => ['short-date'] - ]; - $ufs = [ - 'numberFormat' => ['thousands'] - ]; - $formats = ['Valor' => $ufs, 'Fecha Escritura' => $date]; - $informe->addFormats($formats); - - return $informe->informe(); - } - public static function ventas() - { - if (get('proyecto')) { - $id = get('proyecto'); - $proyecto = model(Proyecto::class)->findOne($id); - $ventas = $proyecto->ventas(); - - usort($ventas, function($a, $b) { - return $a->fecha()->timestamp - $b->fecha()->timestamp; - }); - - $procasa = model(Agente::class)->findOne(1); - $pa = model(ProyectoAgente::class)->where('agente', $procasa->id)->where('proyecto', $proyecto->id)->findOne(); - if ($pa) { - $comision = $pa->comision / 100; - } else { - $comision = 0.03; - } - - #$informe = new Informador('Ventas - ' . $proyecto->descripcion); - $name = 'Ventas'; - $hoy = Carbon::now(config('app.timezone')); - $filename = str_replace('ñ', 'n', $name . ' - ' . $proyecto->descripcion . ' - ' . $hoy->format('Y-m-d') . '.xls'); - $informe = new PHPExcel($name, $filename); - - $columnas = [ - 'Propietario', - ['name' => 'Departamento', 'style' => 'number'], - ['name' => 'Estacionamientos', 'style' => 'number'], - ['name' => 'Bodegas', 'style' => 'number'], - 'Fecha Venta', - ['name' => 'Mes', 'style' => 'mes'], - 'Tipo', - ['name' => 'm² Ponderados', 'style' => 'amount'], - ['name' => 'Valor Promesa', 'style' => 'amount'], - ['name' => 'Bono Pie', 'style' => 'amount'], - 'Operador', - ['name' => 'Valor Operador', 'style' => 'amount'], - ['name' => 'Premios', 'style' => 'amount'], - ['name' => 'Subsidio', 'style' => 'amount'], - ['name' => 'Ahorro', 'style' => 'amount'], - ['name' => 'Credito', 'style' => 'amount'], - 'Banco', - ['name' => 'Valor Ests & Bods', 'style' => 'amount'], - ['name' => 'Valor Neto', 'style' => 'amount'], - ['name' => 'UF/m²*', 'style' => 'amount'], - ['name' => 'Comision', 'style' => 'amount'], - ['name' => 'Venta s/Comision', 'style' => 'amount'] - ]; - $informe->addColumns($columnas); - - $data = []; - foreach ($ventas as $venta) { - $info = []; - $info['Propietario'] = mb_strtoupper($venta->propietario()->nombreCompleto()); - $info['Departamento'] = $venta->unidad()->descripcion; - $ests = []; - if ($venta->propiedad()->estacionamientos != '') { - $es = $venta->propiedad()->estacionamientos(); - foreach ($es as $e) { - $ests []= $e->descripcion; - } - } - $info['Estacionamientos'] = implode(', ', $ests); - $bods = []; - if ($venta->propiedad()->bodegas != '') { - $bs = $venta->propiedad()->bodegas(); - foreach ($bs as $b) { - $bods []= $b->descripcion; - } - } - $info['Bodegas'] = implode(', ', $bods); - $info['Fecha Venta'] = $venta->fecha()->format('d.m.Y'); - $info['Mes'] = $venta->fecha()->format('M-y'); - $info['Tipo'] = $venta->unidad()->abreviacion; - $info['m² Ponderados'] = $venta->unidad()->m2('vendible'); - $info['Valor Promesa'] = $venta->valor_uf; - $info['Bono Pie'] = ($venta->bono_pie == 0 or $venta->bonoPie() === false) ? '' : $venta->bonoPie()->pago()->valor('ufs'); - $info['Operador'] = ($venta->agente and $venta->agente()->agente()->tipo == 19) ? $venta->agente()->agente()->descripcion : ''; - $info['Valor Operador'] = $venta->valorComision(); - $promos = 0; - $ps = $venta->promociones(); - if (count($ps) > 0) { - foreach ($ps as $promo) { - $promos += $promo->valor; - } - } - $info['Premios'] = $promos; - $info['Subsidio'] = 0; - $info['Ahorro'] = 0; - if ($venta->subsidio != 0) { - $info['Subsidio'] = $venta->subsidio()->subsidio()->valor('ufs'); - $info['Ahorro'] = $venta->subsidio()->pago()->valor('ufs'); - } - $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; - } - } - $info['Valor Ests & Bods'] = $venta->valorEstacionamientosYBodegas(); - $info['Valor Neto'] = $venta->valorFinal(); - $info['UF/m²*'] = $venta->uf_m2(); - $info['Comision'] = $venta->valorFinal() * $comision; - $info['Venta s/Comision'] = $venta->valorFinal() - $info['Comision']; - - $data []= $info; - } - $informe->addData($data); - - $totals = [ - 'Propietario' => 'TOTAL', - 'Departamento' => 'count', - 'Estacionamientos' => 'count', - 'Bodegas' => 'count', - 'm² Ponderados' => 'sum', - 'Valor Promesa' => 'sum', - 'Bono Pie' => 'sum', - 'Subsidio' => 'sum', - 'Ahorro' => 'sum', - 'Credito' => 'sum', - 'Valor Operador' => 'sum', - 'Premios' => 'sum', - 'Valor Ests & Bods' => 'sum', - 'Valor Neto' => 'sum', - 'Comision' => 'sum' - ]; - $informe->addTotals($totals); - - return $informe->informe(); - } else { - $proyectos = model(Proyecto::class)->order_by_asc('descripcion')->find_many(); - return view('informes.ventas', compact('proyectos')); - } - } - public static function resumen_contabilidad() - { - if (get('proyecto')) { - $id = get('proyecto'); - $proyecto = model(Proyecto::class)->findOne($id); - $ventas = $proyecto->ventas(); - - usort($ventas, function($a, $b) { - return $a->fecha()->timestamp - $b->fecha()->timestamp; - }); - - $name = 'Ventas'; - $hoy = Carbon::now(config('app.timezone')); - $filename = str_replace('ñ', 'n', $name . ' - ' . $proyecto->descripcion . ' - ' . $hoy->format('Y-m-d') . '.xls'); - $informe = new PHPExcel($name, $filename); - - $columnas = [ - 'Propietario', - ['name' => 'Departamento', 'style' => 'general_number'], - ['name' => 'Estacionamientos', 'style' => 'number'], - ['name' => 'Bodegas', 'style' => 'number'], - 'Fecha Venta', - ['name' => 'Mes', 'style' => 'mes'], - 'Tipo', - ['name' => 'm² Ponderados', 'style' => 'amount'], - ['name' => 'Valor Promesa', 'style' => 'amount'], - ['name' => 'Pie [UF]', 'style' => 'amount'], - ['name' => 'Pie [$]', 'style' => 'amount'], - ['name' => 'Abono Escritura', 'style' => 'amount'], - ['name' => 'Crédito', 'style' => 'amount'], - ['name' => 'Cuotas', 'style' => 'number'], - ['name' => 'Cuotas Pagadas', 'style' => 'number'], - ['name' => 'Pie Pagado [UF]', 'style' => 'amount'], - ['name' => 'Pie Pagado [$]', 'style' => 'amount'] - ]; - $informe->addColumns($columnas); - - $data = []; - foreach ($ventas as $venta) { - $info = []; - $info['Propietario'] = mb_strtoupper($venta->propietario()->nombreCompleto()); - $info['Departamento'] = $venta->unidad()->descripcion; - $ests = []; - if ($venta->propiedad()->estacionamientos != '') { - $es = $venta->propiedad()->estacionamientos(); - foreach ($es as $e) { - $ests []= $e->descripcion; - } - } - $info['Estacionamientos'] = implode(', ', $ests); - $bods = []; - if ($venta->propiedad()->bodegas != '') { - $bs = $venta->propiedad()->bodegas(); - foreach ($bs as $b) { - $bods []= $b->descripcion; - } - } - $info['Bodegas'] = implode(', ', $bods); - $info['Fecha Venta'] = $venta->fecha()->format('d.m.Y'); - $info['Mes'] = $venta->fecha()->format('M-y'); - $info['Tipo'] = $venta->unidad()->abreviacion; - $info['m² Ponderados'] = $venta->unidad()->m2('vendible'); - $info['Valor Promesa'] = $venta->valor_uf; - $info['Pie [UF]'] = 0; - $info['Pie [$]'] = 0; - if ($venta->pie()) { - $info['Pie [UF]'] = $venta->pie()->valor; - $info['Pie [$]'] = $venta->pie()->valorPesos(); - } - $info['Abono Escritura'] = ($venta->escritura != 0) ? $venta->escritura()->valor('ufs') : ($venta->valor_uf - $venta->pie()->valor - (($venta->credito != 0) ? $venta->credito()->pago()->valor('ufs') : 0)); - $info['Crédito'] = ($venta->credito != 0) ? $venta->credito()->pago()->valor('ufs') : 0; - - $info['Cuotas'] = $venta->pie()->cuotas; - $info['Cuotas Pagadas'] = count($venta->pie()->pagadas()); - $info['Pie Pagado [UF]'] = $venta->pie()->valorPagado('uf'); - $info['Pie Pagado [$]'] = $venta->pie()->valorPagado('pesos'); - - $data []= $info; - } - $informe->addData($data); - - $totals = [ - 'Departamento' => 'count', - 'Estacionamientos' => 'count', - 'Bodegas' => 'count', - 'm² Ponderados' => 'sum', - 'Valor Promesa' => 'sum', - 'Pie' => 'sum', - 'Pie Pagado' => 'sum' - ]; - $informe->addTotals($totals); - - return $informe->informe(); - } else { - $proyectos = model(Proyecto::class)->order_by_asc('descripcion')->find_many(); - return view('informes.resumen_contabilidad', compact('proyectos')); - } - } - public static function contabilidad() - { - if (get('proyecto')) { - $id = get('proyecto'); - $fecha = get('fecha'); - $mes = null; - if ($fecha != null) { - $mes = Carbon::parse($fecha); - } - $proyecto = model(Proyecto::class)->findOne($id); - $q = "SELECT pago.*, venta.id AS vid, venta.tipo AS ctipo, venta.pie AS pie - FROM ( - SELECT pago.id, banco.nombre AS banco, pago.fecha, pago.valor, pago.uf, ep.estado, ep.fecha AS efecha - FROM pago JOIN banco ON banco.id = pago.banco JOIN (( - SELECT pago, MAX(id) AS id FROM estado_pago GROUP BY pago) e0 JOIN estado_pago ep ON ep.id = e0.id) ON ep.pago = pago.id - WHERE ep.estado > 0 "; - if ($mes != null) { - $q .= "AND (pago.fecha BETWEEN '" . $mes->format('Y-m-01') . "' AND '" . $mes->format('Y-m-t') . "' - OR ep.fecha BETWEEN '" . $mes->format('Y-m-01') . "' AND '" . $mes->format('Y-m-t') . "')"; - } - $q .= ") pago JOIN (SELECT venta.* - FROM (( - SELECT venta.id, venta.pie, venta.propiedad, credito.pago, 'credito' AS tipo - FROM venta JOIN credito ON credito.id = venta.credito) - UNION ALL ( - SELECT venta.id, venta.pie, venta.propiedad, escritura.pago, 'escritura' AS tipo - FROM venta JOIN escritura ON escritura.id = venta.escritura) - UNION ALL ( - SELECT venta.id, venta.pie, venta.propiedad, cuota.pago, 'cuota' AS tipo - FROM venta JOIN cuota ON cuota.pie = venta.pie)) venta - JOIN propiedad ON propiedad.id = venta.propiedad - JOIN unidad ON unidad.id = propiedad.unidad_principal - WHERE unidad.proyecto = ?) venta - ON venta.pago = pago.id"; - $st = \ORM::getDB()->prepare($q); - $st->execute([$id]); - if ($st->rowCount() > 0) { - $R = $st->fetchAll(\PDO::FETCH_OBJ); - - #$informe = new Informador('Contabilidad - ' . (($mes != null) ? $mes->format('Y-m') . ' - ' : '') . $proyecto->descripcion); - $name = 'Contabilidad'; - $hoy = Carbon::now(config('app.timezone')); - $filename = str_replace('ñ', 'n', 'Contabilidad - ' . (($mes != null) ? $mes->format('Y-m') . ' - ' : '') . $proyecto->descripcion . ' - ' . $hoy->format('Y-m-d') . '.xls'); - - $informe = new PHPExcel($name, $filename); - - $columnas = ['Proyecto', 'Fecha', 'Banco', 'Departamento', 'RUT', 'Propietario', 'Glosa', 'Glosa2', (object) ['name' => 'Valor', 'style' => 'integer'], (object) ['name' => 'Valor UF', 'style' => 'currency']]; - $informe->addColumns($columnas); - $data = []; - foreach ($R as $r) { - $info = []; - $info['Proyecto'] = $proyecto->descripcion; - $f1 = \Carbon\Carbon::parse($r->fecha, config('app.timezone')); - $f2 = \Carbon\Carbon::parse($r->efecha, config('app.timezone')); - $info['Fecha'] = ($f1->max($f2))->format('Y-m-d'); - $info['Banco'] = $r->banco; - $venta = model(Venta::class)->findOne($r->vid); - $info['Departamento'] = $venta->unidad()->descripcion; - $info['RUT'] = $venta->propietario()->rut(); - $info['Propietario'] = $venta->propietario()->nombreCompleto(); - $info['Glosa'] = ucwords($r->ctipo); - $info['Glosa2'] = ''; - if ($r->ctipo == 'cuota') { - $cuota = model(Cuota::class)->where('pago', $r->id)->findOne(); - - $info['Glosa'] = 'Pie - ' . format('ufs', $cuota->pie()->valor('ufs'), null, true); - - $info['Glosa2'] = $cuota->numero() . ' - ' . $cuota->pie()->cuotas; - } - $info['Valor'] = $r->valor; - $info['Valor UF'] = '0'; - if ($r->uf > 0) { - $info['Valor UF'] = $r->valor / $r->uf; - } - $data []= $info; - } - - $informe->addData($data); - - return $informe->informe(); - } - } else { - setlocale(LC_TIME, 'es'); - $proyectos = model(Proyecto::class)->order_by_asc('descripcion')->find_many(); - return view('informes.contabilidad', compact('proyectos')); - } - } - public static function para_comision() - { - $proyectos = model(Proyecto::class)->orderByAsc('descripcion')->findMany(); - return view('informes.para_comision', compact('proyectos')); - } - public static function comisiones() - { - $id = post('proyecto'); - $proyecto = model(Proyecto::class)->findOne($id); - $unidades = explode('-', str_replace([';', '.', ':', ' ', PHP_EOL, '|', '+', ','], '-', post('unidades'))); - $ventas = model(Venta::class) - ->select('venta.*') - ->join('propiedad', ['propiedad.id', '=', 'venta.propiedad']) - ->join('unidad', ['unidad.id', '=', 'propiedad.unidad_principal']) - ->where('unidad.proyecto', $proyecto->id) - ->where('venta.estado', 1) - ->whereIn('unidad.descripcion', $unidades) - ->orderByExpr('FIELD(unidad.descripcion, ' . implode(', ', $unidades) . ')') - ->findMany(); - $ids = []; - $totales = (object) ['precio' => 0, 'neto' => 0, 'comision' => 0]; - foreach ($ventas as $venta) { - $ids []= $venta->id; - $totales->precio += $venta->valor_uf; - $totales->neto += $venta->valorCorredora(); - $totales->comision += $venta->valorCorredora() * 1.5 / 100; - } - return view('informes.comisiones', compact('ventas', 'proyecto', 'totales', 'ids')); - } - public static function comisiones_xlsx() - { - $id_ventas = explode(',', get('ventas')); - $ventas = model(Venta::class) - ->whereIn('id', $id_ventas) - ->orderByExpr('FIELD(id, ' . implode(', ', $id_ventas) . ')') - ->findMany(); - - $informe = new Informador('Comisiones - ' . $ventas[0]->proyecto()->descripcion); - $columnas = ['Departamento', 'Estacionamientos', 'Bodegas', 'Propietario', 'Precio', '% Com', 'Com UF']; - $informe->addColumns($columnas); - $data = []; - foreach ($ventas as $venta) { - $info = []; - $info['Departamento'] = $venta->unidad()->descripcion; - $info['Estacionamientos'] = implode(' - ', $venta->propiedad()->estacionamientos('array')); - $info['Bodegas'] = implode(' - ', $venta->propiedad()->bodegas('array')); - $info['Propietario'] = $venta->propietario()->nombreCompleto(); - $info['Precio'] = "'" . format('ufs', $venta->valorCorredora()); - $info['% Com'] = '1,5 %'; - $info['Com UF'] = "'" . format('ufs', $venta->valorCorredora() * 1.5 / 100); - $data []= $info; - } - - $informe->addDatas($data); - - return $informe->informe(); - } - public static function cuotas() - { - $id_venta = get('venta'); - $venta = model(Venta::class)->findOne($id_venta); - - $name = 'Cuotas - ' . $venta->unidad()->descripcion; - $hoy = Carbon::now(config('app.timezone')); - $filename = str_replace('ñ', 'n', $name . ' - ' . $venta->proyecto()->descripcion . ' - ' . $hoy->format('Y-m-d') . '.xls'); - $informe = new PHPExcel($name, $filename); - $columnas = [ - ['name' => 'Cuota', 'style' => 'number'], - ['name' => 'Fecha Cuota', 'style' => 'date'], - 'Banco', - 'Identificador', - ['name' => 'Valor $', 'style' => 'number'], - ['name' => 'Valor UF', 'style' => 'currency'], - ['name' => 'Fecha Pago', 'style' => 'date'] - ]; - $informe->addColumns($columnas); - $data = []; - foreach ($venta->pie()->cuotas() as $cuota) { - $info = []; - $info['Cuota'] = $cuota->numero(); - $info['Fecha Cuota'] = $cuota->pago()->fecha()->format('Y-m-d'); - $info['Banco'] = $cuota->pago()->banco()->descripcion; - $info['Identificador'] = $cuota->pago()->identificador; - $info['Valor $'] = $cuota->pago()->valor(); - $info['Valor UF'] = $cuota->pago()->valor('ufs'); - $info['Fecha Pago'] = $cuota->pago()->estado()->fecha()->format('Y-m-d'); - $data []= $info; - } - $informe->addData($data); - - return $informe->informe(); - } - public static function resciliaciones() - { - if (get('proyecto')) { - $id = get('proyecto'); - $proyecto = model(Proyecto::class)->findOne($id); - $ventas = $proyecto->resciliaciones(); - - usort($ventas, function($a, $b) { - return $a->fecha()->timestamp - $b->fecha()->timestamp; - }); - - $name = 'Resciliaciones'; - $hoy = Carbon::now(config('app.timezone')); - $filename = str_replace('ñ', 'n', $name . ' - ' . $proyecto->descripcion . ' - ' . $hoy->format('Y-m-d') . '.xls'); - $informe = new PHPExcel($name, $filename); - - $columnas = [ - 'Propietario', - ['name' => 'Departamento', 'style' => 'number'], - ['name' => 'Estacionamientos', 'style' => 'number'], - ['name' => 'Bodegas', 'style' => 'number'], - 'Fecha Venta', - 'Fecha Resciliación', - ['name' => 'Mes', 'style' => 'mes'], - 'Tipo', - ['name' => 'm² Ponderados', 'style' => 'amount'], - ['name' => 'Valor Promesa', 'style' => 'amount'], - ]; - $informe->addColumns($columnas); - - $data = []; - foreach ($ventas as $venta) { - $info = []; - $info['Propietario'] = mb_strtoupper($venta->propietario()->nombreCompleto()); - $info['Departamento'] = $venta->unidad()->descripcion; - $ests = []; - if ($venta->propiedad()->estacionamientos != '') { - $es = $venta->propiedad()->estacionamientos(); - foreach ($es as $e) { - $ests []= $e->descripcion; - } - } - $info['Estacionamientos'] = implode(', ', $ests); - $bods = []; - if ($venta->propiedad()->bodegas != '') { - $bs = $venta->propiedad()->bodegas(); - foreach ($bs as $b) { - $bods []= $b->descripcion; - } - } - $info['Bodegas'] = implode(', ', $bods); - $info['Fecha Venta'] = $venta->fecha()->format('d.m.Y'); - $info['Fecha Resciliación'] = $venta->estado()->fecha()->format('d.m.Y'); - $info['Mes'] = $venta->estado()->fecha()->format('M-y'); - $info['Tipo'] = $venta->unidad()->abreviacion; - $info['m² Ponderados'] = $venta->unidad()->m2('vendible'); - $info['Valor Promesa'] = $venta->valor_uf; - - $data []= $info; - } - $informe->addData($data); - - $totals = [ - 'Departamento' => 'count', - 'Estacionamientos' => 'count', - 'Bodegas' => 'count', - 'm² Ponderados' => 'sum', - 'Valor Promesa' => 'sum' - ]; - $informe->addTotals($totals); - - return $informe->informe(); - } else { - $proyectos = model(Proyecto::class)->order_by_asc('descripcion')->find_many(); - return view('informes.resciliaciones', compact('proyectos')); - } - } -} diff --git a/bin/Pipfile b/bin/Pipfile index b5846df..8108982 100644 --- a/bin/Pipfile +++ b/bin/Pipfile @@ -6,6 +6,7 @@ verify_ssl = true [dev-packages] [packages] +gunicorn = "*" [requires] python_version = "3.8" diff --git a/docker-compose.yml b/docker-compose.yml index 7dfaee6..2790774 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,11 +1,15 @@ version: '3' +x-restart: &restart + restart: unless-stopped + services: web: profiles: - app image: nginx:alpine - container_name: web + container_name: incoviba_web + <<: *restart ports: - "8080:80" volumes: @@ -16,7 +20,8 @@ services: profiles: - app build: . - container_name: php + container_name: incoviba_php + <<: *restart env_file: - .env - .db.env @@ -26,9 +31,9 @@ services: db: profiles: - db - container_name: db image: mariadb:latest - restart: unless-stopped + container_name: incoviba_db + <<: *restart env_file: .db.env volumes: - dbdata:/var/lib/mysql @@ -36,12 +41,20 @@ services: adminer: profiles: - db - container_name: adminer image: adminer:latest - restart: unless-stopped + container_name: incoviba_adminer + <<: *restart ports: - "8083:8080" env_file: .adminer.env + python: + profiles: + - python + build: + dockerfile: Python.Dockerfile + container_name: incoviba_python + <<: *restart + volumes: dbdata: From 24bd5a6fc42718a748d49818145b41cd7177ba29 Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Thu, 10 Mar 2022 15:16:55 -0300 Subject: [PATCH 02/10] FIX: docker context --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index 2790774..f187f85 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -52,6 +52,7 @@ services: profiles: - python build: + context: . dockerfile: Python.Dockerfile container_name: incoviba_python <<: *restart From 6995561e4f91d2832b20c468ffc1a3397ed49f6a Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Thu, 10 Mar 2022 15:31:18 -0300 Subject: [PATCH 03/10] FIX: listen to network --- Python.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Python.Dockerfile b/Python.Dockerfile index 32c4b71..8c42826 100644 --- a/Python.Dockerfile +++ b/Python.Dockerfile @@ -6,4 +6,4 @@ WORKDIR /usr/opt/incoviba/informes RUN pip install gunicorn pandas xlsxwriter httpx flask numpy -CMD ["gunicorn", "-w", "4", "app:app"] +CMD ["gunicorn", "-w", "4", "--bind", "0.0.0.0", "app:app"] From eac6b7d1971170f3f71691d8bdf91e20299d8786 Mon Sep 17 00:00:00 2001 From: aldarien Date: Mon, 11 Apr 2022 11:01:35 -0400 Subject: [PATCH 04/10] FIX: null valor in format --- app/Helper/functions.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Helper/functions.php b/app/Helper/functions.php index abafe62..2be4618 100644 --- a/app/Helper/functions.php +++ b/app/Helper/functions.php @@ -55,6 +55,9 @@ function uf($date, $async = false) { return (object) ['total' => 0]; } function format($tipo, $valor, $format = null, $print = false) { + if ($valor === null) { + $valor = 0; + } if (strtolower($tipo) == 'localdate') { $d = \Carbon\Carbon::parse($valor); $d->locale('es_ES'); From 9ffc7527c3983f34febfba6cd6fa23f59375fc4b Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Thu, 9 Jun 2022 16:19:05 -0400 Subject: [PATCH 05/10] Log agregar Venta --- app/Controller/Ventas.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/Controller/Ventas.php b/app/Controller/Ventas.php index 8bd60b3..64490c3 100644 --- a/app/Controller/Ventas.php +++ b/app/Controller/Ventas.php @@ -120,19 +120,21 @@ class Ventas } public static function agregar() { + error_log(var_export(post(), true)); $f = Carbon::createFromDate(post('year'), post('month'), post('day'), config('app.timezone')); $t = Carbon::today(config('app.timezone')); $uf = uf($f); + error_log(var_export($uf, true)); $calle = trim(post('calle')); $numero = post('numero'); $extra = trim(post('extra')); $comuna = post('comuna'); $direccion = model(Direccion::class) - ->where('calle', $calle) - ->where('numero', $numero) - ->where('extra', $extra) - ->where('comuna', $comuna) + ->where('calle', $calle) + ->where('numero', $numero) + ->where('extra', $extra) + ->where('comuna', $comuna) ->findOne(); if (!$direccion) { $direccion = model(Direccion::class)->create(); From 717ba19792a0684ebf19f595fc77d8199f3dba24 Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Thu, 9 Jun 2022 16:39:25 -0400 Subject: [PATCH 06/10] Check uf, replace ',' in valor --- app/Controller/Ventas.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/app/Controller/Ventas.php b/app/Controller/Ventas.php index 64490c3..217788e 100644 --- a/app/Controller/Ventas.php +++ b/app/Controller/Ventas.php @@ -194,7 +194,9 @@ class Ventas $pie->valor = post('pie'); $pie->fecha = $f->format('Y-m-d'); $pie->cuotas = post('cuotas'); - $pie->uf = $uf->uf->value; + if ($uf->total > 0) { + $pie->uf = $uf->uf->value; + } $pie->save(); $venta->pie = $pie->id; @@ -205,7 +207,9 @@ class Ventas $pago = model(Pago::class)->create(); $pago->fecha = $f->format('Y-m-d'); - $pago->uf = $uf->uf->value; + if ($uf->total > 0) { + $pago->uf = $uf->uf->value; + } $pago->valor = $bono->valor * $uf->uf->value; $pago->tipo = 8; $pago->new(); @@ -218,7 +222,9 @@ class Ventas if (post('credito')) { $pago = model(Pago::class)->create(); $pago->fecha = $f->format('Y-m-d'); - $pago->uf = $uf->uf->value; + if ($uf->total > 0) { + $pago->uf = $uf->uf->value; + } $pago->valor = post('credito') * $uf->uf->value; $pago->tipo = 2; $pago->new(); @@ -231,12 +237,14 @@ class Ventas } $venta->fecha = $f->format('Y-m-d'); - $venta->valor_uf = post('valor'); + $venta->valor_uf = str_replace(',', '', post('valor')); $venta->fecha_ingreso = $t->format('Y-m-d'); if (post('operador') != 0) { $venta->agente = post('operador'); } - $venta->uf = $uf->uf->value; + if ($uf->total > 0) { + $venta->uf = $uf->uf->value; + } $venta->new(); if (post('promociones') != 0) { From d6f58893b67c9fb9c98721456455f721b050f7c5 Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Thu, 9 Jun 2022 16:40:10 -0400 Subject: [PATCH 07/10] FIX --- app/Controller/Ventas.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Controller/Ventas.php b/app/Controller/Ventas.php index 217788e..31f1e61 100644 --- a/app/Controller/Ventas.php +++ b/app/Controller/Ventas.php @@ -237,7 +237,7 @@ class Ventas } $venta->fecha = $f->format('Y-m-d'); - $venta->valor_uf = str_replace(',', '', post('valor')); + $venta->valor_uf = str_replace(',', '.', post('valor')); $venta->fecha_ingreso = $t->format('Y-m-d'); if (post('operador') != 0) { $venta->agente = post('operador'); From bb1d2b2159a63bbd250765788ea80ba3afb13a67 Mon Sep 17 00:00:00 2001 From: Aldarien Date: Fri, 10 Feb 2023 06:38:16 +0000 Subject: [PATCH 08/10] Update aldarien dependencies --- aldarien/asset/composer.json | 2 +- aldarien/config/composer.json | 2 +- aldarien/format/composer.json | 2 +- aldarien/response/composer.json | 4 ++-- aldarien/root/composer.json | 6 +++--- aldarien/session/composer.json | 4 ++-- aldarien/url/app/Service/URL.php | 5 +++-- aldarien/url/composer.json | 6 +++--- aldarien/view/composer.json | 4 ++-- 9 files changed, 18 insertions(+), 17 deletions(-) diff --git a/aldarien/asset/composer.json b/aldarien/asset/composer.json index ebf36ce..dd2c217 100644 --- a/aldarien/asset/composer.json +++ b/aldarien/asset/composer.json @@ -7,7 +7,7 @@ "aldarien/contract" : "*" }, "require-dev" : { - "phpunit/phpunit" : "^6.3" + "phpunit/phpunit" : "*" }, "license" : "MIT", "authors" : [{ diff --git a/aldarien/config/composer.json b/aldarien/config/composer.json index b37bdbc..ff4255b 100644 --- a/aldarien/config/composer.json +++ b/aldarien/config/composer.json @@ -12,7 +12,7 @@ "require": { "aldarien/contract": "*", "aldarien/root": "*", - "symfony/yaml": "^3.3" + "symfony/yaml": "*" }, "autoload": { "psr-4": { diff --git a/aldarien/format/composer.json b/aldarien/format/composer.json index d897165..59d058d 100644 --- a/aldarien/format/composer.json +++ b/aldarien/format/composer.json @@ -3,7 +3,7 @@ "description" : "Module for formatting data, mostly numbers", "type" : "library", "require-dev" : { - "phpunit/phpunit" : "^6", + "phpunit/phpunit" : "*", "aldarien/config": "*" }, "license" : "MIT", diff --git a/aldarien/response/composer.json b/aldarien/response/composer.json index 8db86c3..72ebcc0 100644 --- a/aldarien/response/composer.json +++ b/aldarien/response/composer.json @@ -3,11 +3,11 @@ "description" : "Response handler module for my apps", "type" : "library", "require" : { - "wixel/gump" : "^1.5", + "wixel/gump" : "*", "aldarien/contract" : "*" }, "require-dev" : { - "phpunit/phpunit" : "^6.3" + "phpunit/phpunit" : "*" }, "license" : "MIT", "authors" : [{ diff --git a/aldarien/root/composer.json b/aldarien/root/composer.json index 3898988..784dfb7 100644 --- a/aldarien/root/composer.json +++ b/aldarien/root/composer.json @@ -7,8 +7,8 @@ ], "license": "MIT", "require-dev" : { - "phpunit/phpunit" : "~6", - "kint-php/kint" : "~2" + "phpunit/phpunit" : "*", + "kint-php/kint" : "*" }, "autoload" : { "psr-4" : { @@ -18,4 +18,4 @@ "app/Helper/functions.php" ] } -} \ No newline at end of file +} diff --git a/aldarien/session/composer.json b/aldarien/session/composer.json index f588b42..7fe764d 100644 --- a/aldarien/session/composer.json +++ b/aldarien/session/composer.json @@ -3,11 +3,11 @@ "description": "Session wrapper for aura/session", "type": "library", "require": { - "aura/session": "^2.1", + "aura/session": "*", "aldarien/contract": "*" }, "require-dev": { - "phpunit/phpunit": "^6.3" + "phpunit/phpunit": "*" }, "license": "MIT", "authors": [ diff --git a/aldarien/url/app/Service/URL.php b/aldarien/url/app/Service/URL.php index e504acd..4c70ae1 100644 --- a/aldarien/url/app/Service/URL.php +++ b/aldarien/url/app/Service/URL.php @@ -19,7 +19,8 @@ class URL protected function findRoot() { $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 = $_SERVER['HTTPS'] ? 'https' : 'http'; + $uri = Http::createFromString(\Sabre\Uri\resolve($scheme . '://' . $base, $_SERVER['SCRIPT_NAME'])); $host = new Host($uri->getHost()); if ($host->isAbsolute()) { return $host->getRegistrableDomain(); @@ -73,4 +74,4 @@ class URL return $url; } } -?> \ No newline at end of file +?> diff --git a/aldarien/url/composer.json b/aldarien/url/composer.json index 7e69e9a..78837f1 100644 --- a/aldarien/url/composer.json +++ b/aldarien/url/composer.json @@ -5,11 +5,11 @@ "require" : { "aldarien/contract" : "*", "aldarien/root" : "*", - "league/uri": "^5.2", - "sabre/uri": "^2.1" + "league/uri": "*", + "sabre/uri": "*" }, "require-dev" : { - "phpunit/phpunit" : "^6.3" + "phpunit/phpunit" : "*" }, "license" : "MIT", "authors" : [{ diff --git a/aldarien/view/composer.json b/aldarien/view/composer.json index b8e353e..b41c138 100644 --- a/aldarien/view/composer.json +++ b/aldarien/view/composer.json @@ -3,7 +3,7 @@ "description": "View module for my apps", "type": "library", "require": { - "philo/laravel-blade": "^3.1", + "philo/laravel-blade": "*", "aldarien/contract": "*", "aldarien/config": "*" }, @@ -23,6 +23,6 @@ ] }, "require-dev": { - "phpunit/phpunit": "^6.3" + "phpunit/phpunit": "*" } } From 009ba01e699200dafd0638cf18af377f90654947 Mon Sep 17 00:00:00 2001 From: Aldarien Date: Fri, 10 Feb 2023 06:38:43 +0000 Subject: [PATCH 09/10] Releas dependencies versions --- composer.json | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/composer.json b/composer.json index 9371935..75c6a9f 100644 --- a/composer.json +++ b/composer.json @@ -11,24 +11,25 @@ "aldarien/session" : "*", "aldarien/url": "*", "j4mie/paris" : "^1.5", - "danielstjules/stringy" : "^3.1", + "voku/stringy" : "^6", "phpoffice/phpspreadsheet": "^1", "nesbot/carbon": "^2", "phpoffice/phpword": "^0", "slam/php-excel": "^4.4", "fabpot/goutte": "^3.2", "incoviba/modelos": "*", - "slim/slim": "4.x-dev", - "php-di/slim-bridge": "dev-master", - "rubellum/slim-blade-view": "dev-master", - "nyholm/psr7": "1.4.x-dev", - "nyholm/psr7-server": "dev-master", - "vlucas/phpdotenv": "^5.3" + "slim/slim": "^4", + "php-di/slim-bridge": "*", + "rubellum/slim-blade-view": "*", + "nyholm/psr7": "*", + "nyholm/psr7-server": "*", + "vlucas/phpdotenv": "^5.3", + "monolog/monolog": "^3" }, "require-dev" : { - "phpunit/phpunit" : "^8", - "kint-php/kint" : "^2.1", - "filp/whoops" : "^2.1" + "phpunit/phpunit" : "*", + "kint-php/kint" : "*", + "filp/whoops" : "*" }, "license" : "GNU AGPLv3", "authors" : [{ @@ -59,5 +60,8 @@ "type": "path", "url": "./incoviba/modelos" } - ] + ], + "config": { + "sort-packages": true + } } From 726bdaec4c744a27dd2be3bc5613a1732f06ae71 Mon Sep 17 00:00:00 2001 From: Aldarien Date: Fri, 10 Feb 2023 06:39:24 +0000 Subject: [PATCH 10/10] logs --- docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index f187f85..7fb299d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -27,6 +27,8 @@ services: - .db.env volumes: - .:/code + - ./php-errors.ini:/usr/local/etc/php/conf.d/docker-php-errors.ini + - ./logs:/logs db: profiles: