diff --git a/client_overview.php b/client_overview.php index 30646314..fed7fa50 100644 --- a/client_overview.php +++ b/client_overview.php @@ -2,19 +2,69 @@ require_once("inc_all_client.php"); -$sql_contacts = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_client_id = $client_id AND contact_archived_at IS NULL ORDER BY contact_updated_at, contact_created_at DESC LIMIT 5"); +$sql_important_contacts = mysqli_query( + $mysqli, + "SELECT * FROM contacts + WHERE contact_client_id = $client_id + AND (contact_important = 1 OR contact_billing = 1 OR contact_technical = 1 OR contact_id = $primary_contact) + AND contact_archived_at IS NULL ORDER BY contact_name DESC" +); -$sql_important_contacts = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_client_id = $client_id AND (contact_important = 1 OR contact_billing = 1 OR contact_technical = 1 OR contact_id = $primary_contact) AND contact_archived_at IS NULL ORDER BY contact_name DESC"); +/* + * RECENTLY UPDATED ITEMS + */ -$sql_vendors = mysqli_query($mysqli, "SELECT * FROM vendors WHERE vendor_client_id = $client_id AND vendor_template = 0 AND vendor_archived_at IS NULL ORDER BY vendor_updated_at DESC LIMIT 5"); +$sql_recent_contacts = mysqli_query( + $mysqli, + "SELECT * FROM contacts + WHERE contact_client_id = $client_id + AND contact_archived_at IS NULL + ORDER BY contact_updated_at, contact_created_at DESC LIMIT 3" +); -$sql_documents = mysqli_query($mysqli, "SELECT * FROM documents WHERE document_client_id = $client_id AND document_archived_at IS NULL ORDER BY document_updated_at DESC LIMIT 5"); +$sql_recent_vendors = mysqli_query( + $mysqli, + "SELECT * FROM vendors + WHERE vendor_client_id = $client_id + AND vendor_template = 0 AND vendor_archived_at IS NULL + ORDER BY vendor_updated_at DESC LIMIT 2" +); -$sql_tickets = mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_client_id = $client_id ORDER BY ticket_updated_at DESC LIMIT 5"); +$sql_recent_documents = mysqli_query( + $mysqli, + "SELECT * FROM documents + WHERE document_client_id = $client_id + AND document_archived_at IS NULL + ORDER BY document_updated_at DESC LIMIT 2" +); -$sql_logins = mysqli_query($mysqli, "SELECT * FROM logins WHERE login_client_id = $client_id ORDER BY login_updated_at DESC LIMIT 5"); +$sql_recent_tickets = mysqli_query( + $mysqli, + "SELECT * FROM tickets + WHERE ticket_client_id = $client_id + ORDER BY ticket_updated_at DESC LIMIT 5" +); -// Expiring Items +$sql_recent_logins = mysqli_query( + $mysqli, + "SELECT * FROM logins + WHERE login_client_id = $client_id + ORDER BY login_updated_at DESC LIMIT 5" +); + +/* + * EXPIRING/ACTION ITEMS + */ + +// Stale Tickets +$sql_stale_tickets = mysqli_query( + $mysqli, + "SELECT * FROM tickets + WHERE ticket_client_id = $client_id + AND ticket_created_at < CURRENT_DATE - INTERVAL 14 DAY + AND ticket_status != 'Closed' + ORDER BY ticket_created_at DESC" +); // Get Domains Expiring $sql_domains_expiring = mysqli_query( @@ -27,256 +77,291 @@ $sql_domains_expiring = mysqli_query( 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 IS NOT NULL + AND asset_archived_at IS NULL + AND asset_warranty_expire < CURRENT_DATE + INTERVAL 90 DAY + ORDER BY asset_warranty_expire DESC" +); + +// Get Assets Retiring +$sql_asset_retire = mysqli_query( + $mysqli, + "SELECT * FROM assets + WHERE asset_client_id = $client_id + AND asset_install_date IS NOT NULL + AND asset_archived_at IS NULL + AND asset_install_date + INTERVAL 7 YEAR < CURRENT_DATE + INTERVAL 90 DAY + ORDER BY asset_install_date DESC" +); + ?> -
+
- + -
+
-
-
-
Quick Notes
-
-
- +
+
+
Quick Notes
+
+
+ +
+
+ 0) { ?> + +
+ +
+
+
Important Contacts
+
+
+ + + + + + + + +
+ +
+ +
+ + $contact_phone $contact_extension"; ?> + + +
+
+ +
+
+
+
+ + + + 0 || mysqli_num_rows($sql_recent_vendors) > 0 || mysqli_num_rows($sql_recent_documents) > 0) { ?> +
+ +
+
+
Recently Updated
+
+
+ + + +

+ + +

+ + + + +

+ + +

+ + + + +

+ + +

+ + +
+
+
+ + + 0 + || mysqli_num_rows($sql_asset_warranties_expiring) > 0 + || mysqli_num_rows($sql_asset_retire) > 0 + ) { ?> + +
+ +
+
+
Upcoming Expirations
+
+
+ + +

+ + + -- +

+ + + +

+ + + -- +

+ + + + + +

+ + + -- +

+ + + +
+
+
+ + + + 0) { ?> + + + +
+ +
+
+
Stale Tickets (14d)
+
+
+ + + + + + + + + + + + + +
+
+
+
+ + +
- 0) { ?> + + } +