home *** CD-ROM | disk | FTP | other *** search
- * Program.: LABELS.PRG
- * Author..: Luis A. Castro
- * Date....: 9/15/82, 12/14/83
- * Notice..: Copyright 1982 & 1983, Luis A. Castro, All Rights Reserved
- * Version.: dBASE II, version 2.4x
- * Notes...: Prints multi-column mailing labels.
- *
- SET TALK OFF
- SET BELL OFF
- SET COLON OFF
- * ---Initialize memory variables.
- STORE $(STR(0,133),1,132) TO blank,line1,line2,line3,line4
- STORE 1 TO uptotal
- STORE " " TO select
- STORE 30 TO upwidth
- STORE "Y" TO printer
- * ---Initialize macros.
- STORE [TRIM(City)+", "+TRIM(State)+" "+TRIM(Zip)] TO Macro
- STORE [line1+$(blank,1,upcount*upwidth-LEN(line1))] TO Mline1
- STORE [line2+$(blank,1,upcount*upwidth-LEN(line2))] TO Mline2
- STORE [line3+$(blank,1,upcount*upwidth-LEN(line3))] TO Mline3
- STORE [line4+$(blank,1,upcount*upwidth-LEN(line4))] TO Mline4
- * ---Display heading and enter parameters.
- ERASE
- @ 2, 0 SAY "P R I N T M A I L I N G L A B E L S"
- @ 2,72 SAY DATE()
- @ 3, 0 SAY "========================================"
- @ 3,40 SAY "========================================"
- @ 5, 0 SAY "Enter number of labels to go across ";
- GET uptotal PICTURE "9"
- READ
- * ---Test for uptotal values.
- DO CASE
- CASE uptotal = 0
- RETURN
- CASE uptotal > 4
- STORE 4 TO uptotal
- ENDCASE
- * ---Output to the screen or printer.
- @ 7,0 SAY "Output to the printer? [Y/N] " GET printer PICTURE "!"
- READ
- @ 8,0 SAY "Press <RETURN> to begin printing " GET select
- READ
- IF printer = "Y"
- SET CONSOLE OFF
- SET PRINT ON
- ELSE
- ERASE
- ENDIF
- * ---Open the datafile and begin printing labels.
- USE Names
- DO WHILE .NOT. EOF
- *
- * ---Store first column to output lines.
- STORE TRIM(Name) TO line1
- IF Company = " "
- STORE TRIM(Address) TO line2
- STORE &Macro TO line3
- STORE " " TO line4
- ELSE
- STORE TRIM(Company) TO line2
- STORE TRIM(Address) TO line3
- STORE &Macro TO line4
- ENDIF
- *
- * ---Store rest of columns to output lines.
- IF uptotal > 1
- SKIP
- ENDIF
- STORE 1 TO upcount
- DO WHILE .NOT. EOF .AND. upcount < uptotal
- STORE &Mline1+TRIM(Name) TO line1
- IF Company = " "
- STORE &Mline2+TRIM(Address) TO line2
- STORE &Mline3+&Macro TO line3
- ELSE
- STORE &Mline2+TRIM(Company) TO line2
- STORE &Mline3+TRIM(Address) TO line3
- STORE &Mline4+&Macro TO line4
- ENDIF
- STORE upcount+1 TO upcount
- IF upcount < uptotal
- SKIP
- ENDIF
- ENDDO while .not.eof.and.upcount<uptotal
- *
- * ---Print the contents of memvars line1,...,line4.
- ? line1
- ? line2
- ? line3
- ? line4
- ?
- ?
- *
- SKIP
- ENDDO while .not. eof
- *
- IF printer = "Y"
- SET PRINT OFF
- SET CONSOLE ON
- ENDIF
- ?
- ? "THAT'S ALL FOLKS..."
- SET COLON ON
- SET BELL ON
- SET TALK ON
- CLEAR
- RETURN
- * EOF: LABELS.PRG