home *** CD-ROM | disk | FTP | other *** search
/ The Don Maslin Archive / maslin_archive.zip / AARDVARK_Tape_Backups / maslin_c_d_3oct95 / ddrive / sydex / prgms / invntory.lbr / MAINTAIN.CMD < prev    next >
OS/2 REXX Batch file  |  1980-01-29  |  7KB  |  289 lines

  1. ********************* maintain.cmd ********************
  2. SET talk OFF
  3. SET confirm ON
  4. SET colon OFF
  5. SET bell ON
  6. SET escape OFF
  7. SET inten OFF
  8. CLEAR
  9. SET bell OFF
  10. STORE '00/00/00' TO mdate
  11. STORE t TO getdate
  12. DO WHILE getdate
  13.  ERASE
  14.  ?
  15.  ? " Enter date as MM/DD/YY" 
  16.  @ 3,0 SAY "  or <return> for none: " GET mdate PICTURE '99/99/99' 
  17.  READ
  18.  IF val($(mdate,1,2))>12 ;
  19.   .OR. val($(mdate,4,2))>31 ;
  20.   .OR. (val($(mdate,7,2))<84 .AND. val($(mdate,7,2))<>0)
  21.   @ 5,0 SAY chr(7)
  22.   ? "     **** INVALID DATE, RE-ENTER ****" 
  23.   STORE 1 TO x
  24.   DO WHILE x<25
  25.    STORE x+1 TO x 
  26.   ENDDO WHILE x<25 
  27.   LOOP
  28.  ELSE
  29.   STORE f TO getdate
  30.   SET DATE TO &mdate
  31.  ENDIF val($(mdate,1,2))>12 ; 
  32. ENDDO WHILE getdate 
  33. RELEASE mdate,x,getdate
  34. SET bell ON
  35. SET talk ON
  36. DO WHILE t
  37.  ERASE
  38.  ? "****************************************************" 
  39.  ? '         M A I N T E N A N C E   M E N U' 
  40.  ? "****************************************************" 
  41.  ?
  42.  ? '           1. COPY-CHOP Account File' 
  43.  ?
  44.  ? '           2. COPY-CHOP Inventory File' 
  45.  ?
  46.  ? '           3. PURGE Ledger File' 
  47.  ?
  48.  ? '           4. CHANGE Invoice Number' 
  49.  ?
  50.  ? '           5. RE-INDEX all data files (no alterations)' 
  51.  ?
  52.  ? '           6. DELETE Beat Yesterday file' 
  53.  ? 
  54.  ? '           7. ZERO salesman totals' 
  55.  ? 
  56.  ? '           I. RUN INVENTY Program' 
  57.  ?
  58.  ? '           X. RETURN to CP/M' 
  59.  ? 
  60.  ACCEPT "    Enter here " TO command
  61.  DO CASE
  62.   CASE !(command)= '1' 
  63.    ERASE
  64.    ?
  65.    ? ' **** C O P Y--C H O P  A C C O U N T  D I S K ****' 
  66.    ? 
  67.    ? 
  68.    ? 'This option will allow you to PERMANENTLY delete' 
  69.    ? 'all of the accounts which were tagged for deletion' 
  70.    ? 'YOU MUST BE SURE TO HAVE A BACK-UP COPY OF THE ' 
  71.    ? "ACCOUNT DISK BEFORE YOU BEGIN.  Press <return> or" 
  72.    ? "enter an 'A' to ABORT and return to menu." 
  73.    ?
  74.    SET console OFF
  75.    WAIT TO GO
  76.    SET console ON
  77.    IF !(GO)<> 'A' 
  78.     ERASE
  79.     ?
  80.     ? 
  81.     ?
  82.     ?
  83.     ?
  84.     ?
  85.     ? '     This is going to take a little while..' 
  86.     ?
  87.     ? 
  88.     ? '                Working--' 
  89.     ?
  90.     USE b:accounts
  91.     DELETE FILES b:accounts.ndx
  92.     DELETE FILES b:accnt:no.ndx
  93.     COPY TO b:tempa
  94.     USE b:tempa
  95.     INDEX ON bill:nm TO b:accounts
  96.     INDEX ON accnt:no TO b:accnt:no
  97.     CLEAR
  98.     DELETE FILES b:accounts
  99.     RENAME b:tempa TO b:accounts
  100.    ENDIF !(GO)<> 'A' 
  101.   CASE !(command)= '2' 
  102.    ERASE
  103.    ?
  104.    ? '** C O P Y--C H O P  I N V E N T O R Y   D I S K **' 
  105.    ? 
  106.    ? 
  107.    ? 'This option will allow you to PERMANENTLY delete' 
  108.    ? 'all of the inventory which was tagged for deletion' 
  109.    ? 'YOU MUST BE SURE TO HAVE A BACK-UP COPY OF THE ' 
  110.    ? "INVENTORY DISK BEFORE YOU BEGIN.  Press <return> or" 
  111.    ? "enter an 'A' to ABORT and return to menu." 
  112.    ?
  113.    SET console OFF
  114.    WAIT TO GO
  115.    SET console ON
  116.    IF !(GO)<> 'A' 
  117.     ERASE
  118.     ?
  119.     ? 
  120.     ?
  121.     ?
  122.     ?
  123.     ?
  124.     ? '     This is going to take a little while..' 
  125.     ?
  126.     ? 
  127.     ? '                Working--' 
  128.     ?
  129.     USE b:inventy
  130.     DELETE FILES b:invcatno.ndx
  131.     COPY TO b:tempi
  132.     USE b:tempi
  133.     DELETE FILES b:inventy
  134.     INDEX ON cat:no TO b:invcatno
  135.     CLEAR
  136.     RENAME b:tempi TO b:inventy
  137.    ENDIF !(GO)<> 'A' 
  138.   CASE !(command)= '3' 
  139.    ERASE
  140.    ?
  141.    ? '     ***** P U R G E  L E D G E R  F I L E ****' 
  142.    ?
  143.    ?
  144.    ? 'This option will allow you to permanently delete ' 
  145.    ? "ALL of the ledger entries on file. Press <return> " 
  146.    ? "or enter an 'A' to ABORT this operation and return" 
  147.    ? "to the menu. This will also create an single entry" 
  148.    ? "for each account with today's date, a DEBIT consisting" 
  149.    ? "of the current balance, a detail of 'BROUGHT FOWARD'" 
  150.    ?
  151.    ? 
  152.    ? "          DO YOU HAVE NEW BACK-UPS MADE!!!" 
  153.    ? 
  154.    ?
  155.    SET console OFF
  156.    WAIT TO GO
  157.    SET console ON
  158.    IF !(GO)<> 'A' 
  159.     ERASE
  160.     ?
  161.     ? '     ***** P U R G E  L E D G E R  F I L E ****' 
  162.     ?
  163.     ?
  164.     ?
  165.     ?
  166.     ?
  167.     ? '                   Working---' 
  168.     DELETE FILES b:ledger.ndx
  169.     USE a:ledger
  170.     COPY STRUCTURE TO b:templ
  171.     SELECT PRIMARY
  172.     USE b:templ
  173.     SELECT secondary
  174.     USE b:accounts
  175.     GO TOP
  176.     DO WHILE .not. eof
  177.      SELECT PRIMARY
  178.      APPEND BLANK 
  179.      REPLACE DATE WITH DATE (),detail WITH "BROUGHT FOWARD" 
  180.      REPLACE debit WITH s.balance,rbalance WITH s.balance,accnt:no WITH s.accnt:no
  181.      SELECT secondary
  182.      SKIP +1
  183.     ENDDO WHILE .not. eof 
  184.     DELETE FILES b:ledger
  185.     CLEAR
  186.     RENAME b:templ TO b:ledger
  187.     USE b:ledger
  188.     INDEX ON accnt:no TO b:ledger
  189.     CLEAR
  190.    ENDIF !(GO)<> 'A' 
  191.   CASE !(command)= '4' 
  192.    CLEAR
  193.    ERASE
  194.    ?
  195.    ? ' *** C H A N G E   I N V O I C E  N U M B E R ***' 
  196.    ?
  197.    ?
  198.    RESTORE FROM a:invnmbr
  199.    STORE '         ' TO inv:no2
  200.    ?
  201.    ? 'The OLD invoice number was: ' ,inv:no
  202.    ?
  203.    ?
  204.    @ 8,0 SAY 'Enter new STARTING number :  ' GET inv:no2 PICTURE '9999999999' 
  205.    READ
  206.    STORE trim(inv:no2) TO inv:no
  207.    RELEASE inv:no2
  208.    SAVE TO a:invnmbr
  209.   CASE command= '5' 
  210.    CLEAR
  211.    ERASE
  212.    ?
  213.    ? "        *** H O U S E -- C L E A N I N G *** " 
  214.    ?
  215.    ?
  216.    ? "  Make sure you have NEW BACK-UP disks before" 
  217.    ? "  begining this process.  PRESS <RETURN> to " 
  218.    ? "  continue -- or enter an 'A' to ABORT" 
  219.    ?
  220.    WAIT TO GO
  221.    IF !(GO) <> "A" 
  222.     ERASE
  223.     @ 12,10 SAY "Working..." 
  224.     SET console OFF
  225.     SET talk OFF
  226.     DELETE FILES b:accnt:no.ndx
  227.     DELETE FILES b:accounts.ndx
  228.     DELETE FILES b:ledger.ndx
  229.     DELETE FILES b:sales.ndx
  230.     DELETE FILES b:accntzip.ndx
  231.     DELETE FILES b:invcatno.ndx
  232.     USE b:accounts
  233.     INDEX ON accnt:no TO b:accnt:no
  234.     INDEX ON bill:nm TO b:accounts
  235.     USE b:inventy
  236.     INDEX ON cat:no TO b:invcatno
  237.     USE b:ledger
  238.     INDEX ON accnt:no TO b:ledger
  239.    ENDIF !(GO) <> "A" 
  240.    CLEAR
  241.    SET console ON
  242.    RETURN
  243.   CASE command= '6' 
  244.    ERASE
  245.    ?
  246.    ? '  *** D E L E T E   B E A T   Y E S T E R D A Y ***' 
  247.    ? 
  248.    ?
  249.    ? "Enter an 'A' if you wish to ABORT this process" 
  250.    ?
  251.    SET console OFF
  252.    WAIT TO GO
  253.    SET console ON
  254.    IF !(GO) <> 'A' 
  255.     USE a:diary
  256.     ? '                  DELETING' 
  257.     DELETE ALL
  258.     PACK
  259.    ENDIF !(GO) <> 'A' 
  260.   CASE command= '7' 
  261.    ?
  262.    ? "    *** Z E R O   S A L E S  T O T A L S ***" 
  263.    ?
  264.    ?
  265.    ? "Enter an 'A' if you wish to abort this process" 
  266.    ?
  267.    SET console OFF
  268.    WAIT TO GO
  269.    SET console ON
  270.    IF !(GO) <> "A" 
  271.     USE a:salesman
  272.     DELETE ALL
  273.     PACK
  274.    ENDIF !(GO) <> "A" 
  275.   CASE !(command)= 'X' 
  276.    ERASE
  277.    CLEAR
  278.    SET console OFF
  279.    QUIT
  280.   CASE !(command)= 'I' 
  281.    CLEAR
  282.    ERASE
  283.    DO a:it
  284.   OTHERWISE
  285.    ERASE
  286.    ?? chr(07)
  287.  ENDCASE 
  288. ENDDO WHILE t 
  289.