home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a070 / 3.ddi / FOXPRO / SAMPLE / INVENTRY.PRG < prev    next >
Encoding:
Text File  |  1989-11-07  |  4.4 KB  |  179 lines

  1. * ┌─────────────────────────────────────────────────────────────────────┐ *
  2. * │  PROG NAME: INVENTRY.PRG - Inventory File Maintenance.              │ *
  3. * │  Copyright (c) 1989 Tech III, Inc. All rights reserved.             │ *
  4. * │  Tech III of San Pedro, California      (213) 547-2191.             │ *
  5. * │  "The bridge connecting people and technology."(tm)                 │ *
  6. * └─────────────────────────────────────────────────────────────────────┘ *
  7.  
  8. ACTIVATE WINDOW working
  9. DO set_itm
  10. SELECT items
  11. SET ORDER TO itm_itm
  12. IF EOF()
  13.   GO TOP
  14. ENDIF
  15. STORE item TO mitem
  16. DO disp_itm
  17. DO show_itm
  18. STORE .t. TO inventing
  19. DO WHILE inventing
  20.   ACTIVATE MENU inventry PAD search
  21.   IF .NOT. in_prodemo
  22.       DEACTIVATE MENU
  23.   ENDIF
  24. ENDDO
  25. RELEASE MENU inventry
  26. CLEAR
  27. DEACTIVATE WINDOW working
  28. RETURN
  29.  
  30. PROCEDURE add_itm
  31.   DO disp_itm
  32.   STORE SPACE(6) TO mitem
  33.   @ 01,08 GET mitem PICT '!!!!!!'
  34.   READ
  35.   SEEK mitem
  36.   IF FOUND()
  37.     DO show_itm
  38.     DO standby WITH "Can't add this record: it's already on file."
  39.     RETURN
  40.   ELSE
  41.     APPEND BLANK
  42.     REPLACE NEXT 1 item WITH mitem
  43.   ENDIF
  44.   DO edit_itm
  45.   RETURN
  46.   
  47. PROCEDURE del_itm
  48.   STORE .f. TO do_it
  49.   ACTIVATE WINDOW msg2user
  50.   @ 01,02 SAY 'Are you sure you want to delete this record? ' GET do_it PICT 'Y'
  51.   READ
  52.   DEACTIVATE WINDOW msg2user
  53.   IF .NOT. do_it
  54.     RETURN
  55.   ENDIF
  56.   DELETE NEXT 1
  57.   IF .NOT. EOF()
  58.     SKIP
  59.   ENDIF
  60.   IF EOF()
  61.     GO BOTTOM
  62.   ENDIF
  63.   DO show_itm
  64.   RETURN
  65.   
  66. PROCEDURE disp_itm
  67.   CLEAR
  68.   @ 00,01 TO 02,18
  69.   @ 01,03 SAY "Item"
  70.   @ 02,01 TO 21,76
  71.   @ 02,01 SAY "├"
  72.   @ 02,18 SAY "┴"
  73.   @ 07,10 SAY "            On Hand: "
  74.   @ 08,10 SAY "      Cost per unit: "
  75.   @ 09,10 SAY "     Price per unit: "
  76.   @ 10,10 SAY "          Taxable ?: "
  77.   @ 12,10 SAY "  Cost of Inventory: "
  78.   @ 14,10 SAY " Value of Inventory: "
  79.   RETURN
  80.   
  81. PROCEDURE edit_itm
  82.   @ 01,08 GET item
  83.   CLEAR GETS
  84.   @ 04,04 GET descript
  85.   @ 07,31 GET quantity PICTURE '9999999'
  86.   @ 08,31 GET cost     PICTURE '999,999.99'
  87.   @ 09,31 GET price    PICTURE '999,999.99'
  88.   @ 10,31 GET taxable  PICTURE 'Y'
  89.   READ
  90.   DO show_itm
  91.   RETURN
  92.   
  93. PROCEDURE last_itm
  94.   GO BOTTOM
  95.   DO show_itm
  96.   RETURN
  97.   
  98. PROCEDURE next_itm
  99.   SKIP
  100.   IF EOF()
  101.     GO BOTTOM
  102.     DO standby WITH "End of file: there is no NEXT inventory item."
  103.   ELSE
  104.     DO show_itm
  105.   ENDIF
  106.   RETURN
  107.   
  108. PROCEDURE prev_itm
  109.   SKIP -1
  110.   IF BOF()
  111.     GO TOP
  112.     DO standby WITH "Beginning of file: there is no PREVIOUS inventory item."
  113.   ELSE
  114.     DO show_itm
  115.   ENDIF
  116.   RETURN
  117.   
  118. PROCEDURE quit_itm
  119.   STORE .f. TO inventing
  120.   DEACTIVATE MENU
  121.   RETURN
  122.   
  123. PROCEDURE set_itm
  124.   DEFINE MENU inventry COLOR SCHEME 3
  125.   DEFINE PAD NEXT   OF inventry PROMPT '\<Next'   AT 17,03
  126.   DEFINE PAD prev   OF inventry PROMPT '\<Prev'   AT 17,10
  127.   DEFINE PAD first  OF inventry PROMPT '\<First'  AT 17,17
  128.   DEFINE PAD LAST   OF inventry PROMPT '\<Last'   AT 17,25
  129.   DEFINE PAD search OF inventry PROMPT '\<Search' AT 17,32
  130.   DEFINE PAD EDIT   OF inventry PROMPT '\<Edit'   AT 17,41
  131.   DEFINE PAD APPEND OF inventry PROMPT '\<Add'    AT 17,48
  132.   DEFINE PAD DELETE OF inventry PROMPT '\<Delete' AT 17,54
  133.   DEFINE PAD QUIT   OF inventry PROMPT '\<Quit'   AT 17,63
  134.   ON SELECTION PAD NEXT      OF inventry DO next_itm
  135.   ON SELECTION PAD prev      OF inventry DO prev_itm
  136.   ON SELECTION PAD first     OF inventry DO top_itm
  137.   ON SELECTION PAD LAST      OF inventry DO last_itm
  138.   ON SELECTION PAD search    OF inventry DO srch_itm
  139.   ON SELECTION PAD EDIT      OF inventry DO edit_itm
  140.   ON SELECTION PAD APPEND    OF inventry DO add_itm
  141.   ON SELECTION PAD DELETE    OF inventry DO del_itm
  142.   ON SELECTION PAD QUIT      OF inventry DO quit_itm
  143.   RETURN
  144.   
  145. PROCEDURE show_itm
  146.   @ 01,08 SAY item
  147.   @ 04,04 SAY descript
  148.   @ 07,31 SAY quantity PICTURE '9999999'
  149.   @ 08,31 SAY cost     PICTURE '999,999.99'
  150.   @ 09,31 SAY price    PICTURE '999,999.99'
  151.   @ 10,31 SAY taxable  PICTURE 'Y'
  152.   *calculate the total value and total cost
  153.   mcvalue=quantity*cost
  154.   mpvalue=quantity*price
  155.   *paint these totals on the screen
  156.   @ 12,31 SAY mcvalue  PICTURE '999,999.99'
  157.   @ 14,31 SAY mpvalue  PICTURE '999,999.99'
  158.   RETURN
  159.   
  160. PROCEDURE srch_itm
  161.   last_rec=RECNO()
  162.   STORE SPACE(6) TO mitem
  163.   DO disp_itm
  164.   @ 1,08 GET mitem PICTURE '!!!!!!'
  165.   READ
  166.   SEEK mitem
  167.   IF .NOT. FOUND()
  168.     DO standby WITH "There is no such inventory item."
  169.     GO last_rec
  170.   ENDIF
  171.   DO show_itm
  172.   RETURN
  173.   
  174. PROCEDURE top_itm
  175.   GO TOP
  176.   DO show_itm
  177.   RETURN
  178.   * EOF
  179.