Jump to content
Fivewin Brasil

Help por favor


fasi

Recommended Posts

I want insert on an array adData[mounth,days]

from jannuary to december

if I have a occupated room

I want search the number of room ( num_camera) on my archive and insert on this array aData the value "1" if the room is occupated ,

or "2" if the room not is occupated

on my dbf I have the number of room = num_camera

and the two date date_from and date_to

how I can create this function to save it on the array ?

thanks in advance

Link to comment
Share on other sites

I want insert on an array adData[mounth,days]

from jannuary to december

if I have a occupated room

I want search the number of room ( num_camera) on my archive and insert on this array aData the value "1" if the room is occupated ,

or "2" if the room not is occupated

on my dbf I have the number of room = num_camera

and the two date date_from and date_to

how I can create this function to save it on the array ?

thanks in advance

Link to comment
Share on other sites

Ciao Fasi

Look this:


Local aDate:=Array[12,31] // need the same number of columns for all months

Local dStart:=Ctod("01/01/2010")

Local dFinish:=Ctod("31/12/2010")

Local dDate

For dDate=dStart to dFinish // Fill "2" (room free) for EXISTING days

aDate[Month(dDate)][Day(dDate)] := "2"

Next

// Reading the dbf

For dDate=dStart to dFinish

If Archive->(DbSeek(cRoom+Dtos(dDate))) // need to be indexed

While !Archive->(Eof()) .and. dDate <= Archive->Date_to

aDate[Month(dDate)][Day(dDate)] := "1" // the room is occupated this day

dDate++

End

Else

dDate++

End

Next

// Now, the "wrong days" like a 31/02 remaining empty

Return(aDate)

id=code>id=code>

I hope this is usefull

Puo scrivere anche in italiano, se preferire.

Best regards

Alberto Zamai

São Paulo - SP

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...