Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
VAR GRAT_PERCENTS[ 3 ] : $12
GRAT_PERCENTS[ 1 ] = 15
GRAT_PERCENTS[ 2 ] = 18
GRAT_PERCENTS[ 3 ] = 20
VAR MESSAGE_LINES[ 4 ] : A40
MESSAGE_LINES[ 1 ] = "For your convenience we are"
MESSAGE_LINES[ 2 ] = "providing the following"
MESSAGE_LINES[ 3 ] = "gratuity calculates:"
MESSAGE_LINES[ 4 ] = ""
//The following settings controls whether the system will attempt to calculate the tax into the subtotal; ie: tip on the total AFTER tax has been applied
//1 = TRUE; 0 = FALSE
VAR AFTER_TAX : N1 = 1
EVENT PRINT_TRAILER : GRATS
VAR SUBTOTAL : $12
CALL CALCULATE_SUBTOTAL( SUBTOTAL )
VAR LINE_INDEX : N2 = 1
VAR CURRENT_LINE : A80
VAR I : N2
//print our message first
FOR I = 1 TO ARRAYSIZE( MESSAGE_LINES )
CALL PAD_LINE( CURRENT_LINE, MESSAGE_LINES[ I ] )
@TRAILER[ LINE_INDEX ] = CURRENT_LINE
LINE_INDEX = LINE_INDEX + 1
ENDFOR
//now print each of our gratuity calculations
FOR I = 1 TO ARRAYSIZE( GRAT_PERCENTS )
FORMAT CURRENT_LINE AS GRAT_PERCENTS[ I ], "% is ", (SUBTOTAL * (GRAT_PERCENTS[ I ] / 100))
CALL PAD_LINE( CURRENT_LINE, CURRENT_LINE )
@TRAILER[ LINE_INDEX ] = CURRENT_LINE
LINE_INDEX = LINE_INDEX + 1
ENDFOR
ENDEVENT
SUB CALCULATE_SUBTOTAL( REF SUBTOTAL )
VAR RUNNINGTOTAL : $12
VAR ITEMTAX : $12
VAR I : N9
USEFILTEREDDETAIL
FOR I = 1 TO @NUMDTLT
IF @DTL_TYPE[ I ] = "M"
RUNNINGTOTAL = RUNNINGTOTAL + @DTL_TTL[ I ]
IF AFTER_TAX = 1
CALL CALCULATE_TAX( I, ITEMTAX )
RUNNINGTOTAL = RUNNINGTOTAL + ITEMTAX
ENDIF
ENDIF
ENDFOR
SUBTOTAL = RUNNINGTOTAL
ENDSUB
SUB CALCULATE_TAX( VAR I : N9, REF TAX )
VAR TAXRATE : $12
VAR PI : N2
FOR PI = 1 TO 8
IF BIT(@DTL_TAXTYPE[ I ], PI) = 1
TAXRATE = TAXRATE + @TAXRATE[ PI ]
ENDIF
ENDFOR
TAX = @DTL_TTL[ I ] * (TAXRATE / 100)
ENDSUB
SUB PAD_LINE( REF OUT, VAR LINE : A40)
VAR PADDING : A40 = " " //some padding so we can center the suggested tips
FORMAT OUT AS MID(PADDING,1,(32-LEN(LINE))/2.0), LINE
//if your device is not set to use 40 columns it will not print centered. change this in POS Configurator -> Devices -> Devices -> (The Printer in Question) -> Printer Definition
ENDSUB