Ticket layout functions
 
Function
Description
Custom or in VFP subset?
TICKETQTY(CHAR_VALUE)
 
Returns the tmp_inv.quantity and sets the printer to print the specified quantity.
Used only when designing a layout for the Cognitive printer. It extracts the quantity of tickets that the customer purchased on a single line item and prints that amount of identical tickets. The ticket designer types the data field name tmp_qty or a number between the parentheses to let the function know how many tickets to print.
 
Example:
If ten tickets or vouchers are sold on a single line item in Sales, ticketqty(tmp_qty) prints ten identical tickets. The following is an example of the first line of a Cognitive Ticket layout:
! 0 100 1050 <|TICKETQTY(tmp_qty)|
This code prints one or more tickets or vouchers on a Cognitive printer, depending on the quantity sold on a particular invoice line item.
! 0 100 1050 1
This code prints one ticket on a Cognitive printer.
ticketqty(5) returns 5
Custom
GETDATESTRING()
Returns the ticket start date and ticket end date as (day of week) MM/DD as a string.
Designed to be used in multi-day Ticket layouts and uses the fields Tmp_date and Tmp_edate to produce the first three letters of the day of the week, the number of the month and the year. Tmp_date is the date that the ticket can start being used. Tmp_edate is the last date the ticket can be used. If the ticket was purchased for one day only, the start date prints. If the ticket was purchased for more than one day, the start and end dates print.
 
Example:
If the ticket was purchased on Monday, April 1, GETDATESTRING() returns MON 04/01 if the ticket was purchased for one day. GETDATESTRING()results in MON 04/01 - FRI 04/05 if the ticket was purchased for more than one day.
Custom
FOP_BREAK()
 
Returns the payment types used and the breakdown of the purchase as a string.
 
Example:
FOP_BREAK()returns:
CASH VISA
10.35 200.00
Custom
BREAKDOWN()
 
Returns the payment breakdown used at the time of the purchase, as a string.
Custom
FOP()
 
Displays the form(s) of payment used to pay for the sale.
If Visa and cash were used to pay for the sale, VISA+CASH are displayed.
Custom
CMONTH(DATE_VALUE)
 
Converts a date to the literal name of the month.
 
Example:
CMONTH(DATE()) returns April if the current month is 04.
Custom
CDOW(DATE_VALUE)
 
Extracts the day of week from the date passed in and returns the day of week as a literal string.
 
Example:
CDOW(DATE())returns Sunday if the current day of the week is 1.
Custom
EMPTY(DATABASE_FIELD)
 
Tests an argument (depending on the type) for true or false, zero or non_zero, blank or non_blank and returns a 1 if empty and 0 if not empty.
This function can be used only with the if() function or the iif() VFP function.
Custom
DAILYCODE(DATE_VALUE)
 
Returns the daily code from the dailycode database using the date that was entered as the parameter.
 
Example:
DAILYCODE(CTOD(TMP_DATE)) returns the daily code for the date that the ticket or voucher was sold. Because TMP_DATE is a character date field, it must be converted into a date value using the CTOD() VFP function. DAILYCODE(DATE()) returns the daily code for the current date.
Custom
IF(LOGICAL_VALUE, TRUE_RESULT, FALSE_RESULT)
 
Tests argument 1 for true or false; returns argument 2 if true or argument 3 if false.
When using this function the ticket designer uses a data field or logical expression to be tested for the first parameter. The second and third parameters of this function can contain legal VFP functions/expressions, other Salesware custom functions or a combination of legal VFP functions/expressions and Salesware custom functions.
 
Examples:
if(tmp_spct =="EMPLOYEE", "Employee Discount"," ")
if(tmp_extx > 100.00, "Free T-Shirt"," ")
Custom
ADD_TIME(<expC1>,
<expN1>,
<expN2>,
<expN3>,
<expN4>,
<expC2>,
<expC3>,
<expC4>,
<expC5>,
<expC6>,
<expC7>,
<expC8>,
<expC9>,
<expC10>,
<expC11>,
<expC12>,
<expC13>,
<expC14>,
<expC15>)
 
Returns the time in the form of a character string that has been altered by having hours or minutes added or subtracted and the time rounded and limited according to minimums and maximums for each day of the week. The time is returned in twelve hour clock form only. This function accepts up to nineteen parameters.
 
Note: This function was designed to accommodate time-based tickets. If an area allows a customer to buy a two or four-hour ticket, this function allows the ticket designer to specify the hours of business, provide for time-in-line, putting on skis, etc.
 
Example:
ADD_TIME(TMP_TIME, 2, 15, 5, 0, 23:00, 23:00, 23:00, 23:00, 23:00, 26:00, 26:00, 09:00, 09:00, 09:00, 09:00, 09:00, 08:00, 08:00)
 
