Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsOtherProgramming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old May 27th, 2006, 05:05 AM
seth700 seth700 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 8 seth700 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 54 m 41 sec
Reputation Power: 0
ASP Booking System modifications

Hi, I have an ASP booking system for the computer rooms at our school. The thing is we now have a regular bookings on a bi-weekly basis; week1 and week2. Each day has 5 periods; so for example week1 Wednesday period 1 is always booked.

At the moment the only way to check for these bookings is to enter the entire years bookings into the database. Is there a way of altering the attached script so that as well as reading the database for 'one-off' bookings it'll also check for 'constant' bookings with one record representing one day, period and week for the entire year?

I hope this makes sense. Check the attachment as it'll be more obvious if you read the code. Email me or reply to this post if you have any questions.

Here is the script for one of the rooms...
Code:
<%
Dim bookroom
Bookroom = "IT1"

		function weekstartdate()
		  Dim dt
 		  dt = Date
 			While (Weekday(dt) <> 2)
  				dt = DateAdd("d",-1,dt)
 			Wend
 			weekstartdate = dt
		end function
'End Of Function
mondaydate = dt

%>
<head>
<title>Online Booking Portal - IT1 Booking</title></head>
<h5 align="center" style="text-align: right"><font size="2">
<a style="font-size: 10pt" href="NextWeek/it1.asp">Next Week</a></font></h5>
<h2 align="center" style="text-align: left">Booking <%response.write bookroom %></h2>
<p align="center">For week Beginning: <font color="000000"><% response.write weekStartDate %> </font></p>
<br>
<div align="center">
<%
 '/* when you're using the getrows method use "dim arrBookings" instead of the following: */
 '/* dim arrBookings(2,5)    '/* there are 6 bookings this week, each with 3 bits of information */
 dim ii, colCounter, intPeriod
 dim dtmToday, dtmMonday, dtmThis, mondate

'declare variables
Dim Connection, objRS
Dim sSQL, sConnString

'declare SQL statement that will query the database
sSQL="SELECT BookedOn as bookDate, bookPeriod, bookname from bookings WHERE bookitem = '" & Bookroom & "'"
'define the connection string, specify database 
'driver and the location of database
sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _ 
"Data Source=" & Server.MapPath("BookDB.mdb") 

'create an ADO connection and recordset
Set connection = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")

'Open the connection to the database
connection.Open sConnString

'Open the recordset object, execute the SQL statement
objRS.Open sSQL, connection     


'begin table creation and booking search

    if not objRS.eof then
           arrBookings = objRS.getrows
          else
             redim arrBookings(0,0)
             arrBookings(0,0) = -1
       end if
    
    '/* if you have decided not to go with the bookName info (taken from your first post) then just drop all references to (2,ii)
	  mondate = weekstartdate
      dtmToday = date    '/* get a date corresponding to any day in the active week */
    dtmMonday = dtmToday - ((datepart("w", dtmToday, vbMonday))-1)    '/* then we get that week's Monday */

    response.write( "<table border=""1"" cellpadding=""5"">" )
    response.write( "<tr>" )
    response.write( "    <td>&nbsp;</td>" )
    for ii = 1 to 5
        response.write( "<td>Period " & ii & "</td>" )
    next
    response.write( "</tr>" &vbcrlf)
    for rowCounter = 0 to 4     '/* loop through 5 days */
        for colCounter = 1 to 5     '/* for each day, loop through 5 periods */
            if (colCounter = 1) then
                response.write( "<tr>" )
                response.write( "<td> " & weekdayname(rowCounter+1,0,2) & "<br><font size=2 color=000000>" & mondate & "</font></td>" )
                mondate = mondate + 1
            end if

            dtmThis = cdate(dtmMonday + rowCounter)
            call checkIsBooked(dtmThis, colCounter, arrBookings)

            if (colCounter = 5) then
                response.write( "</tr>" & vbcrlf)
            end if
         next
    next
    response.write( "</table>" )

function checkisBooked(dtmInput, intPeriod, arrInput)
    dim ii, blnIsBooked
    blnIsBooked = false

   if (arrInput(0,0) <> -1) then    '/* no point searching the array if we know it's empty */
       for ii = 0 to ubound(arrInput,2)
          if (arrInput(0,ii) = dtmInput) and (arrInput(1,ii) = intPeriod) then
           blnIsBooked = true
             exit for    '/* no point continuing now we know it's booked
          end if
       next
    end if

    if (blnIsBooked = true) then
       response.write( "<td style=""background-color: #ff0000;"" width=100 height=50>" )
       response.write( "<p style=""text-align: center""><font size=2 color=ffffff>Booked by:</font>")
       response.write( "<br>")
       response.write( "<font size=3 color=000000>" & arrBookings(2,ii) )    '/* print the booker */
       response.write( "</p></td>" )
    else
       response.write( "<td style=""background-color: #ffffff;"" width=100 height=60>" )
       response.write( "<p style=""text-align: center""><a href='#book' onClick=popupWin=window.open('book.asp?bookdate=" & dtminput & "&bookperiod=" & intperiod & "&Room=" & bookroom & "','remote','width=350,height=410,top=100,left=100'  )>Book</a>" )
       response.write( "</p></td>" )
    end if
end function
%>


Much appreciated.
Attached Files
File Type: txt booking.txt (4.7 KB, 368 views)

Reply With Quote
  #2  
Old May 30th, 2006, 08:54 AM
ngonde ngonde is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2006
Posts: 4 ngonde User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 37 m 9 sec
Reputation Power: 0
Bit confused here:
- Currently, you can only check if a period is booked - one at a time. Now a period can be booked for two weeks, and you want to reflect such a booking either when saving to the database, or decifering that somehow from the database. I'm i on the right track?

Reply With Quote
  #3  
Old May 30th, 2006, 12:31 PM
seth700 seth700 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 8 seth700 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 54 m 41 sec
Reputation Power: 0
Yeah thats about right. Currently the only way to book a room say for example every period 1 on a wednesday is to individually enter the records for every wednesday period 1 for the year - 52 or so records; or every other monday period 2 etc. Is there a way of tweaking the script so we only need one record stating that it's a 'constant' booking and hence it'll always be booked at that time?

Hope that makes sense.

Cheers

Reply With Quote
  #4  
Old June 18th, 2006, 05:57 AM
jazzy639 jazzy639 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Posts: 8 jazzy639 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 34 m 21 sec
Reputation Power: 0
I use a booking system in my school. We also use a Bi-Weekly timetable and this system can have rooms 'permanently booked' at a certain period for either of the weeks in our bi-weekly timetable so teachers can only book a room when it is not being used for a class. So I can have room 520 permanently used on a Monday Period 4 on Week A, and have something different in week B. I define this on the "Edit Classes" page in the administration panel.

We have 7 periods in a day so I assume it will work with your 5.

taken from thier website:

Quote:
Our System is unique as you can specify when rooms are free to be booked


http://www.roombookingsystem.co.uk

I had to contact them about the Bi-Weekly timetable as its not on thier demo, also, the trial I went on had loads more features than the demo.

They really should update that demo with all the new great features!!

Reply With Quote
Reply

Viewing: ASP Free ForumsOtherProgramming Help > ASP Booking System modifications


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway