I made a test
- Code: Select all Expand view
- #include "Fivewin.ch"
request dbfcdx
request dbffpt
Function test()
*local ddcheckin := ctod("31/07/2020")
*local ddcheckout := ctod("31/07/2020")
local ddcheckin := ctod("02/07/2020")
local ddcheckout := ctod("02/07/2020")
local number := 2
local cDesc :="Om"
local cTipo :="01"
local cRoom := Left( cDesc,1)+Strzero(number,3)
local lFree :=.f.
local oReservation
RddSetDefault( "DBFCDX" )
oReservation:=TDatabase():Open( , "Reserva", "DBFCDX", .T. )
oReservation:setorder(1)
oReservation:gotop()
lFree := Search_Room(cRoom,ddcheckin,ddcheckout,oReservation)
? lFree
RETURN NIL
//--------------------------------------------------------------------------//
Function Search_Room(cRoom,ddcheckin,ddcheckout,oReservation)
local lFound:=.f.
Local cSeekT := (cRoom) + dtos(ddcheckin)
oReservation:seek( cSeekT )
WHILE !oReservation:eof()
lFound := .t.
oReservation:skip()
ENDDO
RETURN lFound
//--------------------------------------------------------------------------//
the test always returns me false with either
local ddcheckin: = ctod ("07/31/2020")
local ddcheckout: = ctod ("07/31/2020")
and be with
local ddcheckin: = ctod ("02/07/2020")
local ddcheckout: = ctod ("02/07/2020")
but in reality only the first date range the room is not free for the second date range the room is free
how can i solve?