<% if Request("Format") = "E" then 'The following 2 lines are what makes this happen... Response.ContentType ="Application/vnd.excel" Response.AddHeader "Content-Disposition", "attachment; filename=Presences.xls" end if %> <% dim stActivites, stGroupe, sMax, counter,sNomA,sLocal,sNbrGroupe, counterGroupe counter = 0 stActivites = RemoveJunk(Request("Activites")) stGroupe = RemoveJunk(Request("Groupe")) strSql1 = "SELECT * FROM Activites where CodeA = "& stActivites Set rsQuery1 = Conn.Execute(strSql1) if not rsQuery1.eof then if rsQuery1("Max") <> "" then sMax = int (rsQuery1("Max")) else sMax = 1000 end if sNomA = rsQuery1("Nom") sNbrGroupe = rsQuery1("Groupe") sAnimateur = rsQuery1("Animateur") end if strSql = "SELECT * FROM Horaire where CodeA = "& stActivites Set rsQuery = Conn.Execute(strSql) if not rsQuery.eof then sDateDebut = rsQuery("DateDebut") sDateFin = rsQuery("DateFin") end if '*********l'ensemble des groupe**************** '**********Groupes************** if Request.Form("TGroupe") = "1" then for counterGroupe = 1 to sNbrGroupe Step 0 '******Inscription parametres******** '******Type Horaire*********************** '****Semaine**** if Request("TypeHoraire") = "Semaine" then For S = 1 to Request("NbreSemaines") Step 1 semaine = "Semaine"&S if Request.Form(semaine) = "1" then sSemaine = sSemaine &"-"&s&"-" end if Next if sSemaine <> "" then sSqlR = sSqlR & "Inscriptions.Semaines Like '%" & sSemaine & "%' and " end if end if '***Jours****** if Request("TypeHoraire") = "Jours" then if Request.Form("Lundi") = "1" then sJours = sJours &"-Lundi-" end if if Request.Form("Mardi") = "1" then sJours = sJours &"-Mardi-" end if if Request.Form("Mercredi") = "1" then sJours = sJours &"-Mercredi-" end if if Request.Form("Jeudi") = "1" then sJours = sJours &"-Jeudi-" end if if Request.Form("Vendredi") = "1" then sJours = sJours &"-Vendredi-" end if if Request.Form("Samedi") = "1" then sJours = sJours &"-Samedi-" end if if Request.Form("Dimanche") = "1" then sJours = sJours &"-Dimanche-" end if if sJours <> "" then sSqlR = sSqlR & "Inscriptions.Jours Like '%" & sJours & "%' and " end if end if '**fin Type Horaire*********************** sSqlR = sSqlR & "Inscriptions.CodeA = " & stActivites & " and " sSqlH = sSqlH & "Horaire.CodeA = " & stActivites & " and " sSqlR = sSqlR & "Inscriptions.Groupe = '" & counterGroupe & "' and " sSqlH = sSqlH & "Horaire.GroupeA = '" & counterGroupe & "' and " if sSqlR <> "" then strSql = "SELECT count(*) as iNbrNodes FROM Inscriptions WHERE "& Left(sSqlR, Len(sSqlR) - 4)&" " Set rsQuery = Conn.Execute(strSql) nbrToDisplay = rsQuery("iNbrNodes") '*******Access SQL*************** sSQL = " SELECT Personnes.* " sSQL = sSQL & "FROM Inscriptions INNER JOIN Personnes ON Inscriptions.CodeM = Personnes.CodeM " sSQL = sSQL & "WHERE "& Left(sSqlR, Len(sSqlR) - 4)&" " sSQL = sSQL & "ORDER BY Personnes.DDN DESC" Set RS = Conn.Execute(sSQL) '********************************* sSQLH = "SELECT * FROM Locaux where CodeL in (select CodeL from Horaire WHERE "& Left(sSqlH, Len(sSqlH) - 4)&") " Set RSHoraire = Conn.Execute(sSQLH) if not RSHoraire.eof then sLocal = RSHoraire("Nom") end if else Response.Redirect ("Presences.asp") end if %> <%if not RS.eof then %>

Fiche de présence

<%if counterGroupe <> "" then%> <%end if%>

Date  :   <% = Date()%>

Nom de l'activité : <%= sNomA %>
Local : <%= sLocal %>
Groupe : <%=counterGroupe%>
Responsable : <%=sAnimateur%>
Date de début : <%=sDateDebut %> Date de fin : <%=sDateFin %>
Nombre Totale : <%=nbrToDisplay%>
  
