Fixat
Hej alla!
Jag har nog fått till det, men mina koder kanske inte är de bästa.
Tyck gärna till!
Här är koden (sidan):
<%@ Language=VBScript %>
<!--#include file = "../include/adovbs.inc"-->
<!--#include file = "../include/db.asp"-->
<% Session.LCID = 1053
dtmDate = Request.QueryString("dtmDate")
if dtmDate="" Then
dtmDate = date()
end if
weekno = DatePart("WW", dtmDate, 2,2)
y = DatePart("YYYY", dtmDate)
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Veckoschema</title>
<link rel='stylesheet' type='text/css' href='../formatmall/formatmall.css'>
<body>
<table width="100%" cellpadding="4" cellspacing="0" border="0" id="kalendarium">
<tr><td class="dagar" align="left" valign="top">Vecka: <%=weekno%></td>
<%
startdate= y & "-01-01"
Do Until DatePart("ww", startdate, 2, 2) = weekno
startdate = DateAdd("d", 1, startdate)
Loop
if weekday(startdate, vbMonday) > 1 then startdate = dateadd("d", -(weekday(startdate)-2), startdate)
For d = startdate To DateAdd("d", 6, startdate)
Select Case weekdayname(weekday(d))
Case "söndag"
sClass = "dagarred"
Case "lördag"
sClass = "dagarred"
Case Else
sClass = "dagar"
End Select
Response.Write "<td class='" & sClass & "'>" & Ucase(weekdayname(weekday(d))) & "<br>" & day(d) & " " & MonthName(Month(d)) & "</td>"
startdate = DateAdd("d", 1, startdate)
next
%>
<tr></tr>
<%
Dim Hamta
Set RecSet = Server.CreateObject("ADODB.Recordset")
Hamta = "SELECT * FROM Personal ORDER BY Namn ASC"
RecSet.Open Hamta, DB, adOpenForwardOnly, adLockReadOnly
Do Until RecSet.EOF
Dim bgcol
If bgcol = "#F0F0F0" then
bgcol = "#FFFFFF"
Else
bgcol = "#F0F0F0"
End If
startdate= y & "-01-01"
Do Until DatePart("ww", startdate, 2, 2) = weekno
startdate = DateAdd("d", 1, startdate)
Loop
if weekday(startdate, vbMonday) > 1 then startdate = dateadd("d", -(weekday(startdate)-2), startdate)
%>
<tr><td align="left" valign="top" class="visanamn" bgcolor="<%=bgcol%>"><%=Ucase(RecSet("Namn"))%></td>
<%
For d = startdate To DateAdd("d", 6, startdate)
%>
<td align="left" valign="top" class="visakal" bgcolor="<%=bgcol%>">
<% ' Checka av om det finns en händelse
Set RecSet2 = Server.CreateObject("ADODB.Recordset")
Hamta = "SELECT * FROM VeckoSchema WHERE NamnID = " & RecSet("ID") & " AND Datum = #" & d & "#"
RecSet2.Open Hamta, DB, adOpenForwardOnly, adLockReadOnly
If RecSet2.EOF Then
Response.Write "<span class='liten'>" & day(d) & "</span>"
RecSet2.Close
Set Recset2 = Nothing
Else
Dim Orsak, Datum
Orsak = RecSet2("Orsak")
Datum = RecSet2("Datum")
If CInt(Right(Datum,2)) = day(d) Then
Response.write day(d) & "<br>" & Orsak
End If
%>
</td>
<% startdate = DateAdd("d", 1, startdate)
RecSet2.Close
Set Recset2 = Nothing
End If
next
%>
</tr>
<% RecSet.MoveNext
Loop
Recset.Close
set RecSet = Nothing
%>
</table>
<% pw = DateAdd("d", -7, startdate)
Response.Write "<br><br><a href=?dtmDate=" & pw & ">« Föregånde Vecka</a>"
Response.Write " "
Response.Write "<a href=?dtmDate=" & d & ">Nästa Vecka »</a>"
%>
</body>
<% DB.Close %>
</html>
Ha en trevlig Jul alla på WF !!
//Annette