Page 1 of 1

CONTROL an HOUR

Posted: Mon Aug 22, 2011 8:52 am
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 ?

Re: CONTROL an HOUR

Posted: Mon Aug 22, 2011 2:19 pm
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

Re: CONTROL an HOUR

Posted: Mon Aug 22, 2011 3:34 pm
by Patrizio
Do you think about use DateTime variables?

Re: CONTROL an HOUR

Posted: Mon Aug 22, 2011 3:52 pm
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