Ejemplo n.º 1
0
$a = round ($hours);
$b = round (get_task_workunit_hours ($id_task));

$image = histogram_2values($a, $b, $labela, $labelb);
$table_advanced->data[0][1] = print_label (__('Estimated hours'), '', '', true, $image);

$labela = __('Total');
$labelb = __('Imp');
$a = round (task_workunit_cost ($id_task, 0));
$b = round (task_workunit_cost ($id_task, 1));
$image = histogram_2values($a, $b, $labela, $labelb);
$table_advanced->data[0][1] .= print_label (__('Imputable estimation'), '', '', true, $image);	

$labela = __('Est.');
$labelb = __('Real');
$a = $estimated_cost;
$b = round (task_workunit_cost ($id_task, 1));
$image = histogram_2values($a, $b, $labela, $labelb);
$table_advanced->data[0][1] .= print_label (__('Cost estimation'), '', '', true, $image);	

//Workload distribution chart
$image = graph_workunit_task (200, 170, $id_task, true);
$image = '<div class="graph_frame">' . $image . '</div>';
$table_advanced->data[0][2] = print_label (__('Workunit distribution'), '', '', true, $image);

$table->colspan['row_task_stats'][0] = 3;
$table->data['row_task_stats'][0] = print_container_div('task_stats', __('Task statitics'), print_table($table_advanced, true), 'open', true, true);	

print_table ($table);

?>
Ejemplo n.º 2
0
	echo "</li>";
}
	echo "</ul>";
	echo "</div>";
   
echo "</h4>";

echo "<table class=search-table width=100%>";
echo "<tr><td style='text-align: center;'>";
echo "<a href='index.php?sec=users&sec2=operation/user_report/monthly_graph&month=$prev_month&year=$prev_year&id=$id_user'><img src='images/control_rewind_blue.png' title='" . __('Prev') . "'> </a>";
echo "<span style='font-size: 18px;'>".$year."/".$month."</span>";
echo "<a href='index.php?sec=users&sec2=operation/user_report/monthly_graph&month=$next_month&year=$next_year&id=$id_user'> <img src='images/control_fastforward_blue.png' title='" . __('Next') . "'></a>";
echo "</table>";

// Show graphs
//$from_one_month = date('Y-m-d', strtotime("now - 1 month"));
echo "<table style='width: 100%; padding: 0px'>";
echo "<tr><td class=datos>";
$workunit_by_task = '<div class="pie_frame">' . graph_workunit_user (750, 270, $id_user, $from_one_month, 0) . '</div>';

echo print_container_div('month_report_workunit_by_task', __('Workunit by task'), $workunit_by_task, 'no', true, false);

echo "<tr><td class=datos>";

$workunit_by_project = '<div class="pie_frame">' . graph_workunit_project_user (750, 270, $id_user, $from_one_month, 0, true) . '</div>'; 
echo print_container_div('month_report_workunit_by_project', __('Workunit by project'), $workunit_by_project, 'no', true, false);

echo "</table>";

?>
Ejemplo n.º 3
0
	$invoice_status_ar['paid'] = __("Paid");
	$invoice_status_ar['canceled'] = __("Canceled");
	$table->data[0][4] = print_select ($invoice_status_ar, 'search_invoice_status', $search_invoice_status, '', __("Any"), '', true, 0, false, __('Invoice status'), false, 'width:150px;');
	$form .= '<div class="form_result">';
		$form .= "<div class='divresult_left'>";
			$form .= print_table($table,true);
		$form .= '</div>';
		$form .= "<div class='divform_right'>";
			$form .= "<div class='button-form'>";
				$form .= print_submit_button (__('Search'), "search_btn", false, 'class="sub search"', true);
			$form .= '</div>';
		$form .= '</div>';
	$form .= '</div>';
	$form .= '</form>';
	
	print_container_div("companys_form",__("Invoices form search"),$form, 'open', false, false);
}

$invoices = crm_get_all_invoices ($where_clause, $order_by);

// NO pagination for PDF output
if ($clean_output == 1)
	$config["block_size"] = 5000;

