GC Sales & Redemption

By default there is no Entity Type configured for Update Entity State action. That’s why it updates all entities. When configured it will only update related entity.

I have been trying to set this up for a couple days now, but as usual, I can’t find the correct event or setting.

First, I need to capture the GC Account Balance after it has been used for Payment, so that I can check to see if the Account still contains funds, or has been depleted to zero…

I’ve tried these events:

Entity Updated
Payment Processed
Ticket Closing
Before Ticket Closing
Account Transaction Document Created
Account Transaction Added to Ticket

For the event, I fire a Message action, and have attempted these settings to be displayed:

[:Account Name]
[=Data.Get("SourceAccountName")]
{:SOURCE ACCOUNT}
{:TARGET ACCOUNT}
[:SourceAccountName]
[:TargetAccountName]
[:EntityTypeName]
[:EntityName]
{:ENTITY NAME}
[:Name]
{:NAME}
[:EntityBalance]
{:ENTITY BALANCE}
[:Balance]
[:Amount]

I never know which setting or tag is available to which event or action, nor do I know the correct syntax. All of my trials so far have produced empty results in the Message Box.

Looking for guidance… :slight_smile:

{ENTITY BALANCE} will work as long as only one entity is selected, and a ticket has been created.

We can filter the Entity Search only by states, but the problem I faced was that entity states are global, that is for all entities, so we need to change the default Update Entity State rules to only apply to Tables before we can deal with GC’s.

When testing for values, the Show Message action is useful in combination with printer tags. If it does not display a message, then there is no value or you have the wrong tag. Always add some text to the message so it will pop up, ie “test {ENTITY BALANCE}”

Thanks @JohnS, I actually do have arbitrary text in the message, in fact my message has been (yes very long):

GC- [:Account Name] [=Data.Get("SourceAccountName")] {:SOURCE ACCOUNT} {:TARGET ACCOUNT} [:SourceAccountName] [:TargetAccountName] [:EntityTypeName] - nm [:EntityName] {:ENTITY NAME} [:Name] {:NAME}- bal [:EntityBalance] {:ENTITY BALANCE} [:Balance] [:Amount]

I get a message that shows (in general):

GC-  - nm  bal 

If I use {ENTITY BALANCE} as you suggest, for Payment Processed event:

GC- name {ENTITY NAME} bal {ENTITY BALANCE}

This is displayed in the message:

GC- name {ENTITY NAME} bal {ENTITY BALANCE}

If I use this instead:

GC- name {:ENTITY NAME} bal {:ENTITY BALANCE}

This is displayed in the message:

GC- name  bal 

Thanks, keep the ideas coming!

Try {ENTITY BALANCE:X}

X means you need to define something here. So for example if you need to read Customer balance you need to type it as {ENTITY BALANCE:Customer}. Be sure X part is not Entity Type Name (eg.Customers). It should be Customer as we typed Entity Name.

Probably you’ll encounter another issue as you need to read actual GC balance as soon as you complete payment with GC. Account balances gets updated after ticket saved to database but most ticket events executes before ticket saved to database. So you may read previous balance. Updating balance by using a custom expression might solve that. Please try it and let me know your result.

I also like to learn why you need to know GC balance :slight_smile:

Great! Almost…

{ENTITY BALANCE:Gift Certificate} works, but as you’ve mentioned, it gives the previous value (before removing Payment Amount). I’ll see if I can get around that by subtracting {TENDERED AMOUNT}?

I want to check the Balance on the GC Account, and if it is ZERO, set the GC Entity State to “Redeemed” (or similar), so that in my GC Entity Search screen, I can hide GCs that have zero balance, by filtering State “Redeemed”.

@emre, how do I know when to use which syntax? for example…
{:ENTITY BALANCE} versus {ENTITY BALANCE} ?

@QMcKay you can solve it by subtracting payment amount.

However I don’t think this is what you really dreamed for (umm… explained) :slight_smile: Do you really need tracking accounts for gift coupons? That was implemented for membership cards. I think it will be better if customer loses remaining amount if not used at once. That will force them to buy more stuff lol.

However there is no way to implement that. If you want such implementation let me know so I can check if we can do something with payment processors.

GC: {ENTITY NAME:Gift Certificate} bal {ENTITY BALANCE:Gift Certificate} tn {TENDERED TOTAL}

produces this message:

GC: GC2014053114171581500 bal -170.00 tn 10.00

You’re correct @emre, this isn’t really what I was dreaming, but I’m hoping I can make it work (for now), since I get a lot of requests for GCs, and we’ve been handling them randomly, and manually.

If a better solution comes along in the future, I’ll be the first to adopt it!

… additionally {:ENTITY BALANCE} is short hand for reading a program setting named ENTITY BALANCE. We store some program wide values (such as logged in user name, selected entity screen, etc) as program settings by default so some values are accessible with that syntax. {ENTITY BALANCE:X} is a printer template tag. Since we can access some ticket, order or entity values from rules with printer tags Printer Template Tags documentation is the place where you need to use as a reference.

When you have time please share your best solution so I’ll know which features you’ll need.

I couldn’t understand the message. Do you think this is an error?

@emre , no… it’s not an error, it’s good! I was just illustrating what my “test” Message Box displays for me…

I’m beginning to see why a “simple” GC sales/redemption Tutorial has not yet been done. The thing that confuses me is that by default, SambaPOS has a Payment Type called Voucher - I don’t understand it’s purpose in it’s current (default) implementation/configuration (or lack thereof).

You are right. Voucher payment type is a little confusing. It stands for prepaid card payments such as Sodexo but while translating SambaPOS to English I’ve preferred a more general name since that type of payments is not popular in all countries.

What makes it complex is heavy customization needs. As you use it in your restaurant you’ll want to try different ideas and these small feature pieces will help a lot.

A side note : Since you don’t make partial searches on Gift Certificate Search screen, I think displaying used items there is not a big issue. What do you think? I have a better idea. Use it as John suggested and if having a lot of items creates issues, you can send me your database and I can make required optimizations.

That’s just the point @emre… I do make partial searches on the GC Search screen (and I want to do it this way). This saves having to type in the rather long GC# (i.e. GC2014060113297581500)

I just type ‘g’ and it lists them all (thankfully alphabetically), though I wish I could reverse the sort order to display most-recent entries first and hide those that have zero balance, since they are useless to me.

As you mentioned earlier, I also mentioned… if the customer does not use the entire value of the GC then too bad - no change is given, and the GC should be dead (marked as “Redeemed”), and thrown away. I still need a control number for every GC printed, so I have some type of validation.

Purchase and Redemption - Tracking with new State "GCStatus"

I have it working with a new State called GCStatus. No need for the Custom Data field, however I include a field called GCBalance which is useful.

NOTE: this will only work for new GCs. Those purchased/redeemed prior to this implementation will not have a proper State!

Add 2 new States to track the Status of the GC. We’ll call it GCStatus, and the State will either be Purchased or Redeemed.

Purchased will indicate the GC Account has a Balance > 0
Redeemed will indicate the GC Account has a Balance = 0

Modify the GC Entity Type to contain Custom Data field called GCBalance. We will update this field when the GC is Purchased, and whenever the GC is used as a Payment Type (Redeemed).

Modify the GC Entity Search Screen to show only GCs which are Purchased (GCBalance > 0)

Add a “Dummy” GC Entity called ZZGC2000 with a GCBalance of zero.

Add an Action to automatically Select the “Dummy” GC.

Add 2 Actions to update the Entity State GCStatus: 1 for Purchased, 1 for Redeemed.

Add an Action to update the GC Entity custom field data for GCBalance.

Add 2 Actions to the GC Print Rule to update the GCStatus and GCBalance when the GC is Purchased.

Create a new Rule to handle when the GC is used as a Payment Type. Here are the formulas used in this Rule, in order:

Payment Type Name   Equals   Gift Certificate
{ENTITY NAME:Gift Certificate}   Starts   GC2014
[=-1*TN('{ENTITY BALANCE:Gift Certificate}')]   Greater   0

{ENTITY NAME:Gift Certificate}
[=-1*TN('{ENTITY BALANCE:Gift Certificate}')-[:ProcessedAmount]]

[=-1*TN('{ENTITY BALANCE:Gift Certificate}')-[:ProcessedAmount]]<=0
{ENTITY NAME:Gift Certificate}

[=-1*TN('{ENTITY BALANCE:Gift Certificate}')-[:ProcessedAmount]]<=0

[:RemainingAmount]>0

[:RemainingAmount]<=0

The final result…
When we Search for a GC Entity, it will only show those with Balance > 0 (GCStatus=Purchased)

As shown above, we have 3 GCs:
1: GC201406021759845500 was Purchased for 500, partially used, current balance is 160
2: GC201406021818267777 was Purchased for 777, partially used, current balance is 317
3: GC201406030927070800 was Purchased for 800, unused, current balance is 800

Yay! :slight_smile:

Great solution! Now I’m thinking of a payment processor to limit GC payment total to GCBalance. So tracking accounts for GC’s will not be needed.

I think I may have overdone it with the Rules and Actions, but it works fairly well. :slight_smile: I think it could be optimized to reduce the number of Rules and Actions, since some of them appear to be (partially) redundant.

Also, I’m wondering about the comments from @JohnS, regarding selecting more than 1 Entity Type (eg. a Table and a GC) and updating States. I haven’t hit any issues, but my testing has been limited.

@emre, can you elaborate on the above? Tell me what I need to change to track this better?

I want to be able to post the Balance of the GC into the Charged field on the Payment screen. @emre, Is there an Action for this?

In this screen shot, the customer has ordered products totaling 140.
They have a GC with a value/balance of 100 which they want to use.

Rather than typing 100 on the numberpad and clicking Gift Certificate, I want to use something like an automation command, which when clicked, posts the GC balance to the Charged field. Then I would click Gift Certificate, which would reduce the remaining total to 40, which I would settle by another Payment Type (Cash, CC, Cust. Account).

Using the GC as Tender - Automating Payment Amount with a Button

Create an Automation Command button, give it a Button Header name that suits you (i.e. “Tender Gift Cert”), and map the visibility to the Payment screen.

Create an Action for use with paying the Ticket.

Create 2 rules to handle the click of the Automation Command.

Rule 1: when the amount owing on the Ticket is less than the balance on the GC (GCBalance), we pay the Ticket in full with the GC Account, for the amount that is owing on the Ticket.

Here are the formulas used in this screen, in order of use:

Automation Command Name   Equals   AU GC Tender
{ENTITY NAME:Gift Certificate}   Starts   GC2014
[=-1*TN('{ENTITY BALANCE:Gift Certificate}')]   Greater   0
[=-1*TN('{ENTITY BALANCE:Gift Certificate}')]   Greater   [=TN('{TICKET TOTAL}')-TN('{TENDERED TOTAL}')]

[=TN('{TICKET TOTAL}')-TN('{TENDERED TOTAL}')]   Greater   0

[=TN('{TICKET TOTAL}')-TN('{TENDERED TOTAL}')]

Rule 2: when the amount owing on the Ticket is greater than or equal to the balance on the GC (GCBalance), we pay as much of the Ticket as possible with the GC Account.

Here are the formulas used in this screen, in order of use:

Automation Command Name   Equals   AU GC Tender
{ENTITY NAME:Gift Certificate}   Starts   GC2014
[=-1*TN('{ENTITY BALANCE:Gift Certificate}')]   Greater   0
[=-1*TN('{ENTITY BALANCE:Gift Certificate}')]   Less   [=TN('{TICKET TOTAL}')-TN('{TENDERED TOTAL}')+0.01]

[=TN('{TICKET TOTAL}')-TN('{TENDERED TOTAL}')]   Greater   0

[=-1*TN('{ENTITY BALANCE:Gift Certificate}')]

Yay! :slight_smile:

There is no better POS once you’ve tried SambaPOS

The realization is this: None of this would be possible without the help of @emre and @JohnS, and of course…

The AWESOME Power and Flexibility of SambaPOS!!!

2 Likes