I have a Weekly Calendar where it shows the work categories for each user. There is currently just 1 table that the data comes from. I was asked to make that calendar so that when a user is late coming to work, then display that day in RED (column), else just normal white color.
I tried this various ways, but everytime I try it, it messes up the columns and/or rows. Anyone can give me a hand with this, PLEASE?
This is the current code, which displays the columns in white:
<tr bgcolor="#FFFFFF">
<%
Dim workingDay, workingDate
arrWeekDays = Array("", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
Dim dtNow
dtNow = Now()
For workingDay = 1 to 7
workingDate = DateAdd("d",workingDay,WeekStart)
dtIterate = DateAdd("d", workingDay,WeekStart)
%>
<td bgcolor="#FFFFFF" valign="top" width="14%">
<% Response.Write "<em>" & "<span class=TimeTrackerDate>" %>
<a href="Add/TimeAdd.asp?ReqDate=<%= FormatDateTime (workingDate, 2) %>"><img src="../images/cal-plus.gif" width="10" height="10" border="0" align="left" alt="Add a New Entry in your Calendar"></a>
<a href="Reports/ListDates.aspx?DateID=<%= FormatDateTime (workingDate, 2) %>&TechnicianID=<%= TechID %>"><img src="../images/SmallDelete.gif" width="12" height="11" border="0" align="right" alt="Delete an Entry from your Calendar"></a>
<% Response.Write arrWeekDays(WeekDay(dtIterate))%>
<% Response.Write "<BR>" & (FormatDateTime (workingDate, 2)) & "</em>" & "</span>" & "<BR>" %>
<% Do Until RS.EOF %>
<% If Day(rs("ReqDate") <> Day(workingDate) Then Exit Do %>
<span class="CalendarHours"><% Response.Write (RS("Category_Name")%><center><img src="../images/d_arrow.gif" align="texttop"></center><center><% Response.Write RS("HrsOff" / 60 & " Hrs"%></center></span>
<hr size="1">
<% RS.MoveNext
Loop
NEXT
%>
</tr>
This is what I tried and it messes up the columns. It does not display anything but just the first column (Monday) and that is it. Anyone tell me where i go wrong?
New statement code:
<tr>
<%
Dim workingDay, workingDate
arrWeekDays = Array("", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
Dim dtNow
dtNow = Now()
For workingDay = 1 to 7
workingDate = DateAdd("d",workingDay,WeekStart)
dtIterate = DateAdd("d", workingDay,WeekStart)
%>
<% While NOT RS2.EOF
If Day(RS2("ReqDate") <> Day(workingDate) Then
Dim bgcolor
bgcolor ="#FFFFFF"
else
bgcolor ="#FF0000"
%>
<td bgcolor="<%= bgcolor %>" valign="top" width="14%">
<% Response.Write "<em>" & "<span class=TimeTrackerDate>" %>
<a href="Add/TimeAdd.asp?ReqDate=<%= FormatDateTime (workingDate, 2) %>"><img src="../images/cal-plus.gif" width="10" height="10" border="0" align="left" alt="Add a New Entry in your Calendar"></a>
<a href="Reports/ListDates.aspx?DateID=<%= FormatDateTime (workingDate, 2) %>&TechnicianID=<%= TechID %>"><img src="../images/SmallDelete.gif" width="12" height="11" border="0" align="right" alt="Delete an Entry from your Calendar"></a>
<% Response.Write arrWeekDays(WeekDay(dtIterate))%>
<% Response.Write "<BR>" & (FormatDateTime (workingDate, 2)) & "</em>" & "</span>" & "<BR>" %>
<% End If %>
<% Do Until RS.EOF
If Day(rs("ReqDate") <> Day(workingDate) Then Exit Do %>
<span class="<%=bgcolor%>"><% Response.Write (RS("Category_Name")%><center><img src="../images/d_arrow.gif" align="texttop"></center><center><% Response.Write RS("HrsOff" / 60 & " Hrs"%></center></span>
<hr size="1">
<% RS2.MoveNext
RS.MoveNext
Loop
WEND
NEXT
%>
</tr>
Statement RS2 is the new query that comes from a different table, which has only user name and date.
Anyone can let me know what I do wrong, or another way to do this?
THANK YOU VERY MUCH.
I tried this various ways, but everytime I try it, it messes up the columns and/or rows. Anyone can give me a hand with this, PLEASE?
This is the current code, which displays the columns in white:
<tr bgcolor="#FFFFFF">
<%
Dim workingDay, workingDate
arrWeekDays = Array("", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
Dim dtNow
dtNow = Now()
For workingDay = 1 to 7
workingDate = DateAdd("d",workingDay,WeekStart)
dtIterate = DateAdd("d", workingDay,WeekStart)
%>
<td bgcolor="#FFFFFF" valign="top" width="14%">
<% Response.Write "<em>" & "<span class=TimeTrackerDate>" %>
<a href="Add/TimeAdd.asp?ReqDate=<%= FormatDateTime (workingDate, 2) %>"><img src="../images/cal-plus.gif" width="10" height="10" border="0" align="left" alt="Add a New Entry in your Calendar"></a>
<a href="Reports/ListDates.aspx?DateID=<%= FormatDateTime (workingDate, 2) %>&TechnicianID=<%= TechID %>"><img src="../images/SmallDelete.gif" width="12" height="11" border="0" align="right" alt="Delete an Entry from your Calendar"></a>
<% Response.Write arrWeekDays(WeekDay(dtIterate))%>
<% Response.Write "<BR>" & (FormatDateTime (workingDate, 2)) & "</em>" & "</span>" & "<BR>" %>
<% Do Until RS.EOF %>
<% If Day(rs("ReqDate") <> Day(workingDate) Then Exit Do %>
<span class="CalendarHours"><% Response.Write (RS("Category_Name")%><center><img src="../images/d_arrow.gif" align="texttop"></center><center><% Response.Write RS("HrsOff" / 60 & " Hrs"%></center></span>
<hr size="1">
<% RS.MoveNext
Loop
NEXT
%>
</tr>
This is what I tried and it messes up the columns. It does not display anything but just the first column (Monday) and that is it. Anyone tell me where i go wrong?
New statement code:
<tr>
<%
Dim workingDay, workingDate
arrWeekDays = Array("", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
Dim dtNow
dtNow = Now()
For workingDay = 1 to 7
workingDate = DateAdd("d",workingDay,WeekStart)
dtIterate = DateAdd("d", workingDay,WeekStart)
%>
<% While NOT RS2.EOF
If Day(RS2("ReqDate") <> Day(workingDate) Then
Dim bgcolor
bgcolor ="#FFFFFF"
else
bgcolor ="#FF0000"
%>
<td bgcolor="<%= bgcolor %>" valign="top" width="14%">
<% Response.Write "<em>" & "<span class=TimeTrackerDate>" %>
<a href="Add/TimeAdd.asp?ReqDate=<%= FormatDateTime (workingDate, 2) %>"><img src="../images/cal-plus.gif" width="10" height="10" border="0" align="left" alt="Add a New Entry in your Calendar"></a>
<a href="Reports/ListDates.aspx?DateID=<%= FormatDateTime (workingDate, 2) %>&TechnicianID=<%= TechID %>"><img src="../images/SmallDelete.gif" width="12" height="11" border="0" align="right" alt="Delete an Entry from your Calendar"></a>
<% Response.Write arrWeekDays(WeekDay(dtIterate))%>
<% Response.Write "<BR>" & (FormatDateTime (workingDate, 2)) & "</em>" & "</span>" & "<BR>" %>
<% End If %>
<% Do Until RS.EOF
If Day(rs("ReqDate") <> Day(workingDate) Then Exit Do %>
<span class="<%=bgcolor%>"><% Response.Write (RS("Category_Name")%><center><img src="../images/d_arrow.gif" align="texttop"></center><center><% Response.Write RS("HrsOff" / 60 & " Hrs"%></center></span>
<hr size="1">
<% RS2.MoveNext
RS.MoveNext
Loop
WEND
NEXT
%>
</tr>
Statement RS2 is the new query that comes from a different table, which has only user name and date.
Anyone can let me know what I do wrong, or another way to do this?
THANK YOU VERY MUCH.