How to calculate days?

zaky

Registered User.
Local time
Today, 14:32
Joined
Apr 7, 2003
Messages
17
First of all I just want tell you this forum is like my home can't go to bed without checking what is going on every night.You guys are like family to me or big brother .......!:p.

This is my problem I have Hotel db everything is good except when I want to calculate Totaldays =(Lastday- Firstday)
For ex: guest comes on JUl 1st and he/she leaves JUl 3
Totaldays=(Lastday- Firstday)= 2 days, that is fine but the problem is when the guest stays for only one day
For ex: If guest comes on JUl 1st and he/she leaves JUl 1st
Totaldays=(Lastday- Firstday)= 0 and the guest will not be charged. How can do this any suggestions.

thank you in advance guys.

I'm using 2002
 
Something like...
Code:
Private Sub Form_Current()

  If Me.FirstDay = Me.LastDay Then
     Me.TotalDays = 1
Else
     Me.TotalDays = Me.LastDay - Me.FirstDay
  End If

End Sub

IMO
 
There must be some more bussiness logic going on here, check in time/check out time stuff like that...

e.g.
Check in: 15-08 00:01
Chech out: 15-08 23:59
= 1 day?

Check in: 15-08 00:01
Chech out: 16-08 23:59
= 1 day?

Check in: 15-08 15:00
Chech out: 16-08 23:59
= 1 day?

Check in: 15-08 15:00
Chech out: 16-08 10:00
= 1 day?

Leaving a room after a certain hour (eg 11 am) will prevent the room from beeing cleaned, thus from beeing "sold". Therefor you have pay, right? I think your not looking any further than the surface here... and need to dig a little deeper.

Regards
 
Excuse my ignorance, but why would a customer arrive at a hotel on (say) 1st July and leave 1st July - don't they stay overnight?

Col
 
ColinEssex said:
Excuse my ignorance, but why would a customer arrive at a hotel on (say) 1st July and leave 1st July - don't they stay overnight?


Oh come on, Col - you know the sort. The ones that charge by the quarter hour. ;)
 
Yes, I did think of that Mile-O:o but only after I posted my reply!!!

Its still a bit early for that sort of thing;)

Col
 
Mile-O-Phile said:



Oh come on, Col - you know the sort. The ones that charge by the quarter hour. ;)

15mins?? thats alot!:o
or does the 15 mins include the coffee and smoke time as well
 
SOrry guys I just came from work did not get chance to see your reply my appol......
I want thank all of you for giving me your time. I will try the if statement by IMO and let you know.

Answering ColinEssex's question customer can come after midnight say (Jun 30th after midnight it is already Jul 1st) and leave in the morning of the same day.

thank you guys.
 
Milo’s reply is spot on.

A room used for those purposes, even by the hour, requires the bed linen, towels, floor mats, bath soaps, tidy bins, toilet, shower recess…in fact the entire bathroom, and mini bar to be changed/cleaned/restocked.

Most establishments will charge the overnight rate, except some that give a discount to the professional in order to get their business…so to speak. (Whether or not the discount, or anything else for that matter, is passed on to the ‘End User’ is something of which I know nothing. ;) )

Reservation systems deal with the whims of people and… “People are funnier than anybody.”

Regards
Chris
 
Hi....!

everything is good so far it worked "the if statement" but there is one minor problem. whenever i put the startdate & endDate it deosn't give me the total days immediately
I had to press the next button and come back that time will give me the correct days . It needs some kind of refresh but i dont know how?
private Sub Form_Current()


If Me.StartDate = Me.EndDate Then
Me.txtNumberOfDays = 1
Else
Me.txtNumberOfDays = DateDiff("d", [StartDate], [EndDate])

End If

End Sub
 
You can put the code in the LostFocus event of the StartDate and EndDate controls aswell as the OnCurrent.

IMO
 
HI.......

Thank you a million IMO "for your time" it worked perfect with lostFocus. You are helpful and i realy appreciated greatly.That is why this forum is the best, if i don't get the answers I want here i just don't bother anywhere else.


thank you again IMO and everybody who gave me there time you are always great!!!
 
Wouldn't it best to use nights instead of days.

i.e Nights: [DepartureDay]-[ArrivalDay]

I've used that on my database and it works fine.
 

Users who are viewing this thread

Back
Top Bottom