Ewerton, experimenta com estas correções (foram muito poucas), não deu para eu poder compilar e executar, pois não tenho os DBFs, seria bom se me pudesse passar a estrutura dos arquivos caso não tenha resolvido:
Código: Selecionar todos
FUNCTION PRX0004()
sele 1
use clientes alias cli SHAR
set index to ind_cod, ind_emp
sele 2
use numer1 alias nu1 SHAR
set index to ind_nu1
sele 3
use vendedor alias ven SHAR
set index to ind_cve, ind_nve
sele 4
use ercs1 alias ar2 SHAR
set index to ind_u01, ind_u02, ind_u03, ind_u04
sele 5
use ercs2 alias ar3 SHAR
set index to ind_us1, ind_us2
private m_cod, m_emp, m_end, m_bai, m_cep, m_cid, m_est, m_fon, ;
m_fax, m_cgc, m_ins, m_abe, m_co1, m_rep, m_ob1, m_ob2
tecli:= SaveScreen(5, 6, 20, 75)
do while (.T.)
sele 1
m_cod:=0
m_emp:= Space(40)
m_end:= Space(40)
m_bai:= Space(25)
m_cep:= "00.000-000"
m_cid:= Space(35)
m_est:= Space(2)
m_fon:= "(000) 000-0000"
m_fax:= "(000) 000-0000"
m_cgc:= "00.000.000/0000-00"
m_ins:= space(15)
m_abe:= Date()
m_co1:= 0
m_rep:= Space(30)
m_ob1:= Space(51)
m_ob2:= Space(51)
Sele 2 //coloca o codigo do cliente
rlock()
m_cod:= cod + 1
repl cod with m_cod
dbunlock()
nomepro()
centra(2, "®¯ MENU INCLUSAO DE CLIENTE ®¯")
mens("Inclusao de Clientes | <ESC> Sai | <F1> Help")
setcursor(2)
cor(4)
@ 5, 5 clear to 19, 74
sombra(05,07,19,74)
@ 5, 5 to 19, 74
apaga(5,60,5,68,"n/g","n/g")
@ 05,60 say "Inclusao"
cor(4)
@ 05,59 say "["
@ 05,68 say "]"
te0004()
cor(6)
@ 6, 21 say strzero(m_cod, 4, 0)
sele 1
@ 6, 32 get m_emp picture "@!" valid m_emp<>space(40)
@ 7, 21 get m_end picture "@!"
@ 8, 21 get m_bai picture "@!"
@ 8, 58 get m_cep picture "##.###-###" valid completa()
@ 9, 21 get m_cid picture "@!" valid m_cid<>space(35)
@ 9, 66 get m_est picture "@!" valid m_est<>space(02)
@ 10, 21 get m_fon picture "(###)####-####"
@ 10, 52 get m_fax picture "(###)####-####"
@ 11, 21 get m_cgc picture "##.###.###/####-##" valid vercgc(m_cgc)
@ 11, 52 get m_ins picture "###############"
@ 13, 21 say m_abe picture "##/##/####"
@ 14, 21 say m_co1 picture "9999"
@ 14, 37 say m_rep picture "##############################"
@ 16, 21 say m_ob1 picture "@!"
@ 17, 21 say m_ob2 picture "@!"
read
if (LastKey() == 27)
sele 2 //se sair do sistema, extorna o codigo
rlock()
m_cod:= cod - 1
repl cod with m_cod
dbunlock()
dbcloseall()
return
endif
pesq_rep(14,21,14,37,3)
cor(6)
m_rep:=rep
m_co1:=co1
@ 14, 21 say strzero(m_co1, 4, 0)
@ 14, 37 say m_rep picture "##############################"
@ 16, 21 get m_ob1 picture "@!"
@ 17, 21 get m_ob2 picture "@!"
read
if (LastKey() == 27)
sele 2
rlock()
m_cod:= cod - 1
repl cod with m_cod
dbunlock()
dbcloseall()
return
endif
confirma("Inclusao","Cliente")
cresp:= Space(1)
@ 23, 78 get Cresp picture "@!" valid cresp $ "SN"
read
if (cresp = "S")
sele 1
if .not. rlock()
rede(2)
dbcloseall()
loop
endif
append blank
repl_var()
dbunlock()
loop
endif
if (cresp = "N")
sele 2
rlock()
m_cod:= cod - 1
repl cod with m_cod
dbunlock()
endif
enddo
dbcloseall()
lib_var()
(5, 6, 20, 75, restscreen:= tecli)
return("")
FUNCTION PRX0005()
sele 1
use clientes shar index ind_cod, ind_emp
sele 2
use vendedor shar index ind_cve, ind_nve
sele 3
use ercs1 alias ar2 shar
set index to ind_u01, ind_u02, ind_u03, ind_u04
sele 4
use ercs2 alias ar3 shar
set index to ind_us1, ind_us2
sele 1
private m_cod, m_emp, m_end, m_bai, m_cep, m_cid, m_est, m_fon, ;
m_fax, m_cgc, m_ins, m_abe, m_co1,m_rep, m_ob1, m_ob2
tecli:= SaveScreen(5, 6, 20, 75)
do while (.T.)
nomepro()
centra(2, "®¯ MENU ALTERACAO DE CLIENTE ®¯")
mens("Alteracao de Cliente | <ESC> Sai | <F1> Help")
cor(4)
setcursor(2)
m_cod:= 0
setcursor(2)
@ 5, 5 clear to 19, 74
sombra(05,07,19,74)
@ 5, 5 to 19, 74
apaga(5,60,5,69,"n/g","n/g")
@ 05,60 say "Alteracao"
cor(4)
@ 05,59 say "["
@ 05,69 say "]"
te0004()
pesq_cli(06,21,06,32,1)
*****////*******
if found()
if .not. rlock()
rede(2)
// close databases (tirar isto, nao pode fechar BD, ainda)
loop
endif
endif
*******/////*******
igual_var()
cor(6)
@ 6, 21 say strzero(m_cod, 4, 0)
@ 6, 32 get m_emp picture "@!" valid m_emp<>space(40)
@ 7, 21 get m_end picture "@!"
@ 8, 21 get m_bai picture "@!"
@ 8, 58 get m_cep picture "##.###-###"
@ 9, 21 get m_cid picture "@!" valid m_cid<>space(35)
@ 9, 66 get m_est picture "@!" valid m_est<>space(02)
@ 10, 21 get m_fon picture "(###)####-####"
@ 10, 52 get m_fax picture "(###)####-####"
@ 11, 21 get m_cgc picture "##.###.###/####-##" valid vercgc(m_cgc)
@ 11, 52 get m_ins picture "###############"
@ 13, 21 say m_abe picture "##/##/####"
@ 14, 21 say m_co1 picture "9999"
@ 14, 37 say m_rep picture "##############################"
@ 16, 21 say m_ob1 picture "@!"
@ 17, 21 say m_ob2 picture "@!"
read
if (LastKey() == 27)
close databases
return
endif
pesq_rep(14,21,14,37,2)
cor(6)
m_rep:=rep
@ 14, 21 say strzero(m_co1, 4, 0)
@ 14, 37 say rep picture "##############################"
sele 1
@ 16, 21 get m_ob1 picture "@!"
@ 17, 21 get m_ob2 picture "@!"
read
confirma("Alteracao","Cliente")
cresp:= Space(1)
@ 23, 78 get Cresp picture "@!" valid cresp $ "SN"
read
if (cresp = "S")
sele 1
if .not. rlock()
rede(1)
// dbcloseall()
loop
endif
repl_var()
dbunlock()
loop
endif
if (cresp = "N")
loop
endif
if (LastKey() == 27)
loop
endif
enddo
close databases
select 1
lib_var()
(5, 6, 20, 75, restscreen:= tecli)
return("")
FUNCTION PRX0007()
sele 1
use clientes alias cli SHAR
set index to ind_cod, ind_emp
sele 2
use ercs1 alias ar2 SHAR
set index to ind_u01, ind_u02, ind_u03, ind_u04
sele 3
use ercs2 alias ar3 SHAR
set index to ind_us1, ind_us2
private m_cod,m_emp,m_rep
tecli:= SaveScreen(5, 6, 20, 75)
do while (.T.)
nomepro()
centra(2, "®¯ MENU EXCLUSAO DO CLIENTE ®¯")
mens("EXCLUSAO de Cliente | <ESC> Sai | <F1> Help")
m_cod:= 0
sele 1
cod:= 0
m_emp:=space(40)
m_rep:=space(30)
setcursor(2)
cor(4)
@ 5, 5 clear to 19, 74
sombra(05,07,19,74)
@ 5, 5 to 19, 74
apaga(5,60,5,68,"n/g","n/g")
@ 05,60 say "Exclusao"
cor(4)
@ 05,59 say "["
@ 05,68 say "]"
te0004()
cor(6)
set softseek on
@ 6, 21 get m_cod picture "9999"
read
if (LastKey() == 27)
close databases
return
endif
set softseek off
keyboard Chr(13)
pesq_cli(06,21,06,32,1)
if found()
if .not. rlock()
rede(2)
// close databases
loop
endif
endif
m_cod:=cod
cor(6)
@ 6, 21 say strzero(m_cod, 4, 0)
@ 6, 32 say emp picture "@!"
@ 7, 21 say end picture "@!"
@ 8, 21 say bai picture "@!"
@ 8, 58 say cep picture "##.###-###"
@ 9, 21 say cid picture "@!"
@ 9, 66 say est picture "@!"
@ 10, 21 say fon picture "(###)####-####"
@ 10, 52 say fax picture "(###)####-####"
@ 11, 21 say cgc picture "##.###.###/####-##"
@ 11, 52 say ins picture "###############"
@ 13, 21 say abe picture "##/##/####"
@ 14, 21 say co1 picture "9999"
@ 14, 37 say rep picture "##############################"
@ 16, 21 say ob1 picture "@!"
@ 17, 21 say ob2 picture "@!"
read
m_emp:=emp
m_rep:=rep
confirma("Exclusao","Cliente")
cresp:= Space(1)
@ 23, 78 get Cresp picture "@!" valid cresp $ "SN"
read
if (cresp = "S")
sele 1
if .not. rlock()
rede(3)
// dbcloseall()
loop
endif
dele
dbunlock()
loop
endif
if (cresp = "N")
loop
endif
if (LastKey() == 27)
loop
endif
enddo
close databases
select 1
lib_var()
(5, 6, 20, 75, restscreen:= tecli)
return
FUNCTION LIB_VAR()
a=fcount()
for i = 1 to a
if type(field(i))<>"m_"
nomevar="m_"+field(i)
release &nomevar
endif
next
release nomevar
FUNCTION REPL_VAR()
a=fcount()
for i = 1 to a
if type(field(i))<>"m_"
nomecampo=field(i)
nomevar="m_"+nomecampo
if type("&nomevar")<>"u"
repl &nomecampo with &nomevar
endif
endif
next
FUNCTION REDE(R_REDE)
if pcount() != 1
verifica()
endif
do case
case r_rede == 1
setcolor("gr+*/b")
setcursor(0)
@ 23,13 say " "
@ 23,13 say " Nao foi possivel concluir - Arquivo nao Bloqueado!"
tone(900,9)
tone(900,9)
inkey(0)
case r_rede == 2
setcolor("gr+*/b")
setcursor(0)
@ 23,13 say " "
@ 23,13 say " Arquivo sendo usado por outro Usuario!"
tone(900,7)
inkey(0)
case r_rede == 3
setcolor("gr+*/b")
setcursor(0)
@ 23,13 say " "
@ 23,13 say " Arquivo esta em uso, nao pode ser EXCLUIDO! "
tone(900,9)
inkey(0)
endcase
return("")
FUNCTION INDICE() //FAZ A CRIACAO DOS INDICES
set cursor off
save screen to index
nomepro()
setcolor("w+/b")
abrebox(12,09,14,65,"b/b")
sombra(12,09,14,65)
valor:=0
ultimo:=171
termoh(valor)
t:=0
c:=0
use numer1 exclusive new
trava()
pack
index on cod to ind_nu1
mens("Indexando Arquivo 001 - Controle")
valor=(++c)*100/ultimo
termoh(valor)
use numer2 exclusive new
trava()
pack
index on codi to ind_nu2
mens("Indexando Arquivo 002 - Controle")
valor=(++c)*100/ultimo
termoh(valor)
use mapa3 exclusive new
trava()
pack
index on pres to ind_pr9
valor=(++c)*100/ultimo
termoh(valor)
use bancaria exclusive new
trava()
pack
index on emi to ind_ch8
index on doc to ind_ch7
mens("Indexando Arquivo 001 - Impressao Cheque")
valor=(++c)*100/ultimo
termoh(valor)
setcursor(0)
@ 23,13 say " "
mens("Aguarde, Finalizando Rotina...")
valor=(++c)*100/ultimo
termoh(valor)
dbcloseall()
tone(900,1)
restore screen from index
cor(4)
set cursor off
return
FUNCTION TRAVA()
if neterr()
rede(2)
dbcloseall()
return .f.
endif
return("")