Receipt layout functions
 
All Text Merge layout receipt lines must be encapsulated by <| |>.
 
Function
Description
Custom or in VFP subset?
DETAILS(CHAR_EXPRESSION)
DETAILS(CHAR_EXPRESSION, LOGICAL)
 
 
Loops through all of the records in the AllTrans table and converts the expression to readable text.
Similar to ITERATE_OVER() except it uses only the AllTrans table (created just for the DETAILS() function) and sync’s the guests and gst_pass tables as well. CHAR_EXPRESSION is the same as in ITERATE_OVER(), only the SEPARATOR is included at the end of the expression.
In the second form, if LOGICAL is set to TRUE, then the function loops through all of the records in the AllTrans table and only prints the record if it is a new item added to the receipt.
 
Note: With the DETAILS() function, you are sure to get all of the payments (either deposits or account payments) and all relevant information from both the Transact and Tr_Save tables. The DETAILS() function is “one-stop shopping” for all of your Sale_Hdr/Sh_Save Transact/Tr_Save needs.
 
Inside the DETAILS() function, the following tables get synced, so are available for use:
Table
Sync field
Items      
Department+Category+Item
I_Items   
invent_id
Guests    
guest_no
AllAdres   
guest_no
Gst_pass   
pass_no
Specials   
name
 
Custom
ITERATE_OVER(TABLE, INDEX, FILTER, EXPRESSION, SEPARATOR)
 
Loops through the specified table for all records that match the filter expression in the table’s indexed field and converts the expression to readable text. The separator is placed between every line – typically NEWLINE().
When iterating over the tr_save or transact table, the following tables get synced, so are available for use:
Table
Sync field
Items      
Department+Category+Item
I_Items   
invent_id
 
When iterating over the tr_info, trs_info, sh_info or shs_info table, the following table gets synced, so is available for use:
Table
Sync field
Guests 
guest_no
 
Custom
SEEK(TABLE, INDEX, VALUE)
 
Selects the TABLE, sets the index to the INDEX value and seeks to the first record that matches the VALUE in the INDEX field.
Custom
NEWLINE()
 
Returns CHR(13)+CHR(10) (i.e., carriage return + line feed)
Custom
CENTER(EXPRESSION, NUM_COLS)
 
Centers the expression on the page based on the number of character columns you have on the printer – typically 40 or 80.
Custom
JUSTLEFT(EXPRESSION, NUM_COLS)
 
Left-justifies the text.
Custom
JUSTRIGHT(EXPRESSION, NUM_COLS)
 
Right-justifies the expression on the page based on the number of character columns you have on the printer – typically 40 or 80.
Custom
FOP()
 
Displays the form(s) of payment used to pay for the sale.
 
Note: This is only valid on Receipt printing. It cannot be used for Saved Sales. Additionally, this only returns payments made on finalize and not any previous payments.
Custom
DSTR1(TABLEàFIELD)
 
Returns a character representation of the Date/Time field in the format CCYY/MM/DD.
Custom
DSTR2(TABLEàFIELD)
 
Returns a character representation of the Date/Time field in the format MM/DD/CCYY HH:MM:SS AM/PM
Custom
TIPS(EXPRESSION)
 
Evaluates the expression if and only if the salespoint has Tips=TRUE in the Sales32c.INI file. Mostly used only in Ticket layouts (e.g., Charge Cards Ticket layout), but is available for Receipt layouts as well.
Custom
MODIFIER()
 
Returns .T. (TRUE) if the item in the AllTrans table is a product modifier. Used only in the DETAILS() function. Typically used for kitchen printing.
Custom
 
TOTAL(DISCOUNT/PRICE/EXTENSION)
 
Used for Z-Tape Reports in conjunction with ITERATE_OVER(). Sums the specified quantity for DISCOUNT, PRICE or EXTENSION fields for all of the records in the ITERATE_OVER() statement preceding the TOTALS() call.
Custom
 
Examples:
The following line is a fairly common details() line for basic sales receipts:
 
<|Details(STR(admissions*quantity,3,0)+' ' +IIF(transact->Item="**TRANS**","Account Transaction",Items->descrip)+' '+ STR(quantity,3,0)+NEWLINE()+Transact->Special+STR(Transact->Disc_amt,6,2)+STR(transact->init_price,9,2)+' '+STR(transact->extension,10,2)+NEWLINE())|>
 
The following line is a common details() line for remote receipts (kitchen printing) for new items (items ordered after the initial order) added to the tab/check/table/sale:
 
<|Details(IIF(MODIFIER(), alltrim(printers->color_2) + ' ATTN: '+Items->Descrip, alltrim(printers->color_1) + STR(quantity,3,0) + ' - ' + IIF(Item="**TRANS**","Account Transaction",Items->descrip) + NEWLINE()) + NEWLINE(), TRUE)|>
 
 
The following is a common iterate_over() line for a basic sales receipt. accesso is moving towards using details() more than iterate_over() because, in general, it has more/better options. details() is often preferred for listing the transactions because it “sync’s” many of the other tables (guests, gst_pass, i_items, etc.):
 
<|iterate_over(transact, Sale_no, Sale_hdr->Sale_no, STR(admissions*quantity,3,0) + ' ' + IIF(transact->Item="**TRANS**" , "Account Transaction",Items->descrip) + ' ' + STR(quantity,3,0) + NEWLINE() + Transact->Special + STR(Transact->Disc_amt,6,2) + STR(transact->init_price,9,2) + ' ' + STR(transact->extension,10,2), NEWLINE())|>
 
The following line is typically one of the first lines on a receipt:
 
<|CENTER('Sale Number: ' + ALLTRIM(STR(utility->sale_no,16,0)), 40)|>
 
The following line is typically one of the last lines on a receipt:
 
<|JUSTRIGHT('SUB TOTAL: '+STR(Utility->sale_sub,10,2),40)|>
 
FOP()- If Visa and cash were used to pay for the sale, VISA+CASH are displayed.
 
<|CENTER(DSTR2(Utility->Date_time),40)|>
 
This is a common details() line for a remote printer (kitchen receipt printer) that prints all items on the receipt, not just those added during the last recall:
 
<|Details(IIF(MODIFIER(), alltrim(printers->color_2) + ' ATTN: '+Items->Descrip, alltrim(printers->color_1) + STR(quantity,3,0) + ' - ' + IIF(Item="**TRANS**","Account Transaction",Items->descrip) + NEWLINE()) + NEWLINE())|>
 
The following lines print daily codes on a sales receipt:
 
<|CENTER('DAILYC: ' +Dailycode(date(),1),40)|> (prints dailycode)
<|CENTER('DAILYC: ' +Dailycode(date(),2),40)|> (prints dailycode2)
<|CENTER('DAILYC: ' +Dailycode(date(),3),40)|> (prints dailycode3)
<|CENTER('DAILYC: ' +Dailycode(date(),4),40)|> (prints dailycode4)
<|CENTER('DAILYC: ' +Dailycode(date()),40)|> (prints dailycode1)