diff --git a/client_overview.php b/client_overview.php index 7baf3502..e0f655f6 100644 --- a/client_overview.php +++ b/client_overview.php @@ -2,13 +2,37 @@ $sql_contacts = mysqli_query($mysqli,"SELECT * FROM contacts LEFT JOIN departments ON contact_department_id = department_id WHERE contact_client_id = $client_id AND contacts.company_id = $session_company_id ORDER BY contact_updated_at DESC LIMIT 5"); -$sql_vendors = mysqli_query($mysqli,"SELECT * FROM vendors WHERE (vendor_name LIKE '%$query%' OR vendor_phone LIKE '%$phone_query%') AND company_id = $session_company_id ORDER BY vendor_id DESC LIMIT 5"); +$sql_vendors = mysqli_query($mysqli,"SELECT * FROM vendors WHERE vendor_client_id = $client_id AND company_id = $session_company_id ORDER BY vendor_updated_at DESC LIMIT 5"); -$sql_documents = mysqli_query($mysqli, "SELECT * FROM documents LEFT JOIN clients on document_client_id = clients.client_id WHERE document_name LIKE '%$query%' AND documents.company_id = $session_company_id ORDER BY document_id DESC LIMIT 5"); +$sql_documents = mysqli_query($mysqli, "SELECT * FROM documents WHERE document_client_id = $client_id AND documents.company_id = $session_company_id ORDER BY document_updated_at DESC LIMIT 5"); -$sql_tickets = mysqli_query($mysqli, "SELECT * FROM tickets LEFT JOIN clients on tickets.ticket_client_id = clients.client_id WHERE (ticket_subject LIKE '%$query%' OR ticket_number = '$query') AND tickets.company_id = $session_company_id ORDER BY ticket_id DESC LIMIT 5"); +$sql_tickets = mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_client_id = $client_id AND tickets.company_id = $session_company_id ORDER BY ticket_updated_at DESC LIMIT 5"); -$sql_logins = mysqli_query($mysqli,"SELECT * FROM logins WHERE (login_name LIKE '%$query%' OR login_username LIKE '%$query%') AND company_id = $session_company_id ORDER BY login_id DESC LIMIT 5"); +$sql_logins = mysqli_query($mysqli,"SELECT * FROM logins WHERE login_client_id = $client_id AND company_id = $session_company_id ORDER BY login_updated_at DESC LIMIT 5"); + +// Expiring Items + +// Get Domains Expiring +$sql_domains_expiring = mysqli_query($mysqli,"SELECT * FROM domains + WHERE domain_client_id = $client_id + AND domain_expire < CURRENT_DATE + INTERVAL 30 DAY + AND company_id = $session_company_id ORDER BY domain_expire DESC" +); + +// Get Asset Warranties Expiring +$sql_asset_warranties_expiring = mysqli_query($mysqli,"SELECT * FROM assets + WHERE asset_client_id = $client_id + AND asset_warranty_expire < CURRENT_DATE + INTERVAL 90 DAY + AND company_id = $session_company_id ORDER BY asset_warranty_expire DESC" +); + +// Get Stale Tickets +$sql_tickets_stale = mysqli_query($mysqli,"SELECT * FROM tickets + WHERE ticket_client_id = $client_id + AND ticket_created_at < CURRENT_DATE + INTERVAL 14 DAY + AND ticket_status = 'Open' + AND company_id = $session_company_id ORDER BY ticket_created_at DESC" +); ?> @@ -21,20 +45,11 @@ $sql_logins = mysqli_query($mysqli,"SELECT * FROM logins WHERE (login_name LIKE
-
-
-
Recent Contacts
-
+ +
- - - - - - - - - +
Recent Contacts
+
NameEmailPhoneCell
- - + + + + + + +

+
+
+
+ + + + 0){ ?> + + + +
+ +
+
+
Domains Expiring Soon (30d)
+ + + + + + + + + + + +
+
+
+
+ + + + 0){ ?> + + + +
+ +
+
+
Asset Warranties Expiring Soon (90d)
+ + + + + + + + + + + +
+
+
+
+ + + + 0){ ?> + + + +
+ +
+
+
Stale Tickets (14d)
+ + + + + + +