if ($invoices != false) {
	
	$invoices = print_array_pagination ($invoices, "index.php?sec=customers&sec2=operation/invoices/invoice_detail$search_params");
	$url_id_order = 'index.php?sec=customers&sec2=operation/invoices/invoice_detail'.$search_params.'&order_by=bill_id';
	$url_create_order = 'index.php?sec=customers&sec2=operation/invoices/invoice_detail'.$search_params.'&order_by=invoice_create_date';
	switch ($order_by) {
		case "bill_id":
Ejemplo n.º 4
0
function form_search_incident($return = false, $filter = false, $ajax = 0)
{
    include_once "functions_user.php";
    global $config;
    $output = '';
    if (!$filter) {
        $inverse_filter = (bool) get_parameter('search_inverse_filter');
        $search_string = (string) get_parameter('search_string');
        $status = (int) get_parameter('search_status', -10);
        $priority = (int) get_parameter('search_priority', -1);
        $resolution = (int) get_parameter('search_resolution', -1);
        $id_group = (int) get_parameter('search_id_group');
        $id_inventory = (int) get_parameter('search_id_inventory');
        $id_company = (int) get_parameter('search_id_company');
        $search_id_user = (string) get_parameter('search_id_user');
        $search_id_incident_type = (int) get_parameter('search_id_incident_type');
        $date_from = (int) get_parameter("search_from_date");
        $date_start = (string) get_parameter("search_first_date");
        $date_end = (string) get_parameter("search_last_date");
        $search_creator = (string) get_parameter('search_id_creator');
        $search_editor = (string) get_parameter('search_editor');
        $search_closed_by = (string) get_parameter('search_closed_by');
        $group_by_project = (bool) get_parameter('search_group_by_project');
        $sla_state = (int) get_parameter('search_sla_state', 0);
        $id_task = (int) get_parameter('search_id_task', 0);
        $left_sla = (int) get_parameter('search_left_sla', 0);
        $right_sla = (int) get_parameter('search_right_sla', 0);
        $show_hierarchy = (bool) get_parameter('search_show_hierarchy');
        $search_medal = get_parameter('search_medals');
        $name = get_parameter('parent_name');
        $type_fields = incidents_get_type_fields($search_id_incident_type);
        $search_type_field = array();
        foreach ($type_fields as $key => $type_field) {
            $search_type_field[$type_field['id']] = (string) get_parameter('search_type_field_' . $type_field['id']);
        }
    } else {
        $inverse_filter = (bool) $filter['inverse_filter'];
        $search_string = (string) $filter['string'];
        $priority = (int) $filter['priority'];
        $id_group = (int) $filter['id_group'];
        $status = (int) $filter['status'];
        $resolution = (int) $filter['resolution'];
        $id_company = (int) $filter['id_company'];
        $id_inventory = (int) $filter['id_inventory'];
        $search_id_incident_type = (int) $filter['id_incident_type'];
        $search_id_user = (string) $filter['id_user'];
        $date_from = (int) $filter['from_date'];
        $date_start = (string) $filter['first_date'];
        $date_end = (string) $filter['last_date'];
        $search_creator = (string) $filter['id_creator'];
        $search_editor = (string) $filter['editor'];
        $search_closed_by = (string) $filter['closed_by'];
        $group_by_project = (bool) $filter['group_by_project'];
        $sla_state = (int) $filter['sla_state'];
        $id_task = (int) $filter['id_task'];
        $left_sla = (int) $filter['left_sla'];
        $right_sla = (int) $filter['right_sla'];
        $show_hierarchy = (bool) $filter['show_hierarchy'];
        $search_medal = (int) $filter['medals'];
        $name = (string) $filter['parent_name'];
        //This is inventory obj name value !!!
        $type_fields = incidents_get_type_fields($search_id_incident_type);
        $search_type_field = array();
        if ($type_fields) {
            foreach ($type_fields as $key => $type_field) {
                $search_type_field[$type_field['id']] = (string) $filter['type_field_' . $type_field['id']];
            }
        }
    }
    /* No action is set, so the form will be sent to the current page */
    $table = new stdclass();
    $table->width = "100%";
    $table->class = "search-table-button";
    $table->data = array();
    // Filter text
    $table->data[0][0] = print_input_text('search_string', $search_string, '', 30, 100, true, __('Text filter'));
    // Status
    $available_status = get_indicent_status();
    $available_status[-10] = __("Not closed");
    $table->data[0][1] = print_select($available_status, 'search_status', $status, '', __('Any'), 0, true, false, true, __('Status'));
    // Groups
    $groups = users_get_groups_for_select($config['id_user'], "IW", true, true);
    $table->data[0][2] = print_select($groups, 'search_id_group', $id_group, '', '', '', true, false, false, __('Group'));
    // Check Box
    $table->data[0][3] = print_checkbox_extended('search_show_hierarchy', 1, $show_hierarchy, false, '', '', true, __('Show hierarchy'));
    $table_advanced = new stdclass();
    $table_advanced->width = "100%";
    $table_advanced->class = "search-table-button";
    $params_owner = array();
    $params_owner['input_id'] = 'text-search_id_user';
    $params_owner['input_name'] = 'search_id_user';
    $params_owner['input_value'] = $search_id_user;
    $params_owner['title'] = __('Owner');
    $params_owner['attributes'] = 'style="width: 210px;"';
    $params_owner['return'] = true;
    $table_advanced->data[1][0] = user_print_autocomplete_input($params_owner);
    $params_editor = array();
    $params_editor['input_id'] = 'text-search_editor';
    $params_editor['input_name'] = 'search_editor';
    $params_editor['input_value'] = $search_editor;
    $params_editor['title'] = __('Editor');
    $params_editor['attributes'] = 'style="width: 210px;"';
    $params_editor['return'] = true;
    $table_advanced->data[1][1] = user_print_autocomplete_input($params_editor);
    $params_closed_by = array();
    $params_closed_by['input_id'] = 'text-search_closed_by';
    $params_closed_by['input_name'] = 'search_closed_by';
    $params_closed_by['input_value'] = $search_closed_by;
    $params_closed_by['title'] = __('Closed by');
    $params_closed_by['attributes'] = 'style="width: 210px;"';
    $params_closed_by['return'] = true;
    $table_advanced->data[1][2] = user_print_autocomplete_input($params_closed_by);
    $params_creator = array();
    $params_creator['input_id'] = 'text-search_id_creator';
    $params_creator['input_name'] = 'search_id_creator';
    $params_creator['input_value'] = $search_creator;
    $params_creator['title'] = __('Creator');
    $params_creator['attributes'] = 'style="width: 210px;"';
    $params_creator['return'] = true;
    $table_advanced->data[1][3] = user_print_autocomplete_input($params_creator);
    $table_advanced->data[2][0] = print_select(get_priorities(), 'search_priority', $priority, '', __('Any'), -1, true, false, false, __('Priority'), false);
    $table_advanced->data[2][1] = print_select(get_incident_resolutions(), 'search_resolution', $resolution, '', __('Any'), -1, true, false, false, __('Resolution'), false);
    //$name = $id_inventory ? get_inventory_name ($id_inventory) : '';
    //Parent name
    $table_advanced->data[2][2] = print_input_text_extended("parent_name", $name, "text-parent_name", '', 20, 0, false, "", "class='inventory_obj_search' style='width:165px !important;'", true, false, __('Inventory object'), false, true);
    $table_advanced->data[2][2] .= "&nbsp;&nbsp;" . print_image("images/add.png", true, array("onclick" => "show_inventory_search('','','','','','','','','','', '', '')", "style" => "cursor: pointer"));
    $table_advanced->data[2][2] .= "&nbsp;&nbsp;" . print_image("images/cross.png", true, array("onclick" => "cleanParentInventory()", "style" => "cursor: pointer"));
    $table_advanced->data[2][2] .= print_input_hidden('id_parent', $id_inventory, true);
    $table_advanced->data[2][3] = get_last_date_control($date_from, 'search_from_date', __('Date'), $date_start, 'search_first_date', __('Created from'), $date_end, 'search_last_date', __('Created to'));
    $table_advanced->rowspan[2][3] = 2;
    $table_advanced->cellstyle[2][3] = "vertical-align:top;";
    if (!get_standalone_user($config["id_user"])) {
        $table_advanced->data[4][0] = print_select(get_companies(), 'search_id_company', $id_company, '', __('Any'), 0, true, false, false, __('Company'));
    }
    $table_advanced->data[4][1] = print_select(get_incident_types(), 'search_id_incident_type', $search_id_incident_type, 'javascript:change_type_fields_table(\'' . __('Custom field') . '\');', __('Any'), 0, true, false, false, __('Ticket type'));
    $table_advanced->data[4][3] = print_checkbox_extended('search_group_by_project', 1, $group_by_project, false, '', '', true, __('Group by project/task'));
    $sla_states = array();
    $sla_states[1] = __('SLA is fired');
    $sla_states[2] = __('SLA is not fired');
    $table_advanced->data[5][0] = print_select($sla_states, 'search_sla_state', $sla_state, '', __('Any'), 0, true, false, false, __('SLA'));
    $table_advanced->data[5][1] = combo_task_user_participant($config["id_user"], 0, $id_task, true, __("Task"), 'search_id_task');
    $table_advanced->data[5][2] = "<div>";
    $table_advanced->data[5][2] .= "<div style='display: inline-block;'>" . print_input_text('search_left_sla', $left_sla, '', 8, 0, true, __('SLA > (%)'), false) . "</div>";
    $table_advanced->data[5][2] .= "&nbsp;<div style='display: inline-block;'>" . print_input_text('search_right_sla', $right_sla, '', 8, 0, true, __('SLA < (%)'), false) . "</div>";
    $table_advanced->data[5][2] .= "</div>";
    $medals = array();
    $medals[1] = __('Gold medals');
    $medals[2] = __('Black medals');
    $table_advanced->data[5][3] = print_select($medals, 'search_medals', $search_medal, '', __('Any'), 0, true, false, false, __('Medals'));
    $table_type_fields = new StdClass();
    $table_type_fields->width = "100%";
    $table_type_fields->class = "search-table";
    $table_type_fields->data = array();
    $table_type_fields->align[0] = 'left';
    //Print custom field data
    $column = 0;
    $row = 0;
    if ($type_fields) {
        foreach ($type_fields as $key => $type_field) {
            $data = $search_type_field[$type_field['id']];
            switch ($type_field['type']) {
                case "text":
                    $input = print_input_text('search_type_field_' . $type_field['id'], $data, '', 30, 30, true, $type_field['label']);
                    break;
                case "combo":
                    $combo_values = explode(",", $type_field['combo_value']);
                    $values = array();
                    foreach ($combo_values as $value) {
                        $values[$value] = $value;
                    }
                    $input = print_select($values, 'search_type_field_' . $type_field['id'], $data, '', __('Any'), '', true, false, false, $type_field['label']);
                    break;
                case "linked":
                    $linked_values = explode(",", $type_field['linked_value']);
                    $values = array();
                    foreach ($linked_values as $value) {
                        $value_without_parent = preg_replace("/^.*\\|/", "", $value);
                        $values[$value_without_parent] = $value_without_parent;
                        $has_childs = get_db_all_rows_sql("SELECT * FROM tincident_type_field WHERE parent=" . $type_field['id']);
                        if ($has_childs) {
                            $i = 0;
                            foreach ($has_childs as $child) {
                                if ($i == 0) {
                                    $childs = $child['id'];
                                } else {
                                    $childs .= ',' . $child['id'];
                                }
                                $i++;
                            }
                            $childs = "'" . $childs . "'";
                            $script = 'javascript:change_linked_type_fields_table(' . $childs . ',' . $type_field['id'] . ');';
                        } else {
                            $script = '';
                        }
                    }
                    $input = print_select($values, 'search_type_field_' . $type_field['id'], $data, $script, __('Any'), '', true, false, false, $type_field['label']);
                    break;
                case "numeric":
                    $input = print_input_number('search_type_field_' . $type_field['id'], $data, 1, 1000000, '', true, $type_field['label']);
                    break;
                case "date":
                    $input = print_input_date('search_type_field_' . $type_field['id'], $data, '', '', '', true, $type_field['label']);
                    break;
                case "textarea":
                    $input = print_input_text('search_type_field_' . $type_field['id'], $data, '', 30, 30, true, $type_field['label']);
                    break;
            }
            $table_type_fields->data[$row][$column] = $input;
            if ($column >= 3) {
                $column = 0;
                $row++;
            } else {
                $column++;
            }
        }
    }
    $table_advanced->colspan[6][0] = 4;
    if ($table_type_fields->data) {
        $table_type_fields_html = print_table($table_type_fields, true);
    }
    if (!isset($table_type_fields_html)) {
        $table_type_fields_html = '';
    }
    $table_advanced->data[6][0] = "<div id='table_type_fields'>" . $table_type_fields_html . "</div>";
    $table->colspan['row_advanced'][0] = 5;
    $table->data['row_advanced'][0] = print_container_div('advanced_parameters_incidents_search', __('Advanced filter'), print_table($table_advanced, true), 'closed', true, true);
    //Store serialize filter
    serialize_in_temp($filter, $config["id_user"]);
    $table->colspan['button'][0] = 2;
    $table->colspan['button'][2] = 2;
    $table->data['button'][0] = '</br>';
    $table->data['button'][2] = print_submit_button(__('Filter'), 'search', false, 'class="sub search"', true);
    $table->data['button'][2] .= print_input_hidden('search_inverse_filter', (int) $inverse_filter, true);
    $table->data['button'][2] .= print_submit_button(__('Inverse filter'), 'submit_inverse_filter', false, 'class="sub search"', true);
    $table->data['button'][2] .= print_button(__('Export to CSV'), '', false, 'window.open(\'' . 'include/export_csv.php?export_csv_tickets=1' . '\')', 'class="sub"', true);
    // Inverse filter info
    $output .= '<div id="inverse_filter_info" style="display: ' . ($inverse_filter ? 'block' : 'none') . ';">';
    $output .= ui_print_message(__('Inverse filter enabled'), 'suc', 'style="display:inline;padding-top: 15px;padding-bottom: 15px;"', true, 'h3', false);
    $output .= print_help_tip(__('The result will be the items which doesn\'t match the filters') . '. ' . __('The select controls with \'Any\' or \'All\' selected will be ignored'), true);
    $output .= '<br /><br />';
    $output .= '</div>';
    if ($ajax) {
        $output .= '<form id="search_incident_form" method="post">';
    } else {
        $output .= '<form id="search_incident_form" method="post" onsubmit="incidents_gift();return false">';
    }
    //~ $output .= '<form id="search_incident_form" method="post">';
    $output .= '<div class="divresult_incidents">' . print_table($table, true) . '</div>';
    $output .= '</form>';
    echo "<div class= 'dialog ui-dialog-content' id='search_inventory_window'></div>";
    // WARNING: Important for the inverse filter feature
    // Change the search_inverse_filter value when the form is submitted using the submit_inverse_filter or the search buttons
    // Show or hide the inverse filter info
    $output .= '<script type="text/javascript">';
    $output .= '$(document).ready(function () {';
    $output .= 'var inverseFilterInfo = document.getElementById("inverse_filter_info");';
    $output .= 'var filterForm = document.getElementById("search_incident_form");';
    $output .= 'var filterBtn = filterForm.elements["search"];';
    $output .= 'var inverseFilterBtn = filterForm.elements["submit_inverse_filter"];';
    $output .= 'var inverseFilter = filterForm.elements["search_inverse_filter"];';
    $output .= '$(filterBtn).click(function (e) {';
    $output .= 'inverseFilter.value = 0;';
    $output .= '$(inverseFilterInfo).hide();';
    $output .= '});';
    $output .= '$(inverseFilterBtn).click(function (e) {';
    $output .= 'inverseFilter.value = 1;';
    $output .= '$(inverseFilterInfo).show();';
    $output .= '});';
    $output .= '});';
    $output .= '</script>';
    if ($return) {
        return $output;
    }
    echo $output;
}
			$incident_custom_fields .= "<tr>";
			$incident_custom_fields .= "<td>";	
				$incident_custom_fields .= "<table>";
				$incident_custom_fields .= "<tr>";
				$incident_custom_fields .= "<td>".clean_output_breaks($f["data"])."</td>";
				$incident_custom_fields .= "</tr>";
				$incident_custom_fields .= "</table>";
			$incident_custom_fields .= "</td>";
			$incident_custom_fields .= "</tr>";	
		}

	}

	$incident_custom_fields .= "</table>";

	$left_side .= print_container_div('incident_custom_fields', __('Custom fields'), $incident_custom_fields, 'open',true, true, '' , 'no_border',4, 'less_widht');
}

