<%@ Language=VBScript%> <%Response.Buffer = True%> <% 'Local Variables to be used in the page.. Dim ComID, bInit, bExecuted, fExecuted, pExecuted 'Initialize the Page for each server request adLockOptimistic = 3 InitializePage() %> <% '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Function InitializePage() bInit = CBool(Request.Querystring ("init")) If Request.Form("selComm") = "0" AND Not bInit Then 'Response.Clear Response.Redirect "error.asp?mess=You must select a committe to view voting results." Response.End End If If bInit <> Cint(False) then ComId = Cint(0) else ComID = Cint(Request.Form("selComm")) End IF End Function '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %> <% Set rsComm = Server.CreateObject("ADODB.Recordset") GetCommsApprove rsCOMM %> NVS Admin - Approve Results <% Title = "Approve Results" %>
   
<%If Not rsComm.EOF Then %> <% Else %> <% End If%> <% rsComm.Close Set rsComm = Nothing dbNVS.Close If Not bInit then 'Set rsVacant = Server.CreateObject("ADODB.Recordset") 'GetVacancies rsVacant, ComID 'SetVacancies = rsVacant.fields("MAX_VOTE").value 'IS IT NOT SEEING THE COMID HERE? WHY IS THIS FUNCTION RETURNING 0??? SetVacancies = Clng(GetVacancies(ComID)) 'rsVacant.close 'Set rsVacant = Nothing 'dbNVS.Close Set objInfo = Server.CreateObject("ADODB.Recordset") GetComInfo objInfo, ComID Dim CName 'Committee Name Dim EType 'Election Type CName = objInfo.fields("COMNAME").value EType = objInfo.fields("ELECTION_TYPE").value objInfo.close Set objInfo = Nothing dbNVS.Close Set objVoteSum = Server.CreateObject("ADODB.Recordset") GetNumVotes objVoteSum, ComID Dim TotalVotes 'Total votes cast in the election TotalVotes = objVoteSum.fields("TOTAL_VOTES").value objVoteSum.Close Set objVoteSum = Nothing dbNVS.Close Set objVote= Server.CreateObject("ADODB.Recordset") GetCommsPeople objVote, ComID dim kind select case EType case True kind = "Voting Results" case False kind = "Run-Off Results" end select 'total_persons = GetCommsPeopleCount(objVote) GetPeeps ComID, total_persons dim majority 'majority = TotalVotes / total_persons + 1 majority = (total_persons / 2) + 1 '*********************************************** if total_persons = 1 then majority = TotalVotes end if %> <% Dim objResults Set objResults = Server.CreateObject("Scripting.Dictionary") GetDict objResults, objVote 'Gets all keys and items into an array arrKeys = objResults.Keys arrItems = objResults.Items Dim Elected '# of people elected Elected = 0 Dim Ties '# of ties per person Dim Vacant '# of vacancies after elected person is accounted for Vacant = SetVacancies Dim Match '# of matching vote tallys 'Outputs thoes persons who have met the elected conditions Do While Not objVote.EOF AND Elected < SetVacancies AND objVote.fields("VOTES").value >= majority 'calculates voting percentage of each person If objVote.fields("VOTES") > 0 Then Percent = (objVote.fields("VOTES").value / total_persons) * 100 Else Percent = 0 End IF Ties = 0 'Number of time vote count appears For intLoop = 0 To objResults.Count - 1 If objVote.fields("VOTES").value = arrItems(intLoop) Then Ties = Ties + 1 End If Next If Ties <= Vacant OR PreVote = objVote.fields("VOTES").value Then %> %> <% PreVote = objVote.fields("VOTES").value objVote.MoveNext 'changed - move this below eof check to restore Vacant = Vacant - 1 Elected = Elected +1 '****************************** if objVote.EOF then Exit Do end if Else If Elected = 0 Then%> <% End IF Exit Do End IF Loop Dim posleft 'Positions left to be filled Dim runcount 'Counts Number of runoffs runcount = 0 posleft = SetVacancies - Elected If posleft > 0 then dim runoffs runoffs = (2 * posleft) - 1 If runoffs = 1 then 'Must be at least two in a runoff runoffs = 2 End If %> <% Dim LastVotes 'This var is involved in checking for ties '****************************************************** if not objVote.EOF then Do While Not objVote.EOF AND runcount < runoffs OR objVote.fields("VOTES").value = LastVotes If objVote.fields("VOTES") > 0 Then Percent = (objVote.fields("VOTES").value / total_persons) * 100 Else Percent = 0 End If %> <% LastVotes = objVote.fields("VOTES").value runcount = runcount + 1 objVote.MoveNext If objVote.EOF Then Exit Do End If Loop '************************************* end if End If If Not objVote.EOF Then %> <% End If While Not objVote.EOF If objVote.fields("VOTES") > 0 Then Percent = (objVote.fields("VOTES").value / total_persons) * 100 Else Percent = 0 End If %> <% objVote.MoveNext Wend %>
 
 
    
 
 
 
There are no committees ready to display voting results.
 
 
Committee Name Election Type Vacancies
<%=CName%> <%=kind%> <%=SetVacancies%>
Total Number of Faculty Who Voted: <%=CStr(total_persons)%>
 
Name Division Votes Percent
ELECTED POSITION(S)
<%=objVote.fields("F_NAME").value + " " + objVote.fields("L_NAME").value%> <%=objVote.fields("DIVISION").value%> <%=objVote.fields("VOTES").value%> <%=Cint(Percent)%>
---- NONE ----
 
RUNOFF POSITIONS
<%=objVote.fields("F_NAME").value + " " + objVote.fields("L_NAME").value%> <%=objVote.fields("DIVISION").value%> <%=objVote.fields("VOTES").value %> <%=Cint(Percent)%>
 
OTHER CANDIDATES
<%=objVote.fields("F_NAME").value + " " + objVote.fields("L_NAME").value%> <%=objVote.fields("DIVISION").value%> <%=objVote.fields("VOTES").value %> <%=Cint(Percent)%>
 
 
   
<%'cleaning objVote.Close Set objVote = Nothing 'dbNVS.Close Set dbNVS = Nothing End if %>