*BGETSTO
*EDITION DES STOCKS VIN BOUT ET VRAC PAR PRODUITS
TITRE = "EDITION DU RECAPITULATIF STOCKS"
DO TITRE
SELE 2
USE frz!SDFACTUR ORDER 1 
GO BOTT
VFAC=NUMERO
VNOMFAC=NOMCLI
USE
SELE 1
USE frz!SDARTI order 1 ALIAS ar

GO TOP



*SET PRINT ON
*set margin to 0
*??chr(27)+"&l0L"+pol1
*+chr(27)+"&l0E"
totstock=0
totres =0

REPORT FORM  r_etatstock  FOR ar.quantite>0 PREVIEW IN screen


*pp=1 
*DO WHILE .NOT. EOF()
*if prow()<4
*?
*? societe+" STOCK AU ",DATE(),"page "+str(pp,2,0)
*? "DERNIERE FACTURE ",VFAC,VNOMFAC
*?
*?"   article                    stock regie    stock btl    reserv‚ l     dispo           bt"
*?
*endi
*IF FAMILLE ="B" .OR. FAMILLE ="CP".OR. FAMILLE="BTL".OR.FAMILLE ="VRA"
*IF QUANTITE #0
*if res <0
*replace res with 0
*endi
*?"--------------------------------------------------------------------------------------------"
*? pol2+designart+" :"+pol1+str(QUANTITE,10,2)+"  "+str(quantite/0.75,10,2)+"   "+str(res,9,2)+" ",quantite-res,(quantite-res)/0.75
*if famille="B".or. famille ="VRA"
*totstock=totstock+quantite
*totres=totres+res
*endi    
*ENDI
*ENDI
*if prow()>60
*pp=pp+1
*eject
*endi
*SKIP
*ENDDO
*?
*?pol1+"Totaux                       :"+str(totstock,10,2)+"     RESERVES           :"+str(totres,6,0)
*?? "              "
*?
*GO TOP
*totstock=0
*totres=0
*DO WHILE .NOT. EOF()
*IF FAMILLE ="V"
*IF QUANTITE #0
*?"                     -----------------------------------------------------------------"
*? pol2+designart+" :"+pol1+str(QUANTITE,10,2)+"  "+str(quantite/0.75,10,2),res," ",quantite-res,(quantite-res)/0.75
*ENDI    
*ENDI
*SKIP
*ENDDO
CLOSE DATA
*eject
*SET PRINT OFF
RETU


