#include "FWCE.ch"
#include "Directry.ch"
#define SHFS_HIDESIPBUTTON 8
REQUEST DBFCDX
//----------------------------------------------------------------------------//
Procedure Main()
local oWnd, oBrwCli, oBtn1, oBtn2
set century on
set deleted on
set date format to "dd-mm-yyyy"
SET EPOCH TO 2000
Set Default to ( CurDir() )
Abre_File( .f. )
DEFINE WINDOW oWnd TITLE "SeekTest 2.0"
@ 0, 0 LISTBOX oBrwCli ;
FIELDS LTrim(Str(CUSTOMER->SALARY)), CUSTOMER->LAST ;
COLSIZES 50,60 ;
HEADERS "Nº.", "Nome" ;
SIZE 240, 220 ;
OF oWnd ;
ALIAS 'CUSTOMER'
@ 220,0 BTNBMP oBtn1 PROMPT "Pesquisa Numero" SIZE 240, 25 ;
action { Pesq_Cli_Num( oWnd ), oBrwCli:refresh() }
@ 245,0 BTNBMP oBtn2 PROMPT "Pesquisa Nome" SIZE 240, 25 ;
action { Pesq_Cli_Nom( oWnd ), oBrwCli:refresh() }
@ 270,0 BTNBMP oBtn3 PROMPT "Fechar" SIZE 120, 25 ;
action { DbCloseAll(), oWnd:End() }
@ 270,120 BTNBMP oBtn4 PROMPT "Reindex" SIZE 120, 25 ;
action { Abre_File( .t. ), oBrwCli:refresh() }
ACTIVATE WINDOW oWnd ON INIT ( SHFullScreen( GetActiveWindow(), SHFS_HIDESIPBUTTON ) )
Return nil
//=======================================================================================
Function Abre_File( xReorg )
//=======================================================================================
If xReorg
DbCloseAll()
aFile:=Directory("*.CDX")
AEval(aFile,{|aFile| FErase( aFile[F_NAME] ) } )
Endif
USE "Customer" VIA "DBFCDX" NEW
if ! File( "LAST.CDX" )
INDEX ON Last TO "LAST"
endif
if ! File( "SAL.CDX" )
INDEX ON Salary TO "SAL"
endif
SET INDEX TO "SAL" , "LAST"
OrdSetFocus(1)
DbGoTop()
Return Nil
//==================================================================================
Function Pesq_Cli_Num( xParent )
//==================================================================================
Local nPesq := 0, xRecActual
nPesq := BuildGet(.t., xParent )
Customer->( OrdSetFocus( 1 ) )
IF !Empty( nPesq )
if ! CUSTOMER->( DbSeek( nPesq,.t.,2 ))
Msginfo("Cliente Inexistente!","Atenção")
Endif
Endif
Return nil
//==================================================================================
Function Pesq_Cli_Nom( xParent )
//==================================================================================
local oPesCli, nPesq
nPesq := BuildGet(.f., xParent )
Customer->( OrdSetFocus( 2 ) )
If ! Empty( nPesq )
CUSTOMER->( DbSeek( nPesq,.t.,2 ))
Endif
Return nil
//=================================================================
Function BuildGet( xNum, xParent )
//==================================================================================
Local xGet, oGet, oBtn
DEFINE DIALOG oDlg TITLE "Pesquisa" SIZE 240,50
If xNum
xGet := 0
@ 0.2,0 GET oGet VAR xGet Picture "@e 999999" SIZE 60,10
Else
xGet := Space(15)
@ 0.2,0 GET oGet VAR xGet Picture "!!!!!!!!!!!!!!!" SIZE 60,10
Endif
oGet:bGotFocus = { || Showkeyboard() }
oGet:bLostFocus = { || Hidekeyboard() }
@ 15,00 BTNBMP oBtn PROMPT "Pesquisa" SIZE 120, 10 action { oDlg:End() }
ACTIVATE DIALOG oDlg CENTERED
Return xGet
if ! File( "LAST.CDX" )
INDEX ON Last TO "LAST"
endif
MsgInfo( File( "LAST.CDX" ) )
if ! File( "SAL.CDX" )
INDEX ON Salary TO "SAL"
endif
MsgInfo( File( "SAL.CDX" ) )
if ! File( "LAST.CDX" )
INDEX ON Last TO "LAST"
endif
if ! File( "SAL.CDX" )
INDEX ON Salary TO "SAL"
endif
DbCommit()
Return to FiveWin para Pocket PC
Users browsing this forum: No registered users and 0 guests