Mr Rao,
I need a modify
I add on dbf a field called Tipo
Code: Select all
function CreateDBF()
FIELD NUMTABLE
local n, dStart
local aCols := { { 'NUMTABLE', 'N', 2, 0 }, ;
{ 'TIPO', 'C', 1, 0 }, ; //TYPE OF ROOM "O" "H" "C" "T"
{ 'DATAIN' , 'D', 8, 0 }, ;
{ 'DATAFIN' , 'D', 8, 0 } }
DbCreate( 'RESERVATION', aCols )
USE RESERVATION
INDEX ON NUMTABLE TAG NUMTABLE
dStart := AddMonth( BOY( Date() ), 2 ) // 1st March
for n := 1 to 100 * NUM_TABLES
APPEND BLANK
FIELD->NUMTABLE := HB_RandomInt( 1, NUM_TABLES )
FIELD->DATAIN := dStart + HB_RandomInt( 0, 200 )
FIELD->DATAFIN := FIELD->DATAIN + HB_RandomInt( 0, 5 )
FIELD->TIPO := IF(NUMTABLE=1, "O","H")
next n
CLOSE RESERVATION
return nil
I have same numbers of tables but in different rooms.
TYPE OF ROOM "O" "H" "C" "T"
When I wish show reservation with room type "O" is ok
When i show the reservation on other rooms it make errors
on Load data function I tak eonly the type of table I select (ctipo)
Code: Select all
static function LoadData(cTipo)
local i, n, aRes := Array( NUM_TABLES, 0 )
local dMonth := AddMonth( BOY( DATE() ), 2 ) // 1st March
for n := 1 to 7
for i := 1 to NUM_TABLES
AAdd( aRes[ i ], Array( LastDayOM( dMonth ) + 1 ) )
AFill( aRes[ i ][ n ], .f. )
aRes[ i ][ n ][ 1 ] := cMonth( dMonth )
next i
dMonth := AddMonth( dMonth, 1 )
next n
USE RESERVATION
do while ! Eof()
for n := FIELD->DATAIN to FIELD->DATAFIN
IF FIELD->TIPO = cTipo // take the type of room selected
aRes[FIELD->NUMTABLE ][ Month( n ) - 2 ][ Day( n ) + 1 ] := .t.
ENDIF
next
SKIP
enddo
CLOSE RESERVATION
return aRes
on ShowTables( aRes, NumOmb ) function
I erase tab control and I take on xbrowse the number of NUMTABLE (NumOmb)
oBrw:aArrayData := aRes[NumOmb]
How i can resolve?
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC