*EDITION DES MOUVEMENTS DE STOCK
TITRE =" JOURNAL DES MOUVEMENTS DE STOCK"
DO TITRE
@ 6,0 CLEAR
SET fixed ON
DATE1=CTOD("  /  /    ")
*DATE0=CTOD("31/08/"+STR(YEAR(DATE())))
DATE0=CTOD("31/08/1994")
DATE2=DATE1
VCODE =space(6)
@ 10,10 SAY "DATE DE DEBUT" GET date1 VALID(date1 > date0 )
READ
@ 12,10 SAY "DATE DE FIN" GET date2 VALID(DATE2 > DATE1)
@ 15,10 SAY "DONNEZ UN CODE PRODUIT OU RIEN POUR TOUS" GET VCODE PICTURE "@!"
IF date1=CTOD("  /  /    ")
RETU
ENDI
REP="N"
SET esca ON
vcapr1=0
vcapr2=0
vcapr3=0
vcapb1=0
vcapb2=0
vcapb3=0
vbtl1=0
vbtl2=0
vbtl3=0
SELE 2
USE SDARTI INDEX SDARTI ALIAS AR
SELECT 1
USE BGMV INDEX BGMVD
@ 10,5 SAY "REEDITION O/N" GET REP PICTURE "!"
IF REP="N"
SET SAFE OFF
ZAP
if month(date())>08
APPEND FROM SDLIGNES FOR date>=CTOD("01/09/"+STR(YEAR(DATE())))
APPEND FROM BGMVSTO  FOR date>=CTOD("01/09/"+STR(YEAR(DATE())))
else
APPEND FROM SDLIGNES FOR date>=CTOD("01/09/"+STR(YEAR(DATE())-1))
APPEND FROM BGMVSTO  FOR date>=CTOD("01/09/"+STR(YEAR(DATE())-1))
endi
INDEX ON codearti+SUBSTR(DTOC(date),7,4)+SUBSTR(DTOC(date),4,2)+SUBSTR(DTOC(date),1,2)+STR(numfact,5
*INDEX ON CODEARTI+STR(100000-STOCK,5,0) TO BGMV
CLOSE DATA
@ 18,2 SAY"AVEC RECALCUL O/N" GET REP PICTURE "@!"
IF REP="O"
**RECONSTITUTION DES STOCKS
DO WHILE .NOT.EOF()
VSTOCK=00000000.00
CPD=CODEART
IF CODEART="     "
SKIP
LOOP
IF FAMILLE<>"VRA".AND.LEFT(FAMILLE,1)<>"B".AND.FAMILLE<>"CP".and.left(famille,3)<>"BTL"
@ 14,5 SAY "CODE PRODUIT"
@ 14,20 SAY CPD
VSTOCK=ART1
@ 15,2 SAY "STOCK AU DEPART "
@ 15,20 SAY VSTOCK
SELE 1
SET EXAC OFF
FIND &CPD
IF EOF()
@ 10,10 SAY "Produit"
@ 10,20 SAY cpd
DO WHILE .NOT. EOF()
IF CODEARTI=CPD
IF TRIM(STR(NUMFACT,5,0)) # "99999"
VSTOCK=VSTOCK-Q2
ELSE
VSTOCK=VSTOCK+Q2
DO CASE
CASE cpd="CPR1"
vcapr1=vcapr1-q2
CASE cpd="CPR2"
vcapr2=vcapr2-q2
CASE cpd="CPR3"
vcapr3=vcapr3-q2
CASE cpd="CPB1"
vcapb1=vcapb1-q2
CASE cpd="CPB2"
vcapb2=vcapb2-q2
CASE cpd="CPB3"
vcapb3=vcapb3-q2
case cpd="BTL1"
vbtl1=vbtl1-q2
case cpd="BTL2"
vbtl2=vbtl2-q2
case cpd="BTL3"
vbtl3=vbtl3-q2
ENDC
REPLACE STOCK WITH VAL(STR(VSTOCK,10,2))
*wait
@ 12,10 SAY ""
? cpd ,numfact,vstock
*************************
IF BGMV->caps="O"
CASE Bgmv->colisage=0.750
IF ar->blouro="B"
vcapb1=vcapb1+bgmv->quantite
*ait
IF ar->blouro="R"
vcapr1=vcapr1+bgmv->quantite
@ 20,1 SAY "capsules "
? vcapr1
CASE BgMV->colisage=0.375
vcapb2=vcapb2+BGMV->quantite
vcapr2=vcapr2+BGMV->quantite
CASE BGMV->colisage=1.50
vcapb3=vcapb3+BGMV->quantite
vcapr3=vcapr3+BGMV->quantite
do case
case bgmv->colisage=0.75
vbtl1=vbtl1+bgmv->quantite
case bgmv->colisage=0.375
vbtl2=vbtl2+bgmv->quantite
case bgmv->colisage=1.5
vbtl3=vbtl3+bgmv->quantite
endcase
IF .NOT.EOF()
ENDDO
REPLACE AR->QUANTITE WITH VSTOCK
IF .NOT. EOF()
*ENDI
FIND "CPR1"
REPLACE quantite WITH art1-vcapr1
FIND "CPR2"
REPLACE quantite WITH art1-vcapr2
FIND "CPR3"
REPLACE quantite WITH art1-vcapr3
FIND "CPB1"
REPLACE quantite WITH art1-vcapb1
FIND "CPB2"
REPLACE quantite WITH art1-vcapB2
FIND "CPB3"
REPLACE quantite WITH art1-vcapB3
FIND "BTL1"
REPLACE quantite WITH art1-vbtl1
FIND "BTL2"
REPLACE quantite WITH art1-vbtl2
FIND "BTL3"
REPLACE quantite WITH art1-vbtl3
SET TALK OFF
IF VCODE #"    "
if vcode="ECH"
SET FILTER TO ech="O".AND.(DATE<=DATE2 .AND. DATE>=DATE1)
SET FILTER TO CODEARTI =VCODE.AND.(DATE<=DATE2 .AND. DATE>=DATE1)
GO TOP
SET FILTER TO (DATE<=DATE2 .AND. DATE>=DATE1)
TOTBT=0
TOTLT=0.00
TOTBTP=0
TOTLTP=0
TOTHLP=0.0000
totmag=0
TOTMAGP=0
TOTPBTP=0
TOTPBT=0
totcapb=0
totcapr=0
totcapbp=0
totcaprp=0
PP=1
ppt=1
LL=1
@ 8,10 SAY "IMPRIMANTE O/N" GET REP PICTURE "@!"
SET PRINT ON
set margin to 3
pol1=CHR(27)+"&l0O"+chr(27)+"(s12U"+chr(27)+"(s0P"+chr(27)+"(s12H"+chr(27)+"(s12V"+chr(27)+"(s0S"+ch
pol2=CHR(27)+"&l0O"+chr(27)+"(s12U"+chr(27)+"(s0P"+chr(27)+"(s16H"+chr(27)+"(s12V"+chr(27)+"(s0S"+ch
pol3=CHR(27)+"&l0O"+chr(27)+"(s12U"+chr(27)+"(s1P"+chr(27)+"(s5H"+chr(27)+"(s24V"+chr(27)+"(s0S"+chr
*EJECT
DO BGAFFSTO.PRG
SET EXACT ON
PRD=CODEARTI
set century off
IF PRD#CODEARTI
?
? "  TOTAL DES VENTES SUR LA PERIODE  BOUTEILLES :", TOTBTP,"soit;",STR(totbtp*.75,6,2),"l"
? "  TOTAL DES VENTES SUR LA PERIODE  capsules BL :", TOTcapbp
? "  TOTAL DES VENTES SUR LA PERIODE  capsules RO :", TOTcapRp
? "  TOTAL DES VENTES SUR LA PERIODE  DEMI BTLES :", TOTPBTp,"soit;",STR(totPBTp*0.375,6,2),"l"
? "  TOTAL DES VENTES SUR LA PERIODE  MAGNUMS    :", TOTMAGp,"soit;",STR(totMAGp*1.5,6,2),"l"
? "  TOTAL DES VENTES SUR LA PERIODE  EN LITRES  :", TOThLP
EJECT
ppt=ppt+1
WAIT
TOTLTP=0.00
tothlp=0.00
totmagp=0
totpbtp=0
IF PROW() < 4
??pol1
?"JOURNAL DES MOUVEMENTS DE STOCK du ",DTOC(DATE1)," au ",DTOC(DATE2),"PAGE",STR(PPt,3,0),pol2+"édit
? "PRODUIT"+pol3+" "+PRD+pol1+" page",str(pp,2)
? pol1
? "DATE      NATURE OU NOM                   QUANTITE  STOCK          BTLES   FACT  CAPS"
*PRD=CODEARTI
? DATE,NATURE,Q2,STOCK,COLISAGE
CASE COLISAGE=0.75
TOTBT=TOTBT+QUANTITE
TOTBTP=TOTBTP+QUANTITE
TOTHLP=TOTHLP+Q2
CASE COLISAGE=0.375
TOTPBT=TOTPBT+QUANTITE
TOTPBTP=TOTPBTP+QUANTITE
CASE COLISAGE=1.5
TOTMAG=TOTMAG+QUANTITE
TOTMAGP=TOTMAGP+QUANTITE
OTHER
IF NUMFACT #99999
IF COLISAGE #0
TOTLT=TOTLT+QUANTITE*COLISAGE
TOTLTP=TOTLTP+QUANTITE*COLISAGE
****** capsules ********
sele ar
seek prd
if .not. eof()
clear
@ 10,5 say prd
if bgmv->caps="O".and.bgmv->colisage=0.75
if trim(ar->blouro)="B"
totcapb=totcapb+bgmv->quantite
totcapbp=totcapbp+bgmv->quantite
if ar->blouro="R"
totcapr=totcapr+bgmv->quantite
totcaprp=totcaprp+bgmv->quantite
************* fin capsules ******
??"",QUANTITE,"   "+str(NUMFACT,5,0)+"  ",caps
? "---------------------------------------------------------------------------------------------"
IF REP #"O"
IF PROW()<58
PP=PP+1
CLEAR typeahead
? "  TOTAL DES VENTES SUR LA PERIODE  DEMI BTLES :", TOTPBT,"soit;",STR(totPBT*0.375,6,2),"l"
? "  TOTAL DES VENTES SUR LA PERIODE  MAGNUMS    :", TOTMAG,"soit;",STR(totMAG*1.5,6,2),"l"
? "  TOTAL DES VENTES SUR LA PERIODE  EN LITRES  :", TOTLTP
IF PROW() > 55
? "  CUMUL DES VENTES SUR LA PERIODE  BOUTEILLES      :", TOTBT
? "  CUMUL DES VENTES SUR LA PERIODE  CAPSULES ROUGES :", TOTcapr
? "  CUMUL DES VENTES SUR LA PERIODE  CAPSULES BLANC  :", TOTCAPB
? "  CUMUL DES VENTES SUR LA PERIODE  EN LITRES  :", TOTLT
SET FILTER TO
*SUM QUANTITE FOR COLISAGE=0.75 TO TOTBT
*? " CUMUL DES BOUTEILLES ",TOTBT
eject
SET PRINT OFF
SET fixed OFF
CLEAR TYPEAHEAD
set century on