when it search a classroom sample 1A
and control if the nday_hour sample "11"
is the same
and if it found it must return .f. ( no free)
but perhaps there is an error and the function not run ok
Code: Select all | Expand
#include "FiveWin.ch"
REQUEST DBFCDX
REQUEST DBFFPT
EXTERNAL ORDKEYNO,ORDKEYCOUNT,ORDCREATE,ORDKEYGOTO
Function test()
local nGiornoOra := "11"
USE ORARIO ALIAS OR
INDEX ON str(PROF,3) TAG ORARIO1
Do while ! or->(eof())
If classelibera(nGiornoOra)
replace or->gg_ora with nGiornoOra
Endif
or->(dbskip())
enddo
return nil
function ClasseLibera(GiornoOra)
Local lRet
local cClasse:= alltrim(or->classe)
Local nRecord:= or->(RecNo())
SELECT OR
INDEX ON UPPER(or->classe) tag CLASSE TO ORA
or->(dbGoTop())
If dbseek(cClasse,.T.)
If or->GG_ORA==GiornoOra
lRet:= .f.
else
lRet:= .t.
endif
else
lRet:= .t.
Endif
or->(dbSetOrder(1))
or->(dbGoto(nRecord))
return lret
the strcture of dbf used
dbcreate('ORario',;
{{"prof ", "n", 3, 0},;
{"classe ", "c", 4, 0},;
{"aula ", "c", 4, 0},;
{"materia ", "n", 3, 0},;
{"flag ", "c", 1, 0},;
{"gruppo ", "n", 3, 0},;
{"oreseq ", "c", 1, 0},;
{"gg_ora ", "c", 2, 0}, ;
{"num ", "c", 10, 0}, ;
{"blocco ", "c", 1, 0}}, 'DBFCDX' )