From 1d45fd3044e8c62d769c23cba696769c4550319f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Su=C3=A1rez?= Date: Thu, 11 Apr 2024 13:46:46 -0600 Subject: [PATCH] Align reports --- .../include/functions_reporting_html.php | 43 ++++++++++++++++++- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index ae7279a40d..2b06ce1a4b 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -4044,6 +4044,10 @@ function reporting_html_historical_data($table, $item, $pdf=0) __('Date'), __('Data'), ]; + + $table1->headStyle['Date'] = 'text-align: center;'; + $table1->headStyle['Data'] = 'text-align: center;'; + $table1->data = []; foreach ($item['data'] as $data) { if (!is_numeric($data[__('Data')])) { @@ -4098,6 +4102,13 @@ function reporting_html_historical_data($table, $item, $pdf=0) $table1->titleclass = 'title_table_pdf'; $table1->titlestyle = 'text-align:left;'; + // Center every row + foreach ($table1->data[0] as $k => $v) { + for ($i = 0; $i < count($table1->data); $i++){ + $table1->cellstyle[$i][$k] = 'text-align: center;'; + } + } + return html_print_table($table1, true); } @@ -4129,6 +4140,10 @@ function reporting_html_database_serialized($table, $item, $pdf=0) __('Date'), __('Data'), ]; + + $table1->headStyle['Date'] = 'text-align: center;'; + $table1->headStyle['Data'] = 'text-align: center;'; + if (!empty($item['keys'])) { $table1->head = array_merge($table1->head, $item['keys']); } @@ -4169,6 +4184,14 @@ function reporting_html_database_serialized($table, $item, $pdf=0) $table1->title = $item['title']; $table1->titleclass = 'title_table_pdf'; $table1->titlestyle = 'text-align:left;'; + + // Center every row + foreach ($table1->data[0] as $k => $v) { + for ($i = 0; $i < count($table1->data); $i++){ + $table1->cellstyle[$i][$k] = 'text-align: center;'; + } + } + return html_print_table( $table1, true @@ -4195,9 +4218,7 @@ function reporting_html_last_value($table, $item, $pdf=0) $table_data->width = '100%'; $table_data->class = 'info_table'; $table_data->headstyle = []; - $table_data->headstyle[0] = 'text-align: left;'; $table_data->style = []; - $table_data->style[0] = 'text-align: left;'; $table_data->head = [ __('Name'), __('Date'), @@ -4205,6 +4226,11 @@ function reporting_html_last_value($table, $item, $pdf=0) __('Status'), ]; + $table_data->headStyle['Name'] = 'text-align: center;'; + $table_data->headStyle['Date'] = 'text-align: center;'; + $table_data->headStyle['Data'] = 'text-align: center;'; + $table_data->headStyle['Status'] = 'text-align: center;'; + $table_data->data = []; $table_data->data[1][0] = $item['data']['agent_name']; $table_data->data[1][0] .= ' / '; @@ -4329,6 +4355,11 @@ function reporting_html_last_value($table, $item, $pdf=0) true ); } else { + // PDF align center each column + for ($i = 0; $i < 4; $i++) { + $table_data->cellstyle['1'][$i] = 'text-align: center;'; + } + return html_print_table( $table_data, true @@ -6398,6 +6429,14 @@ function reporting_html_sql($table, $item, $pdf=0) $table2->title = $item['title']; $table2->titleclass = 'title_table_pdf'; $table2->titlestyle = 'text-align:left;'; + + // Center every row + foreach ($table2->data[0] as $k => $v) { + for ($i = 0; $i < count($table2->data); $i++){ + $table2->cellstyle[$i][$k] = 'text-align: center;'; + } + } + $return_pdf .= html_print_table( $table2, true