
**********
* PCHIMV *
**********
SET EXACT ON
@  7, 7 SAY 'PLAATS EEN 8" DISKETTE IN DE DISK-DRIVE. DEZE DISKETTE MOET REEDS'
@  8, 7 SAY "ZIJN GEFORMATTEERD EN VOORZIEN VAN HET HISTORISCH BESTAND."
@ 10,25 SAY "1- OVERSCHRIJVEN GEGEVENS"
@ 11,25 SAY "E- EINDE"
@ 13,28 SAY "UW KEUZE SVP"
STORE F TO fin:move 
DO WHILE .NOT. fin:move
   STORE "." TO akk
   DO WHILE .NOT. (akk $ "1E")
      STORE "." TO akk
      @ 13,41 GET akk PICTURE "!"
      READ
      CLEAR GETS
   ENDDO
   IF akk = "1" .AND. .NOT. FILE ('&historie')
      STORE "." TO akk
      @ 22,0 SAY "HISTORISCH BESTAND IS NIET AANWEZIG, DRUK RETURN " GET akk
      READ
      CLEAR GETS
      @ 22,0 SAY "                                                    " 
      STORE "." TO akk
      STORE T TO fin:move
   ENDIF
   IF akk = "1"
      SELECT PRIMARY
      USE &historie INDEX &historie
      FIND &cur:prod
      IF (#>0)
         STORE "." TO akk
         DO WHILE .NOT. (akk $ "JN")
            STORE "." TO akk
            @ 16,7 SAY "PRODUKTIENUMMER REEDS AANWEZIG, TOCH OVERSCHRIJVEN (J/N) " GET akk PICTURE "!"
            READ
            CLEAR GETS
         ENDDO
         @ 16,7 SAY "                                                            "
         IF akk = "J"
            STORE "1" TO akk
         ELSE
            STORE "E" TO akk
         ENDIF
      ELSE
         APPEND BLANK
      ENDIF
   ENDIF
   IF akk = "1"
      @ 22,0 SAY "GEGEVENS WORDEN NU OVERGESCHREVEN."
      SELECT SECONDARY
      USE &opdracht INDEX &opdracht
      FIND &cur:prod
      SELECT PRIMARY
      REPLACE p.prod:nr WITH s.prod:nr,p.mail:dat WITH s.mail:dat,p.nr:camp WITH s.nr:camp, ;
              p.produkt WITH s.produkt,p.form:code WITH s.form:code,p.nr:codes WITH s.nr:codes, ;
              p.formaat WITH s.formaat, p.pap:kwal WITH s.pap:kwal
      SELECT SECONDARY
      REPLACE hist:file WITH T
      USE
      STORE 0 TO m:tot:best 
      STORE 0 TO m:tot:gel
      USE &oplage INDEX &oplage
      FIND &cur:prod
      DO WHILE (#>0) .AND. .NOT. EOF
         STORE m:tot:best + aant:best TO m:tot:best
         STORE m:tot:gel  + aant:gel  TO m:tot:gel
         SKIP +1
      ENDDO
      USE
      SELECT PRIMARY
      REPLACE tot:best WITH m:tot:best,tot:gel WITH m:tot:gel
      SELECT SECONDARY
      USE &calcdat INDEX &calcdat
      FIND &cur:prod
      SELECT PRIMARY
      REPLACE werk:tek WITH $(s.werk:tek,1,15) + ":" +  $(s.werk:tek,26,10), zetwerk WITH $(s.zetwerk,1,15) + ":" +  $(s.zetwerk,26,10), ;
      lithos WITH $(s.lithos,1,15) + ":" +  $(s.lithos,26,10), fotos WITH $(s.fotos,1,15) + ":" +  $(s.fotos,26,10)
      REPLACE drukker WITH $(s.drukker,1,15) + ":" +  $(s.drukker,26,10), papier WITH $(s.papier,1,15) + ":" +  $(s.papier,26,10), ;
      nabewerk WITH $(s.nabewerk,1,15) + ":" +  $(s.nabewerk,26,10)
      REPLACE afwerk WITH $(s.afwerk,1,15) + ":" +  $(s.afwerk,26,10), bijzond WITH $(s.bijzond,1,15) + ":" +  $(s.bijzond,26,10)
      SELECT SECONDARY
      USE
      SELECT PRIMARY 
      USE
      @ 22,0 SAY "                                  "
      STORE T TO fin:move
   ENDIF
   IF akk = "E"
      STORE T TO fin:move
   ENDIF
ENDDO
RETURN
*
* EINDE PROGRAMMA
*
