From cc7e9e55375bdf5980784e0f1cab6aac28c11c87 Mon Sep 17 00:00:00 2001 From: "manuel.montes" Date: Thu, 10 Jan 2019 17:33:24 +0100 Subject: [PATCH] Visuals changes in the data of general type reports Former-commit-id: 15d0c6f67d2b1cafddd372c96807e8c4201c4f7f --- .../include/functions_reporting.php | 19 +++++++++++++---- .../include/functions_reporting_html.php | 21 ++++--------------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 3209a61492..9683fc5158 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -6126,7 +6126,7 @@ function reporting_general($report, $content) { $unit = db_get_value('unit', 'tagente_modulo', 'id_agente_modulo', $row['id_agent_module']); - + $id_module_type = db_get_value("id_tipo_modulo", "tagente_modulo","nombre", $mod_name); if ($content['period'] == 0) { $data_res[$index] = modules_get_last_value($row['id_agent_module']); @@ -6167,9 +6167,21 @@ function reporting_general($report, $content) { $agent_name[$index] = $ag_name; $module_name[$index] = $mod_name; $units[$index] = $unit; + $id_module_types[$index] = $id_module_type; $operations[$index] = $row['operation']; break; case REPORT_GENERAL_GROUP_BY_AGENT: + $id_module_types[$index] = $id_module_type; + if($id_module_types[$index] == 2 || $id_module_types[$index] == 6 || $id_module_types[$index] == 9 || $id_module_types[$index] == 18 ){ + $data_res[$index] = round($data_res[$index], 0, PHP_ROUND_HALF_DOWN); + } + if($id_module_types[$index] == 2 || $id_module_types[$index] == 6 || $id_module_types[$index] == 9 || $id_module_types[$index] == 18 ){ + if($data_res[$index] == 1){ + $data_res[$index] = "Up"; + }elseif($data_res[$index] == 0){ + $data_res[$index] = "Down"; + } + } if ($data_res[$index] === false) { $return["data"][$ag_name][$mod_name] = null; } @@ -6178,6 +6190,7 @@ function reporting_general($report, $content) { $return["data"][$ag_name][$mod_name] = $data_res[$index]; } else { + hd($data_res[$index], true); $return["data"][$ag_name][$mod_name] = format_for_graph($data_res[$index], 2) . " " . $unit; } @@ -6267,8 +6280,6 @@ function reporting_general($report, $content) { break; } - - $i = 0; foreach ($data_res as $d) { $data = array(); @@ -6276,7 +6287,7 @@ function reporting_general($report, $content) { $data['module'] = $module_name[$i]; $data['id_agent_module'] = $id_agent_module[$i]; $data['id_agent'] = agents_get_agent_id_by_module_id($id_agent_module[$i]); - + $data['id_module_type'] = $id_module_types[$i]; $data['operator'] = ""; if ($content['period'] != 0) { switch ($operations[$i]) { diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 2e4b2b521a..e9a3f41029 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -2568,15 +2568,14 @@ function reporting_html_general(&$table, $item) { array_multisort($aux, SORT_ASC, $item['data']); /* End - Order by agent */ - + foreach ($item['data'] as $row) { - $module_type = db_get_value("id_tipo_modulo", "tagente_modulo","nombre", $row['module']); - if($module_type == 6 || $module_type == 9 || $module_type == 18 || $module_type == 2){ + if($row['id_module_type'] == 6 || $row['id_module_type'] == 9 || $row['id_module_type'] == 18 || $row['id_module_type'] == 2){ $row['formated_value'] = round($row['formated_value'], 0, PHP_ROUND_HALF_DOWN); } - if(($module_type == 6 || $module_type == 9 || $module_type == 18 || $module_type == 2) && $row['formated_value'] == 1){ + if(($row['id_module_type'] == 6 || $row['id_module_type'] == 9 || $row['id_module_type'] == 18 || $row['id_module_type'] == 2) && $row['formated_value'] == 1){ $row['formated_value'] = "Up"; - }elseif(($module_type == 6 || $module_type == 9 || $module_type == 18 || $module_type == 2) && $row['formated_value'] == 0){ + }elseif(($row['id_module_type'] == 6 || $row['id_module_type'] == 9 || $row['id_module_type'] == 18 || $row['id_module_type'] == 2) && $row['formated_value'] == 0){ $row['formated_value'] = "Down"; } if ($item['date']['period'] != 0) { @@ -2639,28 +2638,16 @@ function reporting_html_general(&$table, $item) { } } $list_modules = array_keys($list_modules); - $table1->width = '99%'; $table1->data = array (); $table1->head = array_merge(array(__('Agent')), $list_modules); foreach ($item['data'] as $agent => $modules) { $row = array(); - $row['agent'] = $agent; $table1->style['agent'] = 'text-align: center;'; foreach ($list_modules as $name) { - $module_type = db_get_value("id_tipo_modulo", "tagente_modulo","nombre", $name); - if($module_type == 6 || $module_type == 9 || $module_type == 18 || $module_type == 2){ - $modules[$name] = round($modules[$name], 0, PHP_ROUND_HALF_DOWN); - } $table1->style[$name] = 'text-align: center;'; if (isset($modules[$name])) { - if(($module_type == 6 || $module_type == 9 || $module_type == 18 || $module_type == 2) && $modules[$name] == 1){ - $modules[$name] = "Up"; - }elseif(($module_type == 6 || $module_type == 9 || $module_type == 18 || $module_type == 2) && $modules[$name] == 0){ - hd( $modules[$name], true); - $modules[$name] = "Down"; - } $row[$name] = $modules[$name]; } else {