$langs->load('mandarin@mandarin');
$userid = GETPOST('userid');
if ($userid != 0) {
    $userdefault = $userid;
} elseif (user_est_responsable_hierarchique()) {
    $userid = $user->id;
}
// Begin of page
llxHeader('', $langs->trans('linkMenuProjectByUserReport'), '');
print dol_get_fiche_head('linkMenuProjectByUserReport');
print_fiche_titre($langs->trans('linkMenuProjectByUserReport'));
print_form_filter($userid);
$TData = get_data_tab($userid);
draw_table($TData, get_list_id_user($TData), get_tab_label_statut_opportunite());
print '<br />';
draw_graphique($TData, get_tab_label_statut_opportunite());
llxFooter();
function print_form_filter($userid)
{
    global $db, $langs;
    $langs->load('users');
    $form = new Form($db);
    print '<form name="filter" methode="GET" action="' . $_SERVER['PHP_SELF'] . '">';
    print $langs->trans('HierarchicalResponsible');
    print $form->select_dolusers($userid, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', '', 1);
    print '<br /><br />';
    $date_deb = explode('/', $_REQUEST['date_deb']);
    $date_deb = implode('/', array_reverse($date_deb));
    $date_fin = explode('/', $_REQUEST['date_fin']);
    $date_fin = implode('/', array_reverse($date_fin));
    print 'Du ';
$langs->load('mandarin@mandarin');
$userid = GETPOST('userid');
if ($userid != 0) {
    $userdefault = $userid;
} elseif (user_est_responsable_hierarchique()) {
    $userid = $user->id;
}
// Begin of page
llxHeader('', $langs->trans('mandarinTitleGraphEventByUser'), '');
print dol_get_fiche_head('RapportEvenementsParCommerciaux');
print_fiche_titre($langs->trans('RapportEvenementsParCommerciaux'));
print_form_filter($userid);
$TData = get_data_tab($userid);
draw_table($TData, get_list_id_user($TData), get_tab_label_action_comm());
print '<br />';
draw_graphique($TData, get_tab_label_action_comm());
llxFooter();
function print_form_filter($userid)
{
    global $db, $langs;
    $langs->load('users');
    $form = new Form($db);
    print '<form name="filter" methode="GET" action="' . $_SERVER['PHP_SELF'] . '">';
    print $langs->trans('HierarchicalResponsible');
    print $form->select_dolusers($userid, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', '', 1);
    print '<br /><br />';
    $date_deb = explode('/', $_REQUEST['date_deb']);
    $date_deb = implode('/', array_reverse($date_deb));
    $date_fin = explode('/', $_REQUEST['date_fin']);
    $date_fin = implode('/', array_reverse($date_fin));
    print 'Du ';