Connecting Tech Pros Worldwide Help | Site Map

Logic for booking system, day rates, etc

Newbie
 
Join Date: Sep 2009
Posts: 4
#1: Sep 29 '09
Hi all,

I have a system and I'm a little stuck. It's a booking system.

It has rooms, etc and every room have a daily price.

Then it has special daily rates when assigned.

How do I calculate the total cost of a room if a daily rate exists?

Eg.

Room 1 = £10 per night

Customer booking between 20/09/2009 - 25/09/2009
Rate Set @ 4.99 per night between 21/09/2009 - 23/09/2009
Total should be: £34.97

Rates Database = start=unix_time, finished=unix_time, price=4.99
Booking Database = customer, checkin=unix_time, checkout=unix_time, room_id
Newbie
 
Join Date: Sep 2009
Posts: 4
#2: Sep 29 '09

re: Logic for booking system, day rates, etc


Nevermind!

All fixed now!
dlite922's Avatar
Expert
 
Join Date: Dec 2007
Location: Moon, Dark Side
Posts: 1,094
#3: Sep 30 '09

re: Logic for booking system, day rates, etc


Post the solution so that others can benefit.

Thanks


Dan
Newbie
 
Join Date: Sep 2009
Posts: 4
#4: Sep 30 '09

re: Logic for booking system, day rates, etc


What I did was first get the total amount of days they're staying.
Then got the total amount of days the special rate is on for.

Then I looped through the rate days to check if any of dates matched that of when they we're staying. If true, added prices to a RatePrice variable and increased a TotalRateDays.

Then I just calculated the total days of stay's price
Worked out how much less it is with (TotalRateDays * RoomRate)
Then added on the RatePrice
Reply