Assuming today is Friday and the current time is 07:00, 10:00 am is returned.
Assuming today is Friday and a current time is 10:06, 12:15 pm is returned.
Assuming today is Friday and the current time is 24:30, 02:00 am is returned.
<expN1> - Number of hours to add or subtract. To add hours, enter a positive number. To subtract hours, enter a negative number.
<expN2> - Number of minutes to add or subtract. To add minutes, enter a positive number. To subtract minutes, enter a negative number.
<expN3> - Number of minutes to round up to.
<expN4> - Number of minutes at which to start rounding.
<expC2> through <expC8> − Maximum time to be returned for a day. <expC2> is Sunday’s maximum while <expC8> is Saturday’s maximum. Enter the string as a time (HH:MM). To set the maximum for a day to be some time during the following day (i.e., after midnight), enter the time as a military time, accounting for moving beyond midnight.
 
Example:
To set the maximum for 2:00 AM the following day, enter 26:00 as the maximum. <expC9> through <expC15> follow the same format but are the minimum times.
Custom
ENCRYPT_NUMBER()
 
Encodes the base 10 number into a base 38 number, primarily for compression of barcodes.
 
Example:
ENCRYPT_NUMBER(TMP_PASSNO) where TMP_PASSNO =120012005 returns 1JL4UP
Custom
ENCRYPT_DATE(CHAR DATE VALUE)
Encodes the base 10 character date into a base 38 number, primarily for compression of barcodes.
 
Example:
ENCRYPT_DATE(TMP_EDATE) where TMP_EDATE = 12/25/2002 returns CP (C=12 and P=25 in base 38). ENCRYPT_DATE(DTOC(DATE())) encrypts the current date.
Custom
SHOW(<style1>, <style2>,
<style3>,
<style4>, <alignment>, <line_size>,
<VFP expr>)
 
Parses and formats the specified text for printing on a dot matrix printer. Used in layouts designed for dot matrix printers only. If the printer at the salespoint is a dot matrix printer, this function must be used on every line of the Ticket layout. SHOW()sends the printer an escape sequence before printing each line of the ticket, which specifies fonts, font sizes and font styles. The justification of a line of text (right, center, left) can also be specified.
<style1> through <style4> The font styles are available to the ticket designer when designing tickets for a dot matrix printer. Availability of specific styles is dependent on the brand of the printer. Can be any of the following:
doublewide
doublehigh
condensed
bold
italics
underline
pitch_10
pitch_12
pitch_15
color_1
color_2
color_3
color_4
nlq_print (near letter-quality print )
‘ ’ (signifies no style)
cut_code (printer with auto cutter)
 
<alignment> can be:
left
right
center
 
<line size> The number of characters on the line that is being printed.
 
<VFP expr> A VFP expression that specifies what is to be printed on the line.
 
Example:
<|Show('bold','condensed',’’, '','left',’45’,alltrim(tmp_oper)+ alltrim(tmp_loc)+alltrim (dtoc(date()))+alltrim(time()))|>
 
In the example,
<style1> = ‘bold’
<style2> = ‘condensed’
<style3> = ‘’ (empty single quotes)
<style4> = ‘’ (empty single quotes)
<alignment> = ‘left’
<line size> = ‘45’
<VFP expr> = alltrim(tmp_oper)+alltrim(tmp_loc)+
alltrim(dtoc(date()))+alltrim(time())
Custom
TTOC(TABLE_NAME->FIELD_NAME,’FORMAT’)
Ticket/Voucher layouts use TTOC() (time to character) followed by specifications for the desired format.
%a       Abbreviated weekday name
%A      Full weekday name       
%b       Abbreviated month name
%B       Full month name
%c       Date and time representation appropriate for
locale
%d       Day of month as decimal number (01 - 31)
%H       Hour in 24-hour format (00 - 23)
%I       Hour in 12-hour format (01 - 12)
%j       Day of year as decimal number (001 - 366)
%m      Month as decimal number (01 - 12)
%M      Minute as decimal number (00 - 59)
%p      Current locale’s A.M./P.M. indicator for 12-
hour clock
%S       Second as decimal number (00 - 59)
%U       Week of year as decimal number, with
Sunday as first day of week (00 - 53)
%w       Weekday as decimal number (0 - 6; Sunday
is 0)
%W      Week of year as decimal number, with
Monday as first day of week (00 - 53)
%x     Date representation for current locale
%X       Time representation for current locale
%y       Year without century, as decimal number (00
- 99)
%Y     Year with century, as decimal number
%Z Time-zone name; no characters if time zone
is unknown
%%      Percent sign
 
Examples:
To print the transaction date & time in DD/MM/YYYY HH:MM:SS AM/PM format, you would use:
TTOC(alltrans->date_time,'%m/%d/%Y %I:%M:%S %p') results in 10/24/2005 12:30:45 PM
To print the transaction date and time in DD/MM/YYYY HH:MM:SS AM/PM format, you would use:
TTOC(alltrans->date_time,'%d/%m/%Y %I:%M:%S %p') results in 24/10/2005 12:30:45 PM
Custom
departme->descrip
Prints the department description on tickets.
 
category->descrip
Prints the category description on tickets.
 
mod_accX
The access number of a modifier is now populated in the mod_accX (where X = 1 - 9) field in the printing and tmp_inv tables. This allows for the printing of multiple barcodes on a single ticket so that a separate ticket no longer needs to be issued for each part of a purchased package.