<%@ language="VBSCRIPT" %>
<!-- #include file="db_conn.asp" -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 transitional//EN" "http://www.w3.org/td/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Bingo Card Generator</title>
<link rel="stylesheet" href="print.css" media="print" type="text/css" />
<link rel="stylesheet" href="global.css" media="screen" type="text/css" />
</head>
<body>
<%
' Gets the row count from the employees field
numEmployees = iCode("Total")
%>
<%
' Get the current date and convert the string to a date object
Dim theCurrentDate
theDate = FormatDateTime(Date(), vbShortDate)
theCurrentDate = (CDate(theDate))
dim cell1, cell2, cell3, cell4, cell5, cell6, cell7, cell8, cell9, cell10, cell11, cell12, cell13, cell14
dim cell15, cell16, cell17, cell18, cell19, cell20, cell21, cell22, cell23, cell24
' set the numbers to choose from
dim emCard
dim min, max
Randomize
max=75
min=1
' Write out the tables based on the number of entries in the employee field
Do Until i = numEmployees
i = i + 1
' Move to next record in the employee field
employeeInfo.MoveNext
' Checks to see if employeeInfo is EOF or not
if employeeInfo.EOF then
Response.Write ""
Else
' Output the tables
Response.Write "<table>"
Response.Write "<thead><th>B</th><th>I</th><th>N</th><th>G</th><th>O</th></thead>"
Response.Write "<tr>"
Response.Write "<td>"
cell1 = Response.Write (Int((max-min+1)*Rnd+min))
Response.Write "</td>"
Response.Write "<td>"
cell2 = Response.Write (Int((max-min+1)*Rnd+min))
Response.Write "</td>"
Response.Write "<td>"
cell3 = Response.Write (Int((max-min+1)*Rnd+min))
Response.Write "</td>"
Response.Write "<td>"
cell4 = Response.Write (Int((max-min+1)*Rnd+min))
Response.Write "</td>"
Response.Write "<td>"
cell5 = Response.Write (Int((max-min+1)*Rnd+min))
Response.Write "</td>"
Response.Write "</tr>"
Response.Write "<tr>"
Response.Write "<td>"
cell6 = Response.Write (Int((max-min+1)*Rnd+min))
Response.Write "</td>"
Response.Write "<td>"
cell7 = Response.Write (Int((max-min+1)*Rnd+min))
Response.Write "</td>"
Response.Write "<td>"
cell8 = Response.Write (Int((max-min+1)*Rnd+min))
Response.Write "</td>"
Response.Write "<td>"
cell9 = Response.Write (Int((max-min+1)*Rnd+min))
Response.Write "</td>"
Response.Write "<td>"
cell10 = Response.Write (Int((max-min+1)*Rnd+min))
Response.Write "</td>"
Response.Write "</tr>"
Response.Write "<tr>"
Response.Write "<td>"
cel11 = Response.Write (Int((max-min+1)*Rnd+min))
Response.Write "</td>"
Response.Write "<td>"
cell12 = Response.Write (Int((max-min+1)*Rnd+min))
Response.Write "</td>"
Response.Write "<td class='freebox'>"
' Inserts the employee name and game start date to the free box
Response.Write theCurrentDate
' Displays the employees name in the free box on each card
Response.Write employeeInfo.Fields("EmployeeFullName")
' Sets the Employee Code to a hidden field
Response.Write "<input type='hidden' id='employeecode' value='"
Response.Write employeeInfo.Fields("EmployeeCode")
Response.Write "' />"
Response.Write "</td>"
Response.Write "<td>"
cell13 = Response.Write (Int((max-min+1)*Rnd+min))
Response.Write "</td>"
Response.Write "<td>"
cell14 = Response.Write (Int((max-min+1)*Rnd+min))
Response.Write "</td>"
Response.Write "</tr>"
Response.Write "<tr>"
Response.Write "<td>"
cell15 = Response.Write (Int((max-min+1)*Rnd+min))
Response.Write "</td>"
Response.Write "<td>"
cell16 = Response.Write (Int((max-min+1)*Rnd+min))
Response.Write "</td>"
Response.Write "<td>"
cell17 = Response.Write (Int((max-min+1)*Rnd+min))
Response.Write "</td>"
Response.Write "<td>"
cell18 = Response.Write (Int((max-min+1)*Rnd+min))
Response.Write "</td>"
Response.Write "<td>"
cell19 = Response.Write (Int((max-min+1)*Rnd+min))
Response.Write "</td>"
Response.Write "</tr>"
Response.Write "<tr>"
Response.Write "<td>"
cell20 = Response.Write (Int((max-min+1)*Rnd+min))
Response.Write "</td>"
Response.Write "<td>"
cell21 = Response.Write (Int((max-min+1)*Rnd+min))
Response.Write "</td>"
Response.Write "<td>"
cell22 = Response.Write (Int((max-min+1)*Rnd+min))
Response.Write "</td>"
Response.Write "<td>"
cell23 = Response.Write (Int((max-min+1)*Rnd+min))
Response.Write "</td>"
Response.Write "<td>"
cell24 = Response.Write (Int((max-min+1)*Rnd+min))
Response.Write "</td>"
Response.Write "</tr>"
Response.Write "</table>"
' Insert data into the database set
dim connection
dim sSQL, sConnString
'declare SQL statement that will query the database
sSQL = "INSERT INTO OCIW_EmployeeBingo (CompanyCode, EmployeeID, GameNumber, Col, Row, tstamp) VALUES ('', '', '', '', '', '" + theCurrentDate + "')"
'define the connection string, specify database
'driver and the location of database
sConnString="Driver={SQL Server};" & _
"Server=*************; Uid=*****; Pwd=*****;"
'create an ADO connection object
Set connection = Server.CreateObject("ADODB.Connection")
'Open the connection to the database
connection.Open(sConnString)
'execute the SQL
connection.execute(sSQL)
' Ends the check if employeeInfo is .EOF or not, eliminating the last error table due to no record found
End If
Loop
%>
</body>
</html>
<%Response.End%>
<%
' Close it all up
employeeInfo.Close
result.Close
emResult.Close
emCard.Close
Connection.Close
Set Connection = Nothing
set employeecode = Nothing
set cell1 = Nothing
set cell2 = Nothing
set cell3 = Nothing
set cell4 = Nothing
set cell5 = Nothing
set cell6 = Nothing
set cell7 = Nothing
set cell8 = Nothing
set cell9 = Nothing
set cell10 = Nothing
set cell11 = Nothing
set cell12 = Nothing
set cell13 = Nothing
set cell14 = Nothing
set cell15 = Nothing
set cell16 = Nothing
set cell17 = Nothing
set cell18 = Nothing
set cell19 = Nothing
set cell20 = Nothing
set cell21 = Nothing
set cell22 = Nothing
set cell23 = Nothing
set cell24 = Nothing
%>
This post has been edited by herkalees: 17 October 2006 - 07:55 AM


Help
This topic is locked

MultiQuote