/**** DASHBOARD RIGHT SIDE ****/

// People
//$incident_users .= "<table style='width: 100%;'>";
$incident_users = "<tr>";

$long_name_creator = get_db_value_filter ("nombre_real", "tusuario", array("id_usuario" => $incident["id_creator"]));
$avatar_creator = get_db_value_filter ("avatar", "tusuario", array("id_usuario" => $incident["id_creator"]));

$incident_users .= "<td>";
$creator = $incident['id_creator'];
$options["onclick"]="openUserInfo(\"$creator\")";
if($avatar_creator){
Ejemplo n.º 6
0
if ($has_im) {
	//Parent ticket
	$table->data[1][2] = print_input_text ('search_parent', $parent_name, '', 10, 100, true, __('Parent ticket'));
	$table->data[1][2] .= print_input_hidden ('id_parent', $id_parent, true);
	$table->data[1][2] .= print_image("images/cross.png", true, array("onclick" => "clean_parent_field()", "style" => "cursor: pointer"));
	//Delete tickets
	$table->data[1][3] = "<b>" . __("Delete all tickets") . "</b>";
	$table->data[1][3] .= print_image("images/cross.png", true, array("onclick" => "delete_massive_tickets()", "style" => "cursor: pointer"));
}

$table->data[2][0] = "<div class='button-form'>" . print_submit_button (__('Update'), 'massive_update', false, 'class="sub next"', true) . "</div>";
$table->colspan[2][0] = 4;

$massive_oper_incidents = print_table ($table, true);

echo print_container_div('massive_oper_incidents', __('Massive operations over selected items'), $massive_oper_incidents, 'closed', true, '20px');

echo "<div class= 'dialog ui-dialog-content' title='".__("Tickets")."' id='inventory_search_window'></div>";
?>

<script type="text/javascript" src="include/js/jquery.metadata.js"></script>
<script type="text/javascript" src="include/languages/date_<?php echo $config['language_code']; ?>.js"></script>
<script type="text/javascript" src="include/js/integria_incident_search.js"></script>
<script type="text/javascript" src="include/js/jquery.ui.autocomplete.js"></script>
<script type="text/javascript" src="include/js/integria_date.js"></script>

<script type="text/javascript">

// Datepicker
add_ranged_datepicker ("#text-search_first_date", "#text-search_last_date", null);
Ejemplo n.º 7
0
$roles .= "<th >".__('Description');
$roles .= "<th>".__('Cost');

$sql1='SELECT * FROM trole ORDER BY name';
$result = process_sql($sql1);

foreach ($result as $row) {
	$roles .= "<tr>";
	//$roles .= "<td class='no_border size_min'></td>";
	$roles .= "<td >".$row["name"];
	$roles .= '<td >'.$row["description"];
	$roles .= '<td>'.$row["cost"];
}
$roles .= "</table>";

print_container_div('people_roles', __('Available roles'), $roles, 'closed', false, '10px', '', '', 2, 'no_border_bottom');

echo "</div>";
echo "<div class= 'dialog ui-dialog-content' title='".__("Delete")."' id='item_delete_window'></div>";
?>

<script type="text/javascript" src="include/js/jquery.ui.autocomplete.js"></script>
<script type="text/javascript" src="include/js/integria.js"></script>
<script src="include/js/jquery.validate.js"></script>
<script type="text/javascript" src="include/js/jquery.validation.functions.js"></script>
<script type="text/javascript" >
$(document).ready (function () {
	$("#textarea-description").TextAreaResizer ();
	
	var idUser = "******";
	var idProject = "<?php echo $id_project ?>";
Ejemplo n.º 8
0
	$html .= 	"<ul></ul>";
	$html .= "</div>";

	$table_description = new stdClass;
	$table_description->width = '100%';
	$table_description->id = 'incident_file_description';
	$table_description->class = 'search-table-button';
	$table_description->data = array();
	$table_description->data[0][0] = print_textarea ("file_description", 3, 40, '', '', true, __('Description'));
	$table_description->data[1][0] = print_submit_button (__('Add'), 'crt_btn', false, 'class="sub create"', true);
	$html .= "<div id='file_description_table_hook' style='display:none;'>";
	$html .= print_table($table_description, true);
	$html .= "</div>";

	$table->colspan[11][0] = 4;
	$table->data[11][0] = print_container_div('file_upload_container', __('File upload'), $html, 'closed', true, true);
}

if ($create_incident) {
	$button = "<div class='button-form'>";
	$button .= print_input_hidden ('action', 'insert', true);
	if ((give_acl ($config["id_user"], 0, "IW")) || (give_acl ($config['id_user'], $id_grupo, "SI"))) {
		$button .= print_submit_button (__('Create'), 'action2', false, 'class="sub create"', true);
	}
	$button .= '</div>';
} else {
	$button = "<div class='button-form'>";
	$button .= print_input_hidden ('id', $id, true);
	$button .= print_input_hidden ('action', 'update', true);
	$button .= print_submit_button (__('Update'), 'action2', false, 'class="sub upd"', true);
	$button .= '</div>';
Ejemplo n.º 9
0
if ($leads_creation !== false) {

	$area_width = 400;
	$area_height = 250;

	if ($clean_output) {
		$area_width = 240;
		$area_height = 155;		
	}

	$leads_creation_content = area_graph($config['flash_charts'], $leads_creation, $area_width, $area_height, "#2179B1", '', '', '', "", "", $config["base_url"], "", '', '', '', $ttl);
} else {
	$leads_creation_content = __('No data to show');
}

$leads_creation_content = '<div class="pie_frame"><br>' . $leads_creation_content . '</div>';


echo "<div style='clear: both;'>";
	echo print_container_div('funnel', __('Leads Funnel'), $leads_country_content_funnel, 'no', true, true, "container_simple_title", "container_simple_div");
	echo print_container_div('conversion_rate', $container_title, $leads_conversion_rate, 'no', true, true, "container_simple_title", "container_simple_div");
	echo print_container_div('container_pie_graphs leads_per_country', __('Leads per country'), $leads_country_content, 'no', true, true, "container_simple_title", "container_simple_div");
echo "</div>";

echo "<div style='clear: both;'>";
	echo print_container_div('container_pie_graphs users_per_lead', __('Users per lead'), $leads_user_content, 'no', true, true, "container_simple_title", "container_simple_div");
	echo print_container_div('top_10_sales', __('Top 10 estimated sales'), $leads_sales_content, 'no', true, true, "container_simple_title", "container_simple_div");
	echo print_container_div('new_leads', __('New leads'), $leads_creation_content, 'no', true, true, "container_simple_title", "container_simple_div");
echo "</div>";
?>
Ejemplo n.º 10
0
function crm_print_company_projects_tree($projects)
{
    require_once "include/functions_tasks.php";
    //~ echo '<table width="100%" cellpadding="0" cellspacing="0" border="0px" class="result_table listing" id="incident_search_result_table">';
    $img = print_image("images/input_create.png", true, array("style" => 'vertical-align: middle;', "id" => $img_id));
    $img_project = print_image("images/note.png", true, array("style" => 'vertical-align: middle;'));
    foreach ($projects as $project) {
        $project_name = get_db_value('name', 'tproject', 'id', $project['id_project']);
        //print project name
        //~ echo '<tr><td colspan="10" valign="top">';
        //~ echo "
        //~ <a onfocus='JavaScript: this.blur()' href='javascript: show_detail(\"" . $project['id_project']. "\")'>" .
        //~ $img . "&nbsp;" . $img_project ."&nbsp;" .  safe_output($project_name)."&nbsp;</a>"."&nbsp;&nbsp;";
        //~ echo '</td></tr>';
        $id_project = $project['id_project'];
        $people_inv = get_db_sql("SELECT COUNT(DISTINCT id_user) FROM trole_people_task, ttask WHERE ttask.id_project={$id_project} AND ttask.id = trole_people_task.id_task;");
        $total_hr = get_project_workunit_hours($id_project);
        $total_planned = get_planned_project_workunit_hours($id_project);
        $project_data = get_db_row('tproject', 'id', $id_project);
        $start_date = $project_data["start"];
        $end_date = $project_data["end"];
        // Project detail
        $table_detail = "<table class='advanced_details_table alternate'>";
        $table_detail .= "<tr>";
        $table_detail .= '<td><b>' . __('Start date') . ' </b>';
        $table_detail .= "</td><td>";
        $table_detail .= $start_date;
        $table_detail .= "</td></tr>";
        $table_detail .= "<tr>";
        $table_detail .= '<td><b>' . __('End date') . ' </b>';
        $table_detail .= "</td><td>";
        $table_detail .= $end_date;
        $table_detail .= "</td></tr>";
        $table_detail .= "<tr>";
        $table_detail .= '<td><b>' . __('Total people involved') . ' </b>';
        $table_detail .= "</td><td>";
        $table_detail .= $people_inv;
        $table_detail .= "</td></tr>";
        //People involved (avatars)
        //Get users with tasks
        $sql = sprintf("SELECT DISTINCT id_user FROM trole_people_task, ttask WHERE ttask.id_project= %d AND ttask.id = trole_people_task.id_task", $id_project);
        $users_aux = get_db_all_rows_sql($sql);
        if (empty($users_aux)) {
            $users_aux = array();
        }
        $users_involved = array();
        foreach ($users_aux as $ua) {
            $users_involved[] = $ua['id_user'];
        }
        //Delete duplicated items
        if (empty($users_involved)) {
            $users_involved = array();
        } else {
            $users_involved = array_unique($users_involved);
        }
        $people_involved = "<div style='padding-bottom: 20px;'>";
        foreach ($users_involved as $u) {
            $avatar = get_db_value("avatar", "tusuario", "id_usuario", $u);
            if ($avatar != "") {
                $people_involved .= "<img src='images/avatars/" . $avatar . ".png' width=40 height=40 onclick='openUserInfo(\"{$u}\")' title='" . $u . "'/>";
            } else {
                $people_involved .= "<img src='images/avatars/avatar_notyet.png' width=40 height=40 onclick='openUserInfo(\"{$u}\")' title='" . $u . "'/>";
            }
        }
        $people_involved .= "</div>";
        $table_detail .= "<tr><td colspan='10'>";
        $table_detail .= $people_involved;
        $table_detail .= "</td></tr>";
        $table_detail .= "<tr>";
        $table_detail .= '<td><b>' . __('Total workunit (hr)') . ' </b>';
        $table_detail .= "</td><td>";
        $table_detail .= $total_hr . " (" . format_numeric($total_hr / $config["hours_perday"]) . " " . __("days") . ")";
        $table_detail .= "</td></tr>";
        $table_detail .= "<tr>";
        $table_detail .= '<td><b>' . __('Planned workunit (hr)') . ' </b>';
        $table_detail .= "</td><td>";
        $table_detail .= $total_planned . " (" . format_numeric($total_planned / $config["hours_perday"]) . " " . __("days") . ")";
        $table_detail .= "</td></tr>";
        $table_detail .= "</table>";
        $class = $project['id_project'] . "-project";
        $tr_status = 'class="' . $class . '"';
        //~ echo '<tr '.$tr_status.'><td>';
        print_container_div("project_" . $project['id_project'], $project_name, $table_detail, 'closed', false, true, '', '', 1, '', 'width:32%; float:left;');
        //~ echo '</td></tr>';
    }
    //~ echo '</table>';
}
Ejemplo n.º 11
0
/**
 * Print a table with statistics of a list of incidents.
 *
 * @param array List of incidents to get stats.
 * @param bool Whether to return an output string or echo now (optional, echo by default).
 *
 * @return Incidents stats if return parameter is true. Nothing otherwise
 */
function print_incidents_stats_simply($incidents, $return = false, $simple_mode = false)
{
    global $config;
    require_once $config["homedir"] . "/include/functions_graph.php";
    $pdf_output = (int) get_parameter('pdf_output', 0);
    $ttl = $pdf_output + 1;
    // Max graph legend string length (without the '...')
    $max_legend_strlen = 25;
    // Necessary for flash graphs
    include_flash_chart_script();
    // TODO: Move this function to function_graphs to encapsulate flash
    // chart script inclusion or make calls to functions_graph when want
    // print a flash chart
    $output = '';
    $total = sizeof($incidents);
    $opened = 0;
    $total_hours = 0;
    $total_workunits = 0;
    $total_lifetime = 0;
    $max_lifetime = 0;
    $oldest_incident = false;
    $scoring_sum = 0;
    $scoring_valid = 0;
    if ($incidents === false) {
        $incidents = array();
    }
    $assigned_users = array();
    $creator_users = array();
    $submitter_label = "";
    $user_assigned_label = "";
    $incident_id_array = array();
    //Initialize incident status array
    $incident_status = array();
    $incident_status[STATUS_NEW] = 0;
    $incident_status[STATUS_UNCONFIRMED] = 0;
    $incident_status[STATUS_ASSIGNED] = 0;
    $incident_status[STATUS_REOPENED] = 0;
    $incident_status[STATUS_VERIFIED] = 0;
    $incident_status[STATUS_RESOLVED] = 0;
    $incident_status[STATUS_PENDING_THIRD_PERSON] = 0;
    $incident_status[STATUS_CLOSED] = 0;
    //Initialize priority array
    $incident_priority = array();
    $incident_priority[PRIORITY_INFORMATIVE] = 0;
    $incident_priority[PRIORITY_LOW] = 0;
    $incident_priority[PRIORITY_MEDIUM] = 0;
    $incident_priority[PRIORITY_SERIOUS] = 0;
    $incident_priority[PRIORITY_VERY_SERIOUS] = 0;
    $incident_priority[PRIORITY_MAINTENANCE] = 0;
    //Initialize status timing array
    $incident_status_timing = array();
    $incident_status_timing[STATUS_NEW] = 0;
    $incident_status_timing[STATUS_UNCONFIRMED] = 0;
    $incident_status_timing[STATUS_ASSIGNED] = 0;
    $incident_status_timing[STATUS_REOPENED] = 0;
    $incident_status_timing[STATUS_VERIFIED] = 0;
    $incident_status_timing[STATUS_RESOLVED] = 0;
    $incident_status_timing[STATUS_PENDING_THIRD_PERSON] = 0;
    $incident_status_timing[STATUS_CLOSED] = 0;
    //Initialize users time array
    $users_time = array();
    //Initialize groups time array
    $groups_time = array();
    foreach ($incidents as $incident) {
        $inc_stats = incidents_get_incident_stats($incident["id_incidencia"]);
        if ($incident['actualizacion'] != '0000-00-00 00:00:00') {
            if (isset($inc_stats[INCIDENT_METRIC_TOTAL_TIME])) {
                $lifetime = $inc_stats[INCIDENT_METRIC_TOTAL_TIME];
                if ($lifetime > $max_lifetime) {
                    $oldest_incident = $incident;
                    $max_lifetime = $lifetime;
                }
                $total_lifetime += $lifetime;
            }
        }
        //Complete incident status timing array
        if (isset($inc_stats[INCIDENT_METRIC_STATUS])) {
            foreach ($inc_stats[INCIDENT_METRIC_STATUS] as $key => $value) {
                $incident_status_timing[$key] += $value;
            }
        }
        //fill users time array
        if (isset($inc_stats[INCIDENT_METRIC_USER])) {
            foreach ($inc_stats[INCIDENT_METRIC_USER] as $user => $time) {
                if (!isset($users_time[$user])) {
                    $users_time[$user] = $time;
                } else {
                    $users_time[$user] += $time;
                }
            }
        }
        //Inidents by group time
        if (isset($inc_stats[INCIDENT_METRIC_GROUP])) {
            foreach ($inc_stats[INCIDENT_METRIC_GROUP] as $key => $time) {
                if (!isset($groups_time[$key])) {
                    $groups_time[$key] = $time;
                } else {
                    $groups_time[$key] += $time;
                }
            }
        }
        //Get only id from incident filter array
        //used for filter in some functions
        array_push($incident_id_array, $incident['id_incidencia']);
        // Take count of assigned / creator users
        if (isset($assigned_users[$incident["id_usuario"]])) {
            $assigned_users[$incident["id_usuario"]]++;
        } else {
            $assigned_users[$incident["id_usuario"]] = 1;
        }
        if (isset($creator_users[$incident["id_creator"]])) {
            $creator_users[$incident["id_creator"]]++;
        } else {
            $creator_users[$incident["id_creator"]] = 1;
        }
        // Scoring avg.
        if ($incident["score"] > 0) {
            $scoring_valid++;
            $scoring_sum = $scoring_sum + $incident["score"];
        }
        $hours = get_incident_workunit_hours($incident['id_incidencia']);
        $workunits = get_incident_workunits($incident['id_incidencia']);
        $total_hours += $hours;
        $total_workunits = $total_workunits + sizeof($workunits);
        //Open incidents
        if ($incident["estado"] != 7) {
            $opened++;
        }
        //Incidents by status
        $incident_status[$incident["estado"]]++;
        //Incidents by priority
        $incident_priority[$incident["prioridad"]]++;
    }
    $closed = $total - $opened;
    $opened_pct = 0;
    $mean_work = 0;
    $mean_lifetime = 0;
    if ($total != 0) {
        $opened_pct = format_numeric($opened / $total * 100);
        $mean_work = format_numeric($total_hours / $total, 2);
    }
    $mean_lifetime = $total_lifetime / $total;
    // Get avg. scoring
    if ($scoring_valid > 0) {
        $scoring_avg = format_numeric($scoring_sum / $scoring_valid);
    } else {
        $scoring_avg = "N/A";
    }
    // Get incident SLA compliance
    $sla_compliance = get_sla_compliance($incidents);
    //Create second table
    // Find the 5 most active users (more hours worked)
    $most_active_users = array();
    if ($incident_id_array) {
        $most_active_users = get_most_active_users(8, $incident_id_array);
    }
    $users_label = '';
    $users_data = array();
    foreach ($most_active_users as $user) {
        $users_data[$user['id_user']] = $user['worked_hours'];
    }
    // Remove the items with no value
    foreach ($users_data as $key => $value) {
        if (!$value || $value <= 0) {
            unset($users_data[$key]);
        }
    }
    if (empty($most_active_users) || empty($users_data)) {
        $users_label = "<div class='container_adaptor_na_graphic2'>";
        $users_label .= graphic_error(false);
        $users_label .= __("N/A");
        $users_label .= "</div>";
    } else {
        arsort($users_data);
        $users_label .= pie3d_graph($config['flash_charts'], $users_data, 300, 150, __('others'), $config["base_url"], "", $config['font'], $config['fontsize'], $ttl);
    }
    // Find the 5 most active incidents (more worked hours)
    $most_active_incidents = get_most_active_incidents(5, $incident_id_array);
    $incidents_label = '';
    foreach ($most_active_incidents as $incident) {
        $incidents_data[$incident['id_incidencia']] = $incident['worked_hours'];
    }
    // Remove the items with no value
    foreach ($incidents_data as $key => $value) {
        if (!$value || $value <= 0) {
            unset($incidents_data[$key]);
        }
    }
    if (empty($most_active_incidents) || empty($incidents_data)) {
        $incidents_label .= graphic_error(false);
        $incidents_label .= __("N/A");
        $incidents_label = "<div class='container_adaptor_na_graphic'>" . $incidents_label . "</div>";
    } else {
        arsort($incidents_data);
        $incidents_label .= pie3d_graph($config['flash_charts'], $incidents_data, 300, 150, __('others'), $config["base_url"], "", $config['font'], $config['fontsize'], $ttl);
    }
    // TOP X creator users
    $creator_assigned_data = array();
    foreach ($creator_users as $clave => $valor) {
        $creator_assigned_data["{$clave} ({$valor})"] = $valor;
    }
    if (empty($creator_assigned_data)) {
        $submitter_label = "<div style='width:300px; height:150px;'>";
        $submitter_label .= graphic_error(false);
        $submitter_label .= __("N/A");
        $submitter_label .= "</div>";
    } else {
        arsort($creator_assigned_data);
        $submitter_label .= pie3d_graph($config['flash_charts'], $creator_assigned_data, 300, 150, __('others'), $config["base_url"], "", $config['font'], $config['fontsize'], $ttl);
    }
    // TOP X scoring users
    $scoring_label = "";
    $top5_scoring = get_best_incident_scoring(5, $incident_id_array);
    foreach ($top5_scoring as $submitter) {
        $scoring_data[$submitter["id_usuario"]] = $submitter["total"];
    }
    if (empty($top5_scoring)) {
        $scoring_label .= graphic_error(false);
        $scoring_label .= __("N/A");
        $scoring_label = "<div class='container_adaptor_na_graphic2'>" . $scoring_label . "</div>";
    } else {
        arsort($scoring_data);
        $scoring_label .= pie3d_graph($config['flash_charts'], $scoring_data, 300, 150, __('others'), $config["base_url"], "", $config['font'], $config['fontsize'], $ttl);
    }
    // TOP X assigned users
    $user_assigned_data = array();
    foreach ($assigned_users as $clave => $valor) {
        $user_assigned_data["{$clave} ({$valor})"] = $valor;
    }
    if (empty($user_assigned_data)) {
        $user_assigned_label = "<div style='width:300px; height:150px;'>";
        $user_assigned_label .= graphic_error(false);
        $user_assigned_label .= __("N/A");
        $user_assigned_label .= "</div>";
    } else {
        arsort($user_assigned_data);
        $user_assigned_label .= pie3d_graph($config['flash_charts'], $user_assigned_data, 300, 150, __('others'), $config["base_url"], "", $config['font'], $config['fontsize'], $ttl);
    }
    // Show graph with incidents by group
    foreach ($incidents as $incident) {
        $grupo = safe_output(dame_grupo($incident["id_grupo"]));
        if (strlen($grupo) > $max_legend_strlen) {
            $grupo = substr($grupo, 0, $max_legend_strlen) . "...";
        }
        if (!isset($incident_group_data[$grupo])) {
            $incident_group_data[$grupo] = 0;
        }
        $incident_group_data[$grupo] = $incident_group_data[$grupo] + 1;
    }
    arsort($incident_group_data);
    // Show graph with incidents by source group
    foreach ($incidents as $incident) {
        $grupo_src = safe_output(dame_grupo($incident["id_group_creator"]));
        if (strlen($grupo_src) > $max_legend_strlen) {
            $grupo_src = substr($grupo_src, 0, $max_legend_strlen) . "...";
        }
        if (!isset($incident_group_data2[$grupo_src])) {
            $incident_group_data2[$grupo_src] = 0;
        }
        $incident_group_data2[$grupo_src] = $incident_group_data2[$grupo_src] + 1;
    }
    arsort($incident_group_data2);
    // Show graph with tickets open/close histogram
    $ticket_oc_graph = '<div class="pie_frame">' . graph_ticket_oc_histogram($incidents, 650, 250, $ttl) . "</div>";
    $container_title = __("Ticket Open/Close histogram");
    $container_ticket_oc = print_container_div('container_ticket_oc', $container_title, $ticket_oc_graph, 'open', true, true, "container_simple_title", "container_simple_div");
    // Show graph with tickets open/close histogram
    $ticket_activity_graph = '<div class="pie_frame">' . graph_ticket_activity_calendar($incidents) . "</div>";
    $container_title = __("Ticket activity");
    $container_ticket_activity = print_container_div('container_ticket_activity', $container_title, $ticket_activity_graph, 'open', true, true, "container_simple_title", "container_simple_div");
    //Print first table
    $output .= "<table class='listing'>";
    $output .= "<tr>";
    $output .= "<th>" . __("Metric") . "</th>";
    $output .= "<th>" . __("Value") . "</th>";
    $output .= "</tr>";
    $output .= "<tr>";
    $output .= "<td><strong>" . __('Total tickets') . "</strong></td>";
    $output .= "<td>";
    $output .= $total;
    $output .= "</td>";
    $output .= "</tr>";
    $output .= "<tr>";
    $output .= "<td><strong>" . __('Avg. life time') . "</strong></td>";
    $output .= "<td>";
    $output .= format_numeric($mean_lifetime / 86400, 2) . " " . __("Days");
    $output .= "</td>";
    $output .= "</tr>";
    $output .= "<tr>";
    $output .= "<td><strong>";
    $output .= __('Avg. work time');
    $output .= "</strong></td>";
    $output .= "<td>" . $mean_work . ' ' . __('Hours') . "</td>";
    $output .= "</tr>";
    $output .= "<tr>";
    $output .= "<td><strong>";
    $output .= __('Avg. Scoring');
    $output .= "</strong></td>";
    $output .= "<td>" . $scoring_avg . "</td>";
    $output .= "<tr>";
    $output .= "<td><strong>";
    $output .= __('Total work time');
    $output .= "</strong></td>";
    $output .= "<td>" . $total_hours . " " . __("Hours") . "</td>";
    $output .= "</tr>";
    $output .= "<tr>";
    $output .= "<td><strong>";
    $output .= __('Total work units');
    $output .= "</strong></td>";
    $output .= "<td>" . $total_workunits . "</td>";
    $output .= "</tr></table>";
    $container_title = __("Tickets statistics");
    $container_incident_statistics = print_container_div('container_incident_statistics', $container_title, $output, 'no', true, true, "container_simple_title", "container_simple_div");
    $output = "<div class='pie_frame'>" . $incidents_label . "</div>";
    $container_title = __("Top 5 active tickets");
    $container_top5_incidents = print_container_div('container_pie_graphs container_top5_incidents', $container_title, $output, 'no', true, true, "container_simple_title", "container_simple_div");
    if ($incidents) {
        $output = graph_incident_statistics_sla_compliance($incidents, 300, 150, $ttl);
    } else {
        $output = "<div style='width:300px; height:150px;'>";
        $output .= graphic_error(false);
        $output .= __("N/A");
        $output .= "</div>";
    }
    $output = "<div class='container_adaptor_graphic'>" . $output . "</div>";
    $output = "<div class='pie_frame'>" . $output . "</div>";
    $container_title = __("SLA compliance");
    $container_sla_compliance = print_container_div('container_pie_graphs container_sla_compliance', $container_title, $output, 'no', true, true, "container_simple_title", "container_simple_div");
    $status_aux = "<table class='listing' style=''>";
    $status_aux .= "<tr>";
    $status_aux .= "<th><strong>" . __("Status") . "</strong></th>";
    $status_aux .= "<th><strong>" . __("Number") . "</strong></th>";
    $status_aux .= "<th><strong>" . __("Total time (AVG)") . "</strong></th>";
    $status_aux .= "</tr>";
    foreach ($incident_status as $key => $value) {
        $name = get_db_value('name', 'tincident_status', 'id', $key);
        $status_aux .= "<tr>";
        $status_aux .= "<td>" . $name . "</td>";
        $status_aux .= "<td>" . $value . "</td>";
        // Arithmetical average
        $time = $incident_status_timing[$key] / count($incidents);
        $status_aux .= "<td>" . give_human_time($time, true, true, true) . "</td>";
        $status_aux .= "</tr>";
    }
    $status_aux .= "</table>";
    $container_title = __("Ticket by status");
    $container_status_incidents = print_container_div('container_status_incidents', $container_title, $status_aux, 'no', true, true, "container_simple_title", "container_simple_div");
    $priority_aux = "<table class='listing table_priority_report'>";
    $priority_aux .= "<tr>";
    $priority_aux .= "<th><strong>" . __("Priority") . "</strong></th>";
    $priority_aux .= "<th><strong>" . __("Number") . "</strong></th>";
    $priority_aux .= "</tr>";
    foreach ($incident_priority as $key => $value) {
        $priority_aux .= "<tr>";
        $priority_aux .= "<td>" . get_priority_name($key) . "</td>";
        $priority_aux .= "<td>" . $value . "</td>";
        $priority_aux .= "</tr>";
    }
    $priority_aux .= "</table>";
    $priority_aux = $priority_aux;
    $container_title = __("Tickets by priority");
    $container_priority_incidents = print_container_div('container_priority_incidents', $container_title, $priority_aux, 'no', true, true, "container_simple_title", "container_simple_div");
    if ($oldest_incident) {
        $oldest_incident_time = get_incident_workunit_hours($oldest_incident["id_incidencia"]);
        $output = "<table class='listing'>";
        $output .= "<th>";
        $output .= __("Metric");
        $output .= "</th>";
        $output .= "<th>";
        $output .= __("Value");
        $output .= "</th>";
        $output .= "</tr>";
        $output .= "<tr>";
        $output .= "<td>";
        $output .= "<strong>" . __("Ticket Id") . "</strong>";
        $output .= "</td>";
        $output .= "<td>";
        $output .= '<a href="index.php?sec=incidents&sec2=operation/incidents/incident_dashboard_detail&id=' . $oldest_incident['id_incidencia'] . '">#' . $oldest_incident['id_incidencia'] . "</strong></a>";
        $output .= "</td>";
        $output .= "</tr>";
        $output .= "<tr>";
        $output .= "<td>";
        $output .= "<strong>" . __("Ticket title") . "</strong>";
        $output .= "</td>";
        $output .= "<td>";
        $output .= '<a href="index.php?sec=incidents&sec2=operation/incidents/incident_dashboard_detail&id=' . $oldest_incident['id_incidencia'] . '">' . $oldest_incident['titulo'] . "</strong></a>";
        $output .= "</td>";
        $output .= "</tr>";
        $output .= "<tr>";
        $output .= "<td>";
        $output .= "<strong>" . __("Worktime hours") . "</strong>";
        $output .= "</td>";
        $output .= "<td>";
        $output .= $oldest_incident_time . " " . __("Hours");
        $output .= "</td>";
        $output .= "</tr>";
        $output .= "<tr>";
        $output .= "<td>";
        $output .= "<strong>" . __("Lifetime") . "</strong>";
        $output .= "</td>";
        $output .= "<td>";
        $output .= format_numeric($max_lifetime / 86400) . " " . __("Days");
        $output .= "</td>";
        $output .= "</tr>";
        $output .= "</table>";
    } else {
        $output = graphic_error(false);
        $output .= __("N/A");
    }
    $output_aux = "<div style='width:100%; height:170px;'>";
    $output_aux .= $output;
    $output_aux .= "</div>";
    $container_title = __("Longest closed ticket");
    $container_longest_closed = print_container_div('container_longest_closed', $container_title, $output_aux, 'no', true, true, "container_simple_title", "container_simple_div");
    $data = array(__('Open') => $opened, __('Closed') => $total - $opened);
    $data = array(__('Close') => $total - $opened, __('Open') => $opened);
    $output = pie3d_graph($config['flash_charts'], $data, 300, 150, __('others'), $config["base_url"], "", $config['font'], $config['fontsize'], $ttl);
    $output = "<div class='pie_frame'>" . $output . "</div>";
    $container_title = __("Open / Close ticket");
    $container_openclose_incidents = print_container_div('container_pie_graphs container_openclose_incidents', $container_title, $output, 'no', true, true, "container_simple_title", "container_simple_div");
    $clean_output = get_parameter("clean_output");
    $container_title = __("Top active users");
    $output = "<div class='pie_frame'>" . $users_label . "</div>";
    $container_topactive_users = print_container_div('container_pie_graphs container_topactive_users', $container_title, $output, 'no', true, true, "container_simple_title", "container_simple_div");
    $container_title = __("Top ticket submitters");
    $output = "<div class='pie_frame'>" . $submitter_label . "</div>";
    $container_topincident_submitter = print_container_div('container_pie_graphs container_topincident_submitter', $container_title, $output, 'no', true, true, "container_simple_title", "container_simple_div");
    $container_title = __("Top assigned users");
    $output = "<div class='pie_frame'>" . $user_assigned_label . "</div>";
    $container_user_assigned = print_container_div('container_pie_graphs container_user_assigned', $container_title, $output, 'no', true, true, "container_simple_title", "container_simple_div");
    $container_title = __("Tickets by group");
    $output = pie3d_graph($config['flash_charts'], $incident_group_data, 300, 150, __('others'), $config["base_url"], "", $config['font'], $config['fontsize'] - 1, $ttl);
    $output = "<div class='pie_frame'>" . $output . "</div>";
    $container_incidents_group = print_container_div('container_pie_graphs container_incidents_group', $container_title, $output, 'no', true, true, "container_simple_title", "container_simple_div");
    $container_title = __("Tickets by creator group");
    $output = pie3d_graph($config['flash_charts'], $incident_group_data2, 300, 150, __('others'), $config["base_url"], "", $config['font'], $config['fontsize'] - 1, $ttl);
    $output = "<div class='pie_frame'>" . $output . "</div>";
    $container_incident_creator_group = print_container_div('container_incident_creator_group', $container_title, $output, 'no', true, true, "container_simple_title", "container_simple_div");
    $container_title = __("Top 5 average scoring by user");
    $output = "<div class='pie_frame'>" . $scoring_label . "</div>";
    $container_top5_scoring = print_container('container_top5_scoring', $container_title, $output, 'no', true, true, "container_simple_title", "container_simple_div");
    //Print second table
    $output = "<table class='listing' style=''>";
    $output .= "<tr>";
    $output .= "<th><strong>" . __("Group") . "</strong></th>";
    $output .= "<th><strong>" . __("Time") . "</strong></th>";
    $output .= "</tr>";
    $count = 1;
    arsort($groups_time);
    $count_groups = 0;
    foreach ($groups_time as $key => $value) {
        //Only show first 5
        if ($count == 5) {
            break;
        }
        $output .= "<tr>";
        $group_name = get_db_value('nombre', 'tgrupo', 'id_grupo', $key);
        $output .= "<td>" . $group_name . "</td>";
        $output .= "<td>" . give_human_time($value, true, true, true) . "</td>";
        $output .= "</tr>";
        $count++;
        $count_groups++;
    }
    if ($count_groups < 5 && $count_groups != 0) {
        $output .= "<tr>";
        $output .= "<td>" . __('Only have ') . $count_groups . __(' group/s with tickets') . "</td>";
        $output .= "<td>" . " " . "</td>";
        $output .= "</tr>";
    }
    $output .= "</table>";
    $container_title = __("Top 5 group by time");
    $container_top5_group_time = print_container_div('container_top5_group_time', $container_title, $output, 'no', true, true, "container_simple_title", "container_simple_div");
    $output = "<table class='listing' style=''>";
    $output .= "<tr>";
    $output .= "<th><strong>" . __("User") . "</strong></th>";
    $output .= "<th><strong>" . __("Time") . "</strong></th>";
    $output .= "</tr>";
    $count = 1;
    $count_users = 0;
    arsort($users_time);
    foreach ($users_time as $key => $value) {
        //Only show first 5
        if ($count == 5) {
            break;
        }
        $output .= "<tr>";
        $user_real = get_db_value('nombre_real', 'tusuario', 'id_usuario', $key);
        $output .= "<td>" . $user_real . "</td>";
        $output .= "<td>" . give_human_time($value, true, true, true) . "</td>";
        $output .= "</tr>";
        $count++;
        $count_users++;
    }
    if ($count_users < 5 && $count_users != 0) {
        $output .= "<tr>";
        $output .= "<td>" . __('Only have ') . $count_users . __(' user/s with tickets') . "</td>";
        $output .= "<td>" . " " . "</td>";
        $output .= "</tr>";
    }
    $output .= "</table>";
    $container_title = __("Top 5 users by time");
    $container_top5_user_time = print_container_div('container_top5_user_time', $container_title, $output, 'open', true, true, "container_simple_title", "container_simple_div");
    if ($simple_mode) {
        // First row
        echo '<div style="float: left; width: 100%;">';
        echo $container_incidents_group;
        echo $container_topincident_submitter;
        echo $container_user_assigned;
        echo "</div>";
        // Second row
        echo '<div style="float: left; width: 100%;">';
        echo $container_incident_statistics;
        echo $container_top5_group_time;
        echo $container_sla_compliance;
        echo "</div>";
    } else {
        // First row
        echo '<div style="float: left; width: 100%;">';
        echo $container_incidents_group;
        echo $container_topincident_submitter;
        echo $container_user_assigned;
        echo "</div>";
        // Second row
        echo '<div style="float: left; width: 100%;">';
        echo $container_incident_statistics;
        echo $container_top5_group_time;
        echo $container_sla_compliance;
        echo "</div>";
        //echo '<br><br>';
        // Third row
        echo '<div style="float: left; width: 100%;">';
        echo $container_status_incidents;
        echo $container_priority_incidents;
        echo "</div>";
        //Fourth row
        echo '<div style="float: left; width: 100%;">';
        echo $container_topactive_users;
        echo $container_top5_incidents;
        echo $container_openclose_incidents;
        echo "</div>";
        //~ // Fifth row
        echo $container_ticket_oc;
        //~ // Sixth row
        echo $container_ticket_activity;
    }
}
Ejemplo n.º 12
0
		
		$form .= "</table>";
		$form .= "</div>";
		
		$form .= "<div class='divform_right'>";
			$form .= "<div class='button-form' style='width:100%;'>";
				$form .= print_submit_button (__('Search'), 
					"search_btn", false, 'class="sub search"', true);
			$form .= "</div>";
		$form .= "</div>";
		
		$form .= "</div>";
		
		$form .= '</form>';
		
		print_container_div("contract_form",__("Contracts form search"),$form, 'open', false, false);
		
		$contracts = crm_get_all_contracts_with_custom_fields ($where_clause);
		if ($contracts !== false) {
			
			$contracts = print_array_pagination ($contracts, "index.php?sec=customers&sec2=operation/contracts/contract_detail&$search_params");
			
			$table = new StdClass();
			$table->width = "100%";
			$table->class = "listing";
			$table->cellspacing = 0;
			$table->cellpadding = 0;
			$table->tablealign="left";
			$table->data = array ();
			$table->size = array ();
			$table->style = array ();
Ejemplo n.º 13
0
	default:
		$container_title_company = ("Submitted billing per company");
		break;
}

$companies_invoiced_graph = pie3d_graph ($config["flash_charts"], $comp_invoiced_data, 300, 150, __('others'), $config["base_url"], "", $config['font'], $config['fontsize'], $graph_ttl);
$companies_invoiced_graph = '<div class="pie_frame">' .$companies_invoiced_graph."</div>";

//container_title_currency
switch ($search_invoice_type) {
	case 'Submitted':
		$container_title_currency = __("Submitted billing per currency");
		break;
	case 'Received':
		$container_title_currency = __("Received billing per currency");
		break;
	default:
		$container_title_currency = __("Submitted billing per currency");
		break;
}
echo "<div style='clear: both;'>";
	echo print_container_div('history_invoiced', $container_title_history, $container_invoicing_graph, 'no', true, true, "container_simple_title", "container_simple_div");
echo "</div>";

echo "<div style='clear: both;'>";
	echo print_container_div('container_pie_graphs companies_invoiced', $container_title_company, $companies_invoiced_graph, 'no', true, true, "container_simple_title", "container_simple_div");
	echo print_container_div('currency_invoiced', $container_title_currency, $currency_table, 'no', true, true, "container_simple_title", "container_simple_div");
echo "</div>";
?>

Ejemplo n.º 14
0
	
	$budget .= "<tr>";
	$budget .= '<td>'.__('Average Cost per Hour').'</td><td>';
	if ($total_hr > 0)
		$budget .= format_numeric ($total_project_costs / $total_hr) . " " . $config["currency"];
	else
		$budget .= __("N/A");
	$budget .= "</td></tr>";
	
	//Print containers
	echo print_container('project_labour', __('Labour'), $labour);
	echo "<div class='divhalf divhalf-left divhalf-border'>";
		echo print_container_div('container_pie_graphs project_workload_distribution', __('Workload distribution'), $workload_distribution);
	echo "</div>";
	echo "<div class='divhalf divhalf-right divhalf-border'>";
		echo print_container_div('container_pie_graphs project_task_distribution', __('Task distribution'), $task_distribution);
	echo "</div>";
	if ($project_activity) {
		echo print_container('project_activity', __('Project activity'), $project_activity, 'closed');
	}
	echo print_container('project_budget', __('Budget'), $budget);
}
echo "</div>";
echo "</form>";

//div to show user info
echo "<div class= 'dialog ui-dialog-content' title='".__("User info")."' id='user_info_window'></div>";

?>
<script type="text/javascript" src="include/js/jquery.ui.slider.js"></script>
<script type="text/javascript" src="include/languages/date_<?php echo $config['language_code']; ?>.js"></script>
Ejemplo n.º 15
0
            echo __('Yes');
        } else {
            echo __('No');
        }
        echo "<td>";
        if ($todo["expire_timestamp"] == "0000-00-00 00:00:00") {
            echo __('No expiration date');
        } else {
            echo $todo["expire_timestamp"];
        }
        echo '<td>';
        echo '<a href="index.php?sec=godmode&sec2=godmode/setup/newsboard&operation=update&id=' . $todo["id"] . '"><img src="images/editor.png"></a>';
        echo '<a href="index.php?sec=godmode&sec2=godmode/setup/newsboard&operation=delete&id=' . $todo["id"] . '" onClick="if (!confirm(\' ' . __('Are you sure?') . '\')) return false;">
					<img border=0 src="images/cross.png"></a>';
        echo "<tr><td colspan=4 style=''>";
        echo print_container_div('news_' . $todo["id"], __("Content"), clean_output($todo["content"]), 'closed', true, false, '', '', 1, '', "margin:0px");
    }
    echo "</table>";
    echo '<form method="post" action="index.php?sec=godmode&sec2=godmode/setup/newsboard&operation=create">';
    echo '<div class="button-form">';
    print_submit_button(__('Create'), 'crt', false, 'class="sub create');
    echo '</div></form>';
}
// Fin bloque else
?>
<script type="text/javascript" src="include/js/jquery.ui.slider.js"></script>
<script type="text/javascript" src="include/js/jquery.ui.datepicker.js"></script>
<script type="text/javascript" src="include/languages/date_<?php 
echo $config['language_code'];
?>
.js"></script>
Ejemplo n.º 16
0
			}
		}
	}
	echo '<div class="divresult">';
	//Print containers
		echo "<div class='divhalf divhalf-left'>";
			echo print_container('project_labour_report', __('Labour'), $labour, 'no', true, true, "container_simple_title", "container_simple_div");
		echo "</div>";
		echo "<div class='divhalf divhalf-right'>";	
			echo print_container('project_budget_report', __('Budget'), $budget, 'no', true, true, "container_simple_title", "container_simple_div");
		echo "</div>";
		echo "<div class='divhalf divhalf-left divhalf-border'>";	
			echo print_container_div('container_pie_graphs project_task_distribution_report', __('Task distribution'), $task_distribution, 'no');
		echo "</div>";
		echo "<div class='divhalf divhalf-right divhalf-border'>";	
			echo print_container_div('container_pie_graphs project_workload_distribution_report', __('Workload distribution'), $workload_distribution, 'no');
		echo "</div>";
		// Project activity graph
		$project_activity = project_activity_graph ($id_project, 750, 250, true, $graph_ttl, 50, true);
		if ($project_activity) {
			$project_activity = '<tr><td colspan = "2" class = "center-graph">' . $project_activity . '</td></tr>';
			echo print_container('project_activity_report', __('Project activity'), $project_activity, 'no', true, true, "container_simple_title", "container_simple_div");
		}
	echo '</div>';
	echo '<div class="divresult">';
		echo print_container('project_tasks_report', __('Project tasks'), $tasks_report, 'no', true, true, "container_simple_title", "container_simple_div");
	echo '</div>';

	echo "<div class= 'dialog ui-dialog-content' title='".__("Workunit of this task")."' id='workunits_task_window'></div>";
}
Ejemplo n.º 17
0
//TOP 10 MANAGERS INVOICING
if ($read && $enterprise) {
	$managers_invoicing = crm_get_invoicing_managers_acl($config['id_user'], $where_clause);
} else {
	$managers_invoicing = crm_get_managers_invoicing($where_clause);
}

