fasi Posted January 5, 2010 Report Share Posted January 5, 2010 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 Quote Link to comment Share on other sites More sharing options...
fasi Posted January 5, 2010 Author Report Share Posted January 5, 2010 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 Quote Link to comment Share on other sites More sharing options...
netsys Posted January 5, 2010 Report Share Posted January 5, 2010 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.