<% if request("wk")="" then %>Semaine<% else %>Mois<% end if %>
<% end sub %>
<%
dim content
dim event_id
dim dt_end
dim CodeAdmin
dim dt_start
dim id
dim b_personal
dim description
dim tm_start
dim tm_end
dim event_name
dim Cat
dim NomU
dim detail_events_sql
sub request_detail_events
''' request form inputs from this form
event_id = request("event_id")
dt_end = request("dt_end")
CodeAdmin = request("CodeAdmin")
dt_start = request("dt_start")
id = request("id")
b_personal = request("b_personal")
description = request("description")
tm_start = request("tm_start")
tm_end = request("tm_end")
'********
location = request("location")
'********
event_name = request("event_name")
Cat = request("Cat")
NomU = request("NomU")
end sub
sub validate_detail_events
''' request and validate data entered from this form
event_id = trim(request("event_id"))
dt_end = trim(request("dt_end"))
CodeAdmin = trim(request("CodeAdmin"))
dt_start = trim(request("dt_start"))
id = trim(request("id"))
b_personal = trim(request("b_personal"))
description = trim(request("description"))
tm_start = trim(request("tm_start"))
tm_end = trim(request("tm_end"))
'********
location = trim(request("location"))
'********
event_name = trim(request("event_name"))
Cat = trim(request("Cat"))
NomU = trim(request("NomU"))
end sub
sub db_select_detail_Events
incDate1 = "#" & Replace(incDate, "'", "''") & "#"
detail_Events_sql = "SELECT " & _
"Events.dt_end, " & _
"Events.CodeAdmin, " & _
"Events.dt_start, " & _
"EventsOccur.id, " & _
"EventsOccur.tm_start, " & _
"EventsOccur.tm_end, " & _
"EventsOccur.location, " & _
"Events.event_id, " & _
"Admin.NomU, " & _
"EventsOccur.event_name, " & _
"EventsOccur.description, " & _
"Events.b_personal FROM ((Events LEFT JOIN Admin ON Events.CodeAdmin = Admin.CodeAdmin) LEFT JOIN EventsOccur ON Events.event_id = EventsOccur.event_id) " & _
" WHERE (b_personal = 0 OR b_personal = 2 OR b_personal is null OR Events.CodeAdmin = " & to_sql(session("CodeAdmin"),"number") & ")" & _
" AND (dt_occur = " & incDate1& ") ORDER BY tm_start"
end sub
sub db_delete_detail_Events
sql = "DELETE FROM EventsOccur" & _
" WHERE " & _
"id = " & to_sql(id,"number") & ""
'response.write sql
on error resume next
cn.Execute(sql)
if err.number <> 0 then
b_error = true
end if
on error goto 0
end sub
'***************************************************Suite calendrier*************************
do_search = request("do_search")
sortby = request("sortby")
''' request form keys and inputs
id = request("id")
':: request action
action = lcase(request("action"))
':: handle the action
select case action
case "select_detail_events"
' select the requested key record from database
if id <> "" then
db_select_detail_Events
else
b_error = true
error_list.add "edit_detail_Events", "Specify record to select."
end if
end select
':: handle the default case(s) (ignores value of action parameter)
dim incDate, boxSize, a_events(31)
incDate = request("incDate")
mo = request("mo")
yr = request("yr")
if "mm/dd/yyyy"="mm/dd/yyyy" then
if incDate = "" and mo <> "" and yr <> "" then incDate = mo & "/1/" & yr
else
if incDate = "" and mo <> "" and yr <> "" then incDate = "01/" & mo & "/" & yr
end if
if action = "detail" then
db_select_detail_events
else
b_display_new_content = true
end if
%>
<%
display_errs
display_msg
%>
<%
if action = "" then
If incDate = "" Then
'' get the current months first day
incDate = DatePart ("m" , Date) & "/01/" & DatePart("yyyy" , Date)
Else
incDate = DatePart ("m" , incDate) & "/" & DatePart ("d" , incDate) & "/" & DatePart("yyyy" , incDate)
End If
'' pixel size for the cell boxes
boxSize = "40"
boxSizeLarge = "40"
' To change the month, Pass in a date with POST or GET of a valid date
' to a variable named incDate
Function GetDateName (monthNumber)
Select Case monthNumber
Case 1
GetDateName = "Janvier"
Case 2
GetDateName = "Février"
Case 3
GetDateName = "Mars"
Case 4
GetDateName = "Avril"
Case 5
GetDateName = "Mai"
Case 6
GetDateName = "Juin"
Case 7
GetDateName = "Juillet"
Case 8
GetDateName = "Août"
Case 9
GetDateName = "Septembre"
Case 10
GetDateName = "Octobre"
Case 11
GetDateName = "Novembre"
Case 12
GetDateName = "Décembre"
End Select
End Function
function DaysInAnyMonth(iMonth, iYear)
dim dTemp
dTemp = DateAdd("d", -1, DateSerial(iYear, iMonth + 1, 1))
DaysInAnyMonth = Day(dTemp)
end function
function WeekdayNameOfFirstOfMonth(iMonth, iYear)
dim dTemp
dTemp = WeekdayName(Weekday(iMonth & "/01/" & iYear,VBSunday))
FirstWeekdayOfMonth = dTemp
'response.write " 1st day of " & iMonth & "/" & iYear & " is a: " & dTemp & " "
end function
function DateFirstWeekdayFallsOn(iMonth, iYear, iWeekdayNumber)
dim dTemp
dTemp = iWeekdayNumber - Weekday(iMonth & "/01/" & iYear, 1)
if dTemp < 0 then dTemp = 0
dTemp = DateAdd("d",dTemp,iMonth & "/01/" & iYear)
DateFirstWeekdayFallsOn = dTemp
'response.write " The 1st " & WeekdayName(iWeekdayNumber) & " of " & iMonth & "/" & iYear & " is on: " & dTemp & " "
end function
render_title
if request("wk") = "" then
%>
Dimanche
Lundi
Mardi
Mercredi
Jeudi
Vendredi
Samedi
<%
'' select events and assign to a_events array
CatId = request("CatId")
if CatId = "" then
sql = "SELECT Events.*, EventsOccur.*, Admin.NomU FROM Events, EventsOccur, Admin WHERE "
sql = sql + "("
sql = sql + "b_personal = 0 OR b_personal = 2 OR b_personal is null OR events.CodeAdmin = " & to_sql(session("CodeAdmin"),"number") & ""
sql = sql + ")"
sql = sql + "AND"
sql = sql + "("
sql = sql + "Events.CodeAdmin = Admin.CodeAdmin"
sql = sql + ")"
sql = sql + "AND"
sql = sql + "("
sql = sql + "EventsOccur.event_id = Events.event_id"
sql = sql + ")"
sql = sql + "AND"
sql = sql + "("
sql = sql + "month(dt_occur) = " & month(incDate) & " AND year(dt_occur) = " & year(incDate) & ""
sql = sql + ")"
sql = sql + " ORDER BY dt_occur"
''response.write sql
else
sql = "SELECT Events.*, EventsOccur.*, Admin.NomU FROM Events, EventsOccur, Admin WHERE "
sql = sql + "("
sql = sql + "b_personal = 0 OR b_personal = 2 OR b_personal is null OR events.CodeAdmin = " & to_sql(session("CodeAdmin"),"number") & ""
sql = sql + ")"
sql = sql + "AND"
sql = sql + "("
sql = sql + "EventsOccur.catid = " & to_sql(catid,"number") & ""
sql = sql + ")"
sql = sql + "AND"
sql = sql + "("
sql = sql + "Events.CodeAdmin = Admin.CodeAdmin"
sql = sql + ")"
sql = sql + "AND"
sql = sql + "("
sql = sql + "EventsOccur.event_id = Events.event_id"
sql = sql + ")"
sql = sql + "AND"
sql = sql + "("
sql = sql + "month(dt_occur) = " & month(incDate) & " AND year(dt_occur) = " & year(incDate) & ""
sql = sql + ")"
sql = sql + " ORDER BY dt_occur"
'response.write sql
end if
set rs = cn.execute(sql)
days_in_month = DaysInAnyMonth(month(incDate),year(incDate))
lastDate = DateAdd("d",days_in_month-1,incDate)
do until rs.EOF
dt_start = rs("dt_start")
dt_end = rs("dt_end")
'*******
location = rs("location")
'*******
dt_occur = rs("dt_occur")
recurring = rs("recurring")
recurring_end = rs("recurring_end")
b_personal = rs("b_personal")
CodeAdmin = rs("CodeAdmin")
NomU = rs("NomU")
ev_start = 0
ev_end = 0
if (dt_end = dt_start) OR isnull(dt_end) then
if b_personal = 2 AND CodeAdmin <> session("CodeAdmin") then
a_events(day(dt_occur)) = a_events(day(dt_occur)) & NomU & " busy.. "
else
a_events(day(dt_occur)) = a_events(day(dt_occur)) & "" & left(rs("event_name"),25) & ".. "
end if
end if
rs.MoveNext
loop
rs.Close
'' calendar loop
dim w, d, count, dispDay, currDay
dateCount = incDate
count = 1
dispDay = 1
for w = 1 to 6
%>
<%
for d = 1 to 7
if Not (count => DatePart("w" , incDate)) AND (count < 8) then
%>
<%
count = count + 1
else
':: current date?
If "mm/dd/yyyy" ="mm/dd/yyyy" then
currDy = DatePart("m" , incDate) & "/" & dispDay & "/"
currDay = DatePart("m" , incDate) & "/" & dispDay & "/" & DatePart("yyyy" , incDate)
Else
currDy = dispDay & "/" & DatePart("m" , incDate) & "/"
currDay = dispDay & "/" & DatePart("m" , incDate) & "/" & DatePart("yyyy" , incDate)
End if
If IsDate(currDay) Then
':: today
If datevalue(currDay) = datevalue(Date) Then
%>
<%=dispDay%>
<% if not isEmpty(a_events(dispDay)) then %>
<% end if %>
<%
Else
':: other date
%>
<%=dispDay%><% if not isEmpty(a_events(dispDay)) then %>
<% end if %>
<%
End If
count = count + 1
dispDay = dispDay + 1
Else
':: no date spacer cell
%>
<%
'' select events and assign to a_events array
if CatId = "" then
sql = "SELECT Events.*, EventsOccur.*, Admin.NomU FROM Events, EventsOccur, Admin WHERE "
sql = sql + "("
sql = sql + "b_personal = 0 OR b_personal = 2 OR b_personal is null OR events.CodeAdmin = " & to_sql(session("CodeAdmin"),"number") & ""
sql = sql + ")"
sql = sql + "AND"
sql = sql + "("
sql = sql + "Events.CodeAdmin = Admin.CodeAdmin"
sql = sql + ")"
sql = sql + "AND"
sql = sql + "("
sql = sql + "EventsOccur.event_id = Events.event_id"
sql = sql + ")"
sql = sql + "AND"
sql = sql + "("
sql = sql + "month(dt_occur) = " & month(incDate) & " AND year(dt_occur) = " & year(incDate) & ""
sql = sql + ")"
sql = sql + " ORDER BY dt_occur"
'response.write sql
else
sql = "SELECT * FROM Events, EventsOccur WHERE "
sql = sql + "("
sql = sql + "b_personal = 0 OR b_personal is null OR CodeAdmin = " & to_sql(session("CodeAdmin"),"number") & ""
sql = sql + ")"
sql = sql + "AND"
sql = sql + "("
sql = sql + "EventsOccur.catid = " & to_sql(cat_id,"number") & ""
sql = sql + ")"
sql = sql + "AND"
sql = sql + "("
sql = sql + "EventsOccur.event_id = Events.event_id"
sql = sql + ")"
sql = sql + "AND"
sql = sql + "("
sql = sql + "month(dt_occur) = " & month(incDate) & " AND year(dt_occur) = " & year(incDate) & ""
sql = sql + ")"
sql = sql + " ORDER BY dt_occur"
'response.write sql
end if
set rs = cn.execute(sql)
days_in_month = DaysInAnyMonth(month(incDate),year(incDate))
lastDate = DateAdd("d",days_in_month-1,incDate)
do until rs.EOF
dt_start = rs("dt_start")
dt_end = rs("dt_end")
'*******
location = rs("location")
'*******
dt_occur = rs("dt_occur")
recurring = rs("recurring")
recurring_end = rs("recurring_end")
b_personal = rs("b_personal")
NomU = rs("NomU")
ev_start = 0
ev_end = 0
if (dt_end = dt_start) OR isnull(dt_end) then
if b_personal = 2 AND CodeAdmin <> session("CodeAdmin") then
a_events(day(dt_occur)) = a_events(day(dt_occur)) & NomU & " busy.."
else
a_events(day(dt_occur)) = a_events(day(dt_occur)) & "" & left(rs("event_name"),25) & ".."
end if
end if
rs.MoveNext
loop
rs.Close
'' calendar loop
dateCount = incDate
count = 1
dispDay = DatePart("d",incDate)
for d = 1 to 7
If IsDate( DatePart("m" , incDate) & "/" & dispDay & "/" & DatePart("yyyy" , incDate)) Then
currDy = DatePart("m" , incDate) & "/" & dispDay & "/"
currDay = DatePart("m" , incDate) & "/" & dispDay & "/" & DatePart("yyyy" , incDate)
%>
<% if weekdayname(weekday(currDay)) = "Saturday" then response.write "Samedi" %>
<% if weekdayname(weekday(currDay)) = "Sunday" then response.write "Dimanche" %>
<% if weekdayname(weekday(currDay)) = "Monday" then response.write "Lundi" %>
<% if weekdayname(weekday(currDay)) = "Tuesday" then response.write "Mardi" %>
<% if weekdayname(weekday(currDay)) = "Wednesday" then response.write "Mercredi" %>
<% if weekdayname(weekday(currDay)) = "Thursday" then response.write "Jeudi" %>
<% if weekdayname(weekday(currDay)) = "Friday" then response.write "Vendredi" %>
<%
If datevalue(currDay) = datevalue(Date) Then
%>
<%=dispDay%>
<% if not isEmpty(a_events(dispDay)) then %>
<%
do while not rs.EOF
':: read db record
on error resume next
event_id = rs("event_id")
dt_end = rs("dt_end")
'*******
location = rs("location")
'*******
CodeAdmin = rs("CodeAdmin")
dt_start = rs("dt_start")
id = rs("id")
b_personal = rs("b_personal")
description = rs("description")
tm_start = rs("tm_start")
tm_end = rs("tm_end")
event_name = rs("event_name")
Cat = rs("Cat")
NomU = rs("NomU")
on error goto 0
%>
<% event_desc = left(event_desc,100) %>
<%
if tm_start <> "" and tm_end <> "" then
tm_start = timevalue(tm_start) & " - " & timevalue(tm_end)
elseif tm_start <> "" then
tm_start = timevalue(tm_start)
else
tm_start = " --Toute la journée-- "
end if
%><% =tm_start %>
<% if b_personal=2 and session("CodeAdmin") <> CodeAdmin then %><% =NomU %> busy<% else %><% =event_name %>
<% end if %>
<%
SQL="Select * from Locaux where CodeL = " & Location
set rsQuery = conn.execute (SQL)
if not rsQuery.EOF then
Response.Write rsQuery("Nom")
end if
%>
<% end if %>
<%
':: assure that any db resources are freed
on error resume next
rs.Close
set rs = NOTHING
cn.Close
set cn = NOTHING
user_cn.Close
set user_cn = NOTHING
on error goto 0
%>
<% if action = "detail" then %>
<%
'Option explicit
'Dim root
'Dim Connection, objRS, strSQL
Dim journee(), str_nbSalle, i, j, k, l, m, n,p,q, jour, mois, annee,desc()
Dim temps, str_heure, col, debut
'root = "../"
if Request.QueryString("incDate") <> "" then
DateincDate = Request.QueryString("incDate")
jour = day(DateincDate)
mois = month(DateincDate)
annee = year(DateincDate)
Session("jour") = jour
Session("mois") = mois
Session("annee") = annee
else
jour = day(date())
mois = month(date())
annee = year(date())
Session("jour") = day(date())
Session("mois") = month(date())
Session("annee") = year(date())
end if
Set objRS = Server.CreateObject("ADODB.Recordset")
strSQL="SELECT * FROM Locaux"
objRS.Open strSQL,Conn,3,3
if not objRS.EOF then
str_nbSalle=objRS.RecordCount
objRS.MoveFirst
Redim journee(19, str_nbSalle)
for i=1 to str_nbSalle step 1
journee(0,i)=objRS("CodeL")
journee(1,i)=objRS("Nom")
journee(2,i)=objRS("Description")
objRS.MoveNext
next
objRS.Close
for l=2 to 18 step 1
str_heure=l+5
journee(l,0)=cdate(str_heure)
next
journee(19,0)=cdate("0")
strSQL="SELECT * FROM EventsOccur WHERE dt_occur=#" & annee & "-" & _
mois & "-" & jour & "#"
objRS.Open strSQL,Conn,3,3
Redim desc(19, str_nbSalle)
while not objRS.EOF
for m=1 to str_nbSalle step 1
if journee(0,m)=objRS("location") then
col=m
desc(0,m)= hour(objRS("tm_start"))
desc(1,m)= hour(objRS("tm_end"))
exit for
end if
next
for q=2 to 19 step 1
stm_start = hour(objRS("tm_start"))
if journee(q,0)= stm_start then
debut=q
desc(2,m)=objRS("tm_start")
desc(3,m)=objRS("tm_end")
exit for
end if
next
temps= datediff("h",objRS("tm_start"),objRS("tm_end") ) - 1
for n=debut to debut+temps step 1
journee(n,col)="X"
next
objRS.movenext
Wend
%>
<% Response.write "
Liste des réservations confirmées pour le " & jour & "/" & mois & "/" & annee & "
" %>
<%
Response.Write "
"
Response.Write "
"
Response.Write "
"
Response.Write "
"
Response.Write "
Nom de local
"
Response.Write "
"
for p=0 to str_nbSalle step 1
Response.Write "
"%>
<%
Response.Write "
" & journee(1,p) & "
"
Response.Write "
"
next
Response.Write "
"
Response.Write "
Nom de local
"
Response.Write "
"
Response.Write "
"
Response.Write "
"
h=7
for k=2 to 18 step 1
Response.Write "
"
Response.Write "
"
Response.Write "
"
Response.Write "
" & h & "
"
Response.Write "
"
for j=1 to str_nbSalle step 1
if journee(k,j)="X" then
Response.Write "