Beispiel #1
0
$project_info .= "</table>";
echo print_container('project_info_report', __('Project info'), $project_info, 'no', true, true, "container_simple_title", "container_simple_div");
if ($id_project) {
    // Project activity graph
    $project_activity = project_activity_graph($id_project, 650, 150, true, $graph_ttl, 50, true);
    if ($project_activity) {
        $project_activity = '<div class="graph_frame">' . $project_activity . '</div>';
        echo print_container('project_activity_report', __('Project activity'), $project_activity, 'no', true, true, "container_simple_title", "container_simple_div");
    }
    // Calculation
    $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);
    $total_planned = get_planned_project_workunit_hours($id_project);
    $expected_length = get_db_sql("SELECT SUM(hours) FROM ttask WHERE id_project = {$id_project}");
    $pr_hour = get_project_workunit_hours($id_project, 1);
    $deviation = format_numeric(($pr_hour - $expected_length) / $config["hours_perday"]);
    $total = project_workunit_cost($id_project, 1);
    $real = project_workunit_cost($id_project, 0);
    $real = $real + get_incident_project_workunit_cost($id_project);
    // Labour
    $labour = "<table class='advanced_details_table alternate'>";
    $labour .= "<tr>";
    $labour .= '<td><b>' . __('Total people involved') . ' </b>';
    $labour .= "</td><td>";
    $labour .= $people_inv;
    $labour .= "</td></tr>";
    $labour .= "<tr>";
    $labour .= '<td><b>' . __('Total workunit (hr)') . ' </b>';
    $labour .= "</td><td>";
    $labour .= $total_hr . " (" . format_numeric($total_hr / $config["hours_perday"]) . " " . __("days") . ")";
