home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a013 / 1.ddi / SAMPLES.EXE / T_SELVAL.PRG < prev    next >
Encoding:
Text File  |  1991-01-25  |  3.8 KB  |  137 lines

  1. *****************************************************************
  2. * Test program for SELVALUE function -  FILE T_SELVAL.PRG
  3. *****************************************************************
  4.  
  5. * Copyright(c) 1991 -- James Occhiogrosso
  6.  
  7. * Demonstrates use of selection values before running a report
  8.  
  9.  
  10. INITGLOBAL()
  11. SETCOLOR(colstd)
  12.  
  13. * Open the selection database
  14. SELECT 0
  15. USE ITFILE
  16.  
  17. * Initialize memory variables
  18. INITVARS()
  19.  
  20. DO WHILE .T.
  21.     CLEAR
  22.     CENTERON(12, 'Selection value demonstration. Proceed? Y/N  ')
  23.     @ 12, COL() - 2 say ''
  24.     IF .NOT. OPCONFIRM()
  25.         EXIT
  26.     ENDIF
  27.  
  28.     * Select database to use before calling SELVALUE
  29.     SELECT ITFILE
  30.  
  31.     * Call SELVALUE to allow operator to enter selection values.
  32.     temp_file = SELVALUE("itfile_say", "itfile_get")
  33.  
  34.     * Check for error condition or operator abort.
  35.     IF EMPTY(temp_file)
  36.         CENTERON(24, 'Aborted! ' + hitanykey)
  37.         INKEY(0)
  38.         LOOP
  39.     ELSE
  40.         CENTERON(24, 'The temporary file is ' + temp_file + ;
  41.                      ' ' + hitanykey)
  42.         INKEY(0)
  43.  
  44.         /********************************************************
  45.         * Code to run your report goes here. Your report should
  46.         * use the temporary file and index. It file is open and
  47.         * selected in current area. A standard PRG file or a FRM
  48.         * report can be used.
  49.         */*******************************************************
  50.  
  51.         * Close the temporary file
  52.         USE
  53.  
  54.         * Erase the temporary DBF and index files
  55.  
  56.         ERASE (temp_file)
  57.         temp_file = SUBSTR(temp_file, 1, 8) + INDEXEXT()
  58.         ERASE (temp_file)
  59.  
  60.         * Check for a temporary DBT file. If it exists, erase it
  61.         temp_file = SUBSTR(temp_file, 1, 8) + '.DBT'
  62.         IF FILE(temp_file)
  63.             ERASE (temp_file)
  64.         ENDIF
  65.     ENDIF
  66. ENDDO
  67.  
  68. FREEVARS()
  69. CLOSE DATABASES
  70. RETURN NIL
  71.  
  72. /****************************************************************
  73. The procedures below are sample SAY and GET procedures to pass
  74. to SELVALUE.  You may include any number of fields. For best
  75. appearance, do not write below line 18. SELVALUE writes messages
  76. from line 20 to line 24.
  77. ****************************************************************/
  78.  
  79.  
  80. *****************************************************************
  81. PROCEDURE ITFILE_SAY  
  82. *****************************************************************
  83. *
  84. * A typical display procedure to pass to SELVALUE
  85.  
  86. @  2, 16 SAY 'MAIN INQUIRY FILE -- SELECTION VALUE SCREEN'
  87. @  3, 16 SAY REPLICATE('▀', 43)
  88. @  5,  1 SAY '  Entry Date: '
  89. @  5, 55 SAY 'General Category: '
  90. @  8,  1 SAY '  Company Name: '
  91. @  9,  1 SAY '       Address: '
  92. @ 10,  1 SAY '       Address: '
  93. @ 11,  1 SAY '          City: '
  94. @ 11, 38 SAY 'State: '
  95. @ 11, 61 SAY 'Zip: '
  96. @ 12,  1 SAY '  Contact Last: '
  97. @ 12, 33 SAY 'First '
  98. @ 12, 57 SAY 'PHONE: '
  99. @ 14,  1 SAY '  Last mailing: '
  100. @ 14, 27 SAY 'Number of mailings:   '
  101. @ 14, 54 SAY 'Last Contact: '
  102. @ 15,  1 SAY '  Inquiry date: '
  103. @ 15, 27 SAY 'Follow up date: '
  104. @ 15, 54 SAY 'Print Label? Y/N  '
  105.  
  106. @ 1, 0 TO 18, 79 DOUBLE
  107. RETURN
  108.  
  109. *****************************************************************
  110. PROCEDURE ITFILE_GET       
  111. *****************************************************************
  112.  
  113. *  A typical GET procedure to pass to SELVALUE
  114.  
  115. @ 5,  15 GET mentry
  116. @ 5,  73 GET mfileid PICTURE "99"
  117. @ 8,  17 GET mcompany
  118. @ 9,  17 GET maddres1
  119. @ 10, 17 GET maddres2
  120. @ 11, 17 GET mcity
  121. @ 11, 45 GET mstate PICTURE "@! "
  122. @ 11, 66 GET mzip PICTURE "@! "
  123. @ 12, 17 GET mlname
  124. @ 12, 39 GET mfname
  125. @ 12, 64 GET mphone PICTURE "999-999-9999"
  126. @ 14, 17 GET mlstmail
  127. @ 14, 49 GET mmailno PICTURE  '@Z 99'
  128. @ 14, 68 GET mlstsale
  129. @ 15, 17 GET minqdate
  130. @ 15, 43 GET mfoldate
  131. @ 15, 72 GET mprnlabl PICTURE "Y"
  132.  
  133. RETURN
  134.  
  135.  
  136.  
  137.