Files
shopdb/testcalc.asp
cproudlock 51f4c078c7 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>
2025-12-18 10:36:48 -05:00

54 lines
1.7 KiB
Plaintext

<%@ 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")
%>