...

View Full Version : Booking system error!



NanoRuler
01-27-2007, 11:01 PM
Hi all!
I'm in the process of writing an app to allow online bookings. It must also show when resources are booked in a calendar. This is done by changing the background colour to red for unavailable and green for available. Resources are booked per day, not per hour.
My code below works fine, EXCEPT when a booking period moves from one month into the next, in which case only dates booked in the beginning month show up. The db has no support for individual calendar dates including unbooked dates - it only carries the start and end date for each resource.

Other than this extremely frustrating issue its fine! PLEASE HELP????

Many thanks in advance!

Code below:
'========================================================
set rsCal = cnndata.Execute("SELECT * FROM tblReservation")

While Not rsCal.EOF

If Not rsCal.EOF then HouseCO=rsCal("codate")
If Not rsCal.EOF then HouseCI = rsCal("cidate")
HouseCO=CDATE(HouseCO)
HouseCI=Cdate(HouseCI)
varDateNow = Cdate(varDateNow)

If Not rsCal.EOF AND varCurrentDate =< CDATE(CurrentDay & "/" & MyMonth & "/" & MyYear) then

If Not rsCal.EOF AND HouseCI = CDATE(CurrentDay & "/" & MyMonth & "/" & MyYear) then varBackground="red"

Else

If HouseCO = CDATE(CurrentDay & "/" & MyMonth & "/" & MyYear) then varBackground="green"

End if

If Not rsCal.EOF then rsCal.MoveNext

Wend

'========================================================

response.write "<td bgcolor='" & varBackground & "'"

Spudhead
01-29-2007, 12:46 PM
You use a number of variables in that code that are clearly populated somewhere else. My guess is that if you response.write() some of those variables, you'll find something in the output that doesn't make sense.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum