home *** CD-ROM | disk | FTP | other *** search
- <<* Prorepo.inc *>>
-
- <<procedure GenReportBody>>
- <<begin>>
- <<genln>>
-
- * --- Procedure to process reports
-
- PROCEDURE {fileprefix}_repo
- PRIVATE savrecnum,okcancel,done
- savrecnum = RECNO()
- SAVE SCREEN TO mscreen
- okcancel = 0
- done = .F.
- mreport = .T.
-
- * --- Loop to create and activate a menu containing the report options
-
- mtview = SYS(3)+'.TMP'
- CREATE VIEW &mtview
-
- DO WHILE .T.
- choice = 3
- ACTIVATE WINDOW menter
- @ 0,14 to 8,27
- @ 1,5 SAY 'Report: '
- @ 1,15 PROMPT ' Create '
- @ 3,15 PROMPT ' Modify '
- @ 5,15 PROMPT ' Print '
- @ 7,15 PROMPT ' Exit '
- MENU TO choice
- IF choice = 0
- choice = 4
- ENDIF
- DEACTIVATE WINDOW menter
- DO CASE
-
- * --- Exit this procedure
- CASE choice = 4
- EXIT
-
- * --- Create a report
- CASE choice = 1
- << filespec( fmain,fpath,fname,fext ) >>
- filename = PUTFILE('Report File to Create:',{'}{fname}{'}+'.frx','frx')
- IF LEN(TRIM(filename)) <> 0
- CREATE REPORT &filename
- DEACTIVATE WINDOW ALL
- ENDIF
-
- * --- Modify an existing report file
- CASE choice = 2
- filename = GETFILE('FRX','Report File to Modify:')
- IF LEN(TRIM(filename)) <> 0
- MODIFY REPORT &filename
- DEACTIVATE WINDOW ALL
- ENDIF
-
- * --- Print an existing report definition file
- CASE choice = 3
- filename = GETFILE('FRX','Report File to Print:')
- IF LEN(TRIM(filename)) <> 0
- DO {fileprefix}_rprnt
- ENDIF
- ENDCASE
- ENDDO
- SET VIEW TO &mtview
- DELETE FILE (mtview)
-
- * --- Return to the previous record before using this procedure
- DEACTIVATE WINDOW ALL
- ** JRW
- IF savrecnum > 0
- GOTO savrecnum
- ENDIF
- RETURN
-
- * --- Procedure used to print labels and reports
-
- PROCEDURE {fileprefix}_rprnt
- DIMENSION mper(3)
- STORE ' ' TO mper,cper
- mper(1) = CHR(249)
- IF .NOT. FILE(TRIM(filename))
- DO alert WITH msg_nofile
- RETURN
- ENDIF
- expr2 = ''
- mcond = '.T.'
-
- * --- Loop that creates and activates the label and report destination
-
- DO WHILE .T.
- okcancel = 6
- ACTIVATE WINDOW menter2
- @ 0,13 TO 6,47
- @ 1,5 SAY 'PRINT: '
- @ 1,15 PROMPT '('+mper(1)+') Printer '
- @ 3,15 PROMPT '('+mper(2)+') Screen '
- @ 5,15 PROMPT '('+mper(3)+') Text file'
- @ 1,35 PROMPT '['+cper+'] For '
- @ 3,35 PROMPT '< Cancel >'
- @ 5,35 PROMPT CHR(174)+' OK '+CHR(175)
- @ 8,1 SAY 'FOR: '
- IF mcond <> '.T.'
- @ 8,7 SAY expr2
- ENDIF
- MENU TO okcancel
- DO CASE
-
- * --- Cancel print process
- CASE okcancel = 5 .or. okcancel = 0
- DEACTIVATE WINDOW menter2
- RETURN
-
- * --- Ok chosen, print the labels or report
- CASE okcancel = 6
- EXIT
-
- * --- Select conditions for the labels or report
- CASE okcancel = 4
- GETEXPR 'Create Logical Expression:' TO expr2 TYPE 'L;Must be a Logical Expression' DEFAULT expr
- IF '' == TRIM(expr2)
- cper = ' '
- mcond = '.T.'
- ELSE
- cper = 'X'
- mcond = expr2
- ENDIF
- @ 8,5 CLEAR
- @ 9,0 CLEAR
-
- * --- Specify output device
- OTHERWISE
- mper = ' '
- mper(okcancel) = CHR(249)
- ENDCASE
- ENDDO
- DEACTIVATE WINDOW menter2
- DO CASE
-
- * --- Send labels or report to a text file
- CASE mper(3) = CHR(249)
- file2 = PUTFILE('Output File to Create:',{'}{fname}{'}+'.txt','txt')
- IF LEN(TRIM(file2)) <> 0
- SET PRINTER TO &file2
- DO working WITH .T.
- CREATE VIEW temp
- IF mreport
- REPORT FORM &filename FOR &mcond TO PRINT OFF ENVIRONMENT
- ELSE
- LABEL FORM &filename FOR &mcond TO PRINT OFF ENVIRONMENT
- ENDIF
- SET VIEW TO temp
- DO working WITH .F.
- SET PRINTER TO
- MODIFY FILE &file2
- DEACTIVATE WINDOW ALL
- ENDIF
-
- * --- Send labels or reports to the printer
- CASE mper(1) = CHR(249)
- DO working WITH .T.
- CREATE VIEW temp
- IF mreport
- REPORT FORM &filename FOR &mcond TO PRINT OFF ENVIRONMENT
- ELSE
- LABEL FORM &filename FOR &mcond TO PRINT OFF ENVIRONMENT
- ENDIF
- SET VIEW TO temp
- DO working with .F.
-
- * --- Send labels or reports to the screen
- CASE mper(2) = CHR(249)
- DEFINE WINDOW output FROM 1,0 TO 23,79 DOUBLE SHADOW TITLE 'OUTPUT' COLOR SCHEME 8
- ACTIVATE WINDOW output
- CREATE VIEW temp
- IF mreport
- REPORT FORM &filename FOR &mcond ENVIRONMENT
- ELSE
- LABEL FORM &filename FOR &mcond ENVIRONMENT
- ENDIF
- SET VIEW TO temp
- WAIT
- DEACTIVATE WINDOW output
- ENDCASE
- DEACTIVATE WINDOW ALL
- RETURN
- <<end>> <<*Prorepo.inc*>>
-
-