<%@ Language=VBScript%> <%'option explicit 'Page/form name: pastsalesstudymission.asp 'Purpose : List of Past Sales Cum Study Missions 'Date Modified: 18/07/2001 'Author :Vikas Agarwal %> <% Dim strsql Dim rs Dim strsql1 Dim rs1 Dim strsql2 Dim rs2 Dim var_sscode Dim var_country 'Declare variables for pagination Dim iPageSize 'How big our pages are Dim iPageCount 'The number of pages we get back Dim iPageCurrent 'The page we want to show Dim iRecordsShown 'Loop controller for displaying just iPageSize records Dim whereclause1 'The where clause parameter to be passed in query string Dim I 'Standard looping var function selected (firstval, secondval) if firstval = secondval then selected = " SELECTED" end if end function iPageSize = Cint(Application("numrecords"))' set page size 'iPageSize = 1 ' could be changed If Request.QueryString("pgno") = "" Then iPageCurrent = 1 Else iPageCurrent = CInt(Request.QueryString("pgno")) End If If Request.QueryString("wherestring") = "" Then var_country = trim(Request.Form("country")) if var_country = "all" then whereclause1 = "" end if if var_country <> "" and var_country <> "all" then whereclause1 = " and country = '" & var_country & "'" else whereclause1 = "" end if else whereclause1 = Request.QueryString("wherestring") var_country = Request.QueryString("country") End If strsql = "select missioncode, missionname, country " &_ "from salesstudymission_master " &_ "where missioncode in " &_ "(select missioncode from salesstudymission_schedule " &_ "group by missioncode " &_ "having convert(char(10),getdate(),112) > " &_ "convert(char(10),max(missiondate),112)) " &_ " " & whereclause1 & " " &_ "order by missioncode " strsql1 = "select distinct country from salesstudymission_master " &_ "where missioncode in (select missioncode from salesstudymission_schedule " &_ "group by missioncode " &_ "having convert(char(10),getdate(),112) > " &_ "convert(char(10),max(missiondate),112)) " set rs = server.CreateObject("ADODB.Recordset") set rs1 = server.CreateObject("ADODB.Recordset") set rs2 = server.CreateObject("ADODB.Recordset") ' set the page size rs.PageSize = iPageSize 'set the cache size rs.CacheSize = iPageSize on error resume next rs.Open strsql, objconn,3,3 if err.number <> 0 then Response.Redirect "/inc/commoninc/error.asp?errorno=err.number" Response.End end if on error goto 0 on error resume next rs1.Open strsql1, objconn if err.number <> 0 then Response.Redirect "/inc/commoninc/error.asp?errorno=err.number" Response.End end if on error goto 0 ' Get the count of the pages using the given page size iPageCount = rs.PageCount %> Past Sales-Cum-Study Missions - <%=Application("Title")%>
Home>Calendar>Program Calendar>Sales Study Mission  
Past Sales-Cum-Study Missions
<%If iPageCount <> 0 Then rs.AbsolutePage = cint(iPageCurrent) iRecordsShown = 0 if not rs.EOF and not rs.BOF then do while not rs.EOF and iRecordsShown < iPageSize var_sscode = rs("missioncode")%> <%iRecordsShown = iRecordsShown + 1 rs.movenext loop end if end if if rs.EOF and rs.BOF and ipagecount = 0 then rs.close%> <%end if%>
Name and Date(s) *
<%=rs("missionname")%> <% strsql2 = "select convert(char(10),missiondate,103) missiondate from salesstudymission_schedule " &_ "where missioncode = " & var_sscode & " " on error resume next rs2.Open strsql2, objconn if err.number <> 0 then Response.Redirect "/inc/commoninc/error.asp?errorno=err.number" Response.End end if on error goto 0%>
<%if not rs2.EOF and not rs2.BOF then rs2.MoveFirst do while not rs2.EOF %> <%=trim(rs2("missiondate"))%> <%if not rs2.EOF then rs2.MoveNext%> <%end if%> <%if not rs2.EOF then%> , <%end if%> <%loop end if rs2.Close%>
<%=rs("country")%>
There are no Past Sales-Cum-Study Missions
<%call pagination(iPageCount,whereclause1,var_country)%>
* Participation on first come first basis. Date subject to change.
 
<%rs1.Close%> <% updatetable = "salesstudymission_master" updatewhereclause = " missioncode in (select max(missioncode) from salesstudymission_schedule group by missioncode having convert(char(10),getdate(),112) > convert(char(10),max(missiondate),112))" %> <% Function pagination(rsmaxpages,keywords,pass_country) Dim intstartpage ' starting page Dim intendpage ' Ending Page Dim intPageNo 'intpageno the Current Page No. Dim Maxpages ' set it to the recordset.pagecount Dim Maxpageset ' set it to one set Dim pagestring ' set it to pagestring ' Setting Maxpages = Recordset Maxpages maxpages=rsmaxpages ' If pgno is not there is querystring then set it to 1 if len(trim(Request("pgno"))) > 0 then intpageno=Request("pgno") else intpageno=1 end if ' Defining the PageString Here ' Change this pagestring="pastsalesstudymission.asp?wherestring=" & Server.URLEncode(keywords) & "&country=" & Server.URLEncode(pass_country) & "&pgno=" ' Defining the MaxPageSet Here ' Change This maxpageset=10 'Initializing maxpages to the Record ' Change the Recordset Name maxpages = rsmaxpages if ((intpageno/maxpageset)=(intpageno\maxpageset)) then if (Cint(intendpage)>=Cint(maxpages)) then intendpage=maxpages else intendpage = ((maxpageset)*(intpageno\maxpageset)) intstartpage = intendpage-maxpageset+1 end if else intstartpage = ((maxpageset)*(intpageno\maxpageset))+1 intendpage = intstartpage+maxpageset-1 end if ' For Restricting the records in case the maxpageset is more than the maxpages if maxpageset > maxpages then intendpage = maxpages end if ' For Restricting the records in case the intendpage is more than the maxpages if intendpage > maxpages then intendpage = maxpages end if if (Cint(intstartpage)" if not(Cint(intpageno)=1) then Response.write "" & "«Prev" & "" & "  " end if For I = Cint(intstartpage) to Cint(intendpage) if Not (maxpages=1) then if (I = Cint(intpageno)) then ' if it is the current page disable the Link Response.write I & "  " else Response.write "" & I & "" & "  " end if End if Next ' Next Processing if not(Cint(intpageno)>=Cint(maxpages)) then Response.write "" & "Next »" & "" & "  " end if Response.write "" End if end function %>