CONTROL an HOUR

Post Reply
User avatar
MdaSolution
Posts: 401
Joined: Tue Jan 05, 2010 2:33 pm

CONTROL an HOUR

Post by MdaSolution »

On Restaurant Appliation I control id the reservation day is equal to the day inserted from user ( when he want create the a new reservation)

Now the problem is another because on a day we can have many reservation for a table

sample if I have a reservation for the table 11 on the same day 13:45 of 22/008/2011

I cannot have a reservation for the same day for 14.30 or 12:45 because I must have a interval max of two hours for each customer

how I can make this control ?
FWH .. BC582.. xharbour
Marcelo Via Giglio
Posts: 1033
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Re: CONTROL an HOUR

Post by Marcelo Via Giglio »

Hello,

a suggestion:

convert the time reservation in day seconds o minutes period, then a new reservation period (2 hours) can't be inside the period of any previous reservation,

regards

Marcelo
Patrizio
Posts: 90
Joined: Wed Nov 07, 2007 8:56 am
Location: Italy
Contact:

Re: CONTROL an HOUR

Post by Patrizio »

Do you think about use DateTime variables?
User avatar
MdaSolution
Posts: 401
Joined: Tue Jan 05, 2010 2:33 pm

Re: CONTROL an HOUR

Post by MdaSolution »

HOw ?
Any sample please ?

I make
IF RESERVATION->(DbSeek( nTable))
IF RESERVATION->DATAIN==cday
msgAlert( i18n( "there is allready a reservation for this day." ))
IF RESERVATION->hor==aHour
msgAlert( i18n( "there is allready a reservation for this day.and for this Hour" ))



ENDIF


oBtnTav:Refresh( .T. )
RETURN lreg

ENDIF
ELSE

APPEND BLANK
RESERVATION->STATE :=5
RESERVATION->CUSTOMER:= cCustomer
RESERVATION->DATAIN := cday
RESERVATION->DATAFIN := cday
RESERVATION->HOR := aHour
RESERVATION->NUMTABLE := ntable
RESERVATION->TIPO := "O"
RESERVATION->(DbCommit())
cCaption_est := "Table n."+ str(ntable)+CRLF+;
"reservation day "+cf( cday)
oBtnTav:SetFile( TABLE_RESERVATION, TABLE_RESERVATION )
oBtnTav:cToolTip:= cCaption_est
FWH .. BC582.. xharbour
Post Reply