Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Booking system error!

    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 & "'"

  • #2
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    1,856
    Thanks
    8
    Thanked 110 Times in 109 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •