<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> Self Catering Cottages - Garheugh Farm Cottages

Sea Cottage Self Catering Tariff and Availability

availability for self catering holiday cottages in Dumfries & Galloway, Scotland



Sea Cottage Availability

Weekly Change out Days - Friday - Check Out 10:00 Check In 16:00
Short breaks and Low season - By arrangement - Please Call

<% Dim arrMonth(31,2) ' Array holding info on each day of the display month Dim dtDisplayDate ' Date currently displaying calendar for Dim intDIM ' Days In Current Month Dim intDOW ' Day Of Week that current month starts on Dim intCurrentDOM ' Variable we use to hold current day of month as we write table Dim intCurrentPos ' Variable we use to hold current position in table Dim testdate1 ' First day of month in long form Dim testdate2 ' Last day of month in long form Dim tablecolour Dim bookedColour Dim tableBorderColour Dim tableGapColour Dim tableHeadingColour Dim tableTitleColour Dim tableDayColour Dim tableFontFace Dim tableFontSize Dim tableBodyFontFace Dim tableBodyFontSize Dim priceBandFontSize Dim priceBand1Val Dim priceBand2Val Dim priceBand3Val Dim priceBand4Val Dim priceBand5Val Dim priceBandDisplay Dim priceBandSymbol Dim priceBandEmtyText Dim startDay Dim startMonth Dim startYear Dim endDay Dim endMonth Dim endYear Dim calendarDay Dim calendarMonth Dim calendarYear %> <% ' ***Begin Function Declaration*** Function ukDate(str) 'Convert date to unambiguous UK format Dim aDay Dim aMonth Dim aYear aDay = Day(str) aMonth = Monthname(Month(str),False) aYear = Year(str) ukDate = aDay & "-" & aMonth & "-" & aYear End Function Function FindDaysInMonth(iMonth, iYear) Dim dTemp dTemp = DateAdd("d", -1, DateSerial(iYear, iMonth + 1, 1)) FindDaysInMonth = Day(dTemp) End Function Function FindStartingWeekdayForMonth(dAnyDayInTheMonth) Dim dTemp dTemp = DateAdd("d", -(Day(dAnyDayInTheMonth) - 1), dAnyDayInTheMonth) FindStartingWeekdayForMonth = WeekDay(dTemp) End Function Function DecrementMonth(dtDisplayDate) DecrementMonth = ukdate(DateAdd("m", -1, dtDisplayDate)) End Function Function DecrementYear(dtDisplayDate) DecrementYear = ukdate(DateAdd("yyyy", -1, dtDisplayDate)) End Function Function IncrementMonth(dtDisplayDate) IncrementMonth = ukdate(DateAdd("m", 1, dtDisplayDate)) End Function Function IncrementYear(dtDisplayDate) IncrementYear = ukdate(DateAdd("yyyy", 1, dtDisplayDate)) End Function ' ***End Function Declaration*** ' Get display date by querystring or by current date If IsDate(Request.QueryString("date")) Then dtDisplayDate = CDate(Request.QueryString("date")) Else If IsDate(Request.QueryString("month") & "-" & Request.QueryString("day") & "-" & Request.QueryString("year")) Then dtDisplayDate = CDate(Request.QueryString("month") & "-" & Request.QueryString("day") & "-" & Request.QueryString("year")) Else dtDisplayDate = ukdate(Date()) If Len(Request.QueryString("month")) <> 0 Or Len(Request.QueryString("day")) <> 0 Or Len(Request.QueryString("year")) <> 0 Or Len(Request.QueryString("date")) <> 0 Then Response.Write "The date you picked was not a valid date. The calendar was set to today's date.

" End If End If End If 'Find days in the choosen month and the day of the week it starts on. intDIM = FindDaysInMonth(Month(dtDisplayDate), Year(dtDisplayDate)) intDOW = FindStartingWeekdayForMonth(dtDisplayDate) 'Get first day and last day of month testdate1="01" & "/" & Monthname(Month(dtDisplayDate)) & "/" & Year(dtDisplayDate) testdate1=cDate(testdate1) testdate1=ukdate(testdate1) testdate2=intDIM & "/" & Monthname(Month(dtDisplayDate)) & "/" & Year(dtDisplayDate) testdate2=cDate(testdate2) testdate2=ukdate(testdate2) 'Retrieve all values from configuration table configRecordset.open "select * from config", myConnection,2,3 tablecolour=configRecordset("tablecolour") bookedColour=configRecordset("bookedColour") changeoverColour=configRecordset("changeoverColour") tableBorderColour=configRecordset("tableBorderColour") tableGapColour=configRecordset("tableGapColour") tableHeadingColour=configRecordset("tableHeadingColour") tableTitleColour=configRecordset("tableTitleColour") tableTextColour=configRecordset("tableTextColour") tableDayColour=configRecordset("tableDayColour") tableFontFace=configRecordset("tableFontFace") tableFontSize=configRecordset("tableFontSize") tableBodyFontFace=configRecordset("tableBodyFontFace") tableBodyFontSize=configRecordset("tableBodyFontSize") priceBandFontSize=configRecordset("priceBandFontSize") priceBand1Val=configRecordset("priceBand1Val") priceBand2Val=configRecordset("priceBand2Val") priceBand3Val=configRecordset("priceBand3Val") priceBand4Val=configRecordset("priceBand4Val") priceBand5Val=configRecordset("priceBand5Val") priceBand1DayVal=configRecordset("priceBand1DayVal") priceBand2DayVal=configRecordset("priceBand2DayVal") priceBand3DayVal=configRecordset("priceBand3DayVal") priceBand4DayVal=configRecordset("priceBand4DayVal") priceBand5DayVal=configRecordset("priceBand5DayVal") priceBandDisplay=configRecordset("priceBandDisplay") priceBandDayDisplay=configRecordset("priceBandDayDisplay") priceBandSymbol=configRecordset("priceBandSymbol") priceBandEmtyText=configRecordset("priceBandEmtyText") configRecordset.close set configRecordset=nothing 'Retrieve all bookings between first and last day of month myRecordset.open "select * from bookings where ((startdate <= #"&testdate1&"#) and (endDate >= #"&testdate2&"#)) or ((startdate >= #"&testdate1&"#) and (endDate <= #"&testdate2&"#)) or ((startdate <= #"&testdate1&"#) and (endDate >= #"&testdate1&"#) and (endDate <= #"&testdate2&"#)) or ((startdate <= #"&testdate2&"#) and (startdate >= #"&testdate1&"#) and (endDate >= #"&testdate2&"#))" , myConnection,2,3 'Retrieve all price band definitions between first and last day of month pricebandRecordset.open "select * from priceBands where ((priceStart <= #"&testdate1&"#) and (priceEnd >= #"&testdate2&"#)) or ((priceStart >= #"&testdate1&"#) and (priceEnd <= #"&testdate2&"#)) or ((priceStart <= #"&testdate1&"#) and (priceEnd >= #"&testdate1&"#) and (priceEnd <= #"&testdate2&"#)) or ((priceStart <= #"&testdate2&"#) and (priceStart >= #"&testdate1&"#) and (priceEnd >= #"&testdate2&"#))" , myConnection,2,3 'Create month booking array and parse bookings to add colour to booked days 'Start by initialising colour in each day and priceband as - for i = 1 to 31 arrMonth(i,1)=tableColour arrMonth(i,2)=priceBandEmtyText next do while not myrecordset.eof startDay=Day(myRecordset("startDate")) startMonth=Month(myRecordset("startDate")) startYear=Year(myRecordset("startDate")) endDay=Day(myRecordset("endDate")) endMonth=Month(myRecordset("endDate")) endYear=Year(myRecordset("endDate")) calendarDay=Day(dtDisplayDate) calendarMonth=Month(dtDisplayDate) calendarYear=Year(dtDisplayDate) 'Deal with spanning end of month/ year if startYear < calendarYear then startDay=1 end if if endYear > calendarYear then endDay=31 end if if startmonth < calendarMonth then startDay=1 end if if endMonth > calendarMonth then endDay=31 end if 'Replace background colour in each array cell with booked colour for i = startDay to endDay arrMonth(i,1)=bookedColour if i = startday then arrMonth(i,1)=changeoverColour end if if i = endDay then arrMonth(i,1)=changeoverColour end if next myRecordset.movenext loop 'add price band info to array do while not pricebandRecordset.eof startDay=Day(pricebandRecordset("priceStart")) startMonth=Month(pricebandRecordset("priceStart")) startYear=Year(pricebandRecordset("priceStart")) endDay=Day(pricebandRecordset("priceEnd")) endMonth=Month(pricebandRecordset("priceEnd")) endYear=Year(pricebandRecordset("priceEnd")) calendarDay=Day(dtDisplayDate) calendarMonth=Month(dtDisplayDate) calendarYear=Year(dtDisplayDate) '########## Deal with spanning end of month/ year ####### if startYear < calendarYear then startDay=1 end if if startmonth < calendarMonth then startDay=1 end if if endYear > calendarYear then endDay=31 end if if endMonth > calendarMonth then endDay=31 end if 'Replace background colour in each array cell with booked colour for i = startDay to endDay arrMonth(i,2)=pricebandRecordset("priceBand") next pricebandRecordset.movenext loop pricebandRecordset.close set pricebandRecordset=nothing myRecordset.close set myRecordset=nothing myConnection.close set myConnection=nothing 'End of retrieval of booking info - Now display table for month %>
«Year   «Mth   <%= MonthName(Month(dtDisplayDate)) & " " & Year(dtDisplayDate) %>
  Mth»   Year»
<% ' Write spacer cells at beginning of first row if month doesn't start on a Sunday. If intDOW <> 1 Then Response.Write vbTab & "" & vbCrLf intCurrentPos = 1 Do While intCurrentPos < intDOW Response.Write vbTab & vbTab & "" & vbCrLf intCurrentPos = intCurrentPos + 1 Loop End If ' Write days of month in proper day slots intCurrentDOM = 1 intCurrentPos = intDOW Do While intCurrentDOM <= intDIM ' If we're at the beginning of a row then write TR If intCurrentPos = 1 Then Response.Write vbTab & "" & vbCrLf End If ' Write the date into the cell. Response.Write vbTab & vbTab & "" & vbCrLf ' If at the end of a row then write /TR If intCurrentPos = 7 Then Response.Write vbTab & "" & vbCrLf intCurrentPos = 0 End If ' Increment variables intCurrentDOM = intCurrentDOM + 1 intCurrentPos = intCurrentPos + 1 Loop ' Write spacer cells at end of last row if month doesn't end on a Saturday. If intCurrentPos <> 1 Then Do While intCurrentPos <= 7 Response.Write vbTab & vbTab & "" & vbCrLf intCurrentPos = intCurrentPos + 1 Loop Response.Write vbTab & "" & vbCrLf End If %>
"& intCurrentDOM & "
" & ""&arrMonth(intCurrentDOM,2)&"
<%' Display price band values if required if priceBandDisplay="Yes" then%>
Price bands per week:    <% if priceBand1Val<>0 then%> Band 1 = <%response.write priceBandSymbol&priceBand1Val%>   <%end if%> <% if priceBand2Val<>0 then%> 2 = <%response.write priceBandSymbol&priceBand2Val%>   <%end if%> <% if priceBand3Val<>0 then%> 3 = <%response.write priceBandSymbol&priceBand3Val%>   <%end if%> <% if priceBand4Val<>0 then%> 4 = <%response.write priceBandSymbol&priceBand4Val%>   <%end if%> <% if priceBand5Val<>0 then%> 5 = <%response.write priceBandSymbol&priceBand5Val%> <%end if%>
<%end if%> <%' Display price band values if required if priceBandDayDisplay="Yes" then%>
Price bands per day:    <% if priceBand1DayVal<>0 then%> Band 1 = <%response.write priceBandSymbol&priceBand1DayVal%>   <%end if%> <% if priceBand2DayVal<>0 then%> 2 = <%response.write priceBandSymbol&priceBand2DayVal%>   <%end if%> <% if priceBand3DayVal<>0 then%> 3 = <%response.write priceBandSymbol&priceBand3DayVal%>   <%end if%> <% if priceBand4DayVal<>0 then%> 4 = <%response.write priceBandSymbol&priceBand4DayVal%>   <%end if%> <% if priceBand5DayVal<>0 then%> 5 = <%response.write priceBandSymbol&priceBand5DayVal%> <%end if%>
<%end if%>
Day is possibly available - enquire:    Day is Booked:     


© <%=year(date())%> Garheugh Self Catering Cottages