Ejemplo n.º 1
0
    $AppUI->setState('TimecardMonthlyMonth', $current_date->getMonth());
}
$month = $AppUI->getState('TimecardMonthlyMonth');
if ($show_other_worksheets) {
    if (isset($_GET['user_id'])) {
        $AppUI->setState('TimecardMonthlyUserId', $_GET['user_id']);
    } else {
        $AppUI->setState('TimecardMonthlyUserId', $AppUI->user_id);
    }
    $user_id = $AppUI->getState('TimecardMonthlyUserId') ? $AppUI->getState('TimecardMonthlyUserId') : 0;
} else {
    $user_id = $AppUI->user_id;
}
$start_report = new CDate();
$start_report->setMonth($month);
$start_report->setYear($year);
$start_report->setDay(1);
$start_report->setTime(0, 0, 0);
$end_report = new CDate();
$end_report->copy($start_report);
$end_report->addMonths(1);
$end_report->addDays(-1);
$end_report->setTime(23, 59, 59);
//Get hash of users
$sql = "SELECT user_id, contact_email, concat(contact_last_name,' ',contact_first_name) as name FROM users LEFT JOIN contacts AS c ON users.user_contact = contact_id ORDER BY contact_last_name, contact_first_name;";
$result = db_loadList($sql);
$people = array();
// users list
foreach ($result as $row) {
    $people[$row['user_id']] = $row;
    $users[$row['user_id']] = $row['name'];