Otto and James I explain the code :
- Code: Select all Expand view
If aData[nY,nX]== "O"
cTipoAttrez:="O"
cTipoSol :=""
cPosNome := ""
nOmbrellone := (oDBeach)->camera
nFila:= (oDBeach)->Y
cCaption2:="Ombrellone n.:"+str(nOmbrellone)+CRLF+"Fila:"+str(nFila)
n:= nOmbrellone
(oDPre)->(OrdSetFocus(3))
(oDPre)->(DbGoTop())
DO WHILE !(oDPre)->(EoF())
IF alltrim((oDPre)->tipoattrez)=cTipoAttrez .AND. (oDPre)->CAMERA=n .AND.;
( ;
( (oDPre)->DAL <= dDataIniziale .AND. (oDPre)->AL >= dDataIniziale ) .or. ;
( dDataFinale <= (oDPre)->DAL .AND. (oDPre)->AL <= dDataFinale );
)
cPosNome := alltrim( (oDPre)->RAZSOC)
cTipoSol := alltrim( (oDPre)->TIPSOL)
nStato:=((oDPre)->stato)
ENDIF
(oDPre)->(DbSkip())
ENDDO
endif
aData[nY,nX] is the type of object and this case it is an umbrellas. I made a class where I can draw the beach and the I can save all umbrellas on a dbf
the procedure show all object of the beach but if the object is an umbrellas must to control if there is a booking on cotiza.dbf for this umbrellas for the range dates
it found the number and the type of umbrellas (cTipoAttrez) and if the reservation is made during the two dates entered return the nstate
the nstate can be 1 = booking, 2= occupated
my procedure then show the umbrellas and show a bitmap blu if nstate is 1 , red if the nstate is 2, and if it not have nstate show an green umbrella
green = free