General information
Category:
Coding, syntax & commands
Title:
Case not work properly
Environment versions
Network:
Windows 2008 Server
Hello comunity
i have the following prg , but my problem is in the case statment because is only excute the first one , i mean is put the value on my cursor teste , field :ecredito, and i don´t know why :
if left(analist.caption,21)='Integração de RECIBOS'
proc_analitica()
mensagem("Operação Concluída..." + chr(13) + chr(13) + "Atenção, se o ecrã não fechar e reabrir, Por favor feche e clique no botão observar...","directa")
keyboard "{ALT+O}"
keyboard "{ALT+O}"
else
mensagem("Atenção, esta operação é só para integração de documentos de Facturação...","directa")
return .f.
endif
procedure proc_analitica()
Local lc_strsql
Local myeuro as double
Local mypte as double
myeuro = 0.00
mypte = 0.00
store "" to lc_strsql
select distinct oristamp from teste where (teste.edebito = 0 and teste.ecredito = 0) into cursor crspivo
select crspivo
go top
scan
text to lc_strsql noshow
select re.no,re.contado,re.ndoc,cl.conta as 'ContaCCO',cl.contaacer as 'ContaADT'
from re (nolock) inner join cl (nolock) on cl.no = re.no and
cl.estab = re.estab where re.restamp = ?crspivo.oristamp
endtext
if u_sqlexec(lc_strsql,"crsmovextra")
text to msel textmerge noshow pretext 7
select top 1 rl.erec as 'vleuro', rl.rec as 'vlpte' from rl (nolock) inner join re (nolock) on rl.restamp = re.restamp
and re.restamp = ?crspivo.oristamp
endtext
if u_sqlexec(msel,[CValores])
myeuro = CValores.vleuro
mypte = CValores.vlpte
else
msg(msel)
endif
else
msg(lc_strsql)
endif
select crsmovextra
go top
if reccount() > 0
select teste
scan
do case
case teste.conta = '2111' and (teste.ecredito = 0 and teste.edebito = 0) and teste.oristamp = crspivo.oristamp
update teste set teste.ecredito = myeuro, teste.credito = mypte where teste.oristamp = crspivo.oristamp
case teste.conta = '11' and (teste.edebito = 0 and teste.ecredito = 0) and teste.oristamp = crspivo.oristamp
update teste set teste.edebito = myeuro, teste.debito = mypte , teste.conta = crsmovextra.ContaADT ;
where teste.oristamp = crspivo.oristamp
endcase
endscan
endif
select crspivo
endscan
endproc
The STAMP crspivo.oristamp is the same for this 2 lines of movment (ADM11051282771,594000001) , but not the account, the first one begin on 211(complete account is : 2111101396), and the second one begin on 11 (complete account is : 111)
Could someone help me.
Best regards
Luis Santos
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only