Add badge printing, test pages, and eDNC cleanup script

- printbadge.asp: Machine badge printing with barcode (Code39)
- testcalc.asp: Test page for UDC calculation debugging
- testpage.asp: Generic test page template
- sql/drop_ednc_tables.sql: Cleanup script for deprecated eDNC tables

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
cproudlock
2025-12-18 10:36:48 -05:00
parent b858d069c5
commit 51f4c078c7
4 changed files with 226 additions and 0 deletions

64
printbadge.asp Normal file
View File

@@ -0,0 +1,64 @@
<%@ Language=VBScript %>
<%
Option Explicit
Dim objConn, rs
%>
<!DOCTYPE html>
<html>
<head>
<!--#include file="./includes/sql.asp"-->
<title>Print Badge</title>
<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>
</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>
<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>
</body>
</html>

23
sql/drop_ednc_tables.sql Normal file
View File

@@ -0,0 +1,23 @@
-- ============================================================================
-- Drop eDNC Special Character Fix Tables and Data
-- Run on PRODUCTION to remove deprecated eDNC tracking
-- Created: 2025-12-12
-- ============================================================================
-- Remove view first (depends on table)
DROP VIEW IF EXISTS vw_ednclogs;
-- Remove log table
DROP TABLE IF EXISTS ednclogs;
-- Remove installation tracking records
DELETE FROM installedapps WHERE appid = 79;
-- Remove application definition
DELETE FROM applications WHERE appid = 79;
-- Verify cleanup
SELECT 'Cleanup complete. Verify tables removed:' AS status;
SHOW TABLES LIKE '%ednc%';
SELECT COUNT(*) AS remaining_installedapps FROM installedapps WHERE appid = 79;
SELECT COUNT(*) AS remaining_applications FROM applications WHERE appid = 79;

53
testcalc.asp Normal file
View File

@@ -0,0 +1,53 @@
<%@ Language=VBScript %>
<%
Option Explicit
Response.Write("Test 1: Prepend pattern<br>")
Dim testVal, result
' Test prepend pattern with numbers
testVal = 272
result = CLng("0" & testVal)
Response.Write("CLng(""0"" & 272) = " & result & " (should be 272)<br>")
' Test prepend pattern with null
testVal = Null
result = CLng("0" & testVal)
Response.Write("CLng(""0"" & Null) = " & result & " (should be 0)<br>")
' Test append pattern (the bug)
testVal = 272
result = CLng(testVal & "0")
Response.Write("CLng(272 & ""0"") = " & result & " (bug: gives 2720)<br>")
Response.Write("<br>Test 2: Database query<br>")
Dim objConn
%>
<!--#include file="./includes/sql.asp"-->
<%
Dim rs, strSQL
strSQL = "SELECT COUNT(*) as totalparts, " & _
"SUM(CASE WHEN ootcount > 0 THEN 1 ELSE 0 END) as partswithoot " & _
"FROM udcparts p " & _
"JOIN udcsessions s ON p.sessionid = s.sessionid " & _
"WHERE p.programstart >= '2025-11-12' AND p.programstart <= '2025-12-12 23:59:59'"
Set rs = objConn.Execute(strSQL)
If Not rs.EOF Then
Dim totalParts, partsWithOOT, ootRate
If IsNull(rs("totalparts")) Then totalParts = 0 Else totalParts = CLng(rs("totalparts"))
If IsNull(rs("partswithoot")) Then partsWithOOT = 0 Else partsWithOOT = CLng(rs("partswithoot"))
If totalParts > 0 Then
ootRate = FormatNumber(CDbl(partsWithOOT) / CDbl(totalParts) * 100, 2)
Else
ootRate = "0"
End If
Response.Write("Total Parts: " & totalParts & "<br>")
Response.Write("Parts with OOT: " & partsWithOOT & "<br>")
Response.Write("OOT Rate: " & ootRate & "%<br>")
End If
rs.Close
Set rs = Nothing
objConn.Close
Response.Write("<br>Test Complete")
%>

86
testpage.asp Normal file
View File

@@ -0,0 +1,86 @@
<!--#include file="./includes/sql.asp"-->
<!DOCTYPE html>
<html lang="en">
<head>
<!--#include file="./includes/header.asp"-->
</head>
<%
theme = Request.Cookies("theme")
IF theme = "" THEN
theme="bg-theme1"
END IF
%>
<body class="bg-theme <%Response.Write(theme)%>">
<!-- 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">
<!--Start Dashboard Content-->
<!--#include file="./includes/notificationsbar.asp"-->
<%
Dim max,min
max=14
min=1
Randomize
%>
<img src="./images/<%response.write(Int((max-min+1)*Rnd+min))%>.jpg" height="556px" width="918px">
<!--End Dashboard Content-->
<!--start overlay-->
<div class="overlay toggle-menu"></div>
<!--end overlay-->
</div>
<!-- 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 class="container">
<div class="text-center">
</div>
</div>
</footer>
<!--End footer-->
<!--start color switcher-->
<!--#include file="./includes/colorswitcher.asp"-->
<!--end color switcher-->
</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>
<!-- loader scripts -->
<script src="assets/js/jquery.loading-indicator.js"></script>
<!-- Custom scripts -->
<script src="assets/js/app-script.js"></script>
<!-- Chart js -->
<script src="assets/plugins/Chart.js/Chart.min.js"></script>
</body>
</html>
<%objconn.close%>