Visuals changes in the data of general type reports

Former-commit-id: 15d0c6f67d2b1cafddd372c96807e8c4201c4f7f
This commit is contained in:
manuel.montes 2019-01-10 17:33:24 +01:00
parent 9212e6a892
commit cc7e9e5537
2 changed files with 19 additions and 21 deletions

View File

@ -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]) {

View File

@ -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 {