From 51f4c078c7312a521838ac36b81c3dadccf56154 Mon Sep 17 00:00:00 2001 From: cproudlock Date: Thu, 18 Dec 2025 10:36:48 -0500 Subject: [PATCH] Add badge printing, test pages, and eDNC cleanup script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- printbadge.asp | 64 ++++++++++++++++++++++++++++++ sql/drop_ednc_tables.sql | 23 +++++++++++ testcalc.asp | 53 +++++++++++++++++++++++++ testpage.asp | 86 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 226 insertions(+) create mode 100644 printbadge.asp create mode 100644 sql/drop_ednc_tables.sql create mode 100644 testcalc.asp create mode 100644 testpage.asp diff --git a/printbadge.asp b/printbadge.asp new file mode 100644 index 0000000..347eecc --- /dev/null +++ b/printbadge.asp @@ -0,0 +1,64 @@ +<%@ Language=VBScript %> +<% +Option Explicit +Dim objConn, rs +%> + + + + + Print Badge + + + + +<% +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 +%> + +
+
<%=Server.HTMLEncode(modelName)%>
+<% If machineImage <> "" Then %> + +<% End If %> +
+ +
*<%=Server.HTMLEncode(machineNumber)%>*
+
+
+ + + \ No newline at end of file diff --git a/sql/drop_ednc_tables.sql b/sql/drop_ednc_tables.sql new file mode 100644 index 0000000..b11f12e --- /dev/null +++ b/sql/drop_ednc_tables.sql @@ -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; diff --git a/testcalc.asp b/testcalc.asp new file mode 100644 index 0000000..e531eb0 --- /dev/null +++ b/testcalc.asp @@ -0,0 +1,53 @@ +<%@ Language=VBScript %> +<% +Option Explicit +Response.Write("Test 1: Prepend pattern
") + +Dim testVal, result + +' Test prepend pattern with numbers +testVal = 272 +result = CLng("0" & testVal) +Response.Write("CLng(""0"" & 272) = " & result & " (should be 272)
") + +' Test prepend pattern with null +testVal = Null +result = CLng("0" & testVal) +Response.Write("CLng(""0"" & Null) = " & result & " (should be 0)
") + +' Test append pattern (the bug) +testVal = 272 +result = CLng(testVal & "0") +Response.Write("CLng(272 & ""0"") = " & result & " (bug: gives 2720)
") + +Response.Write("
Test 2: Database query
") +Dim objConn +%> + +<% +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 & "
") + Response.Write("Parts with OOT: " & partsWithOOT & "
") + Response.Write("OOT Rate: " & ootRate & "%
") +End If +rs.Close +Set rs = Nothing +objConn.Close +Response.Write("
Test Complete") +%> diff --git a/testpage.asp b/testpage.asp new file mode 100644 index 0000000..d2b0cef --- /dev/null +++ b/testpage.asp @@ -0,0 +1,86 @@ + + + + + + +<% + theme = Request.Cookies("theme") + IF theme = "" THEN + theme="bg-theme1" + END IF +%> + + + +
+ + + + + +
+ +
+
+ + + + + +<% + +Dim max,min +max=14 +min=1 +Randomize + +%> + + + + + +
+ + +
+ + +
+ + + + + +
+
+
+
+
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + +<%objconn.close%>