132 lines
4.1 KiB
PHP
132 lines
4.1 KiB
PHP
<?php
|
|
/** \file include/report_system.php
|
|
* \brief DI webinterface menu system reports script.
|
|
* \author Rob Schalken, Core|Vision
|
|
* \version $Revision: 26247 $
|
|
* \date $Date: 2016-02-29 10:40:22 +0100 (Mon, 29 Feb 2016) $
|
|
*
|
|
* This file contains the menu system reports content
|
|
*
|
|
*/
|
|
|
|
function report_workorder_template_tree($tree, $indent)
|
|
{
|
|
foreach( $tree as $tree_item ) {
|
|
if( $tree_item['items'] )
|
|
$icon = "icon_plus_gray_22x22.png";
|
|
else
|
|
$icon = "icon_empty_gray_22x22.png";
|
|
|
|
report_data(
|
|
array(
|
|
'value' => array("", $tree_item['value']),
|
|
'align' => array("R","L"),
|
|
'font_size' => array(8,8),
|
|
'cell_width' => array(4 + ($indent * 5), 176 - ($indent * 5)),
|
|
'cell_height' => 18,
|
|
'check_page_end' => TRUE,
|
|
'ishtml' => array(
|
|
array(
|
|
'type' => "image",
|
|
'left' => ($indent * 5), // images don't listen to "align=R"
|
|
'width' => 6,
|
|
'filename' => $icon
|
|
)
|
|
)
|
|
)
|
|
);
|
|
|
|
if( $tree_item['items'] ) report_workorder_template_tree($tree_item['items'], $indent + 1);
|
|
}
|
|
}
|
|
|
|
function report_workorder_template_overview($report_type, $sort_order, $data, $columns)
|
|
{
|
|
global $_PAGE_INFO;
|
|
|
|
// Retrieve info
|
|
$date = date('Y-m-d');
|
|
$datetime = date('Y-m-d H:i:s');
|
|
$user = db_fetch_user($_PAGE_INFO['login']['user']['id'], "", 1);
|
|
$customer = db_fetch_customer($_PAGE_INFO['login']['customer']['id'], 1);
|
|
|
|
// Set file info
|
|
$_PAGE_INFO['report_type'] = $report_type;
|
|
$_PAGE_INFO['dest'] = "S";
|
|
$_PAGE_INFO['file'] = make_filename(_("Workorder template overview") . "-" . str_replace("-", "", $date)) . "." . report_fileext($report_type);
|
|
|
|
// Create header info
|
|
report_header(
|
|
array(
|
|
'subject' => _("Workorder template overview"),
|
|
'header' => _("Workorder template overview"),
|
|
'data' => array(
|
|
array(_("Date"), $datetime),
|
|
array(_("MTinfo"), VERSION . (is_ReleaseCandidate() ? " - " . $_SESSION[$_PAGE_INFO['id']]['release_dir'] : "")),
|
|
array(_("User"), getUser($user['id']))
|
|
)
|
|
)
|
|
);
|
|
|
|
// Print tree or table
|
|
if( $sort_order == "tree" ) {
|
|
// Recurse through the tree
|
|
report_workorder_template_tree($data, 0);
|
|
}
|
|
else {
|
|
// Print table
|
|
// Add column headers
|
|
$table_headers = array(
|
|
'type' => _("Type of equipment"),
|
|
'syscomp' => _("System component"),
|
|
'version' => _("Version"),
|
|
'change' => _("Change log item")
|
|
);
|
|
$sorted_headers = array();
|
|
foreach( $columns as $column_header ) {
|
|
$sorted_headers[] = $table_headers[$column_header];
|
|
}
|
|
report_data(
|
|
array(
|
|
'value' => $sorted_headers,
|
|
'bold' => array(TRUE,TRUE,TRUE,TRUE),
|
|
'border' => array("TLBR","TLBR","TLBR","TLBR"),
|
|
'font_size' => array(8,8,8,8),
|
|
'cell_width' => array(45,45,45,45),
|
|
'cell_height' => 16,
|
|
'check_page_end' => 0
|
|
)
|
|
);
|
|
// The table itself
|
|
foreach( $data as $table_row ) {
|
|
$sorted_data = array();
|
|
foreach( $columns as $column ) {
|
|
$sorted_data[] = $table_row[$column]['value']; //shorten_text($table_row[$column]['value'], 36, SHORTEN_NARROW, FALSE);
|
|
}
|
|
report_text(
|
|
array(
|
|
'value' => $sorted_data,
|
|
'border' => array("TLBR","TLBR","TLBR","TLBR"),
|
|
'font_size' => array(8,8,8,8),
|
|
'cell_width' => array(45,45,45,45),
|
|
'cell_height' => 14,
|
|
'check_page_end' => 1
|
|
)
|
|
);
|
|
}
|
|
}
|
|
|
|
// Generate document
|
|
$report = array(
|
|
'document' => report_generate(),
|
|
'filename' => $_PAGE_INFO['file'],
|
|
'mimetype' => report_mimetype($report_type)
|
|
);
|
|
|
|
if( $report['document'] )
|
|
return $report;
|
|
else
|
|
return FALSE;
|
|
}
|
|
|
|
?>
|