Keystone Forms: Difference between revisions
m (1 revision imported)  | 
				No edit summary  | 
				||
| Line 208: | Line 208: | ||
</PRE>  | </PRE>  | ||
===Conditions===  | |||
Conditions can be used to change the printed form logic, based on a field or form conditional value (Example 1.) When using "IF" with a field, the form will run the logic if the field is '''not''' null or zero (Example 2.)  | |||
You can nest "IF" statements with "ELSE" to do multiple condition checks (Example 3.) Insert the first "IF" condition, then use "ELSE" followed by another "IF" statement. Note: If "ELSE" is on the same line as "IF" it will give unintended results.  | |||
<PRE>  | |||
!EXAMPLE 1 -- Print "INTERNAL USE ONLY" if COND_INTERNAL is met.  | |||
IF COND_INTERNAL  | |||
COLUMN 8 TEXT INTERNAL USE ONLY  | |||
ENDIF  | |||
!EXAMPLE 2 -- Print UNIT_PRICE, if UNIT_PRICE is not null or zero.  | |||
IF UNIT_PRICE  | |||
COLUMN 16 FIELD UNIT_PRICE  | |||
ENDIF  | |||
!EXAMPLE 3 -- Print PRODUCT_COST if COND_INTERNAL is met, otherwise print UNIT_PCT_DISC if it is not null or zero. If COND_INTERNAL is not met and UNIT_PCT_DISC is null or zero, nothing will print.  | |||
!          -- Note that only ONE "ENDIF" is used despite the use of TWO "IF" statements.  | |||
IF COND_INTERNAL  | |||
COLUMN 70       FORMAT ####.000         FIELD PRODUCT_COST  | |||
ELSE  | |||
IF UNIT_PCT_DISC              | |||
COLUMN 70       RIGHT 8                 FIELD CALC_DISCOUNT  | |||
ENDIF  | |||
</PRE>  | |||
=== CHAIN command: Creating Multiple Forms ===  | === CHAIN command: Creating Multiple Forms ===  | ||
| Line 273: | Line 297: | ||
:[[Ticket Form Fields]]  | :[[Ticket Form Fields]]  | ||
:[[AP Check Form Fields]]  | :[[AP Check Form Fields]]  | ||
:[[Quote Form Fields]]  | |||
Revision as of 19:35, 25 June 2025
While forms can be stored in the customer directory (e.g. ...\cust\forms), this should only be done if the form is specific to a computer.  Custom Forms belong in the database.
Sections
Form Section
| Command | Purpose | Comment | Keystone Version | 
|---|---|---|---|
| BEGINCOPY n | apply block of form only for nth copy | applies to all form sections | 2.7.16 | 
| CHAIN name | the next form in the chain | ||
| COLUMNS n | number of columns on each form | used for labels | |
| COPIES n | number of copies of each form | ||
| CPI n | characters per inch | ||
| ENDCOPY | indicates end of COPY block | 2.7.16 | |
| FONTNAME name | default font for the form | ||
| LENGTH n | number of lines on the form | impacts automatic page breaks | |
| LINES n | number of lines for each label | used for labels | |
| LPI n | lines per inch | ||
| MARGIN top,left,bottom,right | specify page margins | default is no margins | 3.6.18.1 | 
| OPTION EXTEND_DETAIL | allow form detail to extend into footer area | 2.1.4 | |
| OPTION IMAGE_FIX | fix image drawing issue | some printers print border on right/bottom edge of images | 3.2.3.1 | 
| OPTION LANDSCAPE | force landscape orientation for the form | 2.6 | |
| OPTION SUMMARIZE_PRODUCTS | summarize product totals when printing invoices | 1.6.6 | |
| PDFPAGES n | ALL | number of PDF document pages to include on form | default is first page only | 4.3.9.10 | 
| PRINTER name | creates a virtual printer name | Keystone can map this name to a physical printer with different settings per user | |
| TITLE name | descriptive name of this form | some options display this to the user when selecting forms | |
| VERSION n | indicates the version number of the form | used for special processing by some Keystone options | 2.5.25 | 
| WIDTH n | number of columns on the form | increase as needed but keep in mind this will reduce the font size | 
Heading
Information that prints 1 time at the top of the form.
Alternate headings (e.g. "HEADING 4") are used in certain types of forms for special sections of a form.
Detail
Information that repeats for each line of detail.
Certain forms may have alternate detail lines with unique behavior. This could be an alternate type of detail or sub-detail. e.g. "DETAIL 2" on an invoice is used to print comments.
Total
Information that prints at the bottom of the form.
| Command | Purpose | Comment | Keystone Version | 
|---|---|---|---|
| NEWPAGE | Start new page on a form | Only verified for Total Section | 3.3.1 | 
Sample Total with a NEWPAGE:
TOTAL  
     LINE 42
COLUMN 41
     BOX 5,24,0,20
     BOX 5,24
     BOX 5,36
        LINE +1 COLUMN 44       TEXT SUB TOTAL
                COLUMN 65       FORMAT ######.00        FIELD CALC_SUBTOTAL
        LINE +1 COLUMN 44       TEXT SALES TAX-
                COLUMN 54  FIELD TAX_AUTHORITY
                COLUMN 65       FORMAT ######.00        FIELD CALC_SALESTAX
        LINE +1 COLUMN 44       TEXT TICKET TOTAL
                COLUMN 65       FORMAT ######.00        FIELD CALC_TICKETTOTAL
     NEWPAGE 
        LINE +2 COLUMN 1        
        LINE +1 COLUMN 30       TEXT *** WARNING ***
        LINE +1 COLUMN 10       TEXT Cement is not good for you and It doesn't taste very good.
        LINE +1 COLUMN 10       TEXT Do not eat cement or stuff made from cement.  Do not eat 
        LINE +1 COLUMN 10       TEXT Tide Pods either.
        LINE +1 COLUMN 1        LEFT IMAGE 2
