<%@ Language=VBScript %> <% dim sqlQuery dim RSBuffer, RSbuffer2, RSbuffer3, RSData, RSData2,RSCONSTANT dim conn dim userID dim surveyID dim newDate,nmonth,ndate,nyear dim totalArea dim totalFac,totalPPC,totalPandC,totalProf,totalAscProf,totalAsstProf,totalDoc,totalMast,totalBach dim totalProDeg, totalPEReg, totalPES dim sumExpAcd, sumExpInd, sumActPowT, sumActNonPow, sumExpOthInd,SumActPowR dim sumMaFTEnr,sumMaPTEnr,sumDoFTEnr,sumDoPTEnr,sumMaFTGra,sumMaPTGra,sumDoFTGra, sumDoPTGra dim schoolName dim filename dim userToBeUpdated,actionTaken, actionChosen dim reportChoiceDesc, reportChoiceValidTill dim adminMail, userMail dim mail set Conn = Server.CreateObject("ADODB.connection") Conn.Open ConnectionString userID = 0 if session("userID") <> "" then userID = cint(session("userID")) sqlQuery = "select * from tbl_IEEE_approved_user where AUADMIN=1 and AUUSID="&userID set RSBuffer= conn.Execute(sqlQuery) if RSbuffer.eof = true then Response.Redirect("surveyAdminLogin.asp?loginFail=yes") end if else if session("userID") = "" then Response.Redirect("surveyAdminLogin.asp?loginFail=yes") end if end if 'Response.Write "user ID:"&session("userID") if userID = 0 then Response.Redirect("surveyAdminLogin.asp?loginFail=yes") else if Request.form("surveyID")<>"" then surveyID = cint(Request.form("surveyID")) else surveyID =0 end if filename="surveyReport.asp" 'make a constantList dim constantList(40) 'fill out the constant list sqlQuery ="select * from tbl_IEEE_constant order by CNID" set RSbuffer = conn.Execute(sqlQuery) i=1 do while RSbuffer.EOF = false 'reDim preserve constantList(i) constantList(i) = trim(RSbuffer("CNVALUE")) RSbuffer.movenext i= i+1 loop actionChosen = trim(Request.Form("actionChosen")) 'Response.Write "actionChosen:"&actionChosen&"
" 'do any change before displaying anything. For actions that require changes in the database if actionChosen = "activate" then sqlQuery = "update tbl_IEEE_reportChoice set RCVALID=1 where RCID="&surveyID conn.Execute(sqlQuery) sqlQuery = "update tbl_IEEE_reportChoice set RCVALID=1 where RCID <> "&surveyID conn.Execute(sqlQuery) actionChosen = "" else if actionChosen = "deactivate" then sqlQuery = "update tbl_IEEE_reportChoice set RCVALID=0 where RCID="&surveyID conn.Execute(sqlQuery) actionChosen = "" else if actionChosen = "changeDate" then ndate = cint(Request.Form("ndate")) nmonth = cint(Request.Form("nmonth")) nyear = cint(Request.Form("nyear")) newDate = nmonth&"/"&ndate&"/"&nyear sqlQuery = "update tbl_IEEE_reportChoice set RCVALIDTILL='"&cdate(newDate)&"' where RCID="&surveyID conn.Execute(sqlQuery) actionChosen ="" else if actionChosen = "writeNewSurveyToDB" then reportChoiceDesc = trim(Request.Form("reportChoiceDesc")) ndate = cint(Request.Form("ndate")) nmonth = cint(Request.Form("nmonth")) nyear = cint(Request.Form("nyear")) reportChoiceValidTill = nmonth&"/"&ndate&"/"&nyear sqlQuery = "insert into tbl_IEEE_reportchoice(RCDESC,RCVALID,RCVALIDTILL) values " sqlQuery = sqlQuery & "('"& reportChoiceDesc & "',0,'"&cdate(reportChoiceValidTill)&"')" conn.Execute(sqlQuery) actionChosen = "" 'surveyID = 0 else if actionChosen = "downloadDOC" then blnExportToExcel = true Response.AddHeader "Content-Disposition","attachment; filename=SurveyReport_" & year(now) & month(now) & day(now) & ".xls" Response.ContentType = "application/vnd.ms-excel" actionChosen = "" else if actionChosen ="logout" then session("userID") = "" 'Response.Write "session user ID? " & session("userID") Response.Redirect("surveyAdminLogin.asp") end if end if end if end if end if end if if surveyID = 0 then 'if no specific survey is chosen then use the latest active survey as focus sqlQuery = "select * from tbl_IEEE_reportChoice where RCID = (select max(RCID) from " sqlQuery = sqlQuery & "tbl_IEEE_reportChoice where RCValid=1)" else 'focus to chosen survey sqlQuery = "select * from tbl_IEEE_reportChoice where RCID = "&cint(surveyID) end if set RSBuffer = conn.Execute(sqlQuery) %> <% 'dont show menu on the excel sheet if not blnExportToExcel then %> <% end if 'end if not blnExportToExcel then %>
IEEE Survey Administrator page
<% if RSbuffer.eof = false then surveyID = cint(RSBuffer("RCID")) sqlQuery = "select count(*) as reportTotal from tbl_IEEE_report where RERCID ="&cint(RSbuffer("RCID")) sqlQuery = sqlQuery &" and REUSID in (select AUUSID from tbl_IEEE_approved_user)" set RSbuffer2 = conn.Execute(sqlQuery) sqlQuery="select count(*) as totalFinish from tbl_IEEE_report where REFINISH=1 and RERCID =" & surveyID sqlQuery = sqlQuery &" and REUSID in (select AUUSID from tbl_IEEE_approved_user)" set RSBuffer3 = conn.Execute(sqlQuery) %>

Report name:
<%=trim(RSbuffer("RCDESC"))%>

Total Report:<%=cint(RSbuffer2("reportTotal"))%>
Total Submitted:<%=cint(RSbuffer3("totalFinish"))%>

<% if cbool(RSbuffer("RCVALID")) = false then %>

<% else if cbool(RSbuffer("RCVALID")) = true then %>

mm "> dd "> yy ">

<% end if end if %>

_________________________

<% end if 'rsbuffer.eof = false sqlQuery = "select * from tbl_IEEE_reportChoice" set RSbuffer = conn.Execute(sqlQuery) %>


_________________________

<% 'Response.Write "Action chosen:"&actionChosen&"
" if actionChosen = "" then %> <% else if actionChosen = "listUnapproved" then %> <% else if actionChosen = "newSurvey" then %> <% end if end if end if %>
<% end if 'if userID = 0 set RSdata = nothing set RSdata2 = nothing set RSbuffer = nothing set RSConstant = nothing set conn = nothing %>