if ($managers_invoicing != false) {
	$managers_invoicing_content = print_table(crm_print_most_invoicing_managers($managers_invoicing), true);
} else {
	$managers_invoicing_content = '<div>' . __('No data to show') . '</div>';
}



echo "<div style='clear: both;'>";
	echo print_container_div('container_pie_graphs companies_per_county', __('Companies per country'), $companies_country_content, 'no', true, '10px');
	echo print_container_div('container_pie_graphs companies_per_manager', __('Companies per manager'), $companies_per_manager, 'no', true, '10px');
	echo print_container_div('container_pie_graphs companies_per_user', __('Users per company'), $companies_user_content, 'no', true, '10px');
echo "</div>";
echo "<div style='clear: both;'>";
	echo print_container_div('container_pie_graphs invoicing_volume', __('Invoicing volume'), $companies_invoincing_volume, 'no', true, '10px');
	echo print_container_div('container_pie_graphs managers_invoicing_volume', __('Managers invoicing volume'), $managers_invoicing_volume, 'no', true, '10px');
echo "</div>";
echo "<div style='clear: both;'>";
	echo print_container_div('top_10_activity', __('Top 10 activity'), $companies_activity_content, 'no', true, '10px');
	echo print_container_div('top_10_invoicing', __('Top 10 invoicing'), $companies_invoincing_content, 'no', true, '10px');
	echo print_container_div('top_10_managers_invoicing', __('Top 10 managers invoicing'), $managers_invoicing_content, 'no', true, '10px');
