Add displaylocations, location/inspection migrations, UI refinements
- New displaylocations.asp (production location listing) - 3 new SQL migrations: inspection machine type, location relationship types, pctype inspection update - displaymachine.asp / printbadge.asp substantial rework - editmachine/editpc/savemachineedit: ~50 line additions each - Dashboard index.html + tv-dashboard tweaks - .gitignore: block database-backup-*.sql, *.bak, *.pdf Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
10
.gitignore
vendored
10
.gitignore
vendored
@@ -20,6 +20,16 @@ tests/test_results_*.csv
|
||||
installers/
|
||||
v2/installers/
|
||||
|
||||
# Database backups (should not be version-controlled)
|
||||
shopdb-database-backup-*.sql
|
||||
database-backup-*.sql
|
||||
employee*-database-backup-*.sql
|
||||
shopdb_backup_*.sql
|
||||
|
||||
# Backup/scratch files
|
||||
*.bak
|
||||
*.pdf
|
||||
|
||||
# OS files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
@@ -23,7 +23,7 @@ ShopDB is a Classic ASP/VBScript web application for managing manufacturing shop
|
||||
- Production IIS server
|
||||
- Production IIS logs
|
||||
- Production MySQL database
|
||||
- Zabbix server (10.48.130.113)
|
||||
- Zabbix server (zabbix.compute.geaerospace.net)
|
||||
- Employee database (wjf_employees) - used by displayprofile.asp (can update code, cannot test)
|
||||
|
||||
For production tasks, user must:
|
||||
|
||||
16
addmodel.asp
16
addmodel.asp
@@ -138,17 +138,23 @@
|
||||
<option value="">-- Select Type --</option>
|
||||
<%
|
||||
Dim rsMachineTypes, strMTSQL
|
||||
strMTSQL = "SELECT machinetypeid, machinetype, category FROM machinetypes WHERE isactive = 1 ORDER BY category, machinetype ASC"
|
||||
strMTSQL = "SELECT machinetypeid, machinetype, " & _
|
||||
"CASE " & _
|
||||
" WHEN machinetypeid BETWEEN 1 AND 15 OR machinetypeid BETWEEN 21 AND 25 OR machinetypeid = 45 OR machinetypeid = 47 THEN 'Equipment' " & _
|
||||
" WHEN machinetypeid BETWEEN 16 AND 20 OR machinetypeid = 46 THEN 'Network' " & _
|
||||
" ELSE 'Other' " & _
|
||||
"END AS category " & _
|
||||
"FROM machinetypes WHERE isactive = 1 AND machinetypeid NOT IN (1, 33, 44) ORDER BY category, machinetype ASC"
|
||||
Set rsMachineTypes = objconn.Execute(strMTSQL)
|
||||
Dim lastCategory
|
||||
lastCategory = ""
|
||||
While Not rsMachineTypes.EOF
|
||||
If rsMachineTypes("category") <> lastCategory Then
|
||||
If rsMachineTypes("category") & "" <> lastCategory Then
|
||||
If lastCategory <> "" Then Response.Write("</optgroup>")
|
||||
Response.Write("<optgroup label='" & Server.HTMLEncode(rsMachineTypes("category")) & "'>")
|
||||
lastCategory = rsMachineTypes("category")
|
||||
Response.Write("<optgroup label='" & Server.HTMLEncode(rsMachineTypes("category") & "") & "'>")
|
||||
lastCategory = rsMachineTypes("category") & ""
|
||||
End If
|
||||
Response.Write("<option value='" & rsMachineTypes("machinetypeid") & "'>" & Server.HTMLEncode(rsMachineTypes("machinetype")) & "</option>")
|
||||
Response.Write("<option value='" & rsMachineTypes("machinetypeid") & "'>" & Server.HTMLEncode(rsMachineTypes("machinetype") & "") & "</option>")
|
||||
rsMachineTypes.MoveNext
|
||||
Wend
|
||||
If lastCategory <> "" Then Response.Write("</optgroup>")
|
||||
|
||||
28
api.asp
28
api.asp
@@ -957,7 +957,7 @@ Sub GetPCMachineRelationships()
|
||||
|
||||
Dim rsRel, strSQL, relList, relCount, relData
|
||||
|
||||
strSQL = "SELECT " & _
|
||||
strSQL = "SELECT DISTINCT " & _
|
||||
"pc.machineid AS pc_id, " & _
|
||||
"pc.machinenumber AS hostname, " & _
|
||||
"c.address AS ip, " & _
|
||||
@@ -978,7 +978,31 @@ Sub GetPCMachineRelationships()
|
||||
"AND eq.machinenumber NOT IN ('0612', '0613', '0614', '0615') " & _
|
||||
"AND (v.vendor IS NULL OR v.vendor != 'WJDT') " & _
|
||||
"AND (m.modelnumber IS NULL OR m.modelnumber != 'TBD') " & _
|
||||
"ORDER BY eq.machinenumber"
|
||||
"UNION " & _
|
||||
"SELECT DISTINCT " & _
|
||||
"pc.machineid AS pc_id, " & _
|
||||
"pc.machinenumber AS hostname, " & _
|
||||
"c.address AS ip, " & _
|
||||
"dp.machineid AS machine_id, " & _
|
||||
"dp.machinenumber AS machine_number, " & _
|
||||
"v.vendor AS vendor, " & _
|
||||
"m.modelnumber AS model " & _
|
||||
"FROM machinerelationships dual_rel " & _
|
||||
"JOIN relationshiptypes drt ON dual_rel.relationshiptypeid = drt.relationshiptypeid AND drt.relationshiptype = 'Dualpath' " & _
|
||||
"JOIN machines dp ON dual_rel.related_machineid = dp.machineid " & _
|
||||
"JOIN machinerelationships mr ON mr.machineid = dual_rel.machineid AND mr.isactive = 1 " & _
|
||||
"JOIN relationshiptypes rt ON mr.relationshiptypeid = rt.relationshiptypeid AND rt.relationshiptype IN ('Controls', 'Controlled By') " & _
|
||||
"JOIN machines pc ON mr.related_machineid = pc.machineid AND pc.pctypeid IS NOT NULL " & _
|
||||
"LEFT JOIN communications c ON pc.machineid = c.machineid AND c.isprimary = 1 AND c.comstypeid = 1 " & _
|
||||
"LEFT JOIN models m ON dp.modelnumberid = m.modelnumberid " & _
|
||||
"LEFT JOIN vendors v ON m.vendorid = v.vendorid " & _
|
||||
"WHERE dual_rel.isactive = 1 " & _
|
||||
"AND dp.machinenumber IS NOT NULL AND dp.machinenumber != '' " & _
|
||||
"AND dp.machinenumber REGEXP '^[0-9]{4}$' " & _
|
||||
"AND dp.machinenumber NOT IN ('0612', '0613', '0614', '0615') " & _
|
||||
"AND (v.vendor IS NULL OR v.vendor != 'WJDT') " & _
|
||||
"AND (m.modelnumber IS NULL OR m.modelnumber != 'TBD') " & _
|
||||
"ORDER BY machine_number"
|
||||
|
||||
Set rsRel = objConn.Execute(strSQL)
|
||||
|
||||
|
||||
353
displaylocations.asp
Normal file
353
displaylocations.asp
Normal file
@@ -0,0 +1,353 @@
|
||||
<%@ Language=VBScript %>
|
||||
<%
|
||||
Option Explicit
|
||||
Dim theme, strSQL, rs, objConn, rsRel
|
||||
%>
|
||||
<!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
|
||||
%>
|
||||
<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="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-xl-auto">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:15px;">
|
||||
<h5 class="card-title" style="margin:0;">
|
||||
<i class="zmdi zmdi-pin"></i> Locations
|
||||
</h5>
|
||||
</div>
|
||||
|
||||
<%
|
||||
' Get all active locations with PC counts and relationship counts
|
||||
strSQL = "SELECT m.machineid, m.machinenumber, m.alias, m.machinenotes, m.mapleft, m.maptop, " & _
|
||||
" (SELECT COUNT(*) FROM machinerelationships mr " & _
|
||||
" JOIN machines pc ON mr.related_machineid = pc.machineid " & _
|
||||
" WHERE mr.machineid = m.machineid AND mr.isactive = 1 AND pc.pctypeid IS NOT NULL AND pc.isactive = 1) AS pc_count, " & _
|
||||
" (SELECT COUNT(*) FROM machinerelationships mr " & _
|
||||
" JOIN machines child ON mr.related_machineid = child.machineid " & _
|
||||
" WHERE mr.machineid = m.machineid AND mr.isactive = 1 AND child.islocationonly = 1 AND child.isactive = 1) AS sublocation_count " & _
|
||||
"FROM machines m " & _
|
||||
"WHERE m.islocationonly = 1 AND m.isactive = 1 AND m.machinenumber <> 'TBD' " & _
|
||||
"ORDER BY m.machinenumber"
|
||||
Set rs = objConn.Execute(strSQL)
|
||||
|
||||
' Build a dictionary of all relationships for location machines
|
||||
' Key = machineid, Value = array of relationship info
|
||||
Dim relDict, relSQL
|
||||
Set relDict = Server.CreateObject("Scripting.Dictionary")
|
||||
|
||||
relSQL = "SELECT mr.machineid AS loc_id, child.machineid AS child_id, child.machinenumber AS child_name, " & _
|
||||
" child.hostname AS child_hostname, child.alias AS child_alias, " & _
|
||||
" child.pctypeid, child.islocationonly, " & _
|
||||
" rt.relationshiptype, rt.relationshiptypeid, " & _
|
||||
" GROUP_CONCAT(DISTINCT c.address ORDER BY c.address SEPARATOR ', ') AS child_ip " & _
|
||||
"FROM machinerelationships mr " & _
|
||||
"JOIN machines loc ON mr.machineid = loc.machineid " & _
|
||||
"JOIN machines child ON mr.related_machineid = child.machineid " & _
|
||||
"JOIN relationshiptypes rt ON mr.relationshiptypeid = rt.relationshiptypeid " & _
|
||||
"LEFT JOIN communications c ON child.machineid = c.machineid AND c.comstypeid IN (1, 3) AND c.isactive = 1 " & _
|
||||
"WHERE loc.islocationonly = 1 AND loc.isactive = 1 AND mr.isactive = 1 AND child.isactive = 1 " & _
|
||||
"GROUP BY mr.machineid, child.machineid, child.machinenumber, child.hostname, child.alias, " & _
|
||||
" child.pctypeid, child.islocationonly, rt.relationshiptype, rt.relationshiptypeid " & _
|
||||
"ORDER BY mr.machineid, rt.relationshiptypeid, child.machinenumber"
|
||||
Set rsRel = objConn.Execute(relSQL)
|
||||
|
||||
Dim curLocId
|
||||
Do While Not rsRel.EOF
|
||||
curLocId = CStr(rsRel("loc_id"))
|
||||
If Not relDict.Exists(curLocId) Then
|
||||
relDict.Add curLocId, ""
|
||||
End If
|
||||
' Build pipe-delimited entries: child_id|child_name|child_hostname|child_alias|child_ip|pctypeid|islocationonly|relationshiptype
|
||||
Dim entry
|
||||
entry = rsRel("child_id") & "|" & (rsRel("child_name") & "") & "|" & (rsRel("child_hostname") & "") & "|" & _
|
||||
(rsRel("child_alias") & "") & "|" & (rsRel("child_ip") & "") & "|" & _
|
||||
(rsRel("pctypeid") & "") & "|" & (rsRel("islocationonly") & "") & "|" & (rsRel("relationshiptype") & "")
|
||||
If relDict(curLocId) <> "" Then
|
||||
relDict(curLocId) = relDict(curLocId) & "~" & entry
|
||||
Else
|
||||
relDict(curLocId) = entry
|
||||
End If
|
||||
rsRel.MoveNext
|
||||
Loop
|
||||
rsRel.Close
|
||||
Set rsRel = Nothing
|
||||
%>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table id="locationsTable" class="table table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Location</th>
|
||||
<th>Alias</th>
|
||||
<th>PCs</th>
|
||||
<th>Sub-locations</th>
|
||||
<th>Map</th>
|
||||
<th>Notes</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
Do While Not rs.EOF
|
||||
Dim locName, locAlias, locNotes, pcCount, subCount, hasMap, mid, totalRels
|
||||
mid = rs("machineid")
|
||||
locName = rs("machinenumber") & ""
|
||||
locAlias = rs("alias") & ""
|
||||
locNotes = rs("machinenotes") & ""
|
||||
pcCount = CLng(rs("pc_count") & "")
|
||||
subCount = CLng(rs("sublocation_count") & "")
|
||||
hasMap = Not (IsNull(rs("mapleft")) Or IsNull(rs("maptop")))
|
||||
totalRels = pcCount + subCount
|
||||
|
||||
' Check if this location has any relationships in our dict
|
||||
Dim hasRels, midStr
|
||||
midStr = CStr(mid)
|
||||
hasRels = relDict.Exists(midStr) And relDict(midStr) <> ""
|
||||
%>
|
||||
<tr<% If hasRels Then %> class="loc-parent" data-mid="<%=mid%>" style="cursor:pointer;"<% End If %>>
|
||||
<td style="width:30px;">
|
||||
<% If hasRels Then %>
|
||||
<i class="zmdi zmdi-chevron-right loc-toggle" data-mid="<%=mid%>" style="transition:transform 0.2s;"></i>
|
||||
<% End If %>
|
||||
</td>
|
||||
<td>
|
||||
<a href="displaymachine.asp?machineid=<%=mid%>">
|
||||
<i class="zmdi zmdi-pin" style="margin-right:5px;"></i><%=Server.HTMLEncode(locName)%>
|
||||
</a>
|
||||
</td>
|
||||
<td><%=Server.HTMLEncode(locAlias)%></td>
|
||||
<td>
|
||||
<% If pcCount > 0 Then %>
|
||||
<span class="badge badge-primary"><%=pcCount%></span>
|
||||
<% Else %>
|
||||
<span class="text-muted">0</span>
|
||||
<% End If %>
|
||||
</td>
|
||||
<td>
|
||||
<% If subCount > 0 Then %>
|
||||
<span class="badge badge-info"><%=subCount%></span>
|
||||
<% Else %>
|
||||
<span class="text-muted">0</span>
|
||||
<% End If %>
|
||||
</td>
|
||||
<td>
|
||||
<% If hasMap Then %>
|
||||
<i class="zmdi zmdi-pin text-success" title="Location set"></i>
|
||||
<% Else %>
|
||||
<i class="zmdi zmdi-pin-off text-muted" title="No location set"></i>
|
||||
<% End If %>
|
||||
</td>
|
||||
<td><span title="<%=Server.HTMLEncode(locNotes)%>"><%
|
||||
If Len(locNotes) > 40 Then
|
||||
Response.Write(Server.HTMLEncode(Left(locNotes, 40)) & "...")
|
||||
Else
|
||||
Response.Write(Server.HTMLEncode(locNotes))
|
||||
End If
|
||||
%></span></td>
|
||||
<td>
|
||||
<a href="displaymachine.asp?machineid=<%=mid%>" class="btn btn-sm btn-outline-info" title="View">
|
||||
<i class="zmdi zmdi-eye"></i>
|
||||
</a>
|
||||
<a href="printbadge.asp?machineid=<%=mid%>" class="btn btn-sm btn-outline-secondary" title="Print Label" target="_blank">
|
||||
<i class="zmdi zmdi-label"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<%
|
||||
' Render hidden detail rows for this location's relationships
|
||||
If hasRels Then
|
||||
Dim entries, i, parts
|
||||
entries = Split(relDict(midStr), "~")
|
||||
For i = 0 To UBound(entries)
|
||||
parts = Split(entries(i), "|")
|
||||
' parts: 0=child_id, 1=child_name, 2=child_hostname, 3=child_alias, 4=child_ip, 5=pctypeid, 6=islocationonly, 7=relationshiptype
|
||||
Dim cId, cName, cHost, cAlias, cIp, cIsPC, cIsLoc, cRelType, cBadgeClass, cIcon, cLink
|
||||
cId = parts(0)
|
||||
cName = parts(1)
|
||||
cHost = parts(2)
|
||||
cAlias = parts(3)
|
||||
cIp = parts(4)
|
||||
cIsPC = (parts(5) <> "")
|
||||
cIsLoc = (parts(6) = "1" Or parts(6) = "True")
|
||||
cRelType = parts(7)
|
||||
|
||||
' Determine icon and badge
|
||||
If cIsLoc Then
|
||||
cIcon = "zmdi zmdi-pin text-info"
|
||||
cBadgeClass = "badge-info"
|
||||
cLink = "displaymachine.asp?machineid=" & cId
|
||||
ElseIf cIsPC Then
|
||||
cIcon = "zmdi zmdi-desktop-windows text-primary"
|
||||
cBadgeClass = "badge-primary"
|
||||
cLink = "displaypc.asp?machineid=" & cId
|
||||
Else
|
||||
cIcon = "zmdi zmdi-memory text-warning"
|
||||
cBadgeClass = "badge-warning"
|
||||
cLink = "displaymachine.asp?machineid=" & cId
|
||||
End If
|
||||
|
||||
' Display name: use hostname for PCs if available, else machinenumber
|
||||
Dim displayName
|
||||
If cIsPC And cHost <> "" Then
|
||||
displayName = cHost
|
||||
Else
|
||||
displayName = cName
|
||||
End If
|
||||
%>
|
||||
<tr class="loc-detail loc-detail-<%=mid%>" style="display:none;">
|
||||
<td></td>
|
||||
<td style="padding-left:30px;">
|
||||
<i class="<%=cIcon%>" style="margin-right:5px;"></i>
|
||||
<a href="<%=cLink%>"><%=Server.HTMLEncode(displayName)%></a>
|
||||
<% If cAlias <> "" Then %>
|
||||
<small class="text-muted"> (<%=Server.HTMLEncode(cAlias)%>)</small>
|
||||
<% End If %>
|
||||
</td>
|
||||
<td>
|
||||
<% If cIp <> "" Then %>
|
||||
<small><%=Server.HTMLEncode(cIp)%></small>
|
||||
<% End If %>
|
||||
</td>
|
||||
<td colspan="2">
|
||||
<span class="badge <%=cBadgeClass%>"><%=Server.HTMLEncode(cRelType)%></span>
|
||||
</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<a href="<%=cLink%>" class="btn btn-sm btn-outline-info" title="View">
|
||||
<i class="zmdi zmdi-eye"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<%
|
||||
Next
|
||||
End If
|
||||
|
||||
rs.MoveNext
|
||||
Loop
|
||||
rs.Close
|
||||
Set rs = Nothing
|
||||
Set relDict = Nothing
|
||||
%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</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 class="container">
|
||||
<div class="text-center">
|
||||
</div>
|
||||
</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>
|
||||
|
||||
<!-- DataTables -->
|
||||
<link rel="stylesheet" href="assets/plugins/datatables/dataTables.bootstrap4.min.css">
|
||||
<script src="assets/plugins/datatables/jquery.dataTables.min.js"></script>
|
||||
<script src="assets/plugins/datatables/dataTables.bootstrap4.min.js"></script>
|
||||
|
||||
<!-- Custom scripts -->
|
||||
<script src="assets/js/app-script.js"></script>
|
||||
|
||||
<style>
|
||||
.loc-detail td {
|
||||
border-top: none !important;
|
||||
padding-top: 2px !important;
|
||||
padding-bottom: 2px !important;
|
||||
background: rgba(0,0,0,0.05) !important;
|
||||
}
|
||||
.loc-toggle.open {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
.loc-parent:hover {
|
||||
background: rgba(255,255,255,0.03);
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
var dt = $('#locationsTable').DataTable({
|
||||
"order": [[1, "asc"]],
|
||||
"pageLength": 25,
|
||||
"language": {
|
||||
"emptyTable": "No locations found",
|
||||
"search": "Filter:"
|
||||
},
|
||||
"columnDefs": [
|
||||
{ "orderable": false, "targets": 0 },
|
||||
{ "searchable": false, "targets": 0 }
|
||||
]
|
||||
});
|
||||
|
||||
// Toggle detail rows
|
||||
$('#locationsTable').on('click', '.loc-parent', function(e) {
|
||||
// Don't toggle if clicking a link or button
|
||||
if ($(e.target).closest('a, button').length) return;
|
||||
|
||||
var mid = $(this).data('mid');
|
||||
var toggle = $(this).find('.loc-toggle');
|
||||
var details = $('.loc-detail-' + mid);
|
||||
|
||||
if (details.first().is(':visible')) {
|
||||
details.hide();
|
||||
toggle.removeClass('open');
|
||||
} else {
|
||||
details.show();
|
||||
toggle.addClass('open');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<%
|
||||
objConn.Close
|
||||
%>
|
||||
@@ -83,7 +83,7 @@
|
||||
"machines.modelnumberid, machines.businessunitid, machines.printerid, machines.pctypeid, " & _
|
||||
"machines.loggedinuser, machines.osid, machines.machinestatusid, " & _
|
||||
"machines.controllertypeid, machines.controllerosid, machines.requires_manual_machine_config, " & _
|
||||
"machines.lastupdated, machines.fqdn, " & _
|
||||
"machines.lastupdated, machines.fqdn, machines.islocationonly, " & _
|
||||
"machinetypes.machinetype, " & _
|
||||
"models.modelnumber, models.image, models.machinetypeid, " & _
|
||||
"businessunits.businessunit, " & _
|
||||
@@ -407,7 +407,44 @@ End If
|
||||
<div class="tab-pane" id="relationships">
|
||||
<h5 class="mb-3">Machine Relationships</h5>
|
||||
|
||||
<!-- Connected PCs -->
|
||||
<%
|
||||
' === Connected PCs (direct + inherited via dualpath) ===
|
||||
strSQL2 = "SELECT m.machineid, m.machinenumber, m.hostname, rt.relationshiptype, " & _
|
||||
"GROUP_CONCAT(DISTINCT c.address ORDER BY c.address SEPARATOR ', ') as address " & _
|
||||
"FROM machinerelationships mr " & _
|
||||
"JOIN relationshiptypes rt ON mr.relationshiptypeid = rt.relationshiptypeid " & _
|
||||
"JOIN machines m ON (mr.machineid = m.machineid OR mr.related_machineid = m.machineid) " & _
|
||||
"LEFT JOIN communications c ON m.machineid = c.machineid AND c.comstypeid IN (1, 3) AND c.isactive = 1 " & _
|
||||
"WHERE (mr.machineid = ? OR mr.related_machineid = ?) " & _
|
||||
" AND m.pctypeid IS NOT NULL AND m.machineid <> ? AND mr.isactive = 1 " & _
|
||||
" AND rt.relationshiptype NOT IN ('Stored At', 'Contains') " & _
|
||||
"GROUP BY m.machineid, m.machinenumber, m.hostname, rt.relationshiptype " & _
|
||||
"UNION " & _
|
||||
"SELECT pc.machineid, pc.machinenumber, pc.hostname, 'Via Dualpath' as relationshiptype, " & _
|
||||
"GROUP_CONCAT(DISTINCT c.address ORDER BY c.address SEPARATOR ', ') as address " & _
|
||||
"FROM machinerelationships dual_rel " & _
|
||||
"JOIN relationshiptypes drt ON dual_rel.relationshiptypeid = drt.relationshiptypeid AND drt.relationshiptype = 'Dualpath' " & _
|
||||
"JOIN machinerelationships mr2 ON mr2.isactive = 1 " & _
|
||||
" AND ((dual_rel.related_machineid = mr2.machineid AND dual_rel.machineid = ?) " & _
|
||||
" OR (dual_rel.machineid = mr2.machineid AND dual_rel.related_machineid = ?)) " & _
|
||||
"JOIN machines pc ON (mr2.machineid = pc.machineid OR mr2.related_machineid = pc.machineid) " & _
|
||||
" AND pc.pctypeid IS NOT NULL AND pc.machineid <> ? " & _
|
||||
"JOIN relationshiptypes rt2 ON mr2.relationshiptypeid = rt2.relationshiptypeid " & _
|
||||
" AND rt2.relationshiptype NOT IN ('Stored At', 'Contains', 'Dualpath') " & _
|
||||
"LEFT JOIN communications c ON pc.machineid = c.machineid AND c.comstypeid IN (1, 3) AND c.isactive = 1 " & _
|
||||
"WHERE dual_rel.isactive = 1 " & _
|
||||
" AND (dual_rel.machineid = ? OR dual_rel.related_machineid = ?) " & _
|
||||
" AND pc.machineid NOT IN ( " & _
|
||||
" SELECT m2.machineid FROM machinerelationships mr3 " & _
|
||||
" JOIN machines m2 ON (mr3.machineid = m2.machineid OR mr3.related_machineid = m2.machineid) " & _
|
||||
" WHERE (mr3.machineid = ? OR mr3.related_machineid = ?) AND m2.pctypeid IS NOT NULL AND m2.machineid <> ? AND mr3.isactive = 1) " & _
|
||||
"GROUP BY pc.machineid, pc.machinenumber, pc.hostname " & _
|
||||
"ORDER BY relationshiptype, hostname"
|
||||
Set rs2 = ExecuteParameterizedQuery(objConn, strSQL2, Array(machineid, machineid, machineid, machineid, machineid, machineid, machineid, machineid, machineid, machineid, machineid))
|
||||
|
||||
Dim pcHostname, pcIP, pcMachineID, pcLocation, pcRelType
|
||||
If Not rs2.EOF Then
|
||||
%>
|
||||
<h6 class="mt-3 mb-2"><i class="zmdi zmdi-desktop-mac"></i> Connected PCs</h6>
|
||||
<div class="table-responsive mb-4">
|
||||
<table class="table table-hover table-striped">
|
||||
@@ -421,25 +458,6 @@ End If
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
' Query ALL PCs related to this machine via machinerelationships
|
||||
' Check both directions - the PC is identified by pctypeid IS NOT NULL
|
||||
' Use GROUP_CONCAT to combine multiple IPs into one row per PC
|
||||
strSQL2 = "SELECT m.machineid, m.machinenumber, m.hostname, rt.relationshiptype, " & _
|
||||
"GROUP_CONCAT(DISTINCT c.address ORDER BY c.address SEPARATOR ', ') as address " & _
|
||||
"FROM machinerelationships mr " & _
|
||||
"JOIN relationshiptypes rt ON mr.relationshiptypeid = rt.relationshiptypeid " & _
|
||||
"JOIN machines m ON (mr.machineid = m.machineid OR mr.related_machineid = m.machineid) " & _
|
||||
"LEFT JOIN communications c ON m.machineid = c.machineid AND c.comstypeid IN (1, 3) AND c.isactive = 1 " & _
|
||||
"WHERE (mr.machineid = ? OR mr.related_machineid = ?) " & _
|
||||
" AND m.pctypeid IS NOT NULL AND m.machineid <> ? AND mr.isactive = 1 " & _
|
||||
"GROUP BY m.machineid, m.machinenumber, m.hostname, rt.relationshiptype " & _
|
||||
"ORDER BY rt.relationshiptype, m.hostname"
|
||||
Set rs2 = ExecuteParameterizedQuery(objConn, strSQL2, Array(machineid, machineid, machineid))
|
||||
|
||||
Dim pcHostname, pcIP, pcMachineID, pcLocation, pcRelType
|
||||
If rs2.EOF Then
|
||||
Response.Write("<tr><td colspan='4' class='text-muted text-center'>No connected PCs</td></tr>")
|
||||
Else
|
||||
Do While Not rs2.EOF
|
||||
pcHostname = rs2("hostname") & ""
|
||||
pcIP = rs2("address") & ""
|
||||
@@ -451,7 +469,6 @@ End If
|
||||
If pcIP = "" Then pcIP = "<span class='text-muted'>N/A</span>"
|
||||
If pcLocation = "" Then pcLocation = "N/A"
|
||||
|
||||
' Badge color based on relationship type
|
||||
Dim pcRelBadge
|
||||
Select Case LCase(pcRelType)
|
||||
Case "controls"
|
||||
@@ -472,15 +489,27 @@ End If
|
||||
Response.Write("</tr>")
|
||||
rs2.MoveNext
|
||||
Loop
|
||||
End If
|
||||
rs2.Close
|
||||
Set rs2 = Nothing
|
||||
%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<%
|
||||
End If
|
||||
rs2.Close
|
||||
Set rs2 = Nothing
|
||||
|
||||
<!-- Machines This Machine Controls -->
|
||||
' === Machines Controlled ===
|
||||
strSQL2 = "SELECT m.machineid, m.machinenumber, mt.machinetype, mo.modelnumber, rt.relationshiptype " & _
|
||||
"FROM machinerelationships mr " & _
|
||||
"JOIN relationshiptypes rt ON mr.relationshiptypeid = rt.relationshiptypeid " & _
|
||||
"JOIN machines m ON mr.related_machineid = m.machineid " & _
|
||||
"LEFT JOIN models mo ON m.modelnumberid = mo.modelnumberid " & _
|
||||
"LEFT JOIN machinetypes mt ON mo.machinetypeid = mt.machinetypeid " & _
|
||||
"WHERE mr.machineid = ? AND rt.relationshiptype NOT IN ('Controls', 'Dualpath', 'Connected To', 'Stored At', 'Contains') AND mr.isactive = 1"
|
||||
Set rs2 = ExecuteParameterizedQuery(objConn, strSQL2, Array(machineid))
|
||||
|
||||
If Not rs2.EOF Then
|
||||
%>
|
||||
<h6 class="mt-3 mb-2"><i class="zmdi zmdi-arrow-right-top"></i> Machines Controlled by This Machine</h6>
|
||||
<div class="table-responsive mb-4">
|
||||
<table class="table table-hover table-striped">
|
||||
@@ -494,20 +523,6 @@ End If
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
' Query other machines related to this one (excluding Controls which is shown in "Controlled By PC" section)
|
||||
' This shows relationships like Cluster Member, Backup For, Master-Slave, etc.
|
||||
strSQL2 = "SELECT m.machineid, m.machinenumber, mt.machinetype, mo.modelnumber, rt.relationshiptype " & _
|
||||
"FROM machinerelationships mr " & _
|
||||
"JOIN relationshiptypes rt ON mr.relationshiptypeid = rt.relationshiptypeid " & _
|
||||
"JOIN machines m ON mr.related_machineid = m.machineid " & _
|
||||
"LEFT JOIN models mo ON m.modelnumberid = mo.modelnumberid " & _
|
||||
"LEFT JOIN machinetypes mt ON mo.machinetypeid = mt.machinetypeid " & _
|
||||
"WHERE mr.machineid = ? AND rt.relationshiptype NOT IN ('Controls', 'Dualpath', 'Connected To') AND mr.isactive = 1"
|
||||
Set rs2 = ExecuteParameterizedQuery(objConn, strSQL2, Array(machineid))
|
||||
|
||||
If rs2.EOF Then
|
||||
Response.Write("<tr><td colspan='4' class='text-muted text-center'>This machine does not control any other machines</td></tr>")
|
||||
Else
|
||||
Do While Not rs2.EOF
|
||||
Dim ctrlMachineNum, ctrlType, ctrlModel, ctrlMachineID
|
||||
ctrlMachineNum = rs2("machinenumber") & ""
|
||||
@@ -526,17 +541,29 @@ End If
|
||||
Response.Write("</tr>")
|
||||
rs2.MoveNext
|
||||
Loop
|
||||
End If
|
||||
rs2.Close
|
||||
Set rs2 = Nothing
|
||||
%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<%
|
||||
End If
|
||||
rs2.Close
|
||||
Set rs2 = Nothing
|
||||
|
||||
<!-- Dualpath Relationships -->
|
||||
' === Dualpath Relationships ===
|
||||
strSQL2 = "SELECT m.machineid, m.machinenumber, mt.machinetype, mo.modelnumber, rt.relationshiptype " & _
|
||||
"FROM machinerelationships mr " & _
|
||||
"JOIN relationshiptypes rt ON mr.relationshiptypeid = rt.relationshiptypeid " & _
|
||||
"JOIN machines m ON mr.related_machineid = m.machineid " & _
|
||||
"LEFT JOIN models mo ON m.modelnumberid = mo.modelnumberid " & _
|
||||
"LEFT JOIN machinetypes mt ON mo.machinetypeid = mt.machinetypeid " & _
|
||||
"WHERE mr.machineid = ? AND rt.relationshiptype = 'Dualpath' AND mr.isactive = 1"
|
||||
Set rs2 = ExecuteParameterizedQuery(objConn, strSQL2, Array(machineid))
|
||||
|
||||
If Not rs2.EOF Then
|
||||
%>
|
||||
<h6 class="mt-3 mb-2"><i class="zmdi zmdi-swap"></i> Dualpath / Redundant Machines</h6>
|
||||
<div class="table-responsive">
|
||||
<div class="table-responsive mb-4">
|
||||
<table class="table table-hover table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -548,19 +575,6 @@ End If
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
' Query dualpath relationships
|
||||
strSQL2 = "SELECT m.machineid, m.machinenumber, mt.machinetype, mo.modelnumber, rt.relationshiptype " & _
|
||||
"FROM machinerelationships mr " & _
|
||||
"JOIN relationshiptypes rt ON mr.relationshiptypeid = rt.relationshiptypeid " & _
|
||||
"JOIN machines m ON mr.related_machineid = m.machineid " & _
|
||||
"LEFT JOIN models mo ON m.modelnumberid = mo.modelnumberid " & _
|
||||
"LEFT JOIN machinetypes mt ON mo.machinetypeid = mt.machinetypeid " & _
|
||||
"WHERE mr.machineid = ? AND rt.relationshiptype = 'Dualpath' AND mr.isactive = 1"
|
||||
Set rs2 = ExecuteParameterizedQuery(objConn, strSQL2, Array(machineid))
|
||||
|
||||
If rs2.EOF Then
|
||||
Response.Write("<tr><td colspan='4' class='text-muted text-center'>No dualpath relationships</td></tr>")
|
||||
Else
|
||||
Do While Not rs2.EOF
|
||||
Dim dualMachineNum, dualType, dualModel, dualMachineID
|
||||
dualMachineNum = rs2("machinenumber") & ""
|
||||
@@ -579,17 +593,42 @@ End If
|
||||
Response.Write("</tr>")
|
||||
rs2.MoveNext
|
||||
Loop
|
||||
End If
|
||||
rs2.Close
|
||||
Set rs2 = Nothing
|
||||
%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<%
|
||||
End If
|
||||
rs2.Close
|
||||
Set rs2 = Nothing
|
||||
|
||||
<!-- Network Device Connections (Connected To) -->
|
||||
' === Network Connections ===
|
||||
' Query both directions for Connected To relationships
|
||||
Dim hasNetConn
|
||||
hasNetConn = False
|
||||
|
||||
strSQL2 = "SELECT m.machineid, m.machinenumber, m.alias, mt.machinetype, rt.relationshiptype, 'to' AS direction " & _
|
||||
"FROM machinerelationships mr " & _
|
||||
"JOIN relationshiptypes rt ON mr.relationshiptypeid = rt.relationshiptypeid " & _
|
||||
"LEFT JOIN machines m ON mr.related_machineid = m.machineid " & _
|
||||
"LEFT JOIN models mo ON m.modelnumberid = mo.modelnumberid " & _
|
||||
"LEFT JOIN machinetypes mt ON mo.machinetypeid = mt.machinetypeid " & _
|
||||
"WHERE mr.machineid = ? AND rt.relationshiptype = 'Connected To' AND mr.isactive = 1 " & _
|
||||
"UNION ALL " & _
|
||||
"SELECT m.machineid, m.machinenumber, m.alias, mt.machinetype, rt.relationshiptype, 'from' AS direction " & _
|
||||
"FROM machinerelationships mr " & _
|
||||
"JOIN relationshiptypes rt ON mr.relationshiptypeid = rt.relationshiptypeid " & _
|
||||
"LEFT JOIN machines m ON mr.machineid = m.machineid " & _
|
||||
"LEFT JOIN models mo ON m.modelnumberid = mo.modelnumberid " & _
|
||||
"LEFT JOIN machinetypes mt ON mo.machinetypeid = mt.machinetypeid " & _
|
||||
"WHERE mr.related_machineid = ? AND rt.relationshiptype = 'Connected To' AND mr.isactive = 1"
|
||||
Set rs2 = ExecuteParameterizedQuery(objConn, strSQL2, Array(machineid, machineid))
|
||||
|
||||
If Not rs2.EOF Then
|
||||
hasNetConn = True
|
||||
%>
|
||||
<h6 class="mt-3 mb-2"><i class="zmdi zmdi-network"></i> Network Connections</h6>
|
||||
<div class="table-responsive">
|
||||
<div class="table-responsive mb-4">
|
||||
<table class="table table-hover table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -601,66 +640,120 @@ End If
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
' Query devices this machine is connected to (e.g., Camera -> IDF)
|
||||
strSQL2 = "SELECT m.machineid, m.machinenumber, m.alias, mt.machinetype, rt.relationshiptype " & _
|
||||
"FROM machinerelationships mr " & _
|
||||
"JOIN relationshiptypes rt ON mr.relationshiptypeid = rt.relationshiptypeid " & _
|
||||
"LEFT JOIN machines m ON mr.related_machineid = m.machineid " & _
|
||||
"LEFT JOIN models mo ON m.modelnumberid = mo.modelnumberid " & _
|
||||
"LEFT JOIN machinetypes mt ON mo.machinetypeid = mt.machinetypeid " & _
|
||||
"WHERE mr.machineid = ? AND rt.relationshiptype = 'Connected To' AND mr.isactive = 1"
|
||||
Set rs2 = ExecuteParameterizedQuery(objConn, strSQL2, Array(machineid))
|
||||
|
||||
If Not rs2.EOF Then
|
||||
While Not rs2.EOF
|
||||
Dim connAlias, connType
|
||||
Dim connAlias, connType, connDir
|
||||
connAlias = "" : If Not IsNull(rs2("alias")) Then connAlias = rs2("alias") & ""
|
||||
connType = "" : If Not IsNull(rs2("machinetype")) Then connType = rs2("machinetype") & ""
|
||||
connDir = rs2("direction") & ""
|
||||
|
||||
Response.Write("<tr>")
|
||||
Response.Write("<td><a href='displaymachine.asp?machineid=" & rs2("machineid") & "'>" & Server.HTMLEncode(rs2("machinenumber") & "") & "</a></td>")
|
||||
Response.Write("<td>" & Server.HTMLEncode(connAlias) & "</td>")
|
||||
Response.Write("<td>" & Server.HTMLEncode(connType) & "</td>")
|
||||
Response.Write("<td><span class='badge badge-success'>" & Server.HTMLEncode(rs2("relationshiptype") & "") & "</span></td>")
|
||||
If connDir = "from" Then
|
||||
Response.Write("<td><span class='badge badge-info'>Connected From</span></td>")
|
||||
Else
|
||||
Response.Write("<td><span class='badge badge-success'>" & Server.HTMLEncode(rs2("relationshiptype") & "") & "</span></td>")
|
||||
End If
|
||||
Response.Write("</tr>")
|
||||
rs2.MoveNext
|
||||
Wend
|
||||
Else
|
||||
Response.Write("<tr><td colspan='4' class='text-muted'>No network connections</td></tr>")
|
||||
End If
|
||||
rs2.Close
|
||||
|
||||
' Query devices connected to this machine (e.g., IDF -> Cameras)
|
||||
strSQL2 = "SELECT m.machineid, m.machinenumber, m.alias, mt.machinetype, rt.relationshiptype " & _
|
||||
"FROM machinerelationships mr " & _
|
||||
"JOIN relationshiptypes rt ON mr.relationshiptypeid = rt.relationshiptypeid " & _
|
||||
"LEFT JOIN machines m ON mr.machineid = m.machineid " & _
|
||||
"LEFT JOIN models mo ON m.modelnumberid = mo.modelnumberid " & _
|
||||
"LEFT JOIN machinetypes mt ON mo.machinetypeid = mt.machinetypeid " & _
|
||||
"WHERE mr.related_machineid = ? AND rt.relationshiptype = 'Connected To' AND mr.isactive = 1"
|
||||
Set rs2 = ExecuteParameterizedQuery(objConn, strSQL2, Array(machineid))
|
||||
|
||||
If Not rs2.EOF Then
|
||||
While Not rs2.EOF
|
||||
Dim connToAlias, connToType
|
||||
connToAlias = "" : If Not IsNull(rs2("alias")) Then connToAlias = rs2("alias") & ""
|
||||
connToType = "" : If Not IsNull(rs2("machinetype")) Then connToType = rs2("machinetype") & ""
|
||||
|
||||
Response.Write("<tr>")
|
||||
Response.Write("<td><a href='displaymachine.asp?machineid=" & rs2("machineid") & "'>" & Server.HTMLEncode(rs2("machinenumber") & "") & "</a></td>")
|
||||
Response.Write("<td>" & Server.HTMLEncode(connToAlias) & "</td>")
|
||||
Response.Write("<td>" & Server.HTMLEncode(connToType) & "</td>")
|
||||
Response.Write("<td><span class='badge badge-info'>Connected From</span></td>")
|
||||
Response.Write("</tr>")
|
||||
rs2.MoveNext
|
||||
Wend
|
||||
End If
|
||||
rs2.Close
|
||||
Set rs2 = Nothing
|
||||
%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<%
|
||||
End If
|
||||
rs2.Close
|
||||
Set rs2 = Nothing
|
||||
%>
|
||||
|
||||
<%
|
||||
' Location-specific section: show stored items and sub-locations
|
||||
Dim isLoc
|
||||
isLoc = rs("islocationonly") & ""
|
||||
If isLoc = "1" Or isLoc = "True" Then
|
||||
%>
|
||||
<!-- Stored Items (for location machines) -->
|
||||
<h6 class="mt-3 mb-2"><i class="zmdi zmdi-pin"></i> Stored Items & Sub-locations</h6>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>IP / Info</th>
|
||||
<th>Relationship</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
strSQL2 = "SELECT m.machineid, m.machinenumber, m.hostname, m.alias, m.pctypeid, m.islocationonly, " & _
|
||||
"rt.relationshiptype, mt.machinetype, " & _
|
||||
"GROUP_CONCAT(DISTINCT c.address ORDER BY c.address SEPARATOR ', ') AS address " & _
|
||||
"FROM machinerelationships mr " & _
|
||||
"JOIN relationshiptypes rt ON mr.relationshiptypeid = rt.relationshiptypeid " & _
|
||||
"JOIN machines m ON mr.related_machineid = m.machineid " & _
|
||||
"LEFT JOIN models mo ON m.modelnumberid = mo.modelnumberid " & _
|
||||
"LEFT JOIN machinetypes mt ON mo.machinetypeid = mt.machinetypeid " & _
|
||||
"LEFT JOIN communications c ON m.machineid = c.machineid AND c.comstypeid IN (1, 3) AND c.isactive = 1 " & _
|
||||
"WHERE mr.machineid = ? AND rt.relationshiptype IN ('Stored At', 'Contains') AND mr.isactive = 1 AND m.isactive = 1 " & _
|
||||
"GROUP BY m.machineid, m.machinenumber, m.hostname, m.alias, m.pctypeid, m.islocationonly, rt.relationshiptype, mt.machinetype " & _
|
||||
"ORDER BY rt.relationshiptype, m.machinenumber"
|
||||
Set rs2 = ExecuteParameterizedQuery(objConn, strSQL2, Array(machineid))
|
||||
|
||||
If rs2.EOF Then
|
||||
Response.Write("<tr><td colspan='4' class='text-muted text-center'>No stored items or sub-locations</td></tr>")
|
||||
Else
|
||||
Do While Not rs2.EOF
|
||||
Dim storedName, storedType, storedIP, storedRelType, storedBadge, storedLink, storedIcon
|
||||
storedRelType = rs2("relationshiptype") & ""
|
||||
|
||||
If (rs2("islocationonly") & "") = "1" Or (rs2("islocationonly") & "") = "True" Then
|
||||
storedName = rs2("machinenumber") & ""
|
||||
storedType = "Sub-location"
|
||||
storedIcon = "zmdi-pin"
|
||||
storedBadge = "badge-info"
|
||||
storedLink = "displaymachine.asp?machineid=" & rs2("machineid")
|
||||
ElseIf rs2("pctypeid") & "" <> "" Then
|
||||
storedName = rs2("hostname") & ""
|
||||
If storedName = "" Then storedName = rs2("machinenumber") & ""
|
||||
storedType = "PC"
|
||||
storedIcon = "zmdi-desktop-windows"
|
||||
storedBadge = "badge-primary"
|
||||
storedLink = "displaypc.asp?machineid=" & rs2("machineid")
|
||||
Else
|
||||
storedName = rs2("machinenumber") & ""
|
||||
storedType = rs2("machinetype") & ""
|
||||
If storedType = "" Then storedType = "Equipment"
|
||||
storedIcon = "zmdi-memory"
|
||||
storedBadge = "badge-warning"
|
||||
storedLink = "displaymachine.asp?machineid=" & rs2("machineid")
|
||||
End If
|
||||
|
||||
storedIP = rs2("address") & ""
|
||||
If storedIP = "" Then storedIP = "<span class='text-muted'>N/A</span>"
|
||||
|
||||
Response.Write("<tr>")
|
||||
Response.Write("<td><i class='zmdi " & storedIcon & "' style='margin-right:5px;'></i><a href='" & storedLink & "'>" & Server.HTMLEncode(storedName) & "</a>")
|
||||
If rs2("alias") & "" <> "" Then Response.Write(" <small class='text-muted'>(" & Server.HTMLEncode(rs2("alias") & "") & ")</small>")
|
||||
Response.Write("</td>")
|
||||
Response.Write("<td>" & Server.HTMLEncode(storedType) & "</td>")
|
||||
Response.Write("<td>" & storedIP & "</td>")
|
||||
Response.Write("<td><span class='badge " & storedBadge & "'>" & Server.HTMLEncode(storedRelType) & "</span></td>")
|
||||
Response.Write("</tr>")
|
||||
rs2.MoveNext
|
||||
Loop
|
||||
End If
|
||||
rs2.Close
|
||||
Set rs2 = Nothing
|
||||
%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<%
|
||||
End If
|
||||
%>
|
||||
</div>
|
||||
<div class="tab-pane" id="compliance">
|
||||
<h5 class="mb-3">Compliance & Security</h5>
|
||||
|
||||
@@ -524,20 +524,6 @@ End If
|
||||
<%
|
||||
End If
|
||||
%>
|
||||
<!-- Connected Equipment -->
|
||||
<h6 class="mt-3 mb-2"><i class="zmdi zmdi-settings"></i> Connected Equipment</h6>
|
||||
<div class="table-responsive mb-4">
|
||||
<table class="table table-hover table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Machine Number</th>
|
||||
<th>Type</th>
|
||||
<th>Model</th>
|
||||
<th>Location</th>
|
||||
<th>Relationship</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
' Query ALL equipment related to this PC via machinerelationships
|
||||
' Check both directions - the equipment is identified by pctypeid IS NULL
|
||||
@@ -552,9 +538,22 @@ End If
|
||||
"ORDER BY rt.relationshiptype, m.machinenumber"
|
||||
Set rs2 = ExecuteParameterizedQuery(objConn, strSQL2, Array(machineid, machineid, machineid))
|
||||
|
||||
If rs2.EOF Then
|
||||
Response.Write("<tr><td colspan='5' class='text-muted text-center'>No connected equipment</td></tr>")
|
||||
Else
|
||||
If Not rs2.EOF Then
|
||||
%>
|
||||
<h6 class="mt-3 mb-2"><i class="zmdi zmdi-settings"></i> Connected Equipment</h6>
|
||||
<div class="table-responsive mb-4">
|
||||
<table class="table table-hover table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Machine Number</th>
|
||||
<th>Type</th>
|
||||
<th>Model</th>
|
||||
<th>Location</th>
|
||||
<th>Relationship</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
Do While Not rs2.EOF
|
||||
Dim ctrlMachineNum, ctrlType, ctrlModel, ctrlMachineID, ctrlRelType
|
||||
ctrlMachineNum = rs2("machinenumber") & ""
|
||||
@@ -567,7 +566,6 @@ End If
|
||||
If ctrlType = "" Then ctrlType = "<span class='text-muted'>N/A</span>"
|
||||
If ctrlModel = "" Then ctrlModel = "<span class='text-muted'>N/A</span>"
|
||||
|
||||
' Badge color based on relationship type
|
||||
Dim ctrlRelBadge
|
||||
Select Case LCase(ctrlRelType)
|
||||
Case "controls"
|
||||
@@ -589,13 +587,15 @@ End If
|
||||
Response.Write("</tr>")
|
||||
rs2.MoveNext
|
||||
Loop
|
||||
End If
|
||||
rs2.Close
|
||||
Set rs2 = Nothing
|
||||
%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<%
|
||||
End If
|
||||
rs2.Close
|
||||
Set rs2 = Nothing
|
||||
%>
|
||||
</div>
|
||||
<div class="tab-pane" id="compliance">
|
||||
<h5 class="mb-3">Compliance & Security</h5>
|
||||
|
||||
@@ -141,6 +141,26 @@
|
||||
Set rsDualpath = Nothing
|
||||
Set cmd = Nothing
|
||||
|
||||
' Load parent location (this machine is contained by a location)
|
||||
Dim parentlocationid
|
||||
parentlocationid = ""
|
||||
strSQL = "SELECT mr.machineid AS parentid FROM machinerelationships mr " &_
|
||||
"JOIN relationshiptypes rt ON mr.relationshiptypeid = rt.relationshiptypeid " &_
|
||||
"WHERE mr.related_machineid = ? AND rt.relationshiptype = 'Contains' AND mr.isactive = 1"
|
||||
Set cmd = Server.CreateObject("ADODB.Command")
|
||||
cmd.ActiveConnection = objConn
|
||||
cmd.CommandText = strSQL
|
||||
cmd.CommandType = 1
|
||||
cmd.Parameters.Append cmd.CreateParameter("@machineid", 3, 1, , machineid)
|
||||
Dim rsParentLoc
|
||||
Set rsParentLoc = cmd.Execute
|
||||
If NOT rsParentLoc.EOF Then
|
||||
If NOT IsNull(rsParentLoc("parentid")) Then parentlocationid = rsParentLoc("parentid")
|
||||
End If
|
||||
rsParentLoc.Close
|
||||
Set rsParentLoc = Nothing
|
||||
Set cmd = Nothing
|
||||
|
||||
' Load compliance data
|
||||
Dim thirdpartymanaged, thirdpartymanager, otassetsystem, dodassettype
|
||||
thirdpartymanaged = "NA" : thirdpartymanager = "" : otassetsystem = "" : dodassettype = ""
|
||||
@@ -589,7 +609,7 @@
|
||||
<option value="">-- None --</option>
|
||||
<%
|
||||
Dim rsDualpathList
|
||||
strSQL = "SELECT machineid, machinenumber, alias FROM machines WHERE pctypeid IS NULL AND isactive = 1 AND machineid <> ? ORDER BY machinenumber ASC"
|
||||
strSQL = "SELECT machineid, machinenumber, alias FROM machines WHERE pctypeid IS NULL AND isactive = 1 AND (islocationonly IS NULL OR islocationonly = 0) AND machineid <> ? ORDER BY machinenumber ASC"
|
||||
Set cmd = Server.CreateObject("ADODB.Command")
|
||||
cmd.ActiveConnection = objConn
|
||||
cmd.CommandText = strSQL
|
||||
@@ -620,6 +640,38 @@
|
||||
<small class="form-text text-muted">Select a backup/redundant machine (creates bidirectional relationship)</small>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="parentlocationid"><i class="zmdi zmdi-pin"></i> Parent Location</label>
|
||||
<select class="form-control" id="parentlocationid" name="parentlocationid">
|
||||
<option value="">-- None --</option>
|
||||
<%
|
||||
Dim rsLocations
|
||||
strSQL = "SELECT machineid, machinenumber, alias FROM machines WHERE islocationonly = 1 AND isactive = 1 AND machineid <> ? ORDER BY machinenumber ASC"
|
||||
Set cmd = Server.CreateObject("ADODB.Command")
|
||||
cmd.ActiveConnection = objConn
|
||||
cmd.CommandText = strSQL
|
||||
cmd.CommandType = 1
|
||||
cmd.Parameters.Append cmd.CreateParameter("@machineid", 3, 1, , machineid)
|
||||
Set rsLocations = cmd.Execute
|
||||
While Not rsLocations.EOF
|
||||
Dim locDisplay, selectedLoc
|
||||
locDisplay = rsLocations("machinenumber") & ""
|
||||
selectedLoc = ""
|
||||
If NOT IsNull(rsLocations("alias")) AND rsLocations("alias") & "" <> "" Then
|
||||
locDisplay = locDisplay & " (" & rsLocations("alias") & ")"
|
||||
End If
|
||||
If CStr(rsLocations("machineid")) = CStr(parentlocationid) Then selectedLoc = " selected"
|
||||
Response.Write("<option value='" & rsLocations("machineid") & "'" & selectedLoc & ">" & Server.HTMLEncode(locDisplay) & "</option>")
|
||||
rsLocations.MoveNext
|
||||
Wend
|
||||
rsLocations.Close
|
||||
Set rsLocations = Nothing
|
||||
Set cmd = Nothing
|
||||
%>
|
||||
</select>
|
||||
<small class="form-text text-muted">Select a location that contains this machine (e.g., IT Closet, Bin, Shelf)</small>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ============================================================ -->
|
||||
|
||||
54
editpc.asp
54
editpc.asp
@@ -146,6 +146,26 @@
|
||||
Set rsDualpath = Nothing
|
||||
Set cmd = Nothing
|
||||
|
||||
' Load parent location (this PC is contained by a location)
|
||||
Dim parentlocationid
|
||||
parentlocationid = ""
|
||||
strSQL = "SELECT mr.machineid AS parentid FROM machinerelationships mr " &_
|
||||
"JOIN relationshiptypes rt ON mr.relationshiptypeid = rt.relationshiptypeid " &_
|
||||
"WHERE mr.related_machineid = ? AND rt.relationshiptype = 'Contains' AND mr.isactive = 1"
|
||||
Set cmd = Server.CreateObject("ADODB.Command")
|
||||
cmd.ActiveConnection = objConn
|
||||
cmd.CommandText = strSQL
|
||||
cmd.CommandType = 1
|
||||
cmd.Parameters.Append cmd.CreateParameter("@machineid", 3, 1, , machineid)
|
||||
Dim rsParentLoc
|
||||
Set rsParentLoc = cmd.Execute
|
||||
If NOT rsParentLoc.EOF Then
|
||||
If NOT IsNull(rsParentLoc("parentid")) Then parentlocationid = rsParentLoc("parentid")
|
||||
End If
|
||||
rsParentLoc.Close
|
||||
Set rsParentLoc = Nothing
|
||||
Set cmd = Nothing
|
||||
|
||||
' Load compliance data
|
||||
Dim thirdpartymanaged, thirdpartymanager, otassetsystem, dodassettype
|
||||
thirdpartymanaged = "NA" : thirdpartymanager = "" : otassetsystem = "" : dodassettype = ""
|
||||
@@ -621,7 +641,7 @@ Set rsMachineStatus = Nothing
|
||||
End Select
|
||||
strSQL = "SELECT m.machineid, m.machinenumber, m.alias FROM machines m " &_
|
||||
"LEFT JOIN models mo ON m.modelnumberid = mo.modelnumberid " &_
|
||||
"WHERE m.pctypeid IS NULL AND m.isactive = 1" & equipmentTypeFilter & " ORDER BY m.machinenumber ASC"
|
||||
"WHERE m.pctypeid IS NULL AND m.isactive = 1 AND (m.islocationonly IS NULL OR m.islocationonly = 0)" & equipmentTypeFilter & " ORDER BY m.machinenumber ASC"
|
||||
Set rsControlPCs = objconn.Execute(strSQL)
|
||||
While Not rsControlPCs.EOF
|
||||
Dim controlPCDisplay, selectedControlPC
|
||||
@@ -653,7 +673,37 @@ Set rsMachineStatus = Nothing
|
||||
%>
|
||||
</div>
|
||||
|
||||
<!-- Dualpath relationships don't typically apply to PCs -->
|
||||
<div class="form-group">
|
||||
<label for="parentlocationid"><i class="zmdi zmdi-pin"></i> Parent Location</label>
|
||||
<select class="form-control" id="parentlocationid" name="parentlocationid">
|
||||
<option value="">-- None --</option>
|
||||
<%
|
||||
Dim rsLocations
|
||||
strSQL = "SELECT machineid, machinenumber, alias FROM machines WHERE islocationonly = 1 AND isactive = 1 AND machineid <> ? ORDER BY machinenumber ASC"
|
||||
Set cmd = Server.CreateObject("ADODB.Command")
|
||||
cmd.ActiveConnection = objConn
|
||||
cmd.CommandText = strSQL
|
||||
cmd.CommandType = 1
|
||||
cmd.Parameters.Append cmd.CreateParameter("@machineid", 3, 1, , machineid)
|
||||
Set rsLocations = cmd.Execute
|
||||
While Not rsLocations.EOF
|
||||
Dim locDisplay, selectedLoc
|
||||
locDisplay = rsLocations("machinenumber") & ""
|
||||
selectedLoc = ""
|
||||
If NOT IsNull(rsLocations("alias")) AND rsLocations("alias") & "" <> "" Then
|
||||
locDisplay = locDisplay & " (" & rsLocations("alias") & ")"
|
||||
End If
|
||||
If CStr(rsLocations("machineid")) = CStr(parentlocationid) Then selectedLoc = " selected"
|
||||
Response.Write("<option value='" & rsLocations("machineid") & "'" & selectedLoc & ">" & Server.HTMLEncode(locDisplay) & "</option>")
|
||||
rsLocations.MoveNext
|
||||
Wend
|
||||
rsLocations.Close
|
||||
Set rsLocations = Nothing
|
||||
Set cmd = Nothing
|
||||
%>
|
||||
</select>
|
||||
<small class="form-text text-muted">Select a location that contains this PC (e.g., IT Closet)</small>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
Binary file not shown.
@@ -78,7 +78,7 @@ Const SNOW_TICKET_PREFIXES = "geinc,gechg,gerit,gesct" ' Valid ServiceNow ticke
|
||||
'-----------------------------------------------------------------------------
|
||||
' External Services - Zabbix API
|
||||
'-----------------------------------------------------------------------------
|
||||
Const ZABBIX_URL = "http://10.48.130.113:8080/api_jsonrpc.php"
|
||||
Const ZABBIX_URL = "http://zabbix.compute.geaerospace.net/zabbix/api_jsonrpc.php"
|
||||
Const ZABBIX_API_TOKEN = "YOUR_ZABBIX_API_TOKEN"
|
||||
|
||||
'-----------------------------------------------------------------------------
|
||||
|
||||
@@ -87,6 +87,7 @@ fiscalWeek = Int(fwDaysFromStart / 7) + 1
|
||||
<li><a href="./displaysubnets.asp"><i class="zmdi zmdi-network text-danger"></i><span>Network</span></a></li>
|
||||
<li><a href="./networkdevices.asp"><i class="zmdi zmdi-device-hub text-info"></i><span>Network Devices</span></a></li>
|
||||
<li><a href="./displaypcs.asp"><i class="zmdi zmdi-desktop-windows text-primary"></i><span>PC Admin</span></a></li>
|
||||
<li><a href="./displaylocations.asp"><i class="zmdi zmdi-pin text-warning"></i><span>Locations</span></a></li>
|
||||
<li><a href="./displayusb.asp"><i class="zmdi zmdi-usb text-purple"></i><span>USB Devices</span></a></li>
|
||||
<li><a href="./displaynotifications.asp"><i class="zmdi zmdi zmdi-notifications-none text-success"></i><span>Notifications</span></a></li>
|
||||
<li><a href="./tv-dashboard/" target="_blank"><i class="zmdi zmdi-tv text-warning"></i><span>Lobby Display</span></a></li>
|
||||
|
||||
@@ -142,6 +142,26 @@
|
||||
Set rsDualpath = Nothing
|
||||
Set cmd = Nothing
|
||||
|
||||
' Load parent location (this machine is contained by a location)
|
||||
Dim parentlocationid
|
||||
parentlocationid = ""
|
||||
strSQL = "SELECT mr.machineid AS parentid FROM machinerelationships mr " &_
|
||||
"JOIN relationshiptypes rt ON mr.relationshiptypeid = rt.relationshiptypeid " &_
|
||||
"WHERE mr.related_machineid = ? AND rt.relationshiptype = 'Contains' AND mr.isactive = 1"
|
||||
Set cmd = Server.CreateObject("ADODB.Command")
|
||||
cmd.ActiveConnection = objConn
|
||||
cmd.CommandText = strSQL
|
||||
cmd.CommandType = 1
|
||||
cmd.Parameters.Append cmd.CreateParameter("@machineid", 3, 1, , machineid)
|
||||
Dim rsParentLoc
|
||||
Set rsParentLoc = cmd.Execute
|
||||
If NOT rsParentLoc.EOF Then
|
||||
If NOT IsNull(rsParentLoc("parentid")) Then parentlocationid = rsParentLoc("parentid")
|
||||
End If
|
||||
rsParentLoc.Close
|
||||
Set rsParentLoc = Nothing
|
||||
Set cmd = Nothing
|
||||
|
||||
' Load compliance data
|
||||
Dim thirdpartymanaged, thirdpartymanager, otassetsystem, dodassettype
|
||||
thirdpartymanaged = "NA" : thirdpartymanager = "" : otassetsystem = "" : dodassettype = ""
|
||||
@@ -630,6 +650,38 @@
|
||||
<small class="form-text text-muted">Select a backup/redundant machine (creates bidirectional relationship)</small>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="parentlocationid"><i class="zmdi zmdi-pin"></i> Parent Location</label>
|
||||
<select class="form-control" id="parentlocationid" name="parentlocationid">
|
||||
<option value="">-- None --</option>
|
||||
<%
|
||||
Dim rsLocations
|
||||
strSQL = "SELECT machineid, machinenumber, alias FROM machines WHERE islocationonly = 1 AND isactive = 1 AND machineid <> ? ORDER BY machinenumber ASC"
|
||||
Set cmd = Server.CreateObject("ADODB.Command")
|
||||
cmd.ActiveConnection = objConn
|
||||
cmd.CommandText = strSQL
|
||||
cmd.CommandType = 1
|
||||
cmd.Parameters.Append cmd.CreateParameter("@machineid", 3, 1, , machineid)
|
||||
Set rsLocations = cmd.Execute
|
||||
While Not rsLocations.EOF
|
||||
Dim locDisplay, selectedLoc
|
||||
locDisplay = rsLocations("machinenumber") & ""
|
||||
selectedLoc = ""
|
||||
If NOT IsNull(rsLocations("alias")) AND rsLocations("alias") & "" <> "" Then
|
||||
locDisplay = locDisplay & " (" & rsLocations("alias") & ")"
|
||||
End If
|
||||
If CStr(rsLocations("machineid")) = CStr(parentlocationid) Then selectedLoc = " selected"
|
||||
Response.Write("<option value='" & rsLocations("machineid") & "'" & selectedLoc & ">" & Server.HTMLEncode(locDisplay) & "</option>")
|
||||
rsLocations.MoveNext
|
||||
Wend
|
||||
rsLocations.Close
|
||||
Set rsLocations = Nothing
|
||||
Set cmd = Nothing
|
||||
%>
|
||||
</select>
|
||||
<small class="form-text text-muted">Select a location that contains this machine (e.g., IT Closet, Bin, Shelf)</small>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ============================================================ -->
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<%
|
||||
Dim strSQL, rs
|
||||
|
||||
strSQL = "SELECT " & _
|
||||
strSQL = "SELECT DISTINCT " & _
|
||||
"pc.machineid AS pc_id, " & _
|
||||
"pc.machinenumber AS hostname, " & _
|
||||
"c.address AS ip, " & _
|
||||
@@ -56,7 +56,31 @@ strSQL = "SELECT " & _
|
||||
"AND eq.machinenumber NOT IN ('0612', '0613', '0614', '0615') " & _
|
||||
"AND (v.vendor IS NULL OR v.vendor != 'WJDT') " & _
|
||||
"AND (m.modelnumber IS NULL OR m.modelnumber != 'TBD') " & _
|
||||
"ORDER BY eq.machinenumber"
|
||||
"UNION " & _
|
||||
"SELECT DISTINCT " & _
|
||||
"pc.machineid AS pc_id, " & _
|
||||
"pc.machinenumber AS hostname, " & _
|
||||
"c.address AS ip, " & _
|
||||
"dp.machineid AS machine_id, " & _
|
||||
"dp.machinenumber AS machine_number, " & _
|
||||
"v.vendor AS vendor, " & _
|
||||
"m.modelnumber AS model " & _
|
||||
"FROM machinerelationships dual_rel " & _
|
||||
"JOIN relationshiptypes drt ON dual_rel.relationshiptypeid = drt.relationshiptypeid AND drt.relationshiptype = 'Dualpath' " & _
|
||||
"JOIN machines dp ON dual_rel.related_machineid = dp.machineid " & _
|
||||
"JOIN machinerelationships mr ON mr.machineid = dual_rel.machineid AND mr.isactive = 1 " & _
|
||||
"JOIN relationshiptypes rt ON mr.relationshiptypeid = rt.relationshiptypeid AND rt.relationshiptype IN ('Controls', 'Controlled By') " & _
|
||||
"JOIN machines pc ON mr.related_machineid = pc.machineid AND pc.pctypeid IS NOT NULL " & _
|
||||
"LEFT JOIN communications c ON pc.machineid = c.machineid AND c.isprimary = 1 AND c.comstypeid = 1 " & _
|
||||
"LEFT JOIN models m ON dp.modelnumberid = m.modelnumberid " & _
|
||||
"LEFT JOIN vendors v ON m.vendorid = v.vendorid " & _
|
||||
"WHERE dual_rel.isactive = 1 " & _
|
||||
"AND dp.machinenumber IS NOT NULL AND dp.machinenumber != '' " & _
|
||||
"AND dp.machinenumber REGEXP '^[0-9]{4}$' " & _
|
||||
"AND dp.machinenumber NOT IN ('0612', '0613', '0614', '0615') " & _
|
||||
"AND (v.vendor IS NULL OR v.vendor != 'WJDT') " & _
|
||||
"AND (m.modelnumber IS NULL OR m.modelnumber != 'TBD') " & _
|
||||
"ORDER BY machine_number"
|
||||
|
||||
Set rs = objConn.Execute(strSQL)
|
||||
|
||||
|
||||
@@ -3,11 +3,48 @@
|
||||
Option Explicit
|
||||
Dim objConn, rs
|
||||
%>
|
||||
<!--#include file="./includes/sql.asp"-->
|
||||
<%
|
||||
Dim machineid, strSQL, machineNumber, modelName, machineImage, isLocation
|
||||
|
||||
machineid = Request.QueryString("machineid")
|
||||
If machineid = "" Then machineid = "0"
|
||||
If Not IsNumeric(machineid) Then machineid = "0"
|
||||
|
||||
strSQL = "SELECT m.machinenumber, m.islocationonly, mo.modelnumber, mo.image FROM machines m LEFT JOIN models mo ON m.modelnumberid = mo.modelnumberid WHERE m.machineid = " & CLng(machineid)
|
||||
Set rs = objConn.Execute(strSQL)
|
||||
|
||||
If rs.EOF Then
|
||||
machineNumber = "NOT FOUND"
|
||||
modelName = ""
|
||||
machineImage = ""
|
||||
isLocation = False
|
||||
Else
|
||||
machineNumber = rs("machinenumber") & ""
|
||||
modelName = rs("modelnumber") & ""
|
||||
machineImage = rs("image") & ""
|
||||
isLocation = (rs("islocationonly") & "" = "1") Or (rs("islocationonly") & "" = "True")
|
||||
End If
|
||||
rs.Close
|
||||
Set rs = Nothing
|
||||
objConn.Close
|
||||
%>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<!--#include file="./includes/sql.asp"-->
|
||||
<title>Print Badge</title>
|
||||
<% If isLocation Then %>
|
||||
<script src="https://cdn.jsdelivr.net/npm/qrcodejs@1.0.0/qrcode.min.js"></script>
|
||||
<style>
|
||||
@page { size: 2in 2in; margin: 0; }
|
||||
body { font-family: Arial, sans-serif; background: #f0f0f0; margin: 0; padding: 20px; }
|
||||
.badge-container { width: 2in; height: 2in; background: white; margin: 0 auto; border: 1px solid #ccc; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0.1in; box-sizing: border-box; }
|
||||
.machine-number { font-size: 10pt; font-weight: bold; font-family: Arial, sans-serif; margin-top: 5px; text-align: center; color: #000; }
|
||||
.qr-container { text-align: center; }
|
||||
.print-btn { display: block; margin: 20px auto; padding: 10px 30px; font-size: 16px; cursor: pointer; background: #667eea; color: white; border: none; border-radius: 5px; }
|
||||
@media print { .print-btn { display: none; } .badge-container { border: none; margin: 0; } body { background: white; padding: 0; } }
|
||||
</style>
|
||||
<% Else %>
|
||||
<script src="https://cdn.jsdelivr.net/npm/jsbarcode@3.11.5/dist/JsBarcode.all.min.js"></script>
|
||||
<style>
|
||||
@page { size: 2.13in 3.38in; margin: 0; }
|
||||
@@ -21,32 +58,21 @@ Dim objConn, rs
|
||||
.print-btn { display: block; margin: 20px auto; padding: 10px 30px; font-size: 16px; cursor: pointer; background: #667eea; color: white; border: none; border-radius: 5px; }
|
||||
@media print { .print-btn { display: none; } .badge-container { border: none; margin: 0; } body { background: white; padding: 0; } }
|
||||
</style>
|
||||
<% End If %>
|
||||
</head>
|
||||
<body>
|
||||
<%
|
||||
Dim machineid, strSQL, machineNumber, modelName, machineImage
|
||||
|
||||
machineid = Request.QueryString("machineid")
|
||||
If machineid = "" Then machineid = "0"
|
||||
If Not IsNumeric(machineid) Then machineid = "0"
|
||||
|
||||
strSQL = "SELECT m.machinenumber, mo.modelnumber, mo.image FROM machines m LEFT JOIN models mo ON m.modelnumberid = mo.modelnumberid WHERE m.machineid = " & CLng(machineid)
|
||||
Set rs = objConn.Execute(strSQL)
|
||||
|
||||
If rs.EOF Then
|
||||
machineNumber = "NOT FOUND"
|
||||
modelName = ""
|
||||
machineImage = ""
|
||||
Else
|
||||
machineNumber = rs("machinenumber") & ""
|
||||
modelName = rs("modelnumber") & ""
|
||||
machineImage = rs("image") & ""
|
||||
End If
|
||||
rs.Close
|
||||
Set rs = Nothing
|
||||
objConn.Close
|
||||
%>
|
||||
<button class="print-btn" onclick="window.print()">Print Badge</button>
|
||||
<% If isLocation Then %>
|
||||
<div class="badge-container">
|
||||
<div class="qr-container">
|
||||
<div id="qrcode" style="margin:0 auto;"></div>
|
||||
</div>
|
||||
<div class="machine-number"><%=Server.HTMLEncode(machineNumber)%></div>
|
||||
</div>
|
||||
<script>
|
||||
new QRCode(document.getElementById("qrcode"), {text:"<%=Server.HTMLEncode(machineNumber)%>",width:140,height:140,correctLevel:QRCode.CorrectLevel.M});
|
||||
</script>
|
||||
<% Else %>
|
||||
<div class="badge-container">
|
||||
<div class="model-name"><%=Server.HTMLEncode(modelName)%></div>
|
||||
<% If machineImage <> "" Then %>
|
||||
@@ -60,5 +86,6 @@ objConn.Close
|
||||
<script>
|
||||
JsBarcode("#barcode", "<%=Server.HTMLEncode(machineNumber)%>", {format:"CODE39",displayValue:false,width:2,height:70,margin:0});
|
||||
</script>
|
||||
<% End If %>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
@@ -651,6 +651,34 @@
|
||||
Call SyncDualpathPartnerData(objConn, CLng(machineid), tempDualpathID)
|
||||
End If
|
||||
|
||||
'=============================================================================
|
||||
' INSERT PARENT LOCATION RELATIONSHIP (Contains)
|
||||
'=============================================================================
|
||||
Dim parentlocationid, containsTypeID
|
||||
parentlocationid = Trim(Request.Form("parentlocationid"))
|
||||
|
||||
If parentlocationid <> "" And IsNumeric(parentlocationid) And CLng(parentlocationid) > 0 Then
|
||||
Set rsCheck = objConn.Execute("SELECT relationshiptypeid FROM relationshiptypes WHERE relationshiptype = 'Contains'")
|
||||
If Not rsCheck.EOF Then containsTypeID = rsCheck("relationshiptypeid")
|
||||
rsCheck.Close
|
||||
|
||||
If Not IsEmpty(containsTypeID) Then
|
||||
Dim cmdRelLoc
|
||||
Set cmdRelLoc = Server.CreateObject("ADODB.Command")
|
||||
cmdRelLoc.ActiveConnection = objConn
|
||||
cmdRelLoc.CommandText = "INSERT INTO machinerelationships (machineid, related_machineid, relationshiptypeid, isactive) VALUES (?, ?, ?, 1)"
|
||||
cmdRelLoc.CommandType = 1
|
||||
cmdRelLoc.Parameters.Append cmdRelLoc.CreateParameter("@machineid", 3, 1, , CLng(parentlocationid))
|
||||
cmdRelLoc.Parameters.Append cmdRelLoc.CreateParameter("@related_machineid", 3, 1, , CLng(machineid))
|
||||
cmdRelLoc.Parameters.Append cmdRelLoc.CreateParameter("@relationshiptypeid", 3, 1, , containsTypeID)
|
||||
|
||||
On Error Resume Next
|
||||
cmdRelLoc.Execute
|
||||
Set cmdRelLoc = Nothing
|
||||
On Error Goto 0
|
||||
End If
|
||||
End If
|
||||
|
||||
'=============================================================================
|
||||
' UPDATE OR INSERT COMPLIANCE DATA
|
||||
'=============================================================================
|
||||
|
||||
BIN
secrets.md
BIN
secrets.md
Binary file not shown.
@@ -1049,9 +1049,9 @@
|
||||
<div class="filter-container">
|
||||
<div class="clock" id="clock"></div>
|
||||
<div>
|
||||
<label for="businessUnitFilter" class="filter-label">Business Unit:</label>
|
||||
<label for="businessUnitFilter" class="filter-label">Location:</label>
|
||||
<select id="businessUnitFilter" class="filter-select">
|
||||
<option value="">All Units</option>
|
||||
<option value="">All Locations</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
19
sql/add_inspection_machine_type.sql
Normal file
19
sql/add_inspection_machine_type.sql
Normal file
@@ -0,0 +1,19 @@
|
||||
-- Add Inspection machine type and update 06xx machines
|
||||
-- Date: 2026-02-03
|
||||
-- Purpose: Create Inspection machine type for 0612-0615 machines so they
|
||||
-- appear on displaymachines.asp (previously hidden as LocationOnly)
|
||||
|
||||
-- 1. Add Inspection machine type
|
||||
INSERT INTO machinetypes (machinetypeid, machinetype) VALUES (47, 'Inspection');
|
||||
|
||||
-- 2. Create Inspection model (linked to new type, default vendor WJDT)
|
||||
INSERT INTO models (modelnumber, vendorid, machinetypeid, isactive)
|
||||
VALUES ('Inspection', 1, 47, 1);
|
||||
|
||||
-- 3. Update machines 0612-0615 to use the new Inspection model
|
||||
UPDATE machines
|
||||
SET modelnumberid = (SELECT modelnumberid FROM models WHERE modelnumber = 'Inspection' AND machinetypeid = 47 LIMIT 1)
|
||||
WHERE machinenumber IN ('0612', '0613', '0614', '0615');
|
||||
|
||||
-- 4. Enable WJDT vendor in machine edit model dropdown
|
||||
UPDATE vendors SET ismachine = 1 WHERE vendorid = 1;
|
||||
14
sql/add_location_relationship_types.sql
Normal file
14
sql/add_location_relationship_types.sql
Normal file
@@ -0,0 +1,14 @@
|
||||
-- Add relationship types for location management (bins, shelves, PC storage)
|
||||
-- Run against production MySQL
|
||||
|
||||
-- New relationship types
|
||||
INSERT INTO relationshiptypes (relationshiptypeid, relationshiptype, description, isactive, displayorder) VALUES
|
||||
(7, 'Contains', 'Location contains a sub-location (e.g., Bin contains Shelf)', 1, 7),
|
||||
(8, 'Stored At', 'PC or device is stored at this location', 1, 8);
|
||||
|
||||
-- Fix DT Office -> GJX9B2Z3ESF from "Controls" to "Stored At"
|
||||
-- Verify relationshipid 69 matches on prod before running
|
||||
UPDATE machinerelationships SET relationshiptypeid = 8 WHERE relationshipid = 69;
|
||||
|
||||
-- Flag IT Closet as a location (machineid=258)
|
||||
UPDATE machines SET islocationonly = 1 WHERE machineid = 258;
|
||||
24
sql/update_pctype_inspection.sql
Normal file
24
sql/update_pctype_inspection.sql
Normal file
@@ -0,0 +1,24 @@
|
||||
-- ============================================================================
|
||||
-- Update PC Type #10: "Part Marker" → "Inspection"
|
||||
-- ============================================================================
|
||||
-- Date: 2026-02-05
|
||||
-- Description: Rename pctype 10 from "Part Marker" to "Inspection"
|
||||
--
|
||||
-- Run against: Production shopdb database
|
||||
-- ============================================================================
|
||||
|
||||
-- Update the pctype record
|
||||
UPDATE pctype
|
||||
SET typename = 'Inspection',
|
||||
description = 'Inspection system'
|
||||
WHERE pctypeid = 10;
|
||||
|
||||
-- Verify the change
|
||||
SELECT pctypeid, typename, description
|
||||
FROM pctype
|
||||
WHERE pctypeid = 10;
|
||||
|
||||
-- Show all PC types for reference
|
||||
SELECT pctypeid, typename, description, displayorder
|
||||
FROM pctype
|
||||
ORDER BY displayorder;
|
||||
@@ -139,6 +139,10 @@
|
||||
function showError(message) {
|
||||
document.getElementById('slideshow').innerHTML =
|
||||
'<div class="error-message"><h2>Display Error</h2><p>' + message + '</p></div>';
|
||||
// Clear slides so the next successful fetch always re-renders
|
||||
slides = [];
|
||||
currentSlide = 0;
|
||||
if (slideTimer) { clearTimeout(slideTimer); slideTimer = null; }
|
||||
}
|
||||
|
||||
function startSlideshow() {
|
||||
|
||||
Reference in New Issue
Block a user