*EDITION DES CAPSULES
do while .t.
TITRE =" JOURNAL DE SORTIE REGIE"
DO TITRE
@ 6,0 CLEAR
SET fixed ON
DATE1=CTOD("  /  /  ")
DATE2=DATE1
VCODE ="    "
@ 10,10 SAY "DATE DE DEBUT" GET date1
READ
@ 12,10 SAY "DATE DE FIN" GET date2 VALID(DATE2 > DATE1) HELP;
"LA DATE DE FIN DOIT ETRE SUPERIEURE A LA DATE DE DEBUT"
*@ 15,10 SAY "DONNEZ UN CODE PRODUIT OU RIEN POUR TOUS" GET VCODE PICTURE "@!"
IF date1=CTOD("  /  /  ")
exit
ENDI
REP="N"
**********
SELECT 1
USE SDARTI INDEX SDARTI ALIAS AR
SELE 2
USE SDLIGNES  ALIAS LG
set safe off
index on str(numfact,4,0)+codearti to temp
set index to sdligne2,temp
sele 3
use bglireg index bglirad alias liv
zap
set safe on
sele lg
lt =prow()
TOTLIT=0.000
*DO WHILE .NOT. EOF()
**************
VDAT=DATE1
TROUVE=.F.
DO WHILE VDAT<DATE1+25
@ 20,5 SAY""
? VDAT
*FIND &VDAT
SEEK VDAT
IF EOF()
VDAT=VDAT+1
LOOP
ELSE
TROUVE=.T.
EXIT
ENDDO
IF TROUVE
set order to 2
SET RELATION TO CODEARTI INTO AR
do while .not. eof()
if trim(lg->codearti)<>"".and.lg->date>=date1.and.lg->date<=date2
vnumf=lg->numfact
vradi=substr(codearti,1,len(trim(codearti))-2)
sele liv
append blank
replace liv->NUMFACT with vnumf,liv->DATE with lg->DATE,liv->RADICAL with vradi
set esca on
do while lg->numfact=vnumf
if ar->blouro ="R" .or. ar->blouro ="B"
if vradi=substr(codearti,1,len(trim(codearti))-2)
? "c'est le meme"
replace liv->total with liv->total+q2
else
replace liv->NUMFACT with vnumf,liv->DATE with lg->date,liv->RADICAL with vradi
replace liv->total with liv->total+lg->q2
endi
? date ,codearti+" "+vradi,ar->designart,q2,numfact
skip
enddo
loop
set date french
set exac off
replace all tabul with 10 for left(radical,3)="BGO"
replace all tabul with 22 for left(radical,3)="CHB"
replace all tabul with 34 for left(radical,2)="HN"
replace all tabul with 46 for left(radical,3)="HNB"
replace all tabul with 58 for left(radical,2)="RB"
replace all tabul with 70 for left(radical,2)="SG"
replace all tabul with 82 for left(radical,2)="VC"
replace all tabul with 94 for left(radical,2)="VCF"
replace all tabul with 106 for left(radical,2)="VM"
replace all tabul with 118 for left(radical,2)="VR"
replace all tabul with 130 for left(radical,2)="EC"
set relation to
close data
retu