6 Example Report Programs

Example 1

The following program is an example of how the Eloquence Report Writer statements can be used to produce a report. This program accesses a file which is sorted first by division (Div$) and second by the department (Dept$).

10    !   This program accesses the file "INV" for data.
20    !   The data is output in a report.
30    !
40    !   Report Description Section
50    !
60 Inv:       REPORT HEADER USING R_head
70            GRAND TOTALS ON Qty*Price
80            PAGE LENGTH 66
100           BREAK 1 WHEN Div$ CHANGES
110           BREAK 3 WHEN Dept$ CHANGES
120   !
130           PAGE HEADER USING P_head;Date$
140                PRINT USING P_2hd
150           PAGE TRAILER WITH 2 LINES USING P_trail;NUMPAGE
160   !
170           HEADER 1
180             TOTALS ON Qty*Price
190             PRINT USING P_head1;Div$
200           TRAILER 1 USING P_trail1;OLDCV$(1),TOTAL(1,1)
210   !
220           HEADER 3 USING P_head3
230             TOTALS ON Qty*Price
240           TRAILER 3 WITH 2 LINES USING P_trail3;OLDCV$(3),
TOTAL(3,1)
250   !
260           REPORT TRAILER WITH 5 LINES USING R_trail;TOTAL(0,1),
TOTAL(0,1)/NUMBREAK(1)
265             PRINT USING R_2tr:AVG(0,1)
270   !
280           END REPORT DESCRIPTION
290   !
300   !
310   !
320           PRINT "ENTER DATA AS MM/DD/YY"
330           INPUT Date$
340           PRINTER IS 0
350           ASSIGN #1 TO "INV,FILES"
360           READ #1,1;X
370   !
380   !
390   !
400   !       Report Execution Section
410   !
420   !
430           BEGIN REPORT Inv
440           FOR I=2 TO X
450               READ #1,I;C$
460               Div$=C$[1,2]          ! Set value for BREAK 1
470               Dept$=C$[3,4]         ! Set value for BREAK 3
480               Part$=C$[5,9]
490               Qty=VAL(C$[10,12])
500               Price=VAL(C$[13,17])
510   !
520               DETAIL LINE 1 USING D_line1;Part$,Qty,Price,Qty*Price
530   !
540           NEXT I
550           END REPORT
560           PRINTER IS 8
570   !
580   !       Line Image Section
590   !
600 R_head:       IMAGE 20X,"XYZ COMPANY INVENTORY",2/
610   !
620 P_head:       IMAGE 60X,8A,2/,10X,"PART",9X,"QUANTY",10X,
"UNIT",/,9X,"NUMBER",8X,"ON HAND",9X,"PRICE",8X,"VALUE,/
630 P_2hd:        IMAGE 9X,"======",8X,"========",8X,"=====",8X,"====="
640   !
650 P_trail:      IMAGE 60X,"PAGE",X,2D
660   !
670 P_head1:      IMAGE /,2A,2X,"DIVISION"
680   !
690 P_trail1:      IMAGE ,22X,"TOTAL",X,2A,X,"DIVISION",6X,
DCDDDCDDDPDD,/47X,10("-")
700   !
710 P_head3:      IMAGE /
720   !
730 P_trail3:     IMAGE /,22X,"TOTAL DEPT",2A,9X,DDCDDDCDDDPDD,/,
46X,"----------"
740   !
750 R_trail:      IMAGE 2/,22X,"TOTAL COMPANY"10X,DCDDDCDDDPDD,
/22X,"AVG PER", "DIVISION",7X,DCDDDCDDDPDD
755 R_2tr:        IMAGE 22X,"AVG PER ITEM",11X,DCDDDCDDDPDD
760   !
770 D_line1:      IMAGE 9X,8A,8X,DCDDD,5X,DDCDDDPDD,3X,DDDCDDDPDD
780   !
790    END
                             XYZ COMPANY INVENTORY

                                                                      4/25/91

        PART           QUANTY               UNIT
        NUMBER         ON HAND              PRICE          VALUE

        ======         ========             =====          =====

AA DIVISION
        A-123              15               41.15               617.25
        K-573             125               10.90             1,362.50
        B-115             982                  75               736.50
        B-125              99               37.50             3,712.50

                       TOTAL DEPT 1                           6,428.75
                                                           -----------

        A-111             782                1.99             1,556.18
        D-286             306                5.28             4,783.68
        N-742              94               28.67             2,694.92
        A-524             120                  44                52.80

                       TOTAL DEPT 2                           9,087.64
                                                           -----------

        K-419             668                9.03             6,032.04

                       TOTAL DEPT 3                           6,032.04
                                                           -----------
                       TOTAL AA DIVISION                     21,548.43
                                                            ----------

BB DIVISION
        F-395              50               78.75             3,937.50
        C-974             225                  32                72.00
        J-156              12              108.05             1,296.60
        K-238              41               97.87             4,012.67

                       TOTAL DEPT 1                           9,318.77
                                                           -----------
                       TOTAL BB DIVISION                      9,318.77
                                                            ----------


                       TOTAL COMPANY                         30,867.20
                       AVG PER DIVISION                      15,433.60
                       AVG PER ITEM                           2,374.40

                                                                       PAGE 1


Eloquence Report Manual - 19 DEC 2002