Gift Certificate Sales & Redemption
This is a working implementation for Selling & Redeeming variable-value Gift Certificates
(GCs) that are tracked under their own individual GC Account and 2 “GC Balance” Accounts called “GC Purchases” and “GC Redemptions”.
GC Sale:
- Customer comes in to purchase a Gift Certificate (GC).
- Enter the value of the GC that the customer wants to purchase into the NUMBERPAD ($10, $20, etc).
- Select GC Product (open price).
- Settle the ticket - customer pays for the GC using Cash, Credit Card, or another Payment Type.
- Gift Certificate Entity & Account is created using a name composed of current Date, Time, and Value of the GC being purchased (i.e.
GC2014061315325614520
would be theEntity Name
&Account Name
of a GC purchased on2014-06-13
at15:32:56.145
for a value of $20
). - Gift Certificate Prints containing Value ($
20
)and Control Code (GC2014061315325614520
).
GC Redemption:
- Customer comes in with a Gift Certificate (GC) that they want to Redeem (use as Payment). Assuming the GC has a value of $20…
- They order some food and drink products, and it comes to a total of $33.
- They want to use the GC as partial payment ($20), and pay the remainder in Cash ($13).
- We scan or enter the GC Control Code (i.e.
GC2014061315325614520
), or search for it in a list of unredeemed Gift Certificates allowing us to verify the GC has not yet been (fully) used, and it enables theGift Certificate
Payment Type to settle the Ticket (in whole or in part). - For the remainder of the Ticket, the balance left to pay is $13, and we settle that with Cash.
This setup and implementation is based on the discussion and initial tutorial provided by @JohnS, found in this thread: GC Sales & Redemption.
With the gracious & frequent help & guidance of @emre and @JohnS, the Tutorial which follows introduces many changes to the initial setup previously provided. The changes are mostly to track Gift Certificates
under their own Accounts, and 2 overall GC Balance accounts, steering clear of the Sales
account, facilitating better control & reporting of the “GC Product” and its balances.
Let’s get to it!
Components required:
GC Product: Gift Certificate
Account Types: GC Accounts
, GC Balances
Accounts: GC Purchases
, GC Redemptions
, GC Payment Account
, ZZGC2000
“dummy” account
Account Screens: Gift Certificates
, General
Transaction Types: GC Credit Transaction
, GC Debit Transaction
, GC Purchase Transaction
, GC Redemption Transaction
Document Types: GC Purchase Doc
, GC Redemption Doc
Payment Types: Gift Certificate
Entity States: (GCStatus) Purchased
, (GCStatus) Redeemed
Entity Types: Gift Certificate
Entities: ZZGC2000
“dummy” entity
Entity Screens: Gift Certificates
(Search)
Ticket Types > Ticket > Entity Type List: Gift Certificates
Printer Template: GC Template
Print Job: Print GC
Automation: several Actions
& Rules
GC Product:
The GC Product “Gift Certificate” has a Price of 0.00
… it’s an “open price” product.
GC Account Types - GC Accounts & GC Balances:
GC Accounts
: holds the balance of each individual GC.
GC Balances
: holds the total balances of all Purchased
& Redeemed
GCs.
GC Accounts - Purchases, Redemptions, Funds, & Dummy:
GC Purchases
: holds the total balance of all Purchased
GCs.
GC Redemptions
: holds the total balance of all Redeemed
GCs.
GC Funds
: Credit/Debit account for GC Purchases/Redemptions.
ZZGC2000
: a “dummy” account with zero (0
) balance, used in place of completely depleted (fully redeemed) GCs.
Account Screen - Gift Certificates:
The Gift Certificate Account Screen
allows us to view the values of all Purchased & Redeemed GCs, and lists any GCs which still have a balance that can be used as Payment, filtered as “All
” so we see the complete history.
Account Screen - General: (optional)
The General Account Screen can also display GC Purchases, Redemptions, and Balances, filtered by “WorkPeriod
”, so we see only GC transactions appearing today.
Account Transaction Types: GC Credit & GC Debit:
GC Credit Transaction
: during GC Purchase, transfers funds from GC Funds
to GC Account
that is being purchased.
GC Debit Transaction
: during GC Redemption, transfers funds from GC Funds
to GC Redemptions
account.
Account Transaction Types: GC Purchase & GC Redemption:
GC Purchase Transaction
: during GC Purchase, transfers funds from GC Purchases
account to Receivables
account.
GC Redemption Transaction
: during GC Redemption, transfers funds from Receivables
account to GC Account
that is being redeemed.
Document Type - GC Purchase:
GC Purchase Doc
: handles GC Credit Transaction
when GC is Purchased.
Document Type - GC Redemption:
GC Redemption Doc
: handles GC Debit Transaction
when GC is Redeemed.
Payment Type - Gift Certificate:
Gift Certificate
: provides for a button on the Payment Screen
(similar to Cash
or Credit Card
), enabling the Redemption of a GC when Settling a Ticket, which invokes the GC Redemption Transaction
.
Entity States for GCStatus - Purchased & Redeemed:
The GCStatus
Entity States are used to easily track the Status of the GC, as either being Purchased or Redeemed (in full):
Purchased
: indicates the GC has a Balance > 0
.
Redeemed
: indicates the GC has a Balance = 0
.
Entity Type - Gift Certificates:
Gift Certificates
Entity Type defines the Gift Certificate
Entity, which use an Account Type of GC Accounts
.
GCBalance
: this Custom data field will be updated to display the balance of the individual GC Account
.
** Gift Certificate Entity - GC Dummy “ZZGC2000”:**
ZZGC2000
: a “dummy” GC Entity with GCBalance=0
linked to “dummy” Account ZZGC2000
to be used in place of GCs that have been fully redeemed.
Entity Screen - GC Search:
Gift Certificates
Entity Screen, set to Search
mode, and filtered to display only GC Entities with a (GCStatus
) State of Purchased
will list all GC Entities which are not fully Redeemed.
Ticket Type - Entity Type List - GC Entity Search:
Adding Gift Certificates
to the Entity Type List
of our Ticket Types
provides a button on the left side of the screen to search for and select a GC, in the same way we select Tables and Customers on a Ticket.
Ticket Tags - Gift Certificate Name - GCN: (optional)
We will use the Ticket Tag GCN
to store the name of the Gift Certificate used during Redemption. This is useful to format output on a Ticket (Receipt) to show information about a GC when it is used as Tender.
Ticket Tags - Gift Certificate Balance - GCB: (optional)
We will use the Ticket Tag GCB
to store the remaining Balance of the Gift Certificate used during Redemption. This is useful to format output on a Ticket (Receipt) to show information about a GC when it is used as Tender.
Printer Template - GC Template:
GC Template
: used to format the output of the printed GC - modify it to suit your needs…
[LAYOUT]
-- General layout
<EB>
<T>The Best Restaurant
<DB>
<J00>{DOCUMENT DATE} {DOCUMENT TIME}
<L>
<EB>
<C01>GIFT CERTIFICATE
<DB>
<L>
{TRANSACTIONS}
<C>NO CASH VALUE
<F>*
[TRANSACTIONS]
<C11>{AMOUNT}
<L>
<F>-
<EC>
-- <QR>{SOURCE ACCOUNT}
-- <BAR>{SOURCE ACCOUNT}
<EL>
<J00>{SOURCE ACCOUNT} | {AMOUNT}
Print Job - Print GC:
Print GC
: the Print Job that prints the GC to the Ticket Printer
using the GC Template
.
Printer Template - Ticket Template addition: (optional)
[<F>=
<J00>{TICKET TAG:GCN}|Balance: [=F(TN('{TICKET TAG:GCB}'))]]
If you set up the Ticket Tags for GCN
and GCB
, including the Actions
& Rules
, the above Printer Template code
can be added somewhere to your regular Ticket Template (Customer Receipt), to show Balance information of a Redeemed Gift Certificate.
Automation - Actions & Rules:
Now that all the Components are in place, we need to define how they interact with each other using Actions
& Rules
.
First, we define all the Actions…
Action - AC Display Ticket:
A “generic” Action to Display a Ticket, given a Ticket Id
.
Name: AC Display Ticket
Type: Display Ticket
Ticket Id: [:TicketId]
Action - GC Credit & GC Debit:
Actions to Credit & Debit accounts when a GC is Purchased and Redeemed.
Name: AC GC Purchase
Type: Create Account Transaction Document
Document Name: GC Purchase Doc
Account Name: [:Account Name]
Description: GC Credit Account [[:CertNum]]
Amount: [:Amount]
Name: AC GC Redeem
Type: Create Account Transaction Document
Document Name: GC Redemption Doc
Account Name: [:Account Name]
Description: GC Debit Account [[:CertNum]]
Amount: [:Amount]
Action - Update Order Transaction Type for GC Purchase:
Action to update the Transaction Type
when a GC is Purchased. This allows the Sale of a GC to be tracked under a separate GC Purchase
Account rather than the default Sales
Account.
Name: AC GC Update Transaction Type
Type: Update Order
Account Transaction Type: GC Purchase Transaction
Action - Update Order State for GC Product:
Action to update the Order State of a GC when it is being Purchased.
Name: AC GC Update Order State
Type: Update Order State
State Name: Certificate
Group Order: 3
Current State: [:Current State]
State: [:State]
State Order: 3
Action - Create GC Entity:
Action to Create the GC Entity when it is Purchased.
Name: AC GC Create
Type: Create Entity
Entity Type Name: Gift Certificates
Entity Name: GC[:Certificate Number]
Create Account: True
Action - Print GC:
Action to Print the GC when it is Purchased.
Name: AC GC Print
Type: Print Account Transaction Document
Document Id: [:DocumentId]
Printer Name: Ticket Printer
Printer Template Name: GC Template
Action - Update Entity Data “GCBalance”:
Action to update the GC Entity Custom Data Field named GCBalance
, when a GC is Purchased or Redeemed.
Name: AC GC Balance Update
Type: Update Entity Data
Entity Type Name: Gift Certificates
Entity Name: [:CertNum]
Field Name: GCBalance
Field Value: [:Bal]
Action - Update Entity State “GCStatus”:
Action to update the GC Entity State (GCStatus
) when a GC is Purchased or Redeemed.
Name: AC GC Update State GCStatus
Type: Update Entity State
Entity Type Name: Gift Certificates
Entity Name: [:CertNum]
Entity State Name: GCStatus
Current State: [:Current GCStatus]
Entity State: [:New GCStatus]
Action - Add Line to Text File: (optional)
Action (optional) to Add Line to Text File
, when a GC is Purchased or Redeemed, to log any interactions with GCs.
Name: AC GC Add Line to Text File
Type: Add Line to Text File
File Path: <enter full path, including filename>
Text: [:sometext]
Actions - Update Ticket Tags - GCN & GCB: (optional)
Actions (optional) to Update Ticket Tag
, for GCN
and GCB
to use on a Customer Receipt when a GC is used for Redemption.
Name: AC GC Update Ticket Tag GCN
Type: Update Ticket Tag
Tag Name: GCN
Tag Value: [:GCN]
Name: AC GC Update Ticket Tag GCB
Type: Update Ticket Tag
Tag Name: GCB
Tag Value: [:GCB]
Action - Search & Select GC Entity via NUMBERPAD or Scanner:
Action to select a GC Entity
(and associated Account) when a GC number (i.e. GC2014061315325614520
) is entered into the NUMBERPAD
, or scanned using a Scanner, for use in Redemption.
Name: AC GC Select NUMPAD
Type: Change Ticket Entity
Can Create Ticket: True
Entity Type Name: Gift Certificates
Entity Name: [:SearchValue]
Action - Change Entity to “dummy” ZZGC2000:
Action to replace a currently-selected GC that is being used for Redemption, when the value of the GC has been depleted (Balance=0
) during a Payment Transaction
(when the Ticket is being Settled).
This would replace GC2014061315325614520
(value=20
) with ZZGC2000
(value=0
) when GC2014061315325614520
has been used as payment for its entire balance (20
), and when there is still a Remaining Amount left to be Settled on the Ticket.
The Entity/Account replacement with the “dummy” GC ZZGC2000
prevents the depleted GC GC2014061315325614520
from being overdrawn.
Name: AC GC Entity Change to Invalid
Type: Change Ticket Entity
Can Create Ticket: False
Entity Type Name: Gift Certificates
Entity Name: ZZGC2000
Now we need to capture Events
using Rules
and fire the Actions
we defined.
Let’s get to defining all the Rules…
Rule - GC Order Added to Ticket - Update States & Transaction Type:
Rule to capture when a GC order has been added to a Ticket, to be Purchased.
Name: RU GC Update New
Event Name: Order Added to Ticket
Custom Constraints: Execute rule if Matches
Menu Item Group Code
Equals Gift Certificates
Actions:
AC GC Update Order State
Constraint:
Current State:
State: Ordered
Update Order Gift State
Constraint:
Current Status:
Status: Locked
Value:
AC GC Update Transaction Type
Constraint:
Rule - Ticket Closing - Update Order State:
Rule to capture when a GC order has been Purchased and Paid for (Settled).
Name: RU GC Update Order States
Event Name: Before Ticket Closing
Custom Constraints: Execute rule if Matches
Remaining Amount
Equals 0
Actions:
AC GC Update Order State
Constraint:
Current State: Ordered
State: Printed
Rule - GC Purchased & Printed: (Action in red is optional)
Rule to capture when a GC has been ordered, purchased, and printed.
This fires many actions, to create the GC Entity
& GC Account
, update its Account Balance and Entity GCBalance
, print the GC and update the Entity GCStatus
to Purchased.
Name: RU GC Purchased & Printed
Event Name: Order State Updated
Custom Constraints: Execute rule if Matches All
State Name
Equals Certificate
State
Equals Printed
Actions:
AC GC Create
Constraint:
Certificate Number: [=Helper.GetUniqueString()][=Order.Price]
AC GC Purchase
Constraint:
Account Name: [=Data.Get("AccountName")]
CertNum: [=Data.Get("AccountName")]
Amount: [=Order.Price]
AC GC Print
Constraint:
DocumentId: [=Data.Get("DocumentId")]
AC GC Balance Update
Constraint:
CertNum: [=Data.Get("AccountName")]
Bal: [=Order.Price]
AC GC Update State GCStatus
Constraint:
CertNum: [=Data.Get("AccountName")]
Current GCStatus:
New GCStatus: Purchased
AC GC Add Line to Text File
(optional)
Constraint:
sometext: {DATE} {TIME}, [=Data.Get("AccountName")] ([=Order.Price]), Purchased, Balance [=Order.Price]
Rule - NUMBERPAD Value Entered - Search & Select GC:
Rule to capture when a valid GC has been scanned, or its number has been entered into the NUMBERPAD, to Select the GC for Redemption.
Name: RU GC Select NUMPAD
Event Name: Numberpad Value Entered
Custom Constraints: Execute rule if Matches
Numberpad Value
Starts GC20
Actions:
AC GC Select NUMPAD
Constraint:
SearchValue: [:NumberpadValue]
AC Display Ticket
Constraint:
TicketId:
Rule - GC Redeemed (used as Payment) - Update GC Data: (Actions in red are optional)
Rule to capture when a valid GC has been used as a Payment Type, to update all the GC Entity Data and GC Account Balance, since it has been used (in whole or in part) for Redemption.
Name: RU GC Redeemed (update GC data)
Event Name: Payment Processed
Custom Constraints: Execute rule if Matches All
Payment Type Name
Equals Gift Certificate
{ENTITY NAME:Gift Certificate}
Starts GC20
[=-1*TN('{ENTITY BALANCE:Gift Certificate}')]
Greater 0
Actions:
AC GC Balance Update
Constraint:
CertNum: {ENTITY NAME:Gift Certificate}
Bal: [=-1*TN('{ENTITY BALANCE:Gift Certificate}')-[:ProcessedAmount]]
AC GC Redeem
Constraint:
Account Name: GC Redemptions
CertNum: {ENTITY NAME:Gift Certificate}
Amount: [:ProcessedAmount]
AC GC Update State GCStatus
Constraint: [=-1*TN('{ENTITY BALANCE:Gift Certificate}')-[:ProcessedAmount]]<=0
CertNum: {ENTITY NAME:Gift Certificate}
Current GCStatus: Purchased
New GCStatus: Redeemed
AC GC Add Line to Text File
(optional)
Constraint:
sometext: {DATE} {TIME}, {ENTITY NAME:Gift Certificate} ([=-1*TN('{ENTITY BALANCE:Gift Certificate}')]), Redeemed [:ProcessedAmount], New Balance [=-1*TN('{ENTITY BALANCE:Gift Certificate}')-[:ProcessedAmount]]
AC GC Update Ticket Tag GCN
(optional)
Constraint:
GCN: {ENTITY NAME:Gift Certificate}
AC GC Update Ticket Tag GCB
(optional)
Constraint:
GCB: [=-1*TN('{ENTITY BALANCE:Gift Certificate}')-[:ProcessedAmount]]
AC GC Entity Change to Invalid
Constraint: [=-1*TN('{ENTITY BALANCE:Gift Certificate}')-[:ProcessedAmount]]<=0
Display Payment Screen
Constraint: [:RemainingAmount]>0
Close Ticket
Constraint: [:RemainingAmount]<=0