Beispiel #2
0
/**
* Calculate project deviation
*
* $id_project 	integer 	ID of project
**/
function calculate_project_deviation($id_project)
{
    global $config;
    $expected_length = get_db_sql("SELECT SUM(hours)\n\t\tFROM ttask\n\t\tWHERE id_project = {$id_project}");
    if (empty($expected_length)) {
        return 0;
    }
    $pr_hour = get_project_workunit_hours($id_project, 1);
    $deviation_percent = format_numeric(100 - abs(($pr_hour - $expected_length) / ($expected_length / 100)));
    return $deviation_percent;
}
Beispiel #3
0
     echo "<li id='sidesel'>";
 } else {
     echo "<li>";
 }
 echo "<a href='index.php?sec=projects&sec2=operation/projects/milestones&id_project={$id_project}'>" . __('Milestones') . "</a></li>";
 // PROJECT - People management
 if ($project_permission['manage']) {
     if ($sec2 == "operation/projects/people_manager" && $id_task < 0) {
         echo "<li id='sidesel'>";
     } else {
         echo "<li>";
     }
     echo "<a href='index.php?sec=projects&sec2=operation/projects/people_manager&id_task=-1&id_project={$id_project}'>" . __('People') . "</a></li>";
 }
 // Workunits
 $totalhours = get_project_workunit_hours($id_project);
 $totalwu = get_project_count_workunits($id_project);
 if ($totalwu > 0) {
     if ($sec2 == "operation/projects/task_workunit" && $id_task < 0) {
         echo "<li id='sidesel'>";
     } else {
         echo "<li>";
     }
     echo "<a href='index.php?sec=projects&sec2=operation/projects/task_workunit&id_project={$id_project}'>" . __('Workunits');
     echo " ({$totalhours} " . __('Hours') . ")";
     echo "</a></li>";
 }
 // Files
 $numberfiles = give_number_files_project($id_project);
 if ($numberfiles > 0) {
     if ($sec2 == "operation/projects/task_files" && $id_task < 0) {
Beispiel #4
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>';
}
Beispiel #5
0
			AND tworkunit_task.id_task = ttask.id
			AND ttask.id_project = tproject.id
			AND tworkunit.timestamp >= "%s"
			AND tworkunit.timestamp <= "%s"
			AND tproject.id_owner = "%s" 
			GROUP BY tproject.name',
			$start_date, $end_date, $config["id_user"]);

		}		
	}

	$projects = get_db_all_rows_sql ($sql);

	if ($projects) {
		foreach ($projects as $project) {
			$total_project = get_project_workunit_hours ($project['id'], 0, $start_date, $end_date);
			$total_time += $project['sum'];
			$total_global  += $total_project;		
			if ($only_summary == 0){	
				echo "<tr style='border-top: 1px solid #ccc'>";
				echo "<td>";
				echo '<a href="index.php?sec=projects&sec2=operation/projects/task&id_project='.$project['id'].'">';
				echo '<strong>'.$project['name'].'</strong>';
				echo "</a>";
				echo "</td><td>";
				echo $project['sum'];

				echo "</td><td>";	
				echo $total_project;

				echo "</td><td>";
function print_project_tabs($selected_tab = '')
{
    global $config;
    $id_project = get_parameter('id_project', -1);
    $id_task = get_parameter('id_task', -1);
    // Get id_task but not id_project
    if ($id_task != -1 and $id_project == -1) {
        $id_project = get_db_value("id_project", "ttask", "id", $id_task);
    }
    // ACL Permissions
    $section_permission = get_project_access($config["id_user"]);
    $manage_any_task = manage_any_task($config["id_user"]);
    if ($id_project > 0) {
        $project_permission = get_project_access($config["id_user"], $id_project);
        $manage_any_task_in_project = manage_any_task($config["id_user"], $id_project);
    }
    $p_menu = array();
    $p_menu['overview'] = array('title' => __('Project overview'), 'link' => "operation/projects/project_detail&id_project=" . $id_project, 'img' => "images/eye.png");
    if ($manage_any_task_in_project) {
        $p_menu['task_plan'] = array('title' => __('Task planning'), 'link' => "operation/projects/task_planning&id_project=" . $id_project, 'img' => "images/task_planning.png");
    }
    $p_menu['time'] = array('title' => __('Time graph'), 'link' => "operation/projects/project_timegraph&id_project=" . $id_project, 'img' => "images/chart_pie.png");
    $p_menu['tracking'] = array('title' => __('Project traking'), 'link' => "operation/projects/project_tracking&id_project=" . $id_project, 'img' => "images/clock_tab.png");
    $task_number = get_tasks_count_in_project($id_project);
    if ($task_number > 0) {
        $p_menu['task_list'] = array('title' => __('Task list') . " (" . $task_number . ")", 'link' => "operation/projects/task&id_project=" . $id_project, 'img' => "images/tree_list.png");
    } else {
        $p_menu['task_list'] = array('title' => __('Task list') . " (" . __("Empty") . ")", 'img' => "images/tree_list_disabled.png");
    }
    if ($manage_any_task_in_project) {
        $p_menu['task_new'] = array('title' => __('New task'), 'link' => "operation/projects/task_detail&operation=create&id_project=" . $id_project, 'img' => "images/new_tab.png");
    }
    $p_menu['gantt'] = array('title' => __('Gantt chart'), 'link' => "operation/projects/gantt&id_project=" . $id_project, 'img' => "images/gantt.png");
    $p_menu['milestones'] = array('title' => __('Milestones'), 'link' => "operation/projects/milestones&id_project=" . $id_project, 'img' => "images/milestone.png");
    if ($project_permission['manage']) {
        $p_menu['people'] = array('title' => __('People'), 'link' => "operation/projects/people_manager&id_project=" . $id_project, 'img' => "images/contacts.png");
    }
    $totalhours = get_project_workunit_hours($id_project);
    $totalwu = get_project_count_workunits($id_project);
    if ($totalwu > 0) {
        $p_menu['workunits'] = array('title' => __('Workunits') . " (" . $totalhours . " " . __("Hours") . ")", 'link' => "operation/projects/task_workunit&id_project=" . $id_project, 'img' => "images/workunit_tab.png");
    } else {
        $p_menu['workunits'] = array('title' => __('Workunit') . " (" . __("Empty") . ")", 'img' => "images/workunit_disabled.png");
    }
    $numberfiles = give_number_files_project($id_project);
    if ($numberfiles > 0) {
        $p_menu['files'] = array('title' => __('Files') . "(" . $numberfiles . ")", 'link' => "operation/projects/task_files&id_project=" . $id_project, 'img' => "images/products/folder.png");
    } else {
        $p_menu['files'] = array('title' => __('Files') . "(" . __("Empty") . ")", 'img' => "images/folder_disabled.png");
    }
    if ($selected_tab == 'overview') {
        $p_menu['report'] = array('title' => __('Project report'), 'link' => "operation/projects/project_report&id_project=" . $id_project, 'img' => "images/chart_bar_dark.png");
    }
    if ($selected_tab == 'task_list') {
        $p_menu['report_task'] = array('title' => __('Tasks report'), 'link' => "operation/projects/task&id_project=" . $id_project . "&pure=1", 'img' => "images/chart_bar_dark.png");
    }
    if ($selected_tab == 'gantt') {
        $p_menu['report_gant'] = array('title' => __('Full screen Gantt'), 'link' => "operation/projects/gantt&id_project=" . $id_project . "&clean_output=1", 'img' => "images/chart_bar_dark.png", 'target' => "top");
    }
    if ($selected_tab == 'workunits') {
        $p_menu['report_gant'] = array('title' => __('Tasks report'), 'link' => "operation/projects/task_workunit&id_project=" . $id_project . "&pure=1", 'img' => "images/chart_bar_dark.png");
    }
    return $p_menu;
}