by oliveiros junior » Thu Jan 04, 2018 10:08 pm
Hello Mr. Rao,
Thanks for the answer.
Would it be possible to send an example to your personal email?
I'm sorry I don't know how to insert images here.
I'm going to put down the routine code.
RowSet
cComando_SQL := "SELECT ocorrencia.escola_ocorrencia, ocorrencia_matricula, ocorrencia dia ocorrência, ocorrencia.observacao," + ;
" ocorrência.situacao, aluno.nome_aluno," + ;
" tabocorrencia.descricao FROM `ocorrencia` JOIN aluno ON" + ;
" aluno.matricula = ocorrencia.matricula" + ;
" LEFT JOIN tabocorrencia on tabocorrencia.codigo = ocorrencia.ocorrencia" + ;
" WHERE `escola_ocorrencia` = ? AND `dia_ocorrencia` BETWEEN ? AND ?" + ;
" ORDER BY dia_ocorrencia DESC"
oOcorrencia := oConexao:RowSet( cComando_SQL, { oSistema():cEscola_Usuario, ;
dData_Inicio, dData_Final } )
Browser
// Browse
*----------------------------------------------------------------------------*
@ 100,260 XBROWSE oBrowse OF oDialog:oDlg SIZE ;
oDialog:nRight - 280, oDialog:nBottom - 140 PIXEL;
DATASOURCE oOcorrencia NOBORDER
WITH OBJECT oBrowse
:nTop := 80
:nLeft := 260
:nBottom := ( oDialog:oDlg:nBottom )- 50
:nRight := ( oDialog:oDlg:nRight ) - 20
:nMarqueeStyle := MARQSTYLE_HIGHLROW
:nColDividerStyle := LINESTYLE_BLACK
:nRowDividerStyle := LINESTYLE_BLACK
:lColDividerComplete := .T.
:lUpdate := .T.
:bClrStd := {|| { CLR_BLACK, IIf( oBrowse:KeyNo() % 3 > 0, CLR_WHITE, ;
IIf( oBrowse:KeyNo() % 3 = 0 .And. oBrowse:KeyNo() % 2 = 0 , ;
nRGB( 238, 238, 238 ), nRGB( 238, 246, 255 ) ) ) } }
:bClrSel := {|| { CLR_BLACK, nRGB( 190, 190, 190 ) } }
:bClrSelFocus := {|| { CLR_BLACK, nRGB( 214, 231, 192 ) } }
:lFooter := .T.
:nFooterLines := 1
:bEdit := { | oRec | Editar_Ocorrencia( oRec ) }
:bLDblClick := { || oBrowse:EditSource() }
:lIncrFilter := .T.
:lSeekWild := .T.
:cFilterFld := "nome_aluno"
// To rebuild the browser if you clear the query say
:bKeyDown := { || If( Empty( oBrowse:cSeek ), ;
( oOcorrencia:ReQuery( { oSistema():cEscola_Usuario, ;
dData_Inicio, dData_Final } ), ;
oBrowse:Refresh(), ;
oBrowse:SetFocus() ), ) }
END
oCol:= oBrowse:AddCol()
oCol:nWidth := 30
oCol:cHeader := "Situação"
oCol:oHeaderFont := oSistema():oFonte8
oCol:nHeadStrAlign := AL_CENTER
oCol:AddResource( "ATIVO" )
oCol:AddResource( "INATIVO" )
oCol:bBmpData := { || IIf( oOcorrencia:situacao, 2, 1 ) }
oCol:= oBrowse:AddCol()
oCol:nWidth := 80
oCol:cHeader := "Dia"
oCol:oHeaderFont := oSistema():oFonte4
oCol:nHeadStrAlign := AL_CENTER
oCol:bStrData := { || oOcorrencia:dia_ocorrencia }
oCol:oDataFont := oSistema():oFonte3
oCol:nDataStrAlign := AL_CENTER
oCol:cFooter := "Registros:"
oCol:nFootStrAlign := AL_CENTER
oCol:= oBrowse:AddCol()
oCol:nWidth := 80
oCol:cHeader := "Matricula"
oCol:oHeaderFont := oSistema():oFonte4
oCol:nHeadStrAlign := AL_CENTER
oCol:bStrData := { || Transform( oOcorrencia:matricula, "@R 999999-9" ) }
oCol:oDataFont := oSistema():oFonte3
oCol:nDataStrAlign := AL_CENTER
oCol:bFooter := { || Transform( oOcorrencia:RecCount(), "@R 9,999,999,999" ) }
oCol:nFootStrAlign := AL_CENTER
oCol:= oBrowse:AddCol()
oCol:nWidth := 300
oCol:cHeader := "Nome"
oCol:oHeaderFont := oSistema():oFonte4
oCol:nHeadStrAlign := AL_CENTER
oCol:bStrData := { || oOcorrencia:nome_aluno }
oCol:oDataFont := oSistema():oFonte3
oCol:nDataStrAlign := AL_LEFT
oCol:= oBrowse:AddCol()
oCol:nWidth := 300
oCol:cHeader := "Ocorrência"
oCol:oHeaderFont := oSistema():oFonte4
oCol:nHeadStrAlign := AL_CENTER
oCol:bStrData := { || oOcorrencia:descricao }
oCol:oDataFont := oSistema():oFonte3
oCol:nDataStrAlign := AL_LEFT
oBrowse:CreateFromCode()
Seek
@ oDialog:oDlg:nTop + 50,570 SAY oBrowse:oSeek PROMPT oBrowse:cSeek SIZE 300,20 PIXEL ;
OF oDialog:oDlg COLOR CLR_BLACK, CLR_WHITE PICTURE '@!' FONT oSistema():oFonte7
Att.,
Oliveiros Junior