Ocenite etot tekst:


DATABASE zawod
MAIN
DEFINE zapisx record like kadry.*
DEFINE  simw char (200), zapr char (300),fn  char (18)

OPEN form maxprim from "maxprim"
DISPLAY form maxprim            # vyvesti ekrannuyu formu

CONSTRUCT BY NAME simw ON kadry.* # Vvedenie kriteriev vybora
                                  # s ekrana
LET zapr="select * from kadry  where ",
simw clipped," order by tabnom "

MESSAGE simw
PREPARE selpr FROM zapr           # Izgotovlenie zaprosa
DECLARE qquer CURSOR FOR selpr    # Obฎyavlenie kursora dlya nego

DISPLAY "Ne zabud'te nazhat' CTRL-O" AT 2,40
PROMPT "Fajl, kuda vyvodit' otchet? ili CR, esli na ekran: "
                         FOR fn

IF length(fn)=0 then START REPORT kadryrep       # na ekran
else                 START REPORT kadryrep TO fn # v fajl
END IF

   # vypolnit' zapros i sbrosit' vybrannye stroki v otchet
   FOREACH qquer  into zapisx.*   # Ocherednuyu stroku iz kursora
   OUTPUT TO REPORT kadryrep(zapisx.*)  # pomestit' v otchet
   END FOREACH
FINISH REPORT kadryrep          # Vyvesti rezul'taty otcheta
END MAIN

REPORT kadryrep(z)
DEFINE nameceh like ceh.nameceh
DEFINE z record like kadry.*
   # nomerceh  int,          # nomer ceha
   # tabnom    serial,       # tabel'n. nomer
   # fio       char(20),     # familiya
   # dolvn     char(20),     # dolzhnost'
   # zarplata  money(16,2),  # zarplata
   # datarovd  date          # data rozhd.
        OUTPUT
left  margin 0
right margin 80
top   margin 0
bottom margin 0
page  length 23
       ORDER BY z.nomerceh, z.tabnom   # Uporyadochit'

                    FORMAT
PAGE HEADER
print "-------------------------------------------------------"
print "ceh|tab.nom|fio       |dolzhnost'   |zarplata| data rozhd"
print "_______________________________________________________"

ON EVERY ROW
 print  z.nomerceh using "##", column 4,z.tabnom using "#####",
 column 13,z.fio clipped,
 column 28,z.dolvn clipped,
 column 43,z.zarplata using "$####.##",
 column 53,z.datarovd using "dd-mm-yyyy"

BEFORE GROUP OF z.nomerceh
select @nameceh into nameceh from ceh where nomerceh=z.nomerceh
 skip to top of page
 skip 1 line
 print "Ceh   ",nameceh
 skip 1 line

AFTER GROUP OF  z.nomerceh
 need 2 lines
 print " V cehe ",nameceh clipped,2 spaces,
       group count(*) using "#####" ," chelovek, "
 print " Srednyaya zarplata ",
       group avg(z.zarplata) using "##### rub.## kop"

PAGE TRAILER
 print "zapolnena stranica nomer", pageno
 pause "nazhmite VVOD"

END REPORT
ญญญญญญญญญญญญญญญญญญญญญญญญญญญญญญญญญญญญญญญญญญญญญญญญญญญญญญญญญญญญญญญ

Vot chto uvidit na pol'zovatel' vo vremya raboty programmy:
+-------------------------------------------------------------+
|Ukazhite fajl, kuda vyvodit' otchet, ili CR, esli na ekran:    |
|                                 Ne zabud'te nazhat' CONTROL-O|
|                                                             |
|----------------------------------------------               |
|     ceh   [1:4] [                     ]                     |
| tab.nomer [           ]                                     |
| familiya   [*ov                 ]                            |
| dolzhnost' [                    ]                            |
| zarplata  [>500         ]                                   |
|data rozhdeniya [          ]                                   |
|                                                             |
|                                                             |
nomerceh between 1 and 4 and fio matches "*o*" and zarplata>500
|                                                             |
+-------------------------------------------------------------+

---------------------------------------------------------------
ceh|tab.nom|fio            |dolzhnost'     |zarplata| data rozhd
_______________________________________________________________

Ceh   direkciya

 1    34    ivanov         direktor       $ 4000.00
 1    35    kononov        zav. po snabzheniyu$ 4000.00
 V cehe direkciya      2 chelovek,
 Srednyaya zarplata   4000 rub.00 kop


zapolnena stranica nomer          1
nazhmite VVOD
---------------------------------------------------------------
ceh|tab.nom|fio            |dolzhnost'     |zarplata| data rozhd
_______________________________________________________________

Ceh   litejnyj

 2    12    okunev         rabochij        $ 2000.00
 2    14    lipko          laborant       $ 2000.00
 2    18    puhov          master         $ 2000.00
 2    21    suhov          rabochij        $ 2000.00
 2    24    ugol'kov       rabochij        $ 2000.00
 V cehe litejnyj      5 chelovek,
 Srednyaya zarplata   2000 rub.00 kop

zapolnena stranica nomer          2
nazhmite VVOD
---------------------------------------------------------------
ceh|tab.nom|fio            |dolzhnost'     |zarplata| data rozhd
_______________________________________________________________

Ceh   garazh

 4     9    potruev        slesar'        $ 1230.00
 4    12    gundosov       shofer          $ 2000.00
 V cehe garazh      2 chelovek,
 Srednyaya zarplata   1615 rub.00 kop


zapolnena stranica nomer          3
nazhmite VVOD

Last-modified: Wed, 17 Apr 1996 04:45:13 GMT
Ocenite etot tekst: