Document Outlines 
The receipt documents have an optional Document Outline screen. This feature is located in the Document section. If you use this function, you can define a different outline, such as controlling the type of lines that appear on the receipt.
Note
The only sections that you do not have control over are the header and footer. Those are always printed first and last respectively.
The Document Outline screen allows the top-level forms to be listed in the order that you want them printed. If you do not use this feature, the current ordering is unchanged.
A document represents a complete output, usually a receipt. The document consists of several forms. These forms begin with a period and are followed with the form name, such as in the following example:
.lineitem
The contents of the form are listed immediately below and are followed by another form. In this example, there are two forms:
.lineitem
%code%||%price%
.nonmerch
%description%||%price%
Top-level forms are forms that are there called out by the document processing engine. When working with these, no other forms in the document are processed explicitly and if other forms exist that are not accessible, they are ignored. In the following example, the . aspecialitem form is never processed as the document processing engine does not know when to call it, nor is the form referenced by any other form:
.lineitem
%code% %description%||%price%
.nonmerch
%description%||%price%
.aspecialitem
!! %description% !! ||%price
Sub-forms are ways to incorporate non-top-level forms into a document, but they must always be referenced. In the . aspecialitem example that is referenced above, this form can be displayed if the code variable has a value of 9999. In this case, the contents of the .lineitem form itself is skipped completely.
.lineitem,code<>9999,onfail=aspecialitem
%code% %description%||%price%
.nonmerch
%description%||%price%
.aspecialitem
!! %description% !! ||%price
When using the .insert directive, it allows you to specify content by a form name. For example, a common subform is processed by both lineitem and nonmerch with the .insert directive. After the inserted form is done, it returns back to the calling form in case there is more text to add. The .nonmerch form must have the .insert of the form immediately following.
In this example, with the $0.00 price, it also prints the word FREE.
Example
As soon as the document processing engine sees a new form definition, the current one— in this case .nonmerch — ends.
.lineitem
%code% %description%||%price%
.insert special detail
.nonmerch
%description%||%price%
.insert special detail
.special detail,~nocurrency(%price%)=0.00,onfail=nospecialdetail
||!! FREE !!
.nospecialdetail
This background information must be sufficient to understand the changes that take place in using the document outline feature.
This section describes how to use the document outline feature by stepping through an example. Using the top-level forms provided in the system, you can create a receipt that lists all items first, all non-merchandise items, and then department sale items, as follows:
lineitem,nonmerch,department
subtotal
taxline
tenderline
total
changeline
detailcount
To allow for partially using the original order, you can specify multiple forms on a single line. The effect is that all lines belonging to any of the forms specified are listed in the order that they were originally processed; that is, the order in which they were originally entered into the sale.
lineitem,nonmerch,department
subtotal
taxline
tenderline
total
changeline
detailcount
In addition to listing the form names in the sequence that they must appear, exclusions can be specified that move matching lines to a different place in the document order, and ensure that they are not included with nonmatching lines. For example:
lineitem,nonmerch,department would not print DEPOSIT nonmerchandise here since we have lineitem broken down below, those items with the department variable set to Beer/Related would not show up either
move lineitem (department=Beer),footer=beerfooter list all items within a department
variable set to Beer
move lineitem(department=Related) list all items with a department
variable set to Related
tenderline
subtotal
taxline would not print LEVY taxes here
move nonmerch(code=DEPOSIT),footer=depositfooter,sum(price)
move taxline(code=LEVY)
total
move detailcount(code=DEPOSIT),form=depositcount
use the .depositcount form instead of .detailcount
move detailcount(code=LEVY),form=levycount
move detailcount(code=BEER),form=beercount
detailcount displays full count, so this likely will not be included.
For the above example, in the Document Detail screen, include the following:
.depositfooter
||----------
||%sum_price%
where sum_price is the sum of prices variables
available in each DEPOSIT nonmerchandise line
.depositcount
||__________
||%count% provides a count of the lines that had a code of DEPOSIT.
In this last example, several new constructs have been added.
move lineitem(department=Beer)
This adds an exclusion from normal processing. That is, all line items are processed where they were originally unless they match the criteria specified. If they match the criteria specified, then they are moved to where the exclusion is specified. In the example, this is whenever the department variable’s value is Beer. Exclusions are processed as they are found in the Outline definition.
The criteria can be a list of multiple comma-separated conditions — in which case all conditions are required — or the key word OR can be used to signify that multiple conditions can be met to satisfy the exclusion. For example:
move lineitem(department=Beer,code=123)
move lineitem(department=Beer OR department=Ice)
There are cases where these exclusions need their own headers and footers, and possibly even form definition. Three parameters are available to do this:
move lineitem(department=Beer),header=beer header,form=beerform,footer=beerfooter.
In the Document Detail screen, you can include the following:
.beer header
|BEER begins|
.beerform
BEER: %code% %description%||%price%
.beerfooter
|BEER ends|
To perform rudimentary arithmetic in a subfooter or subheader, use the following two variables:
nonmerch(code=DEPOSIT),footer=depositfooter,sum(price)
In the Document Detail screen, include the following:
.depositfooter
----------||---------
Items %count%||%sum_price% there must be a matching sum(price) in the Outline. %count% provides a count of the lines that have a code of DEPOSIT.
Note
%sum_A% (where A is an existing numeric variable) adds the contents of the specified variable from each line that is moved to the subform. The value is properly formatted with the currency symbol. There must be a matching sum(A) (where A is an existing numeric variable) added to the actual Outline line to generate the summed value as a separate variable before going into the document processor.
%count% provides a count of the number of items that are moved to the subform. It counts quantity sales appropriately. For example, if a line with a quantity of 2 and a line with a quantity of 1 were moved to the subform, the ~count() value is 3.
If there are cases where you want to remove a line from appearing in the document. The remove option removes all named forms if any (or all) other forms satisfy given conditions.
Example
in remove subtotal(ifall,form=discountdetail,description=King OR description=Ruby) remove subtotal(ifany,form-discountdetail,description=King OR description=Ruby) the subtotal form is removed if there are any (or all) discountdetail forms where the description is King or Ruby.
There are cases where you would want to duplicate a line in two different places. For example, a tender can have a standard output, as well as being represented by other text or graphics later in the document. To do this, we introduce the concept of copying lines. The syntax is similar to an exclusion, but the original instance of the line is not removed.
copy tenderline(code=Cash OR code=GC),sum(amount),form=noform, footer=dobitmaps.
In this example, at the position of the outline detail, the form dobitmaps is added, and it has a variable %sum_amount% available, which is the sum of the %amount% variable in each individual line that meets the condition specified. The original line is also displayed where the tenderline is listed.