<%@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 ' dayLastDimanche = day(lastdimanche) ' monthLastDimanche = month(lastdimanche) ' yearLastDimanche = year(lastdimanche) %> <% Response.Write("") 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 Response.Write("") firstlundi = Dateserial(tmpyear,lastmonth,lastday+7) next Response.Write("
" & _ "") Response.Write("") Response.Write("") Response.Write("") Response.Write("") Response.Write("
  Logout  
  Logbook:    TODOList    Customers    KnowHow    LogBook   
") If Currsem = thisnumerosemaine and year(Date()) = year(currentlundi) then Response.Write("") else Response.Write("
") end if Response.Write("") '''''''''''''''''''''''''''''''''''''''''''''' ' 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 Response.Write("") end if next Response.Write("") IDEmployee = 0 ChangeColor = 0 InitEmployee = "" openrs rsidEmpl, "select IdEmpl, Initiales from employees where DisableEmpl=0 order by 2" while not rsidEmpl.EOF ChangeColor = ChangeColor + 1 If Round(ChangeColor/2) = ChangeColor/2 then trcolor = "CCCCCC" else trcolor = "99CCFF" end if IDEmployee = GetValue(rsidEmpl, 0) InitEmployee = GetValue(rsidEmpl, 1) rsidEmpl.MoveNext If Session("Empl" & IDEmployee) = "on" and IDEmployee <> 0 then Response.Write("") 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 Response.Write("") next Response.Write("") end if wend set rsidEmpl = nothing Response.Write("

Sem." & Currsem & "

" & dayname & "
" & currentday & "
" & dayname & "
" & currentday & "

" & InitEmployee & "

") ClientFull = "" AddEvent = "Add Event" If wd = 5 or wd=6 then AddEvent = "W-E" end if Set rs_search_event = server.CreateObject("ADODB.Recordset") sql_search_event = "SELECT * FROM reldatelieupers_2 WHERE DateInt='" & tosqldate & "' AND (idEmpl=" & IDEmployee & " OR idEmpl=0) ORDER BY BeginTime Asc" openrs rs_search_event, sql_search_event If not rs_search_event.eof then while not rs_search_event.eof If rs_search_event("FullDay") = 1 then ClientFull = rs_search_event("CustInt") idFull = rs_search_event("id") Response.Write("" & ClientFull & "") else EventBeginTime = rs_search_event("BeginTime") EventEndTime = rs_search_event("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 ClientFull = rs_search_event("CustInt") idFull = rs_search_event("id") Response.Write("" & _ EventBeginHour & " - " & EventEndHour & " - " & ClientFull & "") end if rs_search_event.movenext Response.Write("
") wend end if rs_search_event.close set rs_search_event = nothing Response.Write("" & AddEvent & "
") EndCode = Now() TimeCode = DateDiff("s",BeginCode,EndCode) Response.Write(TimeCode) %>