<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> Agenda Eurobrevets 1.01.02 <% CheckSecurity(1) BeginCode = Now() 'Session.Timeout = 50 'Session.Timeout = 30 'Response.Write("The timeout is: " & Session.Timeout) DateTest = "03/04/2008" ' Response.Write("DateTest : " & DateTest & "
") DateTest = FormatDateTime(DateTest,2) ' Response.Write("DateTest : " & DateTest & "
") JourTest = Day(DateTest) ' Response.Write("JourTest : " & JourTest & "
") my_var_type = VarType(JourTest) ' Response.Write("my_var_type : " & my_var_type & "
") If JourTest = 3 then Session("Lg_Server") = "FR" %> <% elseif JourTest = 4 then Session("Lg_Server") = "EN" %> <% end if ' Response.Write("Session('Lg_Server') : " & Session("Lg_Server") & "
") thisnumerosemaine = DatePart("ww",date(),2,3) ' TodayBE = FormatDateTime(DateAdd("h",6,Now()),2) TodayBE = FormatDateTime(Now(),2) TodayBEday = day(TodayBE) TodayBEmonth = month(TodayBE) TodayBEyear = year(TodayBE) TodayBEsql = TodayBEyear & "-" & TodayBEmonth & "-" & TodayBEday TodayBE = DateToHtml(TodayBE) Dim SemRedirect SemRedirect = Request.QueryString("Semaine") If SemRedirect = 0 then SemRedirect = thisnumerosemaine end if '''''''''''''''''''''''''''''''''''' ' Definition premier lundi agenda ' '''''''''''''''''''''''''''''''''''' If Session("datedebut") = "" and Session("datefin") = "" then ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Definition date du jour et lundi de la semaine courante ' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' today = date() postoday = weekday(today,2) daytoday = day(today) monthtoday = month(today) yeartoday = year(today) If postoday > 1 then diff = postoday - 1 lunditoday = Dateserial(yeartoday,monthtoday,daytoday-diff) else lunditoday = today End if daylunditoday = day(lunditoday) monthlunditoday = month(lunditoday) yearlunditoday = year(lunditoday) firstlundi = Dateserial(yearlunditoday,monthlunditoday,daylunditoday-21) firstsem = DatePart("ww",firstlundi,2,3) yearfirstlundi = year(firstlundi) Session("Retrievefirstlundi") = firstlundi Session("datedebut") = firstlundi '''''''''''''''''''''''''''''''''''' ' Definition dernier lundi agenda ' '''''''''''''''''''''''''''''''''''' lastlundi = Dateserial(yearlunditoday,monthlunditoday,daylunditoday+28) lastdimanche = Dateserial(yearlunditoday,monthlunditoday,daylunditoday+34) lastsem = DatePart("ww",lastlundi,2,3) yearlastlundi = year(lastlundi) Session("Retrievelastdimanche") = lastdimanche Session("datefin") = lastdimanche else datedebut = Session("datedebut") datefin = Session("datefin") posdatedebut = weekday(datedebut,2) firstsem = DatePart("ww",datedebut,2,3) If posdatedebut > 1 then daydatedebut = day(datedebut) monthdatedebut = month(datedebut) yeardatedebut = year(datedebut) diff = posdatedebut - 1 firstlundi = Dateserial(yeardatedebut,monthdatedebut,daydatedebut-diff) yearfirstlundi = year(firstlundi) else firstlundi = datedebut yearfirstlundi = year(firstlundi) end if posdatefin = weekday(datefin,2) lastsem = DatePart("ww",datefin,2,3) daydatefin = day(datefin) monthdatefin = month(datefin) yeardatefin = year(datefin) If posdatefin > 1 then diff = posdatefin - 1 lastlundi = Dateserial(yeardatefin,monthdatefin,daydatefin-diff) diff2 = 6 - diff lastdimanche = Dateserial(yeardatefin,monthdatefin,daydatefin+diff2) yearlastlundi = year(lastlundi) else lastlundi = datefin lastdimanche = DateSerial(yeardatefin,monthdatefin,daydatefin+6) yearlastlundi = year(lastlundi) end if end if dayFirstlundiSQL = day(firstlundi) monthFirstlundiSQL = month(firstlundi) yearFirstlundiSQL = year(firstlundi) firstlundiSQL = yearFirstlundiSQL & "-" & monthFirstlundiSQL & "-" & dayFirstlundiSQL dayLastdimancheSQL = day(lastdimanche) monthLastdimancheSQL = month(lastdimanche) yearLastdimancheSQL = year(lastdimanche) lastdimancheSQL = yearLastdimancheSQL & "-" & monthLastdimancheSQL & "-" & dayLastdimancheSQL %> <% '''''''''''''''''''''''''''''''''''''' ' Lecture table events de date à date' '''''''''''''''''''''''''''''''''''''' 'Response.Write("
  Logout  
  Logbook:     TODOList     Customers     KnowHow     LogBook         
") Set rsListEvents = server.CreateObject("ADODB.Recordset") sqlListEvents = "SELECT rdlp.id, rdlp.idEmpl, rdlp.CustInt, year(rdlp.DateInt), week(rdlp.DateInt), rdlp.DateInt, rdlp.FullDay, rdlp.BeginTime, rdlp.EndTime," & _ " rdlp.JobDescription, te.TypeEvent, tp.TypePrestation, e.Initiales " & _ "FROM reldatelieupers_2 as rdlp " & _ "LEFT JOIN employees as e on rdlp.idEmpl=e.IdEmpl " & _ "LEFT JOIN typeevent as te on rdlp.idTypeEvent=te.idType " & _ "LEFT JOIN typeprestation as tp on rdlp.idTypePrestation=tp.idPrestation " & _ "WHERE rdlp.DateInt>='" & firstlundiSQL & "' AND rdlp.DateInt<='" & lastdimancheSQL & "' " & _ "ORDER BY year(rdlp.DateInt),week(rdlp.DateInt),e.Initiales,rdlp.DateInt,rdlp.BeginTime Asc" openStaticRS rsListEvents, sqlListEvents 'Response.Write("") ''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''''''''''' ' Boucle première semaine à dernière semaine' ''''''''''''''''''''''''''''''''''''''''''''' diffyear = yearlastlundi - yearfirstlundi If diffyear > 0 then diffsem = 52 * diffyear lastsem = lastsem + diffsem end if For Sem = firstsem to lastsem lastmonth = month(firstlundi) lastday = day(firstlundi) lastyear = year(firstlundi) currentlundi = firstlundi Currsem = DatePart("ww",currentlundi,2,3) If Currsem = 53 then Currsem = 1 end if %> <% firstlundi = Dateserial(tmpyear,lastmonth,lastday+7) next %>
" & sqlListEvents & "
<% If Currsem = thisnumerosemaine and year(Date()) = year(currentlundi) then %> <% else Response.Write("
") end if %> <% '''''''''''''''''''''''''''''''''''''''''''''' ' Boucle d'affichage des jours de la semaine ' '''''''''''''''''''''''''''''''''''''''''''''' For wd = 0 to 6 tmpmonth = month(firstlundi) tmpday = day(firstlundi) tmpyear = year(firstlundi) currentday = Dateserial(tmpyear,tmpmonth,tmpday+wd) dayname = WeekdayName(Weekday(currentday)) currentday = DateToHtml(currentday) If currentday = TodayBE then Response.Write("") else %> <% end if next %> <% ''''''''''''''''''''''''''''''''''' ' Boucle d'affichage des employés ' ''''''''''''''''''''''''''''''''''' IDEmployee = 0 ChangeColor = 0 InitEmployee = "" openrs rsidEmpl, "select IdEmpl, Initiales from employees where DisableEmpl=0 order by 2" while not rsidEmpl.EOF IDEmployee = GetValue(rsidEmpl, 0) InitEmployee = GetValue(rsidEmpl, 1) rsidEmpl.MoveNext If Session("Empl" & IDEmployee) = "on" and IDEmployee <> 0 then ChangeColor = ChangeColor + 1 If Round(ChangeColor/2) = ChangeColor/2 then trcolor = "CCCCCC" else trcolor = "99CCFF" end if %> <% For wd = 0 to 6 tmpmonth = month(firstlundi) tmpday = day(firstlundi) tmpyear = year(firstlundi) currentday = Dateserial(tmpyear,tmpmonth,tmpday+wd) tosqlmonth = month(currentday) tosqlday = day(currentday) tosqlyear = year(currentday) tosqldate = tosqlyear & "-" & tosqlmonth & "-" & tosqlday ShowToday = "" If tosqldate = TodayBEsql then ShowToday = " bordercolor='#0000FF' bgcolor='#CCFFFF'" End if %> <% next %> <% end if wend set rsidEmpl = nothing %>

Sem.<%=Currsem%>

" & dayname & "
" & currentday & "
<%=dayname%>
<%=currentday%>

<%=InitEmployee%>

> <% ClientFull = "" AddEvent = "Edit Day" AddEvent2 = "Add Event" If wd = 5 or wd=6 then AddEvent = "W-E" end if rsListEvents.Filter = "(Initiales='" & InitEmployee & "' AND DateInt=#" & currentday & "#) OR (Initiales=' All' AND DateInt=#" & currentday & "#)" If not rsListEvents.eof then While not rsListEvents.eof ClientFull = rsListEvents("CustInt") idFull = rsListEvents("id") If rsListEvents("FullDay") = 1 then Response.Write("" & ClientFull & "") 'Response.Write("" & ClientFull & "") else EventBeginTime = rsListEvents("BeginTime") EventEndTime = rsListEvents("EndTime") EventBeginHour = Hour(EventBeginTime) If EventBeginHour < 10 then EventBeginHour = "0" & EventBeginHour end if EventBeginMinute = Minute(EventBeginTime) If EventBeginMinute < 10 then EventBeginMinute = "0" & EventBeginMinute end if EventBeginHour = EventBeginHour & ":" & EventBeginMinute EventEndHour = Hour(EventEndTime) If EventEndHour < 10 then EventEndHour = "0" & EventEndHour end if EventEndMinute = Minute(EventEndTime) If EventEndMinute < 10 then EventEndMinute = "0" & EventEndMinute end if EventEndHour = EventEndHour & ":" & EventEndMinute If EventEndHour = "23:59" then EventEndHour = "24:00" end if Response.Write("" & EventBeginHour & " - " & EventEndHour & " - " & ClientFull & "") 'Response.Write("" & EventBeginHour & " - " & EventEndHour & " - " & ClientFull & "") end if rsListEvents.movenext Response.Write("
") Wend else rsListEvents.Filter = adFilterNone End if Response.Write("" & AddEvent & "") Response.Write(" / " & AddEvent2 & "") %>
<% EndCode = Now() TimeCode = DateDiff("s",BeginCode,EndCode) Response.Write("Temps d'affichage : " & TimeCode) rsListEvents.close %>