* ADDSTORE.CMD
* RLS
* MAR 1986
USE stores
ERASE
RESTORE FROM graphics ADDITIVE
@ 1,0 SAY gr:on
@ 1,1 SAY gr:ltc + gr:line
@ 2,1 SAY gr:vert
@ 3,1 SAY gr:vert
@ 4,1 SAY gr:vert
@ 5,1 SAY gr:vert
@ 6,1 SAY gr:vert
@ 7,1 SAY gr:lbc+gr:line
@ 7,79 SAY gr:rbc
@ 6,79 SAY gr:vert
@ 5,79 SAY gr:vert
@ 4,79 SAY gr:vert
@ 3,79 SAY gr:vert
@ 2,79 SAY gr:vert
@ 1,79 SAY gr:rtc
@ 8,1 SAY gr:off
RELEASE ALL LIKE gr:*
@ 4, 12 SAY "d B A S E   S H O P P E R:  A D D  A  S T O R E "
@ 9, 10 SAY "List of currents stores:  "
STORE 12 TO cntr
GOTO TOP
DO WHILE .NOT. EOF
  @ cntr, 10 SAY storeno + "     " + storename
  SKIP
  @ $+1,0
  STORE 1 + cntr TO cntr
  IF cntr > 22
   STORE 12 TO cntr
  ENDIF
ENDDO  eof
SET CONSOLE OFF
WAIT
SET CONSOLE ON
STORE t TO nocode
STORE " " TO mstoreno
STORE "                              " TO mstorename
DO WHILE nocode
  ERASE
  @ 10,5 SAY "Enter a one digit store code and the name of the new store:"
  @ 12,10 SAY "Store code " GET mstoreno PICTURE '!'
  @ 14,10 SAY "Store name " GET mstorename 
  READ
  IF FILE("grocery&mstoreno.dbf")
    @ 17,10 SAY "That code is already in use.  Please select another."
    SET CONSOLE OFF
    WAIT
    SET CONSOLE ON
  ELSE
    APPEND BLANK
    REPLACE storeno WITH mstoreno
    REPLACE storename WITH mstorename
    STORE "gbase" TO gname
    IF .NOT. FILE("gbase.dbf")
      @ 17, 1 SAY "File GBASE.DBF was not found."  
      ACCEPT " Enter a valid grocery filename " TO gname
    ENDIF
    USE &gname
    @ 20,10 SAY " WORKING . . ."
    COPY TO grocery&mstoreno
    USE grocery&mstoreno
    @ 20,0
    @ 20,10 SAY " halfway . . ."  
    INDEX ON item TO item&mstoreno
    @ 20,0
    @ 20,10 SAY "Almost done . . ."
    INDEX ON aisle TO aisle&mstoreno
    STORE f TO nocode
  ENDIF
ENDDO
RELEASE gname, nocode, mstoreno, mstorename
RETURN
