Esempio n. 1
0
$project_info .= $description;
$project_info .= "</td></tr>";
$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>';
Esempio n. 2
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>';
}