FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour CONTROL an HOUR
Posts: 401
Joined: Tue Jan 05, 2010 02:33 PM
CONTROL an HOUR
Posted: Mon Aug 22, 2011 08:52 AM

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
Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: CONTROL an HOUR
Posted: Mon Aug 22, 2011 02:19 PM

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

Posts: 90
Joined: Wed Nov 07, 2007 08:56 AM
Re: CONTROL an HOUR
Posted: Mon Aug 22, 2011 03:34 PM

Do you think about use DateTime variables?

Posts: 401
Joined: Tue Jan 05, 2010 02:33 PM
Re: CONTROL an HOUR
Posted: Mon Aug 22, 2011 03:52 PM

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

Continue the discussion