Skip to content

Commit

Permalink
Excel Club comparativo TEA empresa TEA mercado
Browse files Browse the repository at this point in the history
  • Loading branch information
elsoftpy committed Feb 25, 2020
1 parent 5414972 commit ec0552b
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 8 deletions.
9 changes: 5 additions & 4 deletions app/Http/Controllers/ReporteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1329,23 +1329,20 @@ public function resultadosExcel(Request $request){
$item->adicional_carga +
( ( $item->fallo_caja +
$item->fallo_caja_ext +
$item->comision +
$item->gratificacion_contrato +
$item->adicional_nivel_cargo +
$item->adicional_titulo) * 12);

}elseif($rubro == 1){
$adicional = ( $item->fallo_caja +
$item->fallo_caja_ext +
$item->comision +
$item->gratificacion_contrato +
$item->adicional_nivel_cargo +
$item->adicional_titulo) * 12;

}else{
$adicional = ( $item->fallo_caja +
$item->fallo_caja_ext +
$item->comision +
$item->gratificacion_contrato +
$item->adicional_nivel_cargo +
$item->adicional_titulo) * 12;
Expand All @@ -1359,23 +1356,27 @@ public function resultadosExcel(Request $request){
}else{
$efectivoTotalAnual = $efectivoAnual +
$adicional +
( $item->comision * 12 ) +
$item->bono_anual;
}
// Aguinaldo impactado
if($rubro == 1){
$aguinaldoImpactado = round( ( $item->salario_anual +
$item->gratificacion +
$adicional +
( $item->comision * 12 ) +
$item->bono_anual ) / 12, 0);
}elseif($rubro == 4){
$aguinaldoImpactado = round( ( $item->salario_anual +
$item->gratificacion +
$adicional +
$adicional +
( $item->comision * 12 ) +
$item->bono_anual ) / 12, 0);
}else{
$aguinaldoImpactado = round( ( $item->salario_anual +
$item->gratificacion +
$adicional +
( $item->comision * 12 ) +
$item->bono_anual ) / 12, 0);
}

Expand Down
43 changes: 39 additions & 4 deletions app/Traits/ReportTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public function cargaDetalle($item, &$itemArray){
$efectivoGarantizado = false;
$salarioEmpresa = 0;
$variableAnualEmp = 0;

foreach ($item as $key => $value) {
switch ($value["Concepto"]) {
case "Comision":
Expand Down Expand Up @@ -80,6 +81,7 @@ public function cargaDetalle($item, &$itemArray){
break;
case Lang::get('reportReport.concept_annual_cash_total'):
$efectivoTotal = true;
$efectivoTotalEmpresa = $value["Empresa"];
$this->cargador($value, $itemArray, false);
break;

Expand Down Expand Up @@ -205,33 +207,45 @@ public function cargaDetalle($item, &$itemArray){
// comparativo efectivo total anual
if($itemArray[34] > 0){
$ratioSalBaseTotalEfectivoMin = round(($itemArray[4]*12)/$itemArray[34], 2);
$ratioSalEmpresaTotalEfectivoMin = round($efectivoTotalEmpresa/$itemArray[34], 2);
}else{
$ratioSalBaseTotalEfectivoMin = 0;
$ratioSalEmpresaTotalEfectivoMin = 0;
}
if($itemArray[35] > 0){
$ratioSalBaseTotalEfectivo25 = round(($itemArray[5]*12)/$itemArray[35], 2);
$ratioSalEmpresaTotalEfectivo25 = round($efectivoTotalEmpresa/$itemArray[35], 2);
}else{
$ratioSalBaseTotalEfectivo25 = 0;
$ratioSalEmpresaTotalEfectivo25 = 0;
}
if($itemArray[36] > 0){
$ratioSalBaseTotalEfectivoProm = round(($itemArray[6]*12)/$itemArray[36], 2);
$ratioSalEmpresaTotalEfectivoProm = round($efectivoTotalEmpresa/$itemArray[36], 2);
}else{
$ratioSalBaseTotalEfectivoProm = 0;
$ratioSalEmpresaTotalEfectivoProm = 0;
}
if($itemArray[37] > 0){
$ratioSalBaseTotalEfectivoMed = round(($itemArray[7]*12)/$itemArray[37], 2);
$ratioSalEmpresaTotalEfectivoMed = round($efectivoTotalEmpresa/$itemArray[37], 2);
}else{
$ratioSalBaseTotalEfectivoMed = 0;
$ratioSalEmpresaTotalEfectivoMed = 0;
}
if($itemArray[38] > 0){
$ratioSalBaseTotalEfectivo75 = round(($itemArray[8]*12)/$itemArray[38], 2);
$ratioSalEmpresaTotalEfectivo75 = round($efectivoTotalEmpresa/$itemArray[38], 2);
}else{
$ratioSalBaseTotalEfectivo75 = 0;
$ratioSalEmpresaTotalEfectivo75 = 0;
}
if($itemArray[39] > 0){
$ratioSalBaseTotalEfectivoMax = round(($itemArray[9]*12)/$itemArray[39], 2);
$ratioSalEmpresaTotalEfectivoMax = round($efectivoTotalEmpresa/$itemArray[39], 2);
}else{
$ratioSalBaseTotalEfectivoMax = 0;
$ratioSalEmpresaTotalEfectivoMax = 0;
}

array_push( $itemArray,
Expand All @@ -246,7 +260,14 @@ public function cargaDetalle($item, &$itemArray){
$ratioSalBaseTotalEfectivoProm,
$ratioSalBaseTotalEfectivoMed,
$ratioSalBaseTotalEfectivo75,
$ratioSalBaseTotalEfectivoMax);
$ratioSalBaseTotalEfectivoMax,
$ratioSalEmpresaTotalEfectivoMin,
$ratioSalEmpresaTotalEfectivo25,
$ratioSalEmpresaTotalEfectivoProm,
$ratioSalEmpresaTotalEfectivoMed,
$ratioSalEmpresaTotalEfectivo75,
$ratioSalEmpresaTotalEfectivoMax,
);
}else{

if($itemArray[10] > 0){
Expand Down Expand Up @@ -3724,8 +3745,9 @@ private function cabeceraExcelFactory($sheet, $rubro){
$cells->setAlignment('center');
});


$topeHeader = 10;
$rango = 'A6:BL6';
$rango = 'A6:BG6';

}else{
// Salario Efectivo Anual Garantizado
Expand Down Expand Up @@ -3830,8 +3852,21 @@ private function cabeceraExcelFactory($sheet, $rubro){
$cells->setAlignment('center');
});

$topeHeader = 9;
$rango = 'A6:BF6';
// Total Efectivo Anual Empresa vs Mercado comp.
$sheet->cell('BG5', function($cell){
$cell->setValue('RATIO TOTAL EFECTIVO ANUAL EMPRESA / TOTAL EFECTIVO ANUAL MERCADO');
});
$sheet->mergeCells('BG5:BL5');
$sheet->cells('BG5:BL5', function($cells){
$cells->setBackground('#f57c00');
$cells->setFontColor("#FFFFFF");
$cells->setFontWeight("bold");
// $cells->setValignment('center');
$cells->setAlignment('center');
});

$topeHeader = 10;
$rango = 'A6:BL6';
}

$itemsHeader = array("Mínimo", "25 Perc.", "Promedio", "Mediana", "75 Perc.", "Máximo");
Expand Down
4 changes: 4 additions & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@

Route::resource('sub_rubros', 'SubRubrosController');

Route::get('tempdir', function(){
return sys_get_temp_dir ( );
});


});

Expand Down

0 comments on commit ec0552b

Please sign in to comment.