<% Do While counter < sMax AND Not RS.EOF sNom = RS("Nom") sPrenom = RS("Prenom") sDDN = RS("DDN") sSexe = RS("Sexe") sTelR = RS("TelR") %> <% counter = counter + 1 RS.MoveNext Loop RS.Close Set RS = Nothing %>
Nom Prénom Sexe DDN

Age

Tél.(M)

L M M J V S D SS
<%=sNom%> <%=sPrenom%> <%=sSexe%> <%=sDDN%> <%if sDDN <> "" then Response.Write left(datediff("m",sDDN,date()) / 12,2) end if %> <%=sTelR%>              

SS

 

<%end if%> <% counterGroupe = counterGroupe + 1 sSqlR = "" sSqlH = "" Next '******fin de l'ensemble des groupes************ %> <% else '*******un seule groupe************** '******Inscription parametres******** '******Type Horaire*********************** '****Semaine**** if Request("TypeHoraire") = "Semaine" then For S = 1 to Request("NbreSemaines") Step 1 semaine = "Semaine"&S if Request.Form(semaine) = "1" then sSemaine = sSemaine &"-"&s&"-" end if Next if sSemaine <> "" then sSqlR = sSqlR & "Inscriptions.Semaines Like '%" & sSemaine & "%' and " end if end if '***Jours****** if Request("TypeHoraire") = "Jours" then if Request.Form("Lundi") = "1" then sJours = sJours &"-Lundi-" end if if Request.Form("Mardi") = "1" then sJours = sJours &"-Mardi-" end if if Request.Form("Mercredi") = "1" then sJours = sJours &"-Mercredi-" end if if Request.Form("Jeudi") = "1" then sJours = sJours &"-Jeudi-" end if if Request.Form("Vendredi") = "1" then sJours = sJours &"-Vendredi-" end if if Request.Form("Samedi") = "1" then sJours = sJours &"-Samedi-" end if if Request.Form("Dimanche") = "1" then sJours = sJours &"-Dimanche-" end if if sJours <> "" then sSqlR = sSqlR & "Inscriptions.Jours Like '%" & sJours & "%' and " end if end if '**fin Type Horaire*********************** sSqlR = sSqlR & "Inscriptions.CodeA = " & stActivites & " and " sSqlH = sSqlH & "Horaire.CodeA = " & stActivites & " and " if stGroupe <> "" then sSqlR = sSqlR & "Inscriptions.Groupe = '" & stGroupe & "' and " sSqlH = sSqlH & "Horaire.GroupeA = '" & stGroupe & "' and " end if if sSqlR <> "" then strSql = "SELECT count(*) as iNbrNodes FROM Inscriptions WHERE "& Left(sSqlR, Len(sSqlR) - 4)&" " Set rsQuery = Conn.Execute(strSql) nbrToDisplay = rsQuery("iNbrNodes") '*******Access SQL********* sSQL = " SELECT Personnes.Nom, Personnes.Prenom, Personnes.DDN " sSQL = sSQL & "FROM Inscriptions INNER JOIN Personnes ON Inscriptions.CodeM = Personnes.CodeM " sSQL = sSQL & "WHERE "& Left(sSqlR, Len(sSqlR) - 4)&" " sSQL = sSQL & "ORDER BY Personnes.DDN DESC" Set RS = Conn.Execute(sSQL) sSQLH = "SELECT * FROM Locaux where CodeL in (select CodeL from Horaire WHERE "& Left(sSqlH, Len(sSqlH) - 4)&") " Set RSHoraire = Conn.Execute(sSQLH) if not RSHoraire.eof then sLocal = RSHoraire("Nom") end if else Response.Redirect ("Presences.asp") end if %>

Fiche de présence

<%if Request("Groupe") <> "" then%> <%end if%>

Date:

<% = Date()%>
Nom de l'activité : <%= sNomA %>
Local : <%= sLocal %>
Groupe : <%=Request("Groupe")%>
Nombre Totale : <%=nbrToDisplay%>
  
<% Do While counter < sMax AND Not RS.EOF sNom = RS("Nom") sPrenom = RS("Prenom") sDDN = RS("DDN") 'end if %> <% counter = counter + 1 RS.MoveNext Loop RS.Close Set RS = Nothing Conn.Close Set Conn = Nothing %>
Nom Prénom DDN L M M J V S D
<%=sNom%> <%=sPrenom%> <%=sDDN%>              

 

<%end if%>