SIMPLE1 - invoice rule set

Top  Previous  Next

 

This is the first example of an invoice rule set, found in simple.rul.  To produce this example:

 

uf100c –i sample1.txt –f simple.rul –p pdf –o client:simple1.pdf

 

 

A title header prefixes all rule sets, which is just a unique name enclosed in brackets.

[simple1]

 

 

Detect statements are used to identify this form from any other report that the application might send to the printer through UnForm.  Unlike most form packages, UnForm doesn't dedicate a printer name to a particular form (though it can be configured to do so).  Instead, it reads the first page of data, then compares it to the detect statements found in the various rule sets in the rule file.

 

The detect statements below indicate that

* a date (mm/dd/yy format) followed by 2 spaces, followed by 7 more characters will appear at column 61, row 5
*6 characters will appear at column 9, row 11
*a date, a space, and 6 characters will appear at column 10, row 21

 

detect 61,5,"~../../..  ......."        # invoice date and #

detect 9,11,"~......"                   # customer code

detect 10,21,"~../../.. ......"         # ord date and cust code

 

 

The following lines define that the dimensions of the page are 80 columns by 66 rows.  All positioning will be based on 80 columns and 66 rows appearing within the printed margins of the page.

 

cols 80                                 # max output columns

rows 66                                 # max output rows

 

The header section draws a box around the entire form with a cbox command, then adds a logo and some header text.  The" \n" character sequence represents a line break, so you can print a column of text easily.  All the text commands are using the univers font, which is standard in all supported laser printers and which maps to Helvetica in PDF output.

 

# header section

cbox .5,.5,80.5,66.5,5

image 1,1,12,6,"sdsilogo.pcl"

text 15,2,"Company Name",univers,14,bold

text 15,3,"Company Address\nCompany City, St Zipcode\nCompany Phone",univers,12,bold

text 15,6,"Web: www.myweb.com\nEmail: sales@myweb.com",univers,11,bold

text 70,2,"INVOICE",univers,16,bold

 

 

The upper right of the form contains a box with grid lines and some title text, placed around the existing text supplied from the input stream (in this example, the file sample1.txt).  The cbox command draws an outer box using the primary dimensions, and then adds internal horizontal lines at rows 6 and 8, and internal vertical lines at columns 69 and 78.  The second row simply duplicates the bottom row, but adds 20% shading between rows 6 and 8.
 
Additional heading and box sections are drawn in a similar manner, for the remainder of the form.  All the drawing simply adds details on top of, or around, the input data stream.

 

# invoice # section

cbox 60,4,80.5,8,crows=6 8::20,ccols=69 78

text 61,7,"Date",univers,italic,10

text 70,7,"Invoice #",univers,italic,10

text 79,7,"Pg",univers,italic,10

 

# bill to / ship to section

cbox .5,10,80.5,18.5,5,ccols=7::20 43.5 50::20

text 2,11,"Sold To",cgtimes,italic,10

text 45,11,"Ship To",cgtimes,italic,10

 

# ribbon section

cbox .5,18.5,80.5,22.5,5,crows=20.5::20,ccols=9 18 25 65

# special internal grid in ribbon box

cbox 29,18.5,65,21.5

cbox 42,18.5,56,21.5

text 1,19,"Order\nNumber",univers,italic,10

text 10,19,"Order\nDate",univers,italic,10

text 19,19,"Cust.\nNumber",univers,italic,10

text 26,19,"Sls\nPrs",univers,italic,10

text 30,19,"Purchase\nOrder No.",univers,italic,10

text 43,19,"\nShip Via",univers,italic,10

text 57,19,"Ship\nDate",univers,italic,10

text 66,19,"\nTerms",univers,10,italic

 

# detail section

cbox .5,22.5,80.5,56.5,5,crows=24.5::10,ccols=5 10 16 51 55 69

text 1,23,"Qty\nOrd",univers,italic,10

text 6,23,"Qty\nShip",univers,italic,10

text 11,23,"Qty\nBkord",univers,10,italic

text 17,23,"\nItem & Description",univers,italic,10

text 52,23,"\nU/M",univers,italic,10

text 56,23,"Unit\nPrice",univers,italic,10

text 70,23,"Extended\nPrice",univers,italic,10

 

# footer section

cbox 57,57,80.5,65,crows=59 63,ccols=69::20

text 58,58,"Sales Amt",univers,11

text 58,61,"Sales Tax",univers,11

text 58,62,"Freight",univers,11

text 58,64.25,"TOTAL",univers,bold,14