Jump to content

Hotel pricing per season


alani

Recommended Posts

Hello,

 

I need some help in a script that i am trying to build few days now.

 

I have a MySQL with hotels information including the seasons that each hotel supports. For example, between 1/7/2008 and 30/8/2008 is the full season of the hotel and the price per day is 20 €. All the other dates is the low season of the hotel and the price per day is 15 €.

 

The problem is that if someone try to make a booking from 25/8/2008 until 5/9/2008 the system must be able to calculate 20 € for the first 5 days and 15 € for the rest of them. In few words my problem is that i can't calculate the price for a booking that it will be requested on the change of the hotels seasons.

 

Any ideas?

Link to comment
Share on other sites

Yes I have an idea.

Make your table like this

 

BookingID (integer)

RoomID (integer)

Date (Date only, no need for time)

Cost (Integer)

Booked (bool type)

BookedID (Integer)

 

So each day will have its own info.  Then when a booking is made you just black out this day by saying

update `table `set Booked = 1, BookedID = $booker where Date > Start_Reservation and Date <= End_Reservation

 

then have a second table that stores the bookers info (based on bookedID) so you can have it all later.  Then to get a price you can just query it for sums of them based on cost and then add it up using a simple math function.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.