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

  1. * ┌─────────────────────────────────────────────────────────────────────┐ *
  2. * │  INVSTOCK.PRG: INVENTORY LIST                                       │ *
  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. ACTIVATE WINDOW screensim
  8. @ 00,00 SAY WINTITLE(PROMPT())
  9.  
  10. * FILE HANDLING
  11. SELECT items
  12. IF EOF()
  13.   GO TOP
  14. ENDIF
  15.  
  16. DEFINE POPUP itemlist FROM 10,20 PROMPT FIELD item
  17. ON SELECTION POPUP itemlist DEACTIVATE POPUP
  18.  
  19. * INITIALIZE VARIABLES
  20. GO TOP
  21. STORE item TO start_item   && First item
  22. GO BOTTOM
  23. STORE item TO end_item     && Last item
  24. STORE 'PRINTER' TO output
  25. STORE .t. TO _box, _wrap, printing
  26. * Boxes, and word-wrapping ON.
  27. * Printing is a control variable to allow user to cancel the job.
  28.  
  29. STORE SET('MEMOWIDTH') TO memocols  && Save old setting
  30. SET MEMOWIDTH TO 40
  31.  
  32. * DEFINITIONS
  33. ON ESCAPE STORE .f. TO printing
  34.  
  35. * USER INPUT: SELECT RANGE TO PRINT
  36. @ 02,02 SAY 'Start with item #:    ' GET start_item VALID GETFIRST(start_item)
  37. @ 04,02 SAY '  End with item #:    ' GET end_item   VALID GETLAST(end_item) ;
  38. RANGE start_item,
  39. @ 06,02 SAY '  Direct report to: PRINTER/SCREEN: ' ;
  40. GET output PICTURE '@M PRINTER,SCREEN '
  41. READ
  42.  
  43. STORE .t. TO printing
  44. IF .NOT. YESNO("System is ready to run report.")
  45.   STORE .f. TO printing
  46. ELSE
  47.   IF output<> "SCREEN "
  48.     IF .NOT. READY2PR()
  49.       STORE .f. TO printing
  50.     ENDIF
  51.   ENDIF
  52. ENDIF
  53.  
  54. SEEK start_item
  55.  
  56. * PRINT REPORT
  57. IF printing
  58.   CLEAR
  59.   IF output = 'PRINTER'
  60.     REPORT FORM invstock REST TO PRINT NOEJECT WHILE item <= end_item .AND. printing
  61.   ELSE
  62.     REPORT FORM invstock REST TO FILE report.txt NOEJECT ;
  63.     WHILE item <= end_item .AND. printing
  64.     SELECT 0
  65.     USE system
  66.     LOCATE FOR LABEL = 'INVSTOCK: '
  67.     IF EOF()
  68.       APPEND BLANK
  69.     ELSE
  70.       REPLACE NEXT 1 contents WITH ''
  71.     ENDIF
  72.     REPLACE LABEL WITH 'INVSTOCK: '  + DTOC(DATE())
  73.     APPEND MEMO contents FROM report.txt
  74.     MODIFY MEMO contents NOEDIT WINDOW reportview
  75.     USE
  76.     SELECT invoice
  77.   ENDIF
  78.   DO standby WITH 'Your report request has been completed.'
  79. ELSE
  80.   DO standby WITH 'You have canceled this report.'
  81. ENDIF
  82. SET MEMOWIDTH TO memocols
  83. CLEAR
  84. DEACTIVATE WINDOW screensim
  85. RETURN
  86.  
  87. FUNCTION getfirst
  88.   PARAMETER an_item
  89.   SEEK an_item
  90.   DO WHILE .NOT. FOUND()
  91.     keyboard LEFT(an_item,1)
  92.     ACTIVATE POPUP itemlist
  93.     STORE PROMPT() TO start_item
  94.     SEEK start_item
  95.   ENDDO
  96.   RETURN .t.
  97.   
  98. FUNCTION getlast
  99.   PARAMETER an_item
  100.   SEEK an_item
  101.   DO WHILE .NOT. FOUND()
  102.     SET FILTER TO item >= start_item
  103.     keyboard LEFT(an_item,1)
  104.     ACTIVATE POPUP itemlist
  105.     STORE PROMPT() TO end_item
  106.     SEEK end_item
  107.   ENDDO
  108.   SET FILTER TO
  109.   RETURN .t.
  110.   
  111.   * EOF
  112.