From e5dc50ec35543b85e1f1697c7ca45c709b4fe05e Mon Sep 17 00:00:00 2001 From: wrongecho Date: Fri, 7 Mar 2025 22:57:18 +0000 Subject: [PATCH] Add time by technician report --- modals/ticket_bulk_assign_modal.php | 1 - report_time_by_tech.php | 179 ++++++++++++++++++++++++++++ ticket.php | 2 +- 3 files changed, 180 insertions(+), 2 deletions(-) create mode 100644 report_time_by_tech.php diff --git a/modals/ticket_bulk_assign_modal.php b/modals/ticket_bulk_assign_modal.php index 8743d75c..fb464ca6 100644 --- a/modals/ticket_bulk_assign_modal.php +++ b/modals/ticket_bulk_assign_modal.php @@ -20,7 +20,6 @@ 1 AND user_type = 1 AND user_status = 1 AND user_archived_at IS NULL diff --git a/report_time_by_tech.php b/report_time_by_tech.php new file mode 100644 index 00000000..7ce4abad --- /dev/null +++ b/report_time_by_tech.php @@ -0,0 +1,179 @@ + (int)$days, + 'hour' => (int)$hours, + 'minute' => (int)$minutes, + 'second' => (int)$seconds, + ]; + + foreach ($sections as $name => $value){ + if ($value > 0){ + $timeParts[] = $value. ' '.$name.($value == 1 ? '' : 's'); + } + } + + return implode(', ', $timeParts); +} + +if (isset($_GET['year'])) { + $year = intval($_GET['year']); +} else { + $year = date('Y'); +} + +if (isset($_GET['month'])) { + $month = intval($_GET['month']); +} else { + $month = date('m'); +} + +$sql_ticket_years = mysqli_query($mysqli, "SELECT DISTINCT YEAR(ticket_created_at) AS ticket_year FROM tickets ORDER BY ticket_year DESC"); + +$sql_clients = mysqli_query($mysqli, "SELECT client_id, client_name FROM clients WHERE client_archived_at IS NULL ORDER BY client_name ASC"); + +$sql_users = mysqli_query($mysqli, " + SELECT users.user_id, user_name FROM users + LEFT JOIN user_settings on users.user_id = user_settings.user_id + WHERE user_type = 1 + AND user_status = 1 + AND user_archived_at IS NULL + ORDER BY user_name DESC" +); +// TODO: Maybe try and filter this to just users with the support module perm + +?> + +
+
+

Time Logged By Technician

+
+ +
+
+
+
+ +
+ +
+
+

Yearly ()

+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
TechnicianTickets assignedTickets touchedTotal time worked (H:M:S)
+
+
+
+ +
+
+ +