<% ' ################################# public function CAL_ViewWeek1() dim sH : sH = "" dim DateFrom dim DateTo dim dtPrev: dtPrev = dateadd("ww",-1,dtDate) dim dtNext: dtNext = dateadd("ww",+1,dtDate) dim Places, EventList, i, J, DayColumns DateFrom = CAL_FirstWeekDay(DtDate) DateTo = DateAdd("d",+6,DateFrom) sH = sH & "" & VbCrLf sH = sH & "" & VbCrLf sH = sH & "" & VbCrLf sH = sH & "
" & VbCrLf sH = sH & " " sH = sH & application(session("LANG") & "_wcal13") & VbCrLf sH = sH & formatdatetime(DateFrom, vbLongDate) & " - " & formatdatetime(DateTo, vbLongDate) & VbCrLf sH = sH & " 
" if session("FILTER_CATEGORY") <> "" then sH = sH & CAL_SHOWCATFILTERS() 'writes list of categories in filter end if sH = sH & "
" & VbCrLf sH = sH & CAL_ViewIcons(dtDate, "W; WS; M; MG; FT; Y;") sH = sH & "

" & VbCrLf sH = sH & "" sH = sH & "" ' Display headers of places ' All Places in DB StrSql = "SELECT DISTINCT Place FROM wcal_events ORDER BY Place ASC" ' All Places in DB for specified week StrSql = "SELECT DISTINCT Place FROM wcal_events left join wcal_eventrec on wcal_eventrec.IDEvent = wcal_events.IDEvent where wcal_eventrec.Lang=" & session("LANG")& " and wcal_eventrec.Client=" & session("Client") & " and EventDate >= " & funcs.VDate(DateFrom) & " AND EventDate <= " & funcs.VDate(DateTo) strSQL = "SELECT DISTINCT wcal_events.Place FROM (wcal_events LEFT JOIN wcal_eventrec ON wcal_events.IDEvent=wcal_eventrec.IDEvent) INNER JOIN wcal_eventcat ON wcal_events.IDEvent=wcal_eventcat.IDEvent WHERE wcal_eventrec.Lang=" & session("LANG") & " and wcal_eventrec.Client=" & session("Client") & " and EventDate >= " & funcs.VDate(DateFrom) & " AND EventDate <= " & funcs.VDate(DateTo) if Session("FILTER_CATEGORY") <> "" then StrSql = strSQL & " AND wcal_eventcat.IDCat IN (" & Session("FILTER_CATEGORY") & "0)" strSQL = strSQL & " ORDER BY Place ASC" set Places = Server.CreateObject("ADODB.Recordset") Places.CursorLocation = 3 Places.Open strSql, my_conn Places.CacheSize = 100 Redim strPLACENAME(1) I=1 dim PlacesCols ' if there is any event in this week if NOT (Places.BOF or Places.EOF) then PlacesCols = clng(90/Places.RecordCount) sH = sH & "" sH = sH & "" do until Places.EOF sH = sH & "" strPLACENAME(I) = Places("Place") Redim Preserve strPLACENAME(I+1) I=I+1 Places.MoveNext Loop sH = sH & "" end if Places.Close set Places = nothing sH = sH & "" For DayColumns = DateFrom to DateTo sH = sH & "" for J=1 To I-1 ' For each Place strSQL = "SELECT wcal_events.Cust1, wcal_events.Cust2, wcal_events.Cust3, wcal_events.Cust4, wcal_events.Cust5, wcal_events.Place, wcal_events.IDEvent AS ID, wcal_events.IDUser, wcal_events.EventName, wcal_eventrec.StartTime, wcal_eventrec.EndTime, wcal_eventrec.Description FROM (wcal_events LEFT JOIN wcal_eventrec ON wcal_events.IDEvent = wcal_eventrec.IDEvent) INNER JOIN wcal_eventcat ON wcal_events.IDEvent = wcal_eventcat.IDEvent WHERE ((wcal_events.Place='" & strPLACENAME(J) & "') AND (wcal_events.UserPrivate=0 OR wcal_events.UserPrivate=" & session("WCAL_USERID") & ") AND (wcal_eventrec.Lang=" & session("LANG") & ") AND (wcal_eventrec.Client=" & session("Client") & ") AND (wcal_eventrec.EventDate=" & funcs.VDate(DayColumns) & ")" if Session("FILTER_CATEGORY") <> "" then StrSQL = strSQL & " AND (wcal_eventcat.IDCat IN (" & Session("FILTER_CATEGORY") & "0))" strSQL = strSQL & ") ORDER BY Place ASC" 'rwe strSQL set EventList = Server.CreateObject("ADODB.Recordset") EventList.CursorLocation = 3 EventList.Open strSQL, my_conn EventList.CacheSize = 100 sH = sH & "" else do until EventList.EOF sH = sH & CAL_ViewOneEvent(EventList, DayColumns, "SHORT") EventList.MoveNext Loop end if sH = sH & " " EventList.Close set EventList = nothing next sH = sH & "" next sH = sH & "" sH = sH & "
 " & Places("Place") & "
" & weekdayName(weekday(DayColumns)) & "" sH = sH & "
" & funcs.DateView(DayColumns) & "" & "
" if EventList.BOF or EventList.EOF then 'sH = sH & "" & application(session("LANG") & "_wcal14") & "
" CAL_ViewWeek1 = sH end function %>