Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting event of the current date

Status
Not open for further replies.

tyapsing

Programmer
Jan 22, 2003
2
MY
this is part of a calendar i'm writing, the problem is i can't display the event for the current date unless the event is placed at the top of the database list. Please help. Its written as javascript and saved as .jsp file.


//starts here
calendar += &quot;<table width='100%' border='0' cellpadding='2' cellspacing='1'>&quot;;
calendar += &quot;<tr>&quot;;
if(startday > 0) {
for(empty = 0; empty < startday; empty++) {
calendar += &quot;<td width='&quot; + twidth + &quot;' height='&quot; + theight + &quot;'> </td>&quot;;
}
}
for(i = startday; i <= endday; i++) {
if( (i % 7) == 0) {
calendar += &quot;</tr><tr>&quot;;
}

//keep highlight info on the current month and day
if( (i - (startday - 1)) == dt && currentmonth == mo && currentyear == year) {
calendar += &quot;<td width='&quot; + twidth + &quot;' height='&quot; + theight + &quot;' bgcolor='&quot; + daybg + &quot;' align='right' valign='top'><font face='&quot; + dayfam + &quot;' size=&quot; + daysize + &quot;><b>&quot;;
calendar += &quot;<a href='javascript://' onclick=javascript:eek:pen_window('day_schedule.jsp?&quot; + months[mo] + &quot;&&quot; + count + &quot;',500,350,0,1);><font color=&quot; + sdaycol + &quot;>&quot; + count + &quot;</font></a>&quot;;

<%

if(RS.next()){

month=RS.getString(&quot;date_format(date,'%M')&quot;);
date=RS.getString(&quot;date_format(date,'%d')&quot;);
ev=RS.getString(&quot;event&quot;);
cat=RS.getString(&quot;category&quot;);
%>
var col;
if ((months[mo]==&quot;<%=month%>&quot;)&&(count==&quot;<%=date%>&quot;)) {
if (&quot;<%=cat%>&quot;==&quot;Leave&quot;){col=&quot;aqua&quot;;}
if (&quot;<%=cat%>&quot;==&quot;Company Trip&quot;){col=&quot;cyan&quot;;}
if (&quot;<%=cat%>&quot;==&quot;Gazetted Public Holidays&quot;){col=&quot;cornsilk&quot;;}
if (&quot;<%=cat%>&quot;==&quot;Annual Dinner&quot;){col=&quot;lavender&quot;;}
if (&quot;<%=cat%>&quot;==&quot;Meeting&quot;){col=&quot;khaki&quot;;}
if (&quot;<%=cat%>&quot;==&quot;Appointment&quot;){col=&quot;lime&quot;;}
if (&quot;<%=cat%>&quot;==&quot;ISO&quot;){col=&quot;linen&quot;;}
if (&quot;<%=cat%>&quot;==&quot;Seminar&quot;){col=&quot;ivory&quot;;}
if (&quot;<%=cat%>&quot;==&quot;Training&quot;){col=&quot;royalblue&quot;;}
if (&quot;<%=cat%>&quot;==&quot;Others&quot;){col=&quot;skyblue&quot;;}

calendar += &quot;<table width=100%>&quot;;
calendar += &quot;<tr bgcolor=&quot;+ col +&quot;><td>&quot;;
calendar += &quot;<font face=Arial size=1 color=#000000><%=ev%></font>&quot;;
calendar += &quot;</td></tr>&quot;;
calendar += &quot;</table>&quot;;


}
<%
}
%>

calendar += &quot;</b></font></td>&quot;;

} else {

calendar += &quot;<td width='&quot; + twidth + &quot;' height='&quot; + theight + &quot;' bgcolor='&quot; + daybg + &quot;' align='right' valign='top'><font face='&quot; + dayfam + &quot;' size=&quot; + daysize + &quot;>&quot;;
calendar += &quot;<a href='javascript://' onclick=javascript:eek:pen_window('day_schedule.jsp?&quot; + months[mo] + &quot;&&quot; + count + &quot;',500,350,0,1);><font color=&quot; + daycol + &quot;>&quot; + count + &quot;</font></a>&quot;;

<%

while(RS.next()){

month=RS.getString(&quot;date_format(date,'%M')&quot;);
date=RS.getString(&quot;date_format(date,'%d')&quot;);
ev=RS.getString(&quot;event&quot;);
cat=RS.getString(&quot;category&quot;);
%>
var col;
if ((months[mo]==&quot;<%=month%>&quot;)&&(count==&quot;<%=date%>&quot;)){
if (&quot;<%=cat%>&quot;==&quot;Leave&quot;){col=&quot;aqua&quot;;}
if (&quot;<%=cat%>&quot;==&quot;Company Trip&quot;){col=&quot;cyan&quot;;}
if (&quot;<%=cat%>&quot;==&quot;Gazetted Public Holidays&quot;){col=&quot;cornsilk&quot;;}
if (&quot;<%=cat%>&quot;==&quot;Annual Dinner&quot;){col=&quot;lavender&quot;;}
if (&quot;<%=cat%>&quot;==&quot;Meeting&quot;){col=&quot;khaki&quot;;}
if (&quot;<%=cat%>&quot;==&quot;Appointment&quot;){col=&quot;lime&quot;;}
if (&quot;<%=cat%>&quot;==&quot;ISO&quot;){col=&quot;linen&quot;;}
if (&quot;<%=cat%>&quot;==&quot;Seminar&quot;){col=&quot;ivory&quot;;}
if (&quot;<%=cat%>&quot;==&quot;Training&quot;){col=&quot;royalblue&quot;;}
if (&quot;<%=cat%>&quot;==&quot;Others&quot;){col=&quot;skyblue&quot;;}

calendar += &quot;<table width=100%>&quot;;
calendar += &quot;<tr bgcolor=&quot;+ col +&quot;><td>&quot;;
calendar += &quot;<font face=Arial size=1 color=#000000><%=ev%></font>&quot;;
calendar += &quot;</td></tr>&quot;;
calendar += &quot;</table>&quot;;
}

<%
}
%>

calendar += &quot;</font></td>&quot;;
}
count++;
}

calendar += &quot;</tr>&quot;;
calendar += &quot;</table>&quot;;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top