home *** CD-ROM | disk | FTP | other *** search
/ ftp.update.uu.se / ftp.update.uu.se.2014.03.zip / ftp.update.uu.se / pub / rainbow / msdos / decus / RB139 / mail20r.lzh / MROOT2.INC < prev    next >
Text File  |  1988-10-11  |  13KB  |  352 lines

  1. { File = MROOT2.INC -- Include file for Reliance Mailing List
  2.     Copyright (c) 1986 William Meacham, All Rights Reserved
  3.     Revised: 3/7/86 }
  4.  
  5. {Revised by David P. Maroun on 11-Oct-1988.}
  6.  
  7. procedure clear_display ;
  8.   { write spaces over data input area on screen }
  9.     begin
  10.       write_str(blanks,14,3) ;         { First name }
  11.       write_str(blanks,14,4) ;         { Last name }
  12.       write_real(0.0,wid,frac,65,4) ;  { Last amount }
  13.       write_str(null_date_str,67,5) ;  { Last date }
  14.       write_str(blanks,14,6) ;         { Title }
  15.       write_real(0.0,wid,frac,65,6) ;   { Total amount }
  16.       write_str(blanks,14,7) ;         { Salutation }
  17.       write_str(blanks,14,9) ;         { Address 1 }
  18.       write_bool(false,74,9) ;         { Category 1 }
  19.       write_str(blanks,14,10) ;        { Address 2 }
  20.       write_bool(false,74,10) ;        { Category 2 }
  21.       write_str(blanks,14,11) ;        { City }
  22.       write_bool(false,74,11) ;        { Category 3 }
  23.       write_str('   ',14,12) ;          { State }
  24.       write_str('         ',29,12) ;   { Zip code }
  25.       write_bool(false,74,12) ;        { Category 4 }
  26.       write_bool(false,74,13) ;        { Category 5 }
  27.       write_str(copy(blanks,1,14),14,14) ; { Home phone }
  28.       write_str('   ',41,14) ;         { Precinct }
  29.       write_bool(false,74,14) ;        { Category 6 }
  30.       write_str(blanks,14,15) ;        { Work phone }
  31.       write_bool(false,74,15) ;        { Category 7 }
  32.       write_bool(false,74,16) ;        { Category 8 }
  33.       clrline (1,23) ;
  34.       clrline (1,24)
  35.     end ; { --- Procedure clear_display --- }
  36.  
  37. { ----------------------------------------------------------- }
  38.  
  39. procedure clear_master ;
  40.   { assign null values to all of master record }
  41. begin
  42.   with master do
  43.     begin
  44.       status     := 0 ;
  45.       last_name  := '' ;
  46.       frst_name  := '' ;
  47.       title      := '' ;
  48.       salutation := '' ;
  49.       addr1      := '' ;
  50.       addr2      := '' ;
  51.       city       := '' ;
  52.       state      := '' ;
  53.       zip        := '' ;
  54.       home_phon  := '' ;
  55.       work_phon  := '' ;
  56.       precinct   := '' ;
  57.       last_amt   := 0.0 ;
  58.       last_date  := null_date ;
  59.       tot_amt    := 0.0 ;
  60.       flags      := 0
  61.     end
  62. end ; { proc clear_master }
  63.  
  64. { ----------------------------------------------------------- }
  65.  
  66. procedure display_master ;
  67.   { write master record on screen }
  68. begin
  69.   with master do
  70.     begin
  71.       write_str(frst_name,14,3) ;
  72.       write_str(last_name,14,4) ;
  73.       write_real(last_amt,wid,frac,65,4) ;
  74.       write_date(last_date,67,5) ;
  75.       write_str(title,14,6) ;
  76.       write_real(tot_amt,wid,frac,65,6) ;
  77.       write_str(salutation,14,7) ;
  78.       write_str(addr1,14,9) ;
  79.       write_bool(tstbit(flags,0),74,9) ;   { category 1 }
  80.       write_str(addr2,14,10) ;
  81.       write_bool(tstbit(flags,1),74,10) ;  { category 2 }
  82.       write_str(city,14,11) ;
  83.       write_bool(tstbit(flags,2),74,11) ;  { category 3 }
  84.       write_str(state,14,12) ;
  85.       write_str(zip,29,12) ;
  86.       write_bool(tstbit(flags,3),74,12) ;  { category 4 }
  87.       write_bool(tstbit(flags,4),74,13) ;  { category 5 }
  88.       write_str(home_phon,14,14) ;
  89.       write_str(precinct,41,14) ;
  90.       write_bool(tstbit(flags,5),74,14) ;  { category 6 }
  91.       write_str(work_phon,14,15) ;
  92.       write_bool(tstbit(flags,6),74,15) ;  { category 7 }
  93.       write_bool(tstbit(flags,7),74,16)    { category 8 }
  94.     end { with }
  95. end ;  { proc display_master }
  96.  
  97. { ----------------------------------------------------------- }
  98.  
  99. procedure input_master ;
  100.   { Gets name and address information from console. }
  101. var
  102.     i : integer ;
  103.  
  104. procedure check_amounts ;
  105.   begin
  106.     if greater (master.last_amt,master.tot_amt) then
  107.       begin
  108.         show_msg ('LAST AMOUNT MAY NOT EXCEED TOTAL AMOUNT') ;
  109.         fld := 13
  110.       end
  111.   end ;  { proc greater_error }
  112.  
  113. begin { proc input_master }
  114.     display_master ;
  115.     fld := 1 ;
  116.     with master do
  117.       begin
  118.         for i := 1 to 8 do
  119.             cat[i] := tstbit(flags,i-1) ;  { determine values of flags }
  120.         repeat
  121.           case fld of
  122.             1:   read_str(frst_name,18,14,3) ;
  123.             2: begin
  124.                  read_str(last_name,30,14,4) ;
  125.                  if  (fld > 2)
  126.                  and not(fld = maxint)
  127.                  and (last_name = '') then
  128.                    begin
  129.                      beep ;
  130.                      fld := 2
  131.                    end
  132.                end ; { 1 }
  133.             3:   read_str(title,9,14,6) ;
  134.             4:   read_str(salutation,11,14,7) ;
  135.             5:   read_str(addr1,25,14,9) ;
  136.             6:   read_str(addr2,25,14,10) ;
  137.             7:   read_str(city,23,14,11) ;
  138.             8:   read_str(state,3,14,12) ;
  139.             9:   read_str(zip,9,29,12) ;
  140.             10:  read_str(home_phon,14,14,14) ;
  141.             11:  read_str(work_phon,14,14,15) ;
  142.             12:  read_str(precinct,3,41,14) ;
  143.             13:  read_real(last_amt,wid,frac,65,4) ;
  144.             14:  read_date(last_date,67,5) ;
  145.             15:  begin
  146.                    read_real(tot_amt,wid,frac,65,6) ;
  147.                    if (fld > 15) and (fld < maxint) then
  148.                        check_amounts
  149.                  end ;
  150.             16 .. 23:
  151.                begin
  152.                  i := fld-15 ;
  153.                  read_bool (cat[i],74,i+8) ;
  154.                  if cat[i] then                 { assign values to flags }
  155.                      setbit(flags,i-1)
  156.                  else
  157.                      clrbit(flags,i-1)
  158.                end ;
  159.             24: pause
  160.           end ; { case }
  161.  
  162.           if fld < 1 then
  163.               fld := 1
  164.           else if (fld > 99) and (fld < maxint) then  { page forward }
  165.             begin                                     { edit for valid data }
  166.               if last_name = '' then
  167.                 begin
  168.                   beep ;
  169.                   fld := 2
  170.                 end
  171.               else if not (valid_date(last_date)) then
  172.                 begin
  173.                   beep ;
  174.                   fld := 14
  175.                 end
  176.               else
  177.                 begin
  178.                   check_amounts ;
  179.                   if not (fld = 13) then
  180.                       fld := 24           { if edits OK, make page forward }
  181.                 end                       { stick on the Pause }
  182.             end
  183.         until (fld > 24)
  184.       end { with }
  185. end ; { --- Procedure input_master --- }
  186.  
  187. { ----------------------------------------------------------- }
  188.  
  189. procedure select (var which : prt_criterion ;
  190.                   var sort  : sort_criterion ;
  191.                       opt   : option) ;
  192.   { select which names to print or count and how to sort them }
  193.  
  194. var
  195.     i,
  196.     sort_choice,
  197.     prevfld,
  198.     savefld      : integer ;
  199.  
  200.   begin
  201.     clrscr ;
  202.     write_str ('SELECT FOR OUTPUT',32,1) ;
  203.     write_str ('1   All the names',6,3) ;
  204.     write_str ('5   Those who have contributed',38,3) ;
  205.     write_str ('2   Only certain categories',6,4) ;
  206.     write_str ('since a certain date',42,4) ;
  207.     write_str ('3   One precinct',6,5) ;
  208.     write_str ('6   Those whose total contribution',38,5) ;
  209.     write_str ('4   One zip code',6,6) ;
  210.     write_str ('is at least a certain amount',42,6) ;
  211.     write_str ('==>',38,8) ;
  212.     mask := 0 ;
  213.     pcinct := '' ;
  214.     zipcode := '' ;
  215.     lastdt := null_date ;
  216.     contrib := 0.0 ;
  217.     sort := name ;
  218.     sort_choice := 0 ;
  219.     choice := 0 ;
  220.     fld := 1 ;
  221.     repeat
  222.         case fld of
  223.           1 : begin
  224.                 for i := 10 to 24 do
  225.                     clrline (1,i) ;
  226.                 repeat
  227.                     read_int(choice,1,42,8) ;
  228.                     if not (choice in [1..6]) then
  229.                       begin
  230.                         choice := 0 ;
  231.                         if not (fld = maxint) then
  232.                             fld := 1
  233.                       end ;
  234.                     if (fld > 1) and (fld < maxint) then
  235.                         fld := 2
  236.                 until (choice in [1..6]) or (fld = maxint) ;
  237.                 case choice of
  238.                   1 : which := all ;
  239.                   2 : which := pcat ;
  240.                   3 : which := pct ;
  241.                   4 : which := pzip ;
  242.                   5 : which := dt ;
  243.                   6 : which := amt
  244.                 end ; { case }
  245.                 prevfld := 1
  246.               end ; { 1 }
  247.           2 : begin
  248.                 for i := 19 to 24 do
  249.                     clrline (1,i) ;
  250.                 case which of
  251.                   all  : if prevfld < 2 then
  252.                              fld := 3
  253.                          else
  254.                              fld := 1 ;
  255.                   pcat : begin
  256.                            write_str ('Selection categories',24,10) ;
  257.                            for i := 1 to 8 do
  258.                                begin
  259.                                   write_int (i,1,26,10+i) ;
  260.                                   write (concat(' ',scr.cat_name[i])) ;
  261.                                   cat[i] := tstbit(mask,i-1) ;
  262.                                   write_bool (cat[i],51,10+i)
  263.                                end ;
  264.                            savefld := fld ;
  265.                            fld := 1 ;
  266.                            repeat
  267.                                case fld of
  268.                                  1..8 : begin
  269.                                           i := fld ;
  270.                                           read_bool (cat[i],51,10+i) ;
  271.                                           if cat[i] then
  272.                                               setbit(mask,i-1)
  273.                                           else
  274.                                               clrbit(mask,i-1)
  275.                                         end ; { 1..8 }
  276.                                end ; { case fld of }
  277.                            until (fld < 1) or (fld > 8) ;
  278.                            if fld < 1 then
  279.                                fld := pred(savefld)
  280.                            else if not (fld = maxint) then
  281.                                fld := succ(savefld) ;
  282.                          end ; { pcat }
  283.                   pct  : begin
  284.                            write_str ('Precinct:',38,10) ;
  285.                            read_str (pcinct,3,48,10)
  286.                          end ; { pct }
  287.                   pzip : begin
  288.                            write_str ('Zip code:',38,10) ;
  289.                            read_str (zipcode,9,48,10)
  290.                          end ; { pzip }
  291.                   dt   : begin
  292.                            write_str ('Date:',38,10) ;
  293.                            read_date (lastdt,45,10)
  294.                          end ; { dt }
  295.                   amt  : begin
  296.                            write_str ('Amount:',38,10) ;
  297.                            read_real (contrib,wid,frac,47,10)
  298.                          end ; { amt }
  299.                 end ; { case }
  300.                 if (fld > 2) and (fld < maxint) then
  301.                     fld := 3 ;
  302.                 prevfld := 2
  303.               end ; { 2 }
  304.           3 : begin
  305.                 for i := 22 to 24 do
  306.                     clrline (1,i) ;
  307.                 if opt = count then
  308.                   begin
  309.                     if prevfld < 3 then
  310.                         fld := 4
  311.                     else
  312.                         fld := 2
  313.                   end
  314.                 else
  315.                   begin
  316.                     write_str ('SORT BY:  1 Last name',24,20) ;
  317.                     write_str ('2 Zip code     ==>',34,21) ;
  318.                     repeat
  319.                         read_int (sort_choice,1,53,21) ;
  320.                         if not (sort_choice in [1..2]) then
  321.                           begin
  322.                             sort_choice := 0 ;
  323.                             if (fld > prevfld) then
  324.                                 fld := 3
  325.                           end ;
  326.                         if (fld > 3) and (fld < maxint) then
  327.                             fld := 4 ;
  328.                     until (sort_choice in [1..2])
  329.                        or (fld < 3)
  330.                        or (fld = maxint) ;
  331.                     if sort_choice = 1 then
  332.                         sort := name
  333.                     else
  334.                         sort := szip ;
  335.                   end ; { else }
  336.                 prevfld := 3
  337.               end ; { 3 }
  338.           4 : begin
  339.                 if (opt = list) then
  340.                     write_str ('PUT PLAIN PAPER IN THE PRINTER . . .',23,23)
  341.                 else if (opt = labels) then
  342.                     write_str ('PUT LABELS IN THE PRINTER . . .',25,23) ;
  343.                 pause ;
  344.                 prevfld := 4
  345.               end ; { 4 }
  346.         end ; { case }
  347.         if fld < 1 then fld := 1 ;
  348.     until (fld > 4)
  349.   end ; { proc select }
  350.  
  351. { ---- EOF FILE MROOT2.INC ---------------------------------- }
  352.