Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Case not work properly
Message
From
01/06/2011 18:58:16
Luis Santos
Biglevel-Soluções Informáticas, Lda
Portugal
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Case not work properly
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01512485
Message ID:
01512485
Views:
176
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
Map
View

Click here to load this message in the networking platform