From 1a30cecf6417ba966afa9c97b4894230fd8d6a6a Mon Sep 17 00:00:00 2001 From: "AFTECH.RO" <38830718+aftechro@users.noreply.github.com> Date: Tue, 8 Feb 2022 23:01:18 +0000 Subject: [PATCH] Update tickets.php - added My tickets - showing total of assigned tickets to user - added Unassigned tickets - showing all open tickets not assigned and ready to be grabbed by anyone available - added Task - this can be left at it is or to be renamed to Alerts/Notification - used for 3rd party emails fetched as tickets ( backups notification, domain/ssl expiry, check central etc) Future to do: - when click on My tickets, to show all the tickets assigned to user (open/answered, unanswered, closed by user) - when click on My Tickets - Unanswered - to show tickets assigned to user with status open but not replied to customer - when click on My Tickets - Open/Answered - to show tickets assigned to user and replied by the agent (work in progress) --- tickets.php | 71 +++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 63 insertions(+), 8 deletions(-) diff --git a/tickets.php b/tickets.php index 14960a3b..7a8f6a11 100644 --- a/tickets.php +++ b/tickets.php @@ -109,38 +109,93 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()")); -?> + +//Get Total tickets +$sql_total_tickets = mysqli_query($mysqli,"SELECT COUNT(`ticket_id`) AS total_tickets FROM `tickets` WHERE company_id = $session_company_id ;"); +$row = mysqli_fetch_array($sql_total_tickets); +$total_tickets = $row['total_tickets']; + +//Get Total tickets open +$sql_total_tickets_open = mysqli_query($mysqli,"SELECT COUNT(`ticket_id`) AS total_tickets_open FROM `tickets` WHERE `ticket_status` = 'open' AND company_id = $session_company_id ;"); +$row = mysqli_fetch_array($sql_total_tickets_open); +$total_tickets_open = $row['total_tickets_open']; + +//Get Total tickets closed +$sql_total_tickets_closed = mysqli_query($mysqli,"SELECT COUNT(DISTINCT `ticket_status`) AS total_tickets_closed FROM `tickets` WHERE `ticket_status` = 'closed' AND company_id = $session_company_id ;"); +$row = mysqli_fetch_array($sql_total_tickets_closed); +$total_tickets_closed = $row['total_tickets_closed']; + +//Get Unnassigned tickets +$sql_total_tickets_unassigned = mysqli_query($mysqli,"SELECT COUNT(`ticket_id`) AS total_tickets_unassigned FROM `tickets` WHERE ticket_assigned_to = '0' AND ticket_status = 'open' AND company_id = $session_company_id;"); +$row = mysqli_fetch_array($sql_total_tickets_unassigned); +$total_tickets_unassigned = $row['total_tickets_unassigned']; + +//Get Total tickets assigned to me +$sql_total_tickets_assigned = mysqli_query($mysqli,"SELECT COUNT(`ticket_id`) AS total_tickets_assigned FROM `tickets` WHERE ticket_assigned_to = '$user_id' AND ticket_status = 'open' AND company_id = $session_company_id;"); +$row = mysqli_fetch_array($sql_total_tickets_assigned); +$total_tickets_assigned = $row['total_tickets_assigned']; + +?>