<!DOCTYPE html>
<html lang="en">
<head>
  <!--#include file="./includes/header.asp"-->
  <!--#include file="./includes/sql.asp"-->
</head>

<%
	theme = Request.Cookies("theme")
	IF theme = "" THEN
		theme="bg-theme1"
	END IF
	appid		=	Request.Querystring("appid")
%>
<body class="bg-theme <%Response.Write(theme)%>">

<!-- start loader -->
   <div id="pageloader-overlay" class="visible incoming"><div class="loader-wrapper-outer"><div class="loader-wrapper-inner" ><div class="loader"></div></div></div></div>
   <!-- end loader -->
<!-- Start wrapper-->
 <div id="wrapper">
  <!--#include file="./includes/leftsidebar.asp"-->
<!--Start topbar header-->
  <!--#include file="./includes/topbarheader.asp"-->
<!--End topbar header-->
<div class="clearfix"></div>
  <div class="content-wrapper">
      <div class="row">
        <div class="col-xl-auto">
          <div class="card">
            <div class="card-body">
              <h5 class="card-title">Application Installs</h5>
			  <div class="table-responsive">
              <table class="table table-hover">
                <thead>
                  <tr>
                    <th scope="col">Machine</th>
                    <th scope="col">Application</th>
                    <th scope="col">Version</th>
                  </tr>
                </thead>
                <tbody>

<%
		strSQL 	=	"SELECT m.machinenumber, a.appname, ia.machineid, av.version " & _
					"FROM installedapps ia " & _
					"INNER JOIN machines m ON ia.machineid = m.machineid " & _
					"INNER JOIN applications a ON ia.appid = a.appid " & _
					"LEFT JOIN appversions av ON ia.appversionid = av.appversionid " & _
					"WHERE ia.isactive = 1 AND ia.appid = " & CLng(appid) & " " & _
					"ORDER BY m.machinenumber ASC"
	set rs = objconn.Execute(strSQL)

	while not rs.eof
			Response.write("<tr>")
			Dim versionDisplay
			versionDisplay = rs("version") & ""
			If versionDisplay = "" Then versionDisplay = "<span class='text-muted'>-</span>"
%>
                    <td><a href="./displaymachine.asp?machineid=<%Response.Write(rs("machineid"))%>" title="View Machine Details"><%Response.Write(Server.HTMLEncode(rs("machinenumber") & ""))%></a></td>
                    <td><%Response.Write(Server.HTMLEncode(rs("appname") & ""))%></td>
                    <td><%Response.Write(versionDisplay)%></td>

                  </tr>

<%
	rs.movenext
	wend
	objConn.Close
%>
                </tbody>
              </table>
            </div>
            </div>
          </div>
        </div>
      </div><!--End Row-->

    <!-- End container-fluid-->
    
    </div><!--End content-wrapper-->
   <!--Start Back To Top Button-->
    <a href="javaScript:void();" class="back-to-top"><i class="fa fa-angle-double-up"></i> </a>
    <!--End Back To Top Button-->
	
	<!--Start footer-->
	<footer class="footer">
      </div>
    </footer>
	<!--End footer-->
	
   
  </div><!--End wrapper-->


  <!-- Bootstrap core JavaScript-->
  <script src="assets/js/jquery.min.js"></script>
  <script src="assets/js/popper.min.js"></script>
  <script src="assets/js/bootstrap.min.js"></script>
	
  <!-- simplebar js -->
  <script src="assets/plugins/simplebar/js/simplebar.js"></script>
  <!-- sidebar-menu js -->
  <script src="assets/js/sidebar-menu.js"></script>
  
  <!-- Custom scripts -->
  <script src="assets/js/app-script.js"></script>
	
</body>
</html>
