Files
shopdb/printbadge.asp
cproudlock 08ffa4ba36 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>
2026-04-17 12:06:28 -04:00

92 lines
4.4 KiB
Plaintext

<%@ Language=VBScript %>
<%
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>
<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; }
body { font-family: Arial, sans-serif; background: #f0f0f0; margin: 0; padding: 20px; }
.badge-container { width: 2.13in; height: 3.38in; background: white; margin: 0 auto; border: 1px solid #ccc; display: flex; flex-direction: column; align-items: center; padding: 0.15in; box-sizing: border-box; }
.model-name { font-size: 12pt; font-weight: bold; text-align: center; margin-bottom: 0.1in; color: #000; }
.machine-image { max-width: 1.8in; max-height: 1.5in; object-fit: contain; margin-bottom: 0.1in; }
.barcode-container { text-align: center; margin-top: auto; }
.barcode-container svg { width: 1.8in; height: 0.9in; }
.machine-number { font-size: 14pt; font-weight: bold; font-family: monospace; margin-top: 0; }
.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>
<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 %>
<img class="machine-image" src="./images/machines/<%=Server.HTMLEncode(machineImage)%>">
<% End If %>
<div class="barcode-container">
<svg id="barcode"></svg>
<div class="machine-number">*<%=Server.HTMLEncode(machineNumber)%>*</div>
</div>
</div>
<script>
JsBarcode("#barcode", "<%=Server.HTMLEncode(machineNumber)%>", {format:"CODE39",displayValue:false,width:2,height:70,margin:0});
</script>
<% End If %>
</body>
</html>