From 0d754cb3db5b30713fa687ff9acc294c81a26343 Mon Sep 17 00:00:00 2001 From: Elias Yambay Date: Fri, 26 Feb 2021 21:47:55 -0300 Subject: [PATCH] Cambios varios --- .../Controllers/EncuestasCargosController.php | 2 +- app/Http/Controllers/ReporteController.php | 2 + app/Traits/ReportTrait.php | 25 +++- composer.json | 3 +- composer.lock | 119 +++++++++++++++++- config/app.php | 2 + resources/lang/es/reportReport.php | 2 +- resources/views/report/cargos_club.blade.php | 2 +- storage/debugbar/.gitignore | 2 + 9 files changed, 147 insertions(+), 12 deletions(-) create mode 100644 storage/debugbar/.gitignore diff --git a/app/Http/Controllers/EncuestasCargosController.php b/app/Http/Controllers/EncuestasCargosController.php index e112dc6..4a2648e 100644 --- a/app/Http/Controllers/EncuestasCargosController.php +++ b/app/Http/Controllers/EncuestasCargosController.php @@ -236,7 +236,7 @@ public function addCargoStore(Request $request, $id){ public function getCargos($id){ ini_set('memory_limit', '1020M'); ini_set('max_execution_time', 300); - $dbData = Encuestas_cargo::where('cabecera_encuesta_id', $id)->get(); + $dbData = Encuestas_cargo::where('cabecera_encuesta_id', $id)->with('detalleEncuestas')->get(); $dbEncuesta = Cabecera_encuesta::find($id); $dbEmpresa = $dbEncuesta->empresa->descripcion; $dbPeriodo = $dbEncuesta->periodo; diff --git a/app/Http/Controllers/ReporteController.php b/app/Http/Controllers/ReporteController.php index 4b6256c..ba4281c 100644 --- a/app/Http/Controllers/ReporteController.php +++ b/app/Http/Controllers/ReporteController.php @@ -1241,6 +1241,7 @@ public function cargosReportExcel(Request $request){ $request->request->add(["cargo_id"=> $cargo->cargo_id, "empresa_id" => $empresa]); // procesamos el reporte $respuesta = $this->cargoReportAll($request, "clubExcel", true); + $filename = 'Cubo_Resultados_'.$periodo; // preparamos los datos para el array final del cargo @@ -1252,6 +1253,7 @@ public function cargosReportExcel(Request $request){ // por cada item del detalle //$cantConceptos = 0; foreach ($respuesta as $key => $item) { + switch ($key) { case 'detalle_universo': $this->CargaDetalle($item, $itemArray); diff --git a/app/Traits/ReportTrait.php b/app/Traits/ReportTrait.php index 1792d90..2490b74 100644 --- a/app/Traits/ReportTrait.php +++ b/app/Traits/ReportTrait.php @@ -46,12 +46,13 @@ public function countEmergentesSegmento($rubro, $subRubro, $periodo){ return $count; } public function cargaDetalle($item, &$itemArray){ + $variableAnual = false; $efectivoTotal = false; $efectivoGarantizado = false; $salarioEmpresa = 0; $variableAnualEmp = 0; - + //dd($item, $itemArray); foreach ($item as $key => $value) { switch ($value["Concepto"]) { case "Comision": @@ -180,7 +181,13 @@ public function cargaDetalle($item, &$itemArray){ $ratioSalBaseTotalEfectivo75 = 0; } if($itemArray[39] > 0){ - $ratioSalBaseTotalEfectivoMax = round(($itemArray[9]*12)/$itemArray[39], 2); + + if($itemArray[9] > 0){ + $ratioSalBaseTotalEfectivoMax = round(($itemArray[9]*12)/$itemArray[39], 2); + }else{ + $ratioSalBaseTotalEfectivoMax = 0; + } + }else{ $ratioSalBaseTotalEfectivoMax = 0; } @@ -668,13 +675,14 @@ public function segmenter( &$collection, }elseif ($rubro == 4) { // Navieras // Salario Base $salariosBase = $detalle->where('salario_base', '>', '0')->pluck('salario_base'); + $salarioMin = $salariosBase->min(); $salarioMax = $salariosBase->max(); $salarioProm = $salariosBase->avg(); $salarioMed = $this->median($salariosBase); $salario25Per = $this->percentile(25,$salariosBase); $salario75Per = $this->percentile(75, $salariosBase); - + //dd($salariosBase); $this->pusher( $collection, $countCasos, Lang::get('reportReport.concept_salary'), @@ -686,7 +694,9 @@ public function segmenter( &$collection, round($salario75Per, 0), $dbClienteEnc->salario_base, $segmento, - $dbCargo); + $dbCargo); + + // Salario Base Anual $salariosBaseAnual = $salariosBase->map(function($item){ return $item * 12; @@ -976,6 +986,7 @@ public function segmenter( &$collection, //Beneficios $beneficiosNavieras = $detalle->where('beneficios_navieras', '>', '0')->pluck('beneficios_navieras'); + $beneficiosMin = $beneficiosNavieras->min(); $beneficiosMax = $beneficiosNavieras->max(); $beneficiosProm = $beneficiosNavieras->avg(); @@ -992,7 +1003,7 @@ public function segmenter( &$collection, round($beneficiosMed, 0), round($beneficios25Per, 0), round($beneficios75Per, 0), - $dbClienteEnc->beneficios_bancos, + $dbClienteEnc->beneficios_navieras, $segmento, $dbCargo); @@ -2438,6 +2449,7 @@ public function cargoReportAll(Request $request, $tipo, $muestraComision = true) ->where('cargo_id', $cargo) ->where('incluir', 1) ->get(); + $dbCargosEncuestasNac = Encuestas_cargo::whereIn('cabecera_encuesta_id', $encuestadasNacIds)->where('cargo_id', $cargo)->where('incluir', 1)->get(); $dbCargosEncuestasInter = Encuestas_cargo::whereIn('cabecera_encuesta_id', $encuestadasInterIds)->where('cargo_id', $cargo)->where('incluir', 1)->get(); @@ -2448,6 +2460,7 @@ public function cargoReportAll(Request $request, $tipo, $muestraComision = true) // Recuperamos los datos de las encuestas $dbDetalle = Detalle_encuesta::whereIn('encuestas_cargo_id', $cargosEncuestasIds)->get(); + // Datos de la encuesta llenada por el cliente $dbClienteEnc = $dbDetalle->where('cabecera_encuesta_id', $dbEncuesta->id)->first(); if(empty($dbClienteEnc)){ @@ -2462,7 +2475,7 @@ public function cargoReportAll(Request $request, $tipo, $muestraComision = true) $countCasos = $dbDetalle->where('cantidad_ocupantes', '>', '0') ->unique('cabecera_encuesta_id') ->count(); - + $countOcupantes = $dbDetalle->sum('cantidad_ocupantes'); $countCasosGratif = $dbDetalle->where('cantidad_ocupantes', '>', '0') ->where('gratificacion', '>', '0') diff --git a/composer.json b/composer.json index 3d6e77c..03674e8 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,8 @@ "php": ">=5.6.4", "laravel/framework": "5.3.*", "maatwebsite/excel": "^2.1", - "barryvdh/laravel-dompdf": "^0.8.1" + "barryvdh/laravel-dompdf": "^0.8.1", + "barryvdh/laravel-debugbar": "~2.4" }, "require-dev": { "fzaninotto/faker": "~1.4", diff --git a/composer.lock b/composer.lock index f82c104..d5aa4ad 100644 --- a/composer.lock +++ b/composer.lock @@ -1,11 +1,60 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "540555237e5d912c3a0e140f7bc77814", + "content-hash": "a22c264f905670c2fc2f1b62e26c4ed2", "packages": [ + { + "name": "barryvdh/laravel-debugbar", + "version": "v2.4.3", + "source": { + "type": "git", + "url": "https://github.com/barryvdh/laravel-debugbar.git", + "reference": "d7c88f08131f6404cb714f3f6cf0642f6afa3903" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/d7c88f08131f6404cb714f3f6cf0642f6afa3903", + "reference": "d7c88f08131f6404cb714f3f6cf0642f6afa3903", + "shasum": "" + }, + "require": { + "illuminate/support": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*", + "maximebf/debugbar": "~1.13.0", + "php": ">=5.5.9", + "symfony/finder": "~2.7|~3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Barryvdh\\Debugbar\\": "src/" + }, + "files": [ + "src/helpers.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Barry vd. Heuvel", + "email": "barryvdh@gmail.com" + } + ], + "description": "PHP Debugbar integration for Laravel", + "keywords": [ + "debug", + "debugbar", + "laravel", + "profiler", + "webprofiler" + ], + "time": "2017-07-21T11:56:48+00:00" + }, { "name": "barryvdh/laravel-dompdf", "version": "v0.8.1", @@ -319,6 +368,7 @@ "homepage": "http://www.acci.cz" } ], + "abandoned": "php-parallel-lint/php-console-color", "time": "2014-04-08T15:00:19+00:00" }, { @@ -363,6 +413,7 @@ "homepage": "http://www.acci.cz/" } ], + "abandoned": "php-parallel-lint/php-console-highlighter", "time": "2015-04-20T18:58:01+00:00" }, { @@ -421,6 +472,7 @@ "serialize", "tokenizer" ], + "abandoned": "opis/closure", "time": "2016-12-07T09:37:55+00:00" }, { @@ -712,6 +764,67 @@ ], "time": "2017-08-31T14:52:24+00:00" }, + { + "name": "maximebf/debugbar", + "version": "1.13.1", + "source": { + "type": "git", + "url": "https://github.com/maximebf/php-debugbar.git", + "reference": "afee79a236348e39a44cb837106b7c5b4897ac2a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/afee79a236348e39a44cb837106b7c5b4897ac2a", + "reference": "afee79a236348e39a44cb837106b7c5b4897ac2a", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/log": "^1.0", + "symfony/var-dumper": "^2.6|^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0|^5.0" + }, + "suggest": { + "kriswallsmith/assetic": "The best way to manage assets", + "monolog/monolog": "Log using Monolog", + "predis/predis": "Redis storage" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.13-dev" + } + }, + "autoload": { + "psr-4": { + "DebugBar\\": "src/DebugBar/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Maxime Bouroumeau-Fuseau", + "email": "maxime.bouroumeau@gmail.com", + "homepage": "http://maximebf.com" + }, + { + "name": "Barry vd. Heuvel", + "email": "barryvdh@gmail.com" + } + ], + "description": "Debug bar in the browser for php application", + "homepage": "https://github.com/maximebf/php-debugbar", + "keywords": [ + "debug", + "debugbar" + ], + "time": "2017-01-05T08:46:19+00:00" + }, { "name": "monolog/monolog", "version": "1.22.0", @@ -832,6 +945,7 @@ "cron", "schedule" ], + "abandoned": "dragonmantank/cron-expression", "time": "2017-01-23T04:29:33+00:00" }, { @@ -1115,6 +1229,7 @@ "xls", "xlsx" ], + "abandoned": "phpoffice/phpspreadsheet", "time": "2015-05-01T07:00:55+00:00" }, { diff --git a/config/app.php b/config/app.php index d04512f..eee783d 100644 --- a/config/app.php +++ b/config/app.php @@ -186,6 +186,7 @@ elsoftpy\Utiles\Flash\elsoftpyFlashProvider::class, Maatwebsite\Excel\ExcelServiceProvider::class, Barryvdh\DomPDF\ServiceProvider::class, + Barryvdh\Debugbar\ServiceProvider::class, ], @@ -239,6 +240,7 @@ 'flash' => elsoftpy\Utiles\Flash\Flash::class, 'Excel' => 'Maatwebsite\Excel\Facades\Excel', 'PDF' => Barryvdh\DomPDF\Facade::class, + 'Debugbar' => Barryvdh\Debugbar\Facade::class, ], diff --git a/resources/lang/es/reportReport.php b/resources/lang/es/reportReport.php index 58d66c2..a6a971b 100644 --- a/resources/lang/es/reportReport.php +++ b/resources/lang/es/reportReport.php @@ -41,7 +41,7 @@ "concept_variable_pay_trip" => "Variable por Viaje", "concept_mooring" => "Adicional por Amarre", "concept_fuel_type" => "Adicional por Tipo de Combustible", - "concept_shipping" => "Adicional por Disponibilidad/Emarque", + "concept_shipping" => "Adicional por Disponibilidad/Embarque", "concept_load" => "Adicional por Carga", "concept_total_benefits" => "Total Beneficios Anual", "concept_annual_cash_total" => "Efectivo Total Anual", diff --git a/resources/views/report/cargos_club.blade.php b/resources/views/report/cargos_club.blade.php index 48d0bbd..0be3fd3 100644 --- a/resources/views/report/cargos_club.blade.php +++ b/resources/views/report/cargos_club.blade.php @@ -45,7 +45,7 @@
-

Club {!! $club !!}

+

{!! $club !!}

    @foreach ($niveles as $element) diff --git a/storage/debugbar/.gitignore b/storage/debugbar/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/storage/debugbar/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file