By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,997 Members | 1,470 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,997 IT Pros & Developers. It's quick & easy.

Logic for booking system, day rates, etc

P: 4
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?


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
Sep 29 '09 #1
Share this Question
Share on Google+
3 Replies

P: 4

All fixed now!
Sep 29 '09 #2

Expert 100+
P: 1,584
Post the solution so that others can benefit.


Sep 29 '09 #3

P: 4
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
Sep 30 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.