EOXML; exit(0); } $report_user_no = $session->user_no; $report_user_name = $session->username; if ($session->AllowedTo("Admin") || $session->AllowedTo("Support") || $session->AllowedTo("Accounts")) { if (preg_match("#^/([^/]+)(/|\$)#", $report_path, $matches)) { $in_username = $matches[1]; $qry = new PgQuery("SELECT user_no FROM usr WHERE username = ?;", $in_username); if ($qry->Exec("REPORT") && ($row = $qry->Fetch())) { $report_user_no = $row->user_no; $report_user_name = $in_username; } } } $ical_date_format = vEvent::SqlDateFormat(); $ical_duration_format = vEvent::SqlDurationFormat(); for ($i = 0; $i <= $reportnum; $i++) { dbg_error_log("REPORT", "Report[%d] Start:%s, End: %s, Events: %d, Todos: %d, Freebusy: %d", $i, $report[$i]['start'], $report[$i]['end'], $report[$i]['calendar-event'], $report[$i]['calendar-todo'], $report[$i]['calendar-freebusy']); if ($report[$i]['calendar-event'] != 1) { continue; } $sql = <<<EOSQL SELECT usr.username, dav_etag, timesheet_id, to_char(work_on,{$ical_date_format}) AS dtstamp, to_char(work_on + case when work_on::time < '06:00'::time then '09:00'::time else '00:00'::time end,{$ical_date_format}) AS dtstart, to_char(work_duration,{$ical_duration_format}) AS duration, work_description AS summary, 'WR#'||request_id::text AS location, 'WR#'||request_id::text || ' - ' || brief AS description, 'Invoice '||charged_details::text || ', Charged \$'|| to_char(charged_amount,'FM999,999,990.00') ||' by ' || chgby.username || ' on ' || to_char(work_charged,'d/mm/YY') AS invoiced