Phone: 406-788-9165

Restaurant Order Pad: Macro Reference

Our macro system currently only covers a menu button press event. Most of the macro functions require a [variable] arguement, this is how the menu buttons' properties are changed.

Special Note: It is recommended that all function arguments be "quoted", esp. while using special characters or a comma (,)!


[variable] reference: Enclose a variable name in percentage symbols (%var%) to replace the variable's value in many function "value" arguements.

Variables to retrieve the selected item's properties. There are separate functions below to set the selected item's properties.

sid = get the selected item's button id
sprice - get the selected item's price
sqty - get the selected item's quantity
sitem - get the selected item's text
sremarks - get the selected item's remarks
sremarkcount - get the selected item's remark line count
sremarkcountprice - get the selected items's remark line count only if there is a price.
sdiscountname - get the selected item's discount name.
sdiscountamount - get the selected item's discount amount.

Variables to change the button's properties before the item is added to the order list.

price - get/set button item's price
qty - get/set button item's quantity
item - get/set button item's text
remarks - get/set button item's remarks
aremarks - appends button item's remarks
var1 - custom value 1
var2 - custom value 2
var3 - custom value 3

Special variables.

dow - gets day of week in 3 char code (sun,mon,tue,wed,thu,fri,sat)
yesno - get result of (yes|no) prompt

Programmically set a variable mentioned above.

setVar("variable", "value");

Sets the NoCondiments flag for any items created by macro for the remainder of the macro. Useful if you need to use macro functions to programically add condiment items to an item. Note: the primary button's item will not be flagged as NoCondiments by this function.

setNoCondimentsFlag();

Perform a math operation on a variable. enclose variables used in values in %%, eg %sprice% = selected item's price. "variable" is where the result is stored. Rounding method can be "none"=no rounding, "ceil"=always round up, "floor"=always round down, "round"=do normal rounding.

math("variable", "value1", "operator", "value2", [rounding method]);

Example: Take the selected item's price, apply a 20% discount to that item only.

math("sprice", "%sprice%", "*", "0.8");

Conditional processing. If condition is true, all macro functions up to endif(); or endselect(); are executed. else(); is optional to execute functions when the condition is false. value can be an OR condition by separating values with the pipe "|"

Plese Note: nesting for condtional processing is not supported!

if("variable", "=|>|<", "value1|value2|..");
...
[else();]
...
endif();
select("variable");
...
case("value");
...
case("anothervalue");
...
endselect();

A Yes/No Prompt. [message] is the text displayed to the user. [title] is the dialog title. Follow with a if(); ... endif(); block to handle user response.

promptYesNo("message", "[title]");
if("yesno", "=", "[yes|no]");
...
endif();

Prompt for a Number. [description] is the text displayed to the user.

promptNumber("variable", "description");

Prompt for a Price. [description] is the text displayed to the user.

promptPrice("variable", "description");

Prompt for a Discount amount. [description] is the text displayed to the user. Enables and set the negative number flag in the input dialog. Does not apply to percentage discounts. See math(); above for example of how to apply percentage discounts.

promptDiscount("variable", "description");

Prompt for Textbox input. [description] is the text displayed to the user.

promptTextbox("variable", "description");

Programmically append remarks [text] to item. Set [noReturnFlag] to 0 or 1. 1 if you do not want to insert a carriage return.

appendRemarks("noReturnFlag 0|1", "text");

Programmically add condiment items to the selected item.

addCondiment("qty", "item");

Programmically add remarks (with price) to the selected item.

addRemarks("remarks", ["price"]);

Programmically set the item text of the selected item. if no text supplied, uses the text of the button that was clicked.

setItemText("[text]");

Programmically set the item qty of the selected item.

setItemQty("qty");

Programmically set a item flag of the selected item. valid flags are: "noKV", "noReceipt", "subFlag". Valid values are 0 or 1.

setItemFlag("flag", "value");

Programmically add a single item to the order list. itemID IS required! All other params are optional. Any missing params will inherit the values/texts from the specified itemID

addItem("itemID", "[itemQty]" ,"[itemText]", "[itemPrice]", "[itemRemarks]", "[allowNegative]");

Incriment the group id number to allow macros to create item groups. Best used followed by 1 or more addItemWithGroup(); function(s) to establish a grouping of items.

newGroupId();

Programmically adding item groups can be useful for bundle deals, such as a 2 for $20 menu. For practical use as a bundle deal, it is recommended to also create a separate "hidden" category with all the buttons pertaining to the bundle deal. Then activate the hidden category with activateCategory(category);

Programmically add a single item to the order list as a group. IMPORTANT: in your macro, Call newGroupId(); first! itemID IS required! All other params are optional. Any missing params will inherit the values/texts from the specified itemID

addItemWithGroup("itemID", "[itemQty]" ,"[itemText]", "[itemPrice]", "[itemRemarks]", "[allowNegative]");

Programmically add multiple items to the order list. You may provide any number of itemID's.

addItems("itemID", ...[itemID]);

Prompt with a List. [description] is the prompt displayed to the user. [list] is a comma seperated list for user to choose from.

promptList("variable", "description", "list");

Prompt for manager pin. If pin is not set, resumes macro processing; If pin is incorrect, macro processing stops.

promptManagerPin();

Activate specified [category] as if the user pressed it on the left column. Can activate hidden categories.

activateCategory("category");

Display a [message] to the user. [title] is the dialog's title.

alert("message", "[title]");

Attempt to apply a discount of the specified name! If discount conditions aren't met, the user is notified that the discount cannot be applied. In most cases, you will want to cancel the default button press with cancel();

applyDiscount("discount");

Applies a discount that isn't specified in discount programming. Optionally specifiy a category and/or button id restrictions. If specified category and button id conditions aren't met, the user is notified that the discount cannot be applied. In most cases, you will want to cancel the default button press with cancel();

applyManualDiscount(name, amount, [category], [buttonids]);

Shows the options dialog as if the user pressed the "options" button on the menu bar. If you wish to create a macro only button, follow with cancel(); Note: if your macro has added new items, the options dialog will be for the last item that was added!

showOptions();

Cancel the default functionality of the button press. Use this when you only want to cancel the default button press action but don't want to end the macro processing. This makes the button a "Macro Only" button.

cancel();

End macro processing and cancels the default functionality of the button press.

stop();
end();

Special API Macros:

TWD Inventory System API: Prompts for a stock number, then performs a lookup to retrieve item name, price, and description. Note: does not adjust inventory values in the Inventory System.

Options specific to the TWD Inventory System API can be set via the preferences screen

twdinv_getitem();

Published by: Thomas Penwell
Initially published on: June 1, 2014
Article last modified on: Sunday, February 1, 2015.

Home - Web Portfolio - Web site Tools - Database Design Service - Consulting
Web Design Service - Web Hosting Solutions - Service Rates
Client Login - Contact Us - Promotions - Partners - Articles - Perl Scripts


Our Sites:
restaurantorderpad.com