! DoNotEatCement.jpg
        LINE +3 COLUMN 13       TEXT RECEIVED BY:
                COLUMN 26       TEXT ________________________________________
        LINE +2 COLUMN 1        
Working With Forms
Formats
        LINE +1 COLUMN 1        FORMAT mm/dd/yy         FIELD TICKET_DATE 
                COLUMN 10       RIGHT 7                 FIELD TICKET_NO
                COLUMN 18       FORMAT ####0.00         FIELD QTY_SOLD
                COLUMN 27                               FIELD UNIT_OF_MEASURE
- Date: The date April 5, 2018 with a format of mm/dd/yy will print as 04/05/2018, mm/dd/yyyy as 4/05/2018
 - Right/Left Slide text to the right or left of the designated space.
 - Numbers with # and 0: # is a placeholder that prints if needed. 0 will always print a value. Example: 403.25 printed with a format of ####0.00 prints as " 403.25", with a format of 00000.00 as "00403.25"
 
Comments
Lines that begin with a ! are comments. They can be removed as needed.
! AVAILABLE CALCULATED FIELDS ! ===========================
Images
In form Maintenance, select Load on the Images tab.
Load the image.
When Setting up the form, refer to the image by number. The following code places an image in column 3, scaled to be 12 characters wide:
LINE 2 COLUMN 3 LEFT 12 IMAGE 2
Conditions
Conditions can be used to change the printed form logic, based on a field or form conditional value (Example 1.) When using "IF" with a field, the form will run the logic if the field is not null or zero (Example 2.)
You can nest "IF" statements with "ELSE" to do multiple condition checks (Example 3.) Insert the first "IF" condition, then use "ELSE" followed by another "IF" statement. Note: If "ELSE" is on the same line as "IF" it will give unintended results.
!EXAMPLE 1 -- Print "INTERNAL USE ONLY" if COND_INTERNAL is met. IF COND_INTERNAL COLUMN 8 TEXT INTERNAL USE ONLY ENDIF !EXAMPLE 2 -- Print UNIT_PRICE, if UNIT_PRICE is not null or zero. IF UNIT_PRICE COLUMN 16 FIELD UNIT_PRICE ENDIF !EXAMPLE 3 -- Print PRODUCT_COST if COND_INTERNAL is met, otherwise print UNIT_PCT_DISC if it is not null or zero. If COND_INTERNAL is not met and UNIT_PCT_DISC is null or zero, nothing will print. ! -- Note that only ONE "ENDIF" is used despite the use of TWO "IF" statements. IF COND_INTERNAL COLUMN 70 FORMAT ####.000 FIELD PRODUCT_COST ELSE IF UNIT_PCT_DISC COLUMN 70 RIGHT 8 FIELD CALC_DISCOUNT ENDIF
CHAIN command: Creating Multiple Forms
The Chain command allows multiple forms to print at one time. These forms can be identical or unique, and can print to multiple printers.
The Chain command is used in the FORM section. Syntax: CHAIN [formname].FRM (e.g. CHAIN ARTCK.FRM)
In order to use multiple printers, make sure that the printer ALIAS is unique for each of the forms. Make sure to update the Plant to point to the correct form. Then in Ticket Printing/ Printer setup you can assign each alias to a printer.
When mixing a special form and a standard form, it is probably best to have the special form chain to the standard form. This prevents you from needing to create a new standard form and makes setting up the printers easier. The Printer setup develops the Alias list from the primary form for each plant. So if a special form with a unique alias is used as the primary form for a plant, then that Alias will appear on the list.
Bar Codes
Here is a section from a sample ticket form file that shows how to print barcodes on ticket forms.
NOTE that this should work in a similar way for dot-matrix (With EPSON emulation) and laser printers. However, for dot-matrix printers the only (currently) supported bar code format is Code 39. For laser/inkjet printers you must have a bar code font available on the printer, and you would specify that font name where you see “FONTNAME BARCODE39” in the sample below.
FORM
LENGTH 66       WIDTH 80        PRINTER ARTicket
     FONTNAME VERDANA
HEADING
     LINE 1     COLUMN 1                   
                FONTNAME BARCODE39
                     FORMAT 00000000      FIELD TICKET_NO                
                FONTNAME DEFAULT
     LINE 8     COLUMN 5                   FIELD PLANT_NO
           COLUMN 10  FORMAT #0":"00       FIELD TICKET_TIME
           COLUMN 30                       FIELD TRUCK_NO
           COLUMN 38                       FIELD DRIVER_NAME
           COLUMN 58  FORMAT MM/DD/YY      FIELD TICKET_DATE
           COLUMN 71                       
Boxes/Shading
The BOX command may be used in any form printing section (Heading, Detail, Total.) The syntax is as follows:
BOX Height, Width [,Weight [,Shading [,Color]]]
Example:
BOX 1,76,0,20,clYellow
Height and Width are expressed in printed characters.
Weight is optional (default is 8 pixels) and indicates the number of pixels for the box border. The border is drawn in the current COLOR setting (black is default.)
Shading is optional (default is no shading) and specifies the shading percentage (0-100.) Lower shading is brighter color, higher shading is darker color.
(Keystone 3.6.4.7+) Color is optional (default is black) and specifies the shading color. The borders are drawn in the current font color.
When Color is black it is treated as white internally, meaning that a lower shading will tend toward white (no shading) while a higher shading will tend toward black.