{ File = MROOT2.INC -- Include file for Reliance Mailing List Copyright (c) 1986 William Meacham, All Rights Reserved Revised: 3/7/86 } procedure clear_display ; { write spaces over data input area on screen } begin write_str(blanks,14,3) ; { First name } write_str(blanks,14,4) ; { Last name } write_real(0.0,wid,frac,65,4) ; { Last amount } write_str(null_date_str,67,5) ; { Last date } write_str(blanks,14,6) ; { Title } write_real(0.0,wid,frac,65,6) ; { Total amount } write_str(blanks,14,7) ; { Salutation } write_str(blanks,14,9) ; { Address 1 } write_bool(false,74,9) ; { Category 1 } write_str(blanks,14,10) ; { Address 2 } write_bool(false,74,10) ; { Category 2 } write_str(blanks,14,11) ; { City } write_bool(false,74,11) ; { Category 3 } write_str(' ',14,12) ; { State } write_str(' ',28,12) ; { Zip code } write_bool(false,74,12) ; { Category 4 } write_bool(false,74,13) ; { Category 5 } write_str(copy(blanks,1,14),14,14) ; { Home phone } write_str(' ',41,14) ; { Precinct } write_bool(false,74,14) ; { Category 6 } write_str(blanks,14,15) ; { Work phone } write_bool(false,74,15) ; { Category 7 } write_bool(false,74,16) ; { Category 8 } clrline (1,23) ; clrline (1,24) end ; { --- Procedure clear_display --- } { ----------------------------------------------------------- } procedure clear_master ; { assign null values to all of master record } begin with master do begin status := 0 ; last_name := '' ; frst_name := '' ; title := '' ; salutation := '' ; addr1 := '' ; addr2 := '' ; city := '' ; state := '' ; zip := '' ; home_phon := '' ; work_phon := '' ; precinct := '' ; last_amt := 0.0 ; last_date := null_date ; tot_amt := 0.0 ; flags := 0 end end ; { proc clear_master } { ----------------------------------------------------------- } procedure display_master ; { write master record on screen } begin with master do begin write_str(frst_name,14,3) ; write_str(last_name,14,4) ; write_real(last_amt,wid,frac,65,4) ; write_date(last_date,67,5) ; write_str(title,14,6) ; write_real(tot_amt,wid,frac,65,6) ; write_str(salutation,14,7) ; write_str(addr1,14,9) ; write_bool(tstbit(flags,0),74,9) ; { category 1 } write_str(addr2,14,10) ; write_bool(tstbit(flags,1),74,10) ; { category 2 } write_str(city,14,11) ; write_bool(tstbit(flags,2),74,11) ; { category 3 } write_str(state,14,12) ; write_str(zip,28,12) ; write_bool(tstbit(flags,3),74,12) ; { category 4 } write_bool(tstbit(flags,4),74,13) ; { category 5 } write_str(home_phon,14,14) ; write_str(precinct,41,14) ; write_bool(tstbit(flags,5),74,14) ; { category 6 } write_str(work_phon,14,15) ; write_bool(tstbit(flags,6),74,15) ; { category 7 } write_bool(tstbit(flags,7),74,16) { category 8 } end { with } end ; { proc display_master } { ----------------------------------------------------------- } procedure input_master ; { Gets name and address information from console. } var i : integer ; procedure check_amounts ; begin if greater (master.last_amt,master.tot_amt) then begin show_msg ('LAST AMOUNT MAY NOT EXCEED TOTAL AMOUNT') ; fld := 13 end end ; { proc greater_error } begin { proc input_master } display_master ; fld := 1 ; with master do begin for i := 1 to 8 do cat[i] := tstbit(flags,i-1) ; { determine values of flags } repeat case fld of 1: read_str(frst_name,18,14,3) ; 2: begin read_str(last_name,30,14,4) ; if (fld > 2) and not(fld = maxint) and (last_name = '') then begin beep ; fld := 2 end end ; { 1 } 3: read_str(title,9,14,6) ; 4: read_str(salutation,11,14,7) ; 5: read_str(addr1,25,14,9) ; 6: read_str(addr2,25,14,10) ; 7: read_str(city,23,14,11) ; 8: read_str(state,2,14,12) ; 9: read_str(zip,9,28,12) ; 10: read_str(home_phon,14,14,14) ; 11: read_str(work_phon,14,14,15) ; 12: read_str(precinct,3,41,14) ; 13: read_real(last_amt,wid,frac,65,4) ; 14: read_date(last_date,67,5) ; 15: begin read_real(tot_amt,wid,frac,65,6) ; if (fld > 15) and (fld < maxint) then check_amounts end ; 16 .. 23: begin i := fld-15 ; read_bool (cat[i],74,i+8) ; if cat[i] then { assign values to flags } setbit(flags,i-1) else clrbit(flags,i-1) end ; 24: pause end ; { case } if fld < 1 then fld := 1 else if (fld > 99) and (fld < maxint) then { page forward } begin { edit for valid data } if last_name = '' then begin beep ; fld := 2 end else if not (valid_date(last_date)) then begin beep ; fld := 14 end else begin check_amounts ; if not (fld = 13) then fld := 24 { if edits OK, make page forward } end { stick on the Pause } end until (fld > 24) end { with } end ; { --- Procedure input_master --- } { ----------------------------------------------------------- } procedure select (var which : prt_criterion ; var sort : sort_criterion ; opt : option) ; { select which names to print or count and how to sort them } var i, sort_choice, prevfld, savefld : integer ; begin clrscr ; write_str ('SELECT FOR OUTPUT',32,1) ; write_str ('1 All the names',6,3) ; write_str ('5 Those who have contributed',38,3) ; write_str ('2 Only certain categories',6,4) ; write_str ('since a certain date',42,4) ; write_str ('3 One precinct',6,5) ; write_str ('6 Those whose total contribution',38,5) ; write_str ('4 One zip code',6,6) ; write_str ('is at least a certain amount',42,6) ; write_str ('==>',38,8) ; mask := 0 ; pcinct := '' ; zipcode := '' ; lastdt := null_date ; contrib := 0.0 ; sort := name ; sort_choice := 0 ; choice := 0 ; fld := 1 ; repeat case fld of 1 : begin for i := 10 to 24 do clrline (1,i) ; repeat read_int(choice,1,42,8) ; if not (choice in [1..6]) then begin choice := 0 ; if not (fld = maxint) then fld := 1 end ; if (fld > 1) and (fld < maxint) then fld := 2 until (choice in [1..6]) or (fld = maxint) ; case choice of 1 : which := all ; 2 : which := pcat ; 3 : which := pct ; 4 : which := pzip ; 5 : which := dt ; 6 : which := amt end ; { case } prevfld := 1 end ; { 1 } 2 : begin for i := 19 to 24 do clrline (1,i) ; case which of all : if prevfld < 2 then fld := 3 else fld := 1 ; pcat : begin write_str ('Selection categories',24,10) ; for i := 1 to 8 do begin write_int (i,1,26,10+i) ; write (concat(' ',scr.cat_name[i])) ; cat[i] := tstbit(mask,i-1) ; write_bool (cat[i],51,10+i) end ; savefld := fld ; fld := 1 ; repeat case fld of 1..8 : begin i := fld ; read_bool (cat[i],51,10+i) ; if cat[i] then setbit(mask,i-1) else clrbit(mask,i-1) end ; { 1..8 } end ; { case fld of } until (fld < 1) or (fld > 8) ; if fld < 1 then fld := pred(savefld) else if not (fld = maxint) then fld := succ(savefld) ; end ; { pcat } pct : begin write_str ('Precinct:',38,10) ; read_str (pcinct,3,48,10) end ; { pct } pzip : begin write_str ('Zip code:',38,10) ; read_str (zipcode,9,48,10) end ; { pzip } dt : begin write_str ('Date:',38,10) ; read_date (lastdt,45,10) end ; { dt } amt : begin write_str ('Amount:',38,10) ; read_real (contrib,wid,frac,47,10) end ; { amt } end ; { case } if (fld > 2) and (fld < maxint) then fld := 3 ; prevfld := 2 end ; { 2 } 3 : begin for i := 22 to 24 do clrline (1,i) ; if opt = count then begin if prevfld < 3 then fld := 4 else fld := 2 end else begin write_str ('SORT BY: 1 Last name',24,20) ; write_str ('2 Zip code ==>',34,21) ; repeat read_int (sort_choice,1,53,21) ; if not (sort_choice in [1..2]) then begin sort_choice := 0 ; if (fld > prevfld) then fld := 3 end ; if (fld > 3) and (fld < maxint) then fld := 4 ; until (sort_choice in [1..2]) or (fld < 3) or (fld = maxint) ; if sort_choice = 1 then sort := name else sort := szip ; end ; { else } prevfld := 3 end ; { 3 } 4 : begin if (opt = list) then write_str ('PUT PLAIN PAPER IN THE PRINTER . . .',23,23) else if (opt = labels) then write_str ('PUT LABELS IN THE PRINTER . . .',25,23) ; pause ; prevfld := 4 end ; { 4 } end ; { case } if fld < 1 then fld := 1 ; until (fld > 4) end ; { proc select } { ---- EOF FILE MROOT2.INC ---------------------------------- }