echo "</div>";
?>
Ejemplo n.º 18
0
		//csv querys
		$filter["query"] = $sql_search;
		$filter["query_pag"] = $sql_search_pagination;
		serialize_in_temp($filter, $config["id_user"]);
		
		//tree_search_submit()
		$table_search->data[3][1] = print_button(__('Export to CSV'), '', false, 'tree_search_submit(); window.open(\'' . 'include/export_csv.php?export_csv_inventory=1'.'\');', 'class="sub csv"', true);

		//button
		$table_search->data[3][2] = print_submit_button (__('Search'), 'search', false, 'class="sub search"', true);

		$search_other .= print_table($table_search, true);
		$search_other .= '</div>';
		
		print_container_div("inventory_form",__("Inventory form search"),$search_other, 'open', false, false);
	echo '</form>';
}

$write_permission = enterprise_hook ('inventory_check_acl', array ($config['id_user'], $id, true));	
$page = (int)get_parameter('page', 1);

switch ($mode) {
	case 'tree':
		echo '<div class = "inventory_tree_table" id = "inventory_tree_table">';
			inventories_print_tree($sql_search_pagination, $last_update);
		echo '</div>';
		break;
	case 'list':
		echo '<div id="tmp_data"></div>';
		echo '<div class = "inventory_list_table" id = "inventory_list_table">';
Ejemplo n.º 19
0
        $projects_home .= "<div class='landing_empty'>";
        $projects_home .= "<div class='graph_frame'>" . $graph_result . "</div>";
        $projects_home .= "</div>";
    } else {
        $projects_home .= "<div class='landing_empty'>";
        $projects_home .= __("There aren't active projects");
        $projects_home .= "</div>";
    }
    $much_more = "<a href='index.php?sec=projects&sec2=operation/projects/project_overview'>";
    $much_more .= "<img class='much_more' src='images/flecha_dcha.png' title='" . __('See more') . "'>";
    $much_more .= "</a>";
    $subtitle = "<span class='landing_subtitle'>";
    $subtitle .= __("Activity") . ": ";
    $subtitle .= projects_active_user($config["id_user"]);
    $subtitle .= "</span>";
    echo print_container_div('projects_home', __('Projects') . $subtitle . $much_more, $projects_home, 'no', false, true, '', '', '', '', "height: 400px;");
    echo "</td>";
    echo "</tr>";
    echo "</table>";
    echo "</div>";
} else {
    if (give_acl($config["id_user"], 0, "AR")) {
        include "operation/agenda/agenda.php";
    } else {
        echo "<h1>" . __("Welcome to Integria") . "</h1>";
    }
}
$check_browser = check_browser();
if ($check_browser) {
    $browser_message = '<h4>' . __('Recommended browsers are Firefox and Chrome. You are using another browser.') . '</h4>';
    echo "<div class= 'dialog ui-dialog-content' title='" . __("Info") . "' id='browser_dialog'>{$browser_message}</div>";