do_timesheet_payroll(); } if ($_GET['page'] == "invoice_timesheet") { $queue_invoice->do_timesheet_invoicing(); } if ($_GET['page'] == "approve_timesheet") { $queue_approval->do_timesheet_approval_processing(); } } elseif ($_GET['action'] == "split2") { if ($_GET['page'] == "approve_timesheet") { $queue_approval->do_timesheet_split(); } } else { if ($_GET['page'] == "payroll_timesheet") { $queue_payroll->do_timesheet_rejectpayroll(); } if ($_GET['page'] == "invoice_timesheet") { $queue_invoice->do_timesheet_rejectinvoicing(); } } } } function email_on_submission($timesheet_id) { $options = get_option('time_sheets'); if (!$options['enable_email']) { return; } global $wpdb; $db = new time_sheets_db(); $common = new time_sheets_common(); $user_id = get_current_user_id(); $sql = "select user_login from {$wpdb->prefix}timesheet t join {$wpdb->users} u on u.ID = t.user_id where t.timesheet_id = %d"; $params = array($timesheet_id); $user_login = $db->get_var($sql, $params); $sql = "select user_email, display_name from {$wpdb->users} u join {$wpdb->prefix}timesheet_approvers_approvies aa on u.ID = aa.approver_user_id and aa.approvie_user_id = {$user_id}"; $users = $db->get_results($sql); $sql = "select display_name from {$wpdb->users} u join {$wpdb->prefix}timesheet t on u.ID = t.user_id where t.timesheet_id = {$timesheet_id}"; $display_user = $db->get_var($sql); $subject = "There are time sheet(s) pending approval."; $body = "A time sheet has been entered by {$display_user} and is pending approval. It can be approved from the approval menu."; foreach ($users as $user) { $common->send_email ($user->user_email, $subject, $body); } } function enter_timesheet() { if ($_POST['action'] == 'save') { if ($this->validate_timesheet()=="true") { $timesheet_id = $this->save_timesheet(); } } $this->show_timesheet($timesheet_id); } function remove_br($string) { $string = str_replace("\'", "'", $string); $string = esc_textarea($string); return nl2br($string); } function check_overages($timesheet_id) { global $wpdb; $db = new time_sheets_db(); $sql = "select MaxHours, HoursUsed from {$wpdb->prefix}timesheet_client_projects a join {$wpdb->prefix}timesheet b on a.ProjectId = b.ProjectId where timesheet_id=%d"; $params=array($timesheet_id); $project = $db->get_row($sql, $params); if ($project->HoursUsed > $project->MaxHours && $project->MaxHours<>0) { echo '
This project has run over on hours. Please inform management that a new SOW may be required.
The week start date is required.
The client name is required.
A project is required.
You must be logged in to view this page.
You must be logged in to view this page.
No Project Was Selected. A project must be selected. If no projects are available contact your lead.
Timesheet updated.
Timesheet saved.
Client may be over their retainer hours for this month. Please ensure that client approves of hours over their monthly retainer of {$client->MonthlyHours} hours if they do not have an active SOW in place.
| Time Sheet | Approved | Week Completed | Start Date | Client Name | Project Name |
| {$timesheet->timesheet_id} | ";
if ($timesheet->approved==1) {
echo " | ";
if ($timesheet->marked_complete_by) {
echo " | {$common->f_date($timesheet->start_date)} | {$common->clean_from_db($timesheet->client_name)} | {$common->clean_from_db($timesheet->ProjectName)}"; } echo " |