diff --git a/client_software.php b/client_software.php index 9afdb187..c95f4d7b 100644 --- a/client_software.php +++ b/client_software.php @@ -74,13 +74,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
- +
"> + @@ -98,27 +99,33 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); $software_seats = nullable_htmlentities($row['software_seats']); $software_purchase = nullable_htmlentities($row['software_purchase']); $software_expire = nullable_htmlentities($row['software_expire']); - $software_notes = nullable_htmlentities($row['software_notes']); - $software_created_at = nullable_htmlentities($row['software_created_at']); + if ($software_expire) { + $software_expire_ago = timeAgo($software_expire); + $software_expire_display = "
$software_expire
$software_expire_ago
"; + + // Convert the expiry date to a timestamp + $software_expire_timestamp = strtotime($row['software_expire']); + $current_timestamp = time(); // Get current timestamp - $software_expire_ago = timeAgo($software_expire); - // Convert the expiry date to a timestamp - $software_expire_timestamp = strtotime($row['software_expire']); - $current_timestamp = time(); // Get current timestamp + // Calculate the difference in days + $days_until_expiry = ($software_expire_timestamp - $current_timestamp) / (60 * 60 * 24); - // Calculate the difference in days - $days_until_expiry = ($software_expire_timestamp - $current_timestamp) / (60 * 60 * 24); - - // Determine the class based on the number of days until expiry - if ($days_until_expiry <= 0) { - $tr_class = "table-secondary"; - } elseif ($days_until_expiry <= 14) { - $tr_class = "table-danger"; - } elseif ($days_until_expiry <= 90) { - $tr_class = "table-warning"; + // Determine the class based on the number of days until expiry + if ($days_until_expiry <= 0) { + $tr_class = "table-secondary"; + } elseif ($days_until_expiry <= 14) { + $tr_class = "table-danger"; + } elseif ($days_until_expiry <= 90) { + $tr_class = "table-warning"; + } + } else { + $software_expire_display = "-"; $tr_class = ''; } + + $software_notes = nullable_htmlentities($row['software_notes']); + $software_created_at = nullable_htmlentities($row['software_created_at']); $seat_count = 0; @@ -158,6 +165,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); +
Software Type License Type SeatsExpire Action