home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a070 / 3.ddi / FOXPRO / TEMPLGEN / PROREPO.INC < prev    next >
Encoding:
Text File  |  1989-11-03  |  5.0 KB  |  191 lines

  1. <<* Prorepo.inc *>>
  2.  
  3. <<procedure GenReportBody>>
  4. <<begin>>
  5. <<genln>>
  6.  
  7. * --- Procedure to process reports
  8.  
  9. PROCEDURE {fileprefix}_repo
  10. PRIVATE savrecnum,okcancel,done
  11. savrecnum = RECNO()
  12. SAVE SCREEN TO mscreen
  13. okcancel = 0  
  14. done = .F. 
  15. mreport = .T. 
  16.  
  17. * ---  Loop to create and activate a menu containing the report options
  18.  
  19. mtview = SYS(3)+'.TMP'
  20. CREATE VIEW &mtview
  21.  
  22. DO WHILE .T.
  23.     choice = 3 
  24.     ACTIVATE WINDOW menter
  25.     @ 0,14 to 8,27
  26.     @ 1,5 SAY 'Report: '
  27.     @ 1,15 PROMPT '  Create   '
  28.     @ 3,15 PROMPT '  Modify   '
  29.     @ 5,15 PROMPT '  Print    '
  30.     @ 7,15 PROMPT '  Exit     '
  31.     MENU TO choice
  32.     IF choice = 0
  33.         choice = 4
  34.     ENDIF
  35.     DEACTIVATE WINDOW menter
  36.     DO CASE 
  37.  
  38.         * --- Exit this procedure
  39.         CASE choice = 4     
  40.             EXIT
  41.  
  42.         * --- Create a report
  43.         CASE choice = 1
  44. <<    filespec( fmain,fpath,fname,fext )  >>
  45.             filename = PUTFILE('Report File to Create:',{'}{fname}{'}+'.frx','frx')
  46.             IF LEN(TRIM(filename)) <> 0
  47.                 CREATE REPORT &filename
  48.                 DEACTIVATE WINDOW ALL
  49.             ENDIF
  50.  
  51.         * --- Modify an existing report file
  52.         CASE choice = 2    
  53.             filename = GETFILE('FRX','Report File to Modify:')
  54.             IF LEN(TRIM(filename)) <> 0
  55.                 MODIFY REPORT &filename
  56.                 DEACTIVATE WINDOW ALL
  57.             ENDIF
  58.  
  59.         * --- Print an existing report definition file
  60.         CASE choice = 3
  61.             filename = GETFILE('FRX','Report File to Print:')
  62.             IF LEN(TRIM(filename)) <> 0
  63.                 DO {fileprefix}_rprnt
  64.             ENDIF
  65.      ENDCASE
  66. ENDDO
  67. SET VIEW TO &mtview
  68. DELETE FILE (mtview)
  69.  
  70. * --- Return to the previous record before using this procedure
  71. DEACTIVATE WINDOW ALL
  72. ** JRW
  73. IF savrecnum > 0
  74.     GOTO savrecnum
  75. ENDIF
  76. RETURN
  77.  
  78. * --- Procedure used to print labels and reports
  79.  
  80. PROCEDURE {fileprefix}_rprnt
  81. DIMENSION mper(3)
  82. STORE ' ' TO mper,cper
  83. mper(1) = CHR(249) 
  84. IF .NOT. FILE(TRIM(filename))
  85.     DO alert WITH msg_nofile
  86.     RETURN
  87. ENDIF
  88. expr2 = '' 
  89. mcond = '.T.' 
  90.  
  91. * --- Loop that creates and activates the label and report destination
  92.  
  93. DO WHILE .T.
  94.     okcancel = 6 
  95.     ACTIVATE WINDOW menter2
  96.     @ 0,13 TO 6,47
  97.     @ 1,5 SAY 'PRINT: '
  98.     @ 1,15 PROMPT '('+mper(1)+') Printer  '
  99.     @ 3,15 PROMPT '('+mper(2)+') Screen   '
  100.     @ 5,15 PROMPT '('+mper(3)+') Text file'
  101.     @ 1,35 PROMPT '['+cper+'] For    '
  102.     @ 3,35 PROMPT '< Cancel  >'
  103.     @ 5,35 PROMPT CHR(174)+'   OK    '+CHR(175)
  104.     @ 8,1 SAY 'FOR: '
  105.     IF mcond <> '.T.'
  106.         @ 8,7 SAY expr2
  107.     ENDIF
  108.     MENU TO okcancel
  109.     DO CASE
  110.  
  111.         * --- Cancel print process
  112.         CASE okcancel = 5 .or. okcancel = 0
  113.             DEACTIVATE WINDOW menter2
  114.             RETURN
  115.  
  116.         * --- Ok chosen,  print the labels or report
  117.         CASE okcancel = 6
  118.             EXIT
  119.  
  120.         * --- Select conditions for the labels or report
  121.         CASE okcancel = 4
  122.             GETEXPR 'Create Logical Expression:' TO expr2 TYPE 'L;Must be a Logical Expression' DEFAULT expr
  123.             IF '' == TRIM(expr2)
  124.                 cper = ' '
  125.                 mcond = '.T.'
  126.             ELSE
  127.                 cper = 'X'
  128.                 mcond = expr2 
  129.             ENDIF
  130.             @ 8,5 CLEAR
  131.             @ 9,0 CLEAR
  132.  
  133.         * --- Specify output device
  134.         OTHERWISE
  135.             mper = ' ' 
  136.             mper(okcancel) = CHR(249) 
  137.     ENDCASE
  138. ENDDO
  139. DEACTIVATE WINDOW menter2
  140. DO CASE            
  141.  
  142.    * --- Send labels or report to a text file
  143.    CASE mper(3) = CHR(249)  
  144.        file2 = PUTFILE('Output File to Create:',{'}{fname}{'}+'.txt','txt')
  145.        IF LEN(TRIM(file2)) <> 0
  146.            SET PRINTER TO &file2
  147.            DO working WITH .T.
  148.            CREATE VIEW temp
  149.            IF mreport
  150.                REPORT FORM &filename FOR &mcond TO PRINT OFF ENVIRONMENT
  151.            ELSE
  152.                LABEL FORM &filename FOR &mcond TO PRINT OFF ENVIRONMENT
  153.            ENDIF
  154.            SET VIEW TO temp
  155.            DO working WITH .F.
  156.            SET PRINTER TO
  157.            MODIFY FILE &file2
  158.            DEACTIVATE WINDOW ALL
  159.        ENDIF
  160.  
  161.    * --- Send labels or reports to the printer
  162.    CASE mper(1)  = CHR(249)
  163.        DO working WITH .T.
  164.        CREATE VIEW temp
  165.        IF mreport
  166.            REPORT FORM &filename FOR &mcond TO PRINT OFF ENVIRONMENT
  167.        ELSE
  168.            LABEL FORM &filename FOR &mcond TO PRINT OFF ENVIRONMENT
  169.        ENDIF
  170.        SET VIEW TO temp
  171.        DO working with .F.
  172.  
  173.    * --- Send labels or reports to the screen
  174.    CASE mper(2) = CHR(249)
  175.        DEFINE WINDOW output FROM 1,0 TO 23,79 DOUBLE SHADOW TITLE 'OUTPUT'  COLOR SCHEME 8 
  176.        ACTIVATE WINDOW output
  177.        CREATE VIEW temp
  178.        IF mreport
  179.            REPORT FORM &filename FOR &mcond ENVIRONMENT
  180.        ELSE
  181.            LABEL FORM &filename FOR &mcond ENVIRONMENT
  182.        ENDIF
  183.        SET VIEW TO temp
  184.        WAIT
  185.        DEACTIVATE WINDOW output
  186. ENDCASE
  187. DEACTIVATE WINDOW ALL
  188. RETURN
  189. <<end>> <<*Prorepo.inc*>>
  190.  
  191.