<% theme = Request.Cookies("theme") IF theme = "" THEN theme="bg-theme1" END IF %>
<% Dim showFilter showFilter = Request.QueryString("filter") If showFilter = "" Then showFilter = "all" %>
USB Devices <% If showFilter = "available" Then %> Available Only <% ElseIf showFilter = "checkedout" Then %> Checked Out Only <% Else %> All Devices <% End If %>
<% If showFilter <> "all" Then %> Show All <% End If %> <% If showFilter <> "available" Then %> Available Only <% End If %> <% If showFilter <> "checkedout" Then %> Checked Out <% End If %> Checkout Check-in Add USB Batch Print Labels
<% Dim strSQL, rs ' Query USB devices with current checkout status strSQL = "SELECT m.machineid, m.serialnumber, m.alias, bu.businessunit, " & _ "uc.checkoutid, uc.sso AS current_holder, uc.checkout_time, uc.checkout_reason, " & _ "CASE WHEN uc.checkoutid IS NOT NULL THEN 'Checked Out' ELSE 'Available' END AS status " & _ "FROM machines m " & _ "LEFT JOIN businessunits bu ON m.businessunitid = bu.businessunitid " & _ "LEFT JOIN usbcheckouts uc ON m.machineid = uc.machineid AND uc.checkin_time IS NULL " & _ "WHERE m.machinetypeid = 44 AND m.isactive = 1 " ' Apply filter If showFilter = "available" Then strSQL = strSQL & "AND uc.checkoutid IS NULL " ElseIf showFilter = "checkedout" Then strSQL = strSQL & "AND uc.checkoutid IS NOT NULL " End If strSQL = strSQL & "ORDER BY m.serialnumber ASC" Set rs = objConn.Execute(strSQL) Dim rowCount rowCount = 0 While Not rs.EOF rowCount = rowCount + 1 Dim machineId, serialNum, usbAlias, businessUnit, statusText, currentHolder, checkoutTime, checkoutReason Dim statusClass, checkoutId machineId = rs("machineid") serialNum = rs("serialnumber") & "" usbAlias = rs("alias") & "" businessUnit = rs("businessunit") & "" statusText = rs("status") & "" currentHolder = rs("current_holder") & "" checkoutId = rs("checkoutid") ' Handle checkout time (MM/DD/YYYY h:mm AM/PM) If Not IsNull(rs("checkout_time")) Then checkoutTime = Month(rs("checkout_time")) & "/" & Day(rs("checkout_time")) & "/" & Year(rs("checkout_time")) & " " & FormatDateTime(rs("checkout_time"), 3) Else checkoutTime = "-" End If checkoutReason = rs("checkout_reason") & "" ' Status styling If statusText = "Available" Then statusClass = "success" Else statusClass = "warning" End If %> <% rs.MoveNext Wend rs.Close Set rs = Nothing If rowCount = 0 Then %> <% End If %>
Serial Number Name Business Unit Status Current Holder Checkout Time Actions
<%=Server.HTMLEncode(serialNum)%> <%=Server.HTMLEncode(usbAlias)%> <%=Server.HTMLEncode(businessUnit)%> <%=Server.HTMLEncode(statusText)%> <% If currentHolder <> "" Then %> <%=Server.HTMLEncode(currentHolder)%> <% If checkoutReason <> "" Then %>
<%=Server.HTMLEncode(Left(checkoutReason, 30))%><% If Len(checkoutReason) > 30 Then Response.Write("...") End If %> <% End If %> <% Else %> - <% End If %>
<%=Server.HTMLEncode(checkoutTime)%> <% If IsNull(checkoutId) Then %> <% Else %> <% End If %>

No USB devices found. <% If showFilter <> "all" Then %>
Show all devices <% Else %>
Add a USB device <% End If %>
Total: <%=rowCount%> USB device(s) <% If showFilter <> "all" Then %> (filtered)<% End If %>