Primitives Guides
Library Primitives Introduction Cheat Sheet Primitive Areas :Sale :GetData :General Reference State Variables

Primitives Cheat Sheet

This primitive cheat sheet brings together a collection of different primitive commands used for different purposes.

Where a ? is used in an example, this indicates a field you should insert a real value.
Parts enclosed in [ ] indicate optional components. Do not include the [ ]

:sale add pid ? [ qty ? ]

The above example shows a generic form to sell a product. the ? should be replaced with the actual value required. Assuming we wanted to sell Pid=22, then the final commands would be one of the following.

  • :sale add pid 22
  • :sale add pid 22 qty 1

If a command has a selector, such as specifying which saleline you mean, the examples will use italics on that part to highlight alternative options. eg :sale alter line sequence ? discount uniform amount 200

Selling

:sale add pid ? [ qty ? ] Adds the product for the given PID to the sale, if possible :sale add plu ? [ qty ? ] Adds the product for the given PLU to the sale, if possible

Saleline Discounts

Discounts can be applied to individual salelines. A discount is an exceptional pricing event, often driven by a human decision at sale time (I made a deal to sell below retail in order to close the sale), or as an easy special offer (Senior citizens get 5% discount)

Add a discount to a saleline

:sale alter line seqnce ? discount uniform amount 5.00 [ reason(Damaged item) ]
:sale alter line seqnce ? discount percent rate 10.5%
:sale alter line seqnce ? discount seniorcitizen

The discount names uniform and percent are known in all retail systems, unless disabled, and allow catchalls for discounting. Other names like seniorcitizen are defined on a per retailer basis. In general you should try and use specific names like seniorcitizen where possible as this allows for discount analysis reporting.

Remove Discounts

From a single item

:sale alter line sequence ? delete discounts

From all salelines

:sale delete discounts
                    

Single Sale Options

Comments

To add comments to the active sale. If the value is empty, all comments are removed

:sale set comments/b64=(...base 64 string...)        
:sale set comments(This is a comment)

In HTML/Javascript, this might be used as

Comments <input size=20 onblur='SaveValue(this)'>
...
function SaveValue(whereFrom) {
    FieldpinePrimitive(":sale set comments/b64(" + btoa(unescape(encodeURIComponent( whereFrom.value ))) + ")");
}

Customers OrderNo

To save the customers order to the active sale. If the value is empty, any previous order number is removed

:sale set orderno/b64=(...base 64 string...)        

Receipts

The Fieldpine engine will return receipts for you. While you can create receipt formats yourself in Javascrip/Html and print those without involving Fieldpine, we don't recommend that as receipt formats may change without warning for many reasons. For example, changes by customer, products purchased, legal differences, marketing offers and so on.

Retrieving the default receipt

:sale send receipt

This wil return the current default receipt for the sale as part of the JSON response. This can then be displayed and printed from the browser.

To email a receipt to a specific email address and select a different format

:sale send receipt format(Corporate Invoice) email(bob@example.com)

Sale Management

Parking and Unparking Sales

A parked sale is one that has been pushed into the background as an active but incomplete sale. It no longer shows on selling screens but can be recalled for further working.

To park an active sale

:sale phase park

To unpark a sale when you know the Sale# or Physkey

:sale .....

To search for parked sales, which can be used to find the Sale# so it can be recalled

:sale .....