Using your example above, the following reservation has been made:
A: 4/17/2009
D: 4/25/2009.
Now, a customer calls and says I want to book 04/16/09 to 04/27/09.
Let's go through my steps.
1. Do any arrivals fall within the date range?
Arrival of 4/17/2009 falls between 4/16 and 4/27 -- record is returned
2. If there is a record returned, you cannot book.
We cannot book this the 2nd reservation.
****
Let's modify the example, and say your 2nd resevation was 4/18/09 to 4/27/09.
1. Do any arrivals fall within the range?
Previous booking has arrival of 4/17, so NO.
2. If so, you cannot continue.
We can continue, because the answer was NO.
3. Are any departures within the date range of 4/18/09 to 4/27/09?
Yes, the first booking is leaving 04/25/09.
4. If so, you cannot continue.
We cannot make the reservation, because a deperature falls within the range.
Does this make sense??