$budget .= "</tr>";
            }
        }
    }
    $budget .= "<tr>";
    $budget .= '<td><b>' . __('Average Cost per Hour') . ' </b>';
    $budget .= "</td><td>";
    if ($total_hr > 0) {
        $budget .= format_numeric($total_project_costs / $total_hr) . " " . $config["currency"];
    } else {
        $budget .= __("N/A");
    }
    $budget .= "</td></tr>";
    $budget .= "</table>";
    // Workload distribution
    $workload_distribution = '<div class="pie_frame">' . graph_workunit_project_user_single(350, 150, $id_project, $graph_ttl) . '</div>';
    // Task detail
    $tasks_report = '';
    $sql = sprintf('SELECT tt.id, tt.name, tt.hours AS estimated_time
					FROM ttask tt
					WHERE tt.id_project = %d', $id_project);
    $tasks = get_db_all_rows_sql($sql);
    if (!empty($tasks)) {
        foreach ($tasks as $task) {
            // Get the dates of the oldest and the newest wu
            $sql = sprintf('SELECT DATE(MIN(first_wu)) AS first_wu, DATE(MAX(last_wu)) AS last_wu
							FROM (
								SELECT MIN(tw1.timestamp) AS first_wu,
								   	   MAX(tw1.timestamp) AS last_wu
								FROM tworkunit tw1
								INNER JOIN tworkunit_task twt
echo "</tr>";
echo "<tr>";
echo "<td>";
echo __("Pending") . ":";
echo "</td>";
echo "<td>";
echo "<span style='background-color:#FFFFFF;border: 2px solid grey;'>";
echo "&nbsp;" . $pending . "&nbsp;";
echo "</span>";
echo "</td>";
echo "</strong>";
echo "</tr>";
echo "</table>";
echo "</td>";
echo "<td>";
$content = '<div class="pie_frame">' . graph_workunit_project_user_single(180, 150, $id_project) . '</div>';
print_container('planning_hours_worked', __("Hours worked"), $content, 'no', false, '10px');
echo "</td>";
echo "<td>";
$content = '<div class="pie_frame">' . graph_workunit_project_task_status(180, 150, $id_project) . '</div>';
print_container('planning_hours_summary_task', __("Summary task status"), $content, 'no', false, '10px');
echo "</td>";
echo "<td>";
$content = '<div class="pie_frame">' . graph_project_task_per_user(180, 150, $id_project) . '</div>';
print_container('planning_hours_task_user', __("Task per user"), $content, 'no', false, '10px');
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</center>";
//Create button bar
echo "<div style='width:100%; border-spacing:0px;' class='button'>";
	echo "<tr><td>";
		print_button (__('Update'), 'update', false, 'document.forms[\'form-tasks\'].submit()','class="submit_update"');
	echo "</td></tr>";
echo "</table>";
echo "</div>";

echo "<div class='divresult'>";
echo "<table class = 'listing'><tr>";
	echo "<th>".__("Verified").":<span style='background-color:#d2e7a4;'>&nbsp;".$verified."&nbsp;</span></th>";
	echo "<th>".__("Completed").":<span style='background-color:#b8e0fd;'>&nbsp;".$completed."&nbsp;</span></th>";
	echo "<th>".__("In process").":<span style='background-color:#fceaa2;'>&nbsp;".$in_process."&nbsp;</span></th>";
	echo "<th>".__("Pending").":<span style='background-color:#FFF;'>&nbsp;".$pending."&nbsp;</span></th>";
echo "</tr></table>";

$content_general = "<tr><td valign='top' >";
		$content = '<tr><td colspan="2" valign=top style="height:250px;">'.graph_workunit_project_user_single(350, 150, $id_project).'</td></tr>';
	$content_general .=	print_container('planning_hours_worked', __("Hours worked"), $content, 'no', true, '10px');
$content_general .= "</td><td valign='top' >";
		$content = '<tr><td colspan="2" valign=top style="height:250px;">'. graph_workunit_project_task_status(350, 150, $id_project).'</td></tr>';
	$content_general .= print_container('planning_hours_summary_task', __("Summary task status"), $content, 'no', true, '10px');
$content_general .= "</td><td valign='top'  >";
		$content = '<tr><td colspan="2" valign=top style="height:250px;">'. graph_project_task_per_user(350, 150, $id_project).'</td></tr>';
	$content_general .= print_container('planning_hours_task_user', __("Task per user"), $content, 'no', true, '10px', '', '', 1, 'less_widht');
$content_general .= "</td></tr>";
print_container('task_information', __("Task Information"), $content_general, 'closed', false, '10px', '', '', 2);

//Starting main form for this view
echo "<form id='form-tasks' method='post' action='index.php?sec=projects&sec2=operation/projects/task_planning&id_project=".$id_project."'>";
print_input_hidden('update', 'update');
//Create table and table header.
echo "<table class='listing'>";