Happenings @ SEDC Tourism &Hospitality
Click Event for further information |
% Function LastDayOfMonth(sMonth, sYear) 'Returns the last day of the month/year passed in "mm/dd/yyyy" format dim tmpMonth, tmpYear tmpMonth = sMonth tmpYear = sYear LastDayOfMonth = dateadd("d", -1, Dateadd("m", 1, tmpMonth & "/1/" & tmpYear)) End Function if request.QueryString("today")="true" then session("cur")="" end if Sub DropDown(tbl, valField, Field) dim counterop,color set rsDrop = Server.CreateObject("ADODB.Recordset") strSQL = "SELECT DISTINCT " & valField & ", " & Field & " FROM " & tbl & _ " ORDER BY " & field rsDrop.Open strSQL, cn Response.Write "" do until rsDrop.EOF counterop=counterop+1 if counterop mod 3=1 then color="one" elseif counterop mod 3=2 then color="two" elseif counterop mod 3=0 then color="three" end if Response.Write "" & vbcrlf rsDrop.MoveNext loop Response.Write "" rsDrop.Close set rsDrop=nothing end sub %> <% dim objRs, objCon, dtToday cat = Request.QueryString("cat") if cat = "" then cat =0 End If ' Format the ouput Function FormatStr(String) on Error resume next String = Replace(String, CHR(13), "") String = Replace(String, CHR(10) & CHR(10), "
")
String = Replace(String, CHR(10), "
")
FormatStr = String
End Function
function dNum(n)
if n >= 10 then
dNum = cstr(n)
Else
dNum = "0" & cstr(n)
End If
End Function
'SQL Formatted Date
Function SQLDate(dt)
SQLDate = cdbl(dt) ' Year(dt) & "-" & DNum(Month(dt)) & "-" & Dnum(Day(dt)) & " " & dnum(hour(dt)) & ":" & dnum(Minute(dt))
End Function
' Get the previous sundays date
Function DtPrevSunday(ByVal dt)
Do While WeekDay(dt) > vbSunday
dt = DateAdd("d", -1, dt)
Loop
DtPrevSunday = dt
End Function
'Todays Date
dtToday = Date()
Dim dtCurViewMonth ' First day of the currently viewed month
Dim dtCurViewDay ' Current day of the currently viewed month
Dim frmDate ' Date submitted by form
' if the GO button was used, build the date from the month and year
If InStr(1, Request.Form, "subGO", 1) > 0 then
if Request.Form("CURDATE_month") = "" then
tmpMonth = month(now())
else
tmpMonth = Request.Form("CURDATE_month")
End If
if Request.Form("CURDATE_year") = "" then
tmpyear = year(now())
else
tmpyear = Request.Form("CURDATE_year")
End If
tmpDate = "1 " & tmpMonth & " 1999"
mnth = Month(tmpDate)
frmDate = DateSerial(tmpyear, mnth, 1)
Else
frmDate = Request.Form("CURDATE")
end if
if Request("view_date") <> "" then
frmDate= DateSerial(year(Request("view_date")), month(Request("view_date")), 1)
end if
' if posted from the form
' if prev button was hit on the form
If InStr(1, Request.Form, "subPrev", 1) > 0 Then
dtCurViewMonth = DateAdd("m", -1, frmDate)
cur=dtCurViewMonth
' if next button was hit on the form
ElseIf InStr(1, Request.Form, "subNext", 1) > 0 Then
dtCurViewMonth = DateAdd("m", 1, frmDate)
cur=dtCurViewMonth
' anyother time
Else
' date add in text box
If InStr(1, Request.Form, "subGO", 1) > 0 then
dtCurViewMonth = frmDate
cur=dtCurViewMonth
Else
if Request("view_date") <> "" then
dtCurviewMonth = frmDate
else
if session("cur")="" then
dtCurViewMonth = DateSerial(Year(dtToday), Month(dtToday), 1)
cur=dtCurViewMonth
else
dtCurViewMonth=session("cur")
cur=dtCurViewMonth
end if
End If
End If
End If
session("cur")=dtCurViewMonth
Dim iDay, iWeek, sFontColor
strSQL ="SELECT diary.id, diary.dte,diary.enddate, diary.contact, diary.remark,diary.etitle, diary.sub_category, Diary_Categorys.Category, Diary_Categorys.Colour, Diary_Categorys.BgColour" & _
" FROM Diary_Categorys RIGHT JOIN diary ON Diary_Categorys.Cat_ID = diary.Category WHERE diary.sub_category <>1 "
if cat <> 0 then
strSQL = strSQL & " where Diary_Categorys.Cat_ID = " & cat &""
End If
strSQL = strSQL & "order by diary.dte,diary.enddate"
set objRs = cn.Execute (StrSql)
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
%>
Click Event for further information |