...
- In the manager station, go to Options > Printing > Documents and Layouts.
In our example, we will edit the receipt layout, but you may edit any other layout. - Go to the Client payment section. Right-click on the Receipt layout and select New (as copy) Printing Layout.
- Name the new layout and change the status to Active. Save the changes.
- In the Basic section, click on the Layout line, then on three dots
- The layout editor will open.
Let's take a closer look at what the check layout consists of:- A Sheet is a page on which all the receipt elements are located. Elements are shown in different colours only in the editor, the receipt is printed in black and white.
- A Band is a section with a specific dataset. Inside the band, you can operate only with data from the dataset.
- A Memo is an active element where various data can be added. You can add a simple text or a variable from a dataset. Variables areenclosed in square brackets. A memo is placed inside a band.
The sizes of bends and memos can be changed by dragging and dropping their borders. Also, you can move the band by holding it down with the left mouse button and dragging it to the desired location.
We will describe the properties of each element in more detail below.
There are two tabs on the right side of the layout editor:- Assistant — displays available datasets
- Properties — displays the properties of the selected layout element.
- Now you can go directly to editing the layout:
Expand | ||
---|---|---|
| ||
|
...
Anchor | ||||
---|---|---|---|---|
|
The layout editor is equipped with a built-in script editor, which has a syntax similar to Pascal with some limitations. Scripts can be applied to a memo (the lower part of the memo editor), sheet, band, depending on where the script is placed (it affects the code triggering time): the sheet is executed first, then the band, and then the memo of this band.
Properties
...
Common for
...
All Elements
- Visible
To show object or not. The script is executed regardless of whether the object is visible or not. - Name
The name of the object. This name is used to access the object in scripts. - Tag
This property has no predefined purpose. Used at the discretion of layout developers in scripts. - Script
The script text. It is written in a Pascal-like language, the syntax is that of Pascal. It has no access to arrays and pointers. The script can contain local variables, which are declared at the beginning of the script using the var construction. The script has access to all layout objects — pages, bands, and memos. The script can change the properties of layout objects. The data source fields are accessed by means of the [DateSet.FieldName] construction. Each script is executed twice: the first time at the stage of the layout preliminary calculation, the second at the stage of generation. You can find out at what stage you are now using the Report.Stage variable, which takes the following values: stPrecalc (preliminary calculation), stShowing (generation).
...
The report layout consists of one or more sheets. Sheets are processed and printed sequentially, independently of each other, the order of output is from left to right. Each sheet contains its own set of service bands: Report title, Header, Footer, and Report summary.
Sheet
...
Properties
- Fixed Height
A fixed paper height. Specifies the maximum number of lines on the printed page. After reaching this number of lines, a new page will be started. In the case of a slip-on printer, a message about inserting a new sheet of paper will appear. In the case of a roller printer, the paper will be cut. - Variables
A list of variables common for all layout sheets. This editor describes the global variables of the layout. Global variables can be accessed from any layout script, in contrast to local variables, which are available only within the script where they are declared. - Parameters
A list of parameters common for all layout sheets. Datasets initially contain data for all stations, waiters, cashiers, etc. Parameters are used in order to build a report only for a specific employee. Before printing the report at the cash station, the user is asked to set values for parameters, and the report is built taking into account these restrictions. Report parameters work like filters for datasets. When developing a layout, a list of its parameters is set. Each parameter is described by the following properties:
...
- New Page
If true, then after the printing of all the page bends is completed, the paper cut command will be inserted (for roller printers only; for slip printers, this command is ignored). - Two Passes
If true, then when building the layout, the scripts are executed twice: the first time with Report.Stage = stPrecalc, the second with Report.Stage = stShowing. Two passes are needed for the script to make such report changes that will require the report regeneration. For example, when you change the grouping or sorting of the band from this band script.
...
Band
...
As mentioned above, each band has its own dataset. After creating a band, using a double click, you can bind the required dataset to it, with which you can later work within this band.
Bands are placed on sheets or nested in other bands. Bands are divided into bands with data sources and bands without data sources (service bands). Service bands include the following types:
...
A band can modify the content of its data source by sorting, filtering, and rearranging it. This is done by using the Filter, Group, and Sort properties. The order of properties processing: first, a filter is applied to the data source — a band filter and a filter based on the report parameters — and after that the resulting data source is grouped and then sorted.
Band
...
Properties
- DataSet Name
The data source linked with the band - Filter
The script text, used to apply the filter to the data source. It is written in a pascal-like language. The script is applied to every line of the data source. The essence of the script is to set the Filter variable to true for those rows of the data source that should remain in the final dataset. Example: Filter: = ([Exclude Income] = 1). Only those rows will remain in the data source where the Excl.Income field was 1. - Sort Order
The set of fields by which the sorting of the data source linked with the band is performed - Grouping
Grouping specifies the set of fields by which the original data source is grouped. Summation is performed for the rest of the fields, i.e. aggregates are counted.
...
Category
Any field of the data source can act as a category. The category is processed as follows: first, unique values are determined for the specified field, then a band is printed for each received value. Each time a band is printed, a filter of the type Category = Value is applied to the data source. For example, if you specify Currency Group as the category, then the Payment data source will be printed as follows:Currency
Order
Guests
Sum
Nat. Sum
Credit cards
Master card
1/4
5
100
100
Cash
Rubles
1/2
2
300
300
Euro
1/3
3
20
700
Rubles
1/5
2
500
500
Rubles
1/2
2
200
200
- Calculated Fields
Using this property, you can add calculated fields to the band dataset. You need to add calculated fields in order to group or sort by fields that are not present in the dataset but can be calculated based on its fields. Each calculated field is described by the following properties:
...
Header
A band header. Is printed first. It is characterized by the following properties:Colored
Печать содержимого колонтитула с выделением цветом. Работает, если принтер поддерживает инверсионную печать
Double Height
Двойная высота печати содержимого колонтитула
Double Width
Двойная ширина печати содержимого колонтитула
Show Empty Lines
Флаг определяет, печатать или нет пустые строки
Size
Высота колонтитула в строчках. Если 0, секция не печатается
Prints the contents of the header and footer with color highlighting. Works if the printer supports inversion printing!
...
Printing the header and footer contents with color highlighting. Works if the printer supports inversion printing
Double Height
Double print height of header and footer content
Double Width
Double print
...
width of the header and footer content
...
Show Empty Lines
The flag determines whether to print
...
empty lines or not
...
Size
Header/footer height in lines. If 0, no section is printed
- Body
...
- A band body, displayed after printing the Header. The content of the band body is printed as many times as
...
- how many records
...
- the
...
- dataset contains. Band body properties are the same as header properties.
- Footer
...
- A band footer, displayed after the Header and Body of the band. The properties of the footer are the same as those of the header.
- Behavior
...
- — Show Empty
A flag indicating whether to display a band if there are no records in the data source
...
- linked with the band. By default, such bands are not displayed, even if they have a Header or Footer set.
- Before Start
A script that is executed before starting band processing. - After Finish
A script that is executed after the end of band processing. - Script
A script that is executed for each line of the data source, just before printing it. - XML Section
Used to export a printed document to XML. When exporting, the lines generated by this band will go to the section with the specified name. By default, the section name is the same as the data source name.
Memo
With In the help of a memo, individual separate fields of the data source or any text are can be displayed. Data source field names (variables) are enclosed in square brackets.
After the dataset is tied to the band, a memo can be placed inside this band. Variables from the dataset are inserted inside these memo, so the required dataset will be printed in the report.
image2021-5-8_10-56-19.png
It is important to understand that variables from a dataset can only be used within your its own band.
Memo
...
Properties
- Alignment
Specifies whether the text is aligned left,
...
- right, or
...
- centered.
- Content
Contains the text to be printed. To print fields from a data source, the field names must be enclosed in square brackets: [FieldName]. To print a field from another data source that is not
...
- linked to the band in which the memo is
...
- placed, you need to use the [DataSourceName.FieldName] construction. To print escape sequences, you need to use the <EscapeCommand> construct. The list of escape commands will be given below. The number of fields that can be displayed using one memo is not limited.
- Format
Specifies the variable format
...
- (number, date, time, other).
- Hide zeros
- Alternative language
- Word wrap
Enable auto-wrap. - XML Attributes
XML class
XML tag
Filter
...
Setting Example
Let's assume that you need to set up filtering of the Dish in the bill by category. It should look something like this:
Code Block |
---|
[Classification] |
...
[Category1] |
...
Dish1 Dish2 Dish3 Total for category: [priceamount] [Категория2] Dish4 Dish5 Dish6 Total for category: [priceamount] Total for classification |
Solution:
- Add a calculated field with the required classification to the dish
...
- band (f.ex., the Category field)
- Set
...
- Category = Category for the band
- Group
...
- the band by the Category field
- Add another
...
- band of dishes to the
...
- band
- Add the same calculated field to the nested band and set the same grouping
- The field for displaying the dish name must be added to the nested band, the field for the category name — to the external one.