Actions, Rules & Automation Commands Explanation

I’m trying to trigger it with ‘Handle Deliverer Command’ which is an automation command executed rule. This command adds my deliverer entity to the ticket.

I would ideally also need to calculate a time like 1 month from now and set that as the expiry date on the coupon.

OK, am going to need to be at my desk to discuss this,
If no one comes back in the mean time I should be home in 3-4 hours.

Thanks a lot JRTech! Really appreciate you taking the time to help me out.
Take your time… if i manage to solve it on my own, will post my solution here.

I would wadger a solution for what your trying to do could be very similar to the native hotel account setup I did which used a automation command flow to create and update a seccond entity.
Your random coupon number would be the command value of an execute automation command going in to a coupon generation command rule.
Using the command value it would make the coupon entity, and then update entity data actions would update the required entity data again using the command value for the entity name.
There is allot more to the example that you will need but take a look and you might get the insparation to sort yourself before I get home;

There is a tutorial to print vouchers when a certain limit is reached so this may be a starting point for you.

But JTRTech is great at showing you how to implement the rest of the procedures or even show you other ways of doing this.

1 Like

Thanks!
Yeah i originally Implemented the Voucher thing, but realized i may need some unique IDs to them in order to prevent people from reusing vouchers. Works perfectly though this one. Then followed https://sambapos.org/wiki/doku.php/en/promotion_coupons_documentation .

seems almost there, but then again he has gone on to use a Product in the menu to generate the Coupons… So im trying to really just get something in the middle… Create coupons and discount vouchers with unique IDs and and auto generate them based on customer purchase history or total amount on current ticket.

JRTech has provided some massive content to look at and refer to, so will be studying that.

I use the voucher system i linked to produce vouchers and I have also got it inserting a ticket tag into the voucher with a random number and also the date and expiry date… My system currently looks at the value of the ticket and then prints the voucher but if you want to link it to total spend of the customer over a certain period then you may be better off using Sambacard or similar system.

I dont use the create product system

1 Like

I am not a fan of the creating product method, seems unesercery to me but this is why a samba manual is imposible as there is no set way to do anything.

What type of coupons are these going to be?
They are not vouchers in a sense of having a credit balance?
If you can explain the use of cupons and how you plan to redeem them would help.

I created two Entities: Coupons & Vouchers

Coupons: Will be issued (example) if the customer bought 5 pizzas, it should generate a free pizza coupon. So i think following the coffee shop example almost gets me there. Will also have a few buttons in case of late delivery and all for free pizza or bread or something.

Vouchers: Will be issued for x amount like ‘500 worth voucher’. Vouchers will be generated when the customer spends more than a certain amount in a single order.

I think i can implement almost everything from the Coffee shop and the Voucher examples. My only issue is triggering and creating these coupons and vouchers with the ticket ID so that i’m able to print these out when i’m printing a receipt for the delivery guy to take to customer.

Do the coupons need to be tracked? If you print of a coupon would it say something like “Order 2 Pizza and get 1Free”?. personally i wouldnt want to track that as my coupon/voucher is printed on thermal 80mm paper and customers usually dont have something like that so wont be able to copy it. And if they did, at least they are coming back to your store for the pizzas :slight_smile:

Im not sure you would use Entities to do this but JTRTech can advise better

I think maybe we can discuss better my sugestion idea when I get home.

Just to keep things clear can we clarify some terminology so we are all on the same page.

An ORDER is a product/item line on a TICKET.
When you say customer spends so much on an ORDER I am presuming you mean TICKET.
I dont mean to be penicity but its better if we are all talking in the same way and that is the way things are called within samba so really the best way for us to refer to them.
A customers whole order is the TICKET, the things be has ordered are the ORDERS.

I too would personally like to track like you sugest.
This would also allow you to make a report to show the amount of unclaimed coupons. How much value to would place on a report like that is up to you but its a good thing to know I think.
Vouchers would obviously be tracked through their account. If your not using accounts I would recomend it that way myself.

We can go through my sugestions when I get home.

1 Like

ok @digithai am home.
so just recap what you currently have for coupons?

Any luck? The hotel entity setup give you any ideas?

good morning JTR, im working on it, things are starting to make more sense…

I’m located at GMT+7, so i had hit the bed last light. i’ll post my updates in a few hours.
thanks!

Ok, So i tried to read through the links properly and re-evaluated what im trying to accomplish.

So my current simplified conclusion to what i am trying to do is:

Coupons:
• An Entity object with Unique ID, Redemption status, expiry date and Text Description.
• On the Ticket screen, there will be an automation command (Button) ‘Issue Coupon’. OnClick generates a popup that will ask for Description. This description will be saved into the New Coupon generated. So technically submission of the message triggers ‘Create Coupon’ action which should be able to take the message as input. The created Coupon’s code has to be returned and added to the Ticket so that it can be printed along with the Bill for the customer(When Deliverer is assigned).

Vouchers:
• An Entity object with Unique ID, Redemption status, expiry date and Amount in numbers.
• Vouchers will be auto-generated depending on the total amount in the ticket. This generation will have to be done as soon as i assign the Deliverer to the ticket. Again, voucher code will be printed along with the customer Bill.

Redeeming Coupons and Vouchers
• Both Coupons and Vouchers will be redeemed by providing the code in the numberpad. If available, the coupon or voucher is assigned to the ticket.
• For Coupon the Description will need to be displayed in the ticket header so the sales employee is able to read that and mark relative products free/gift and flag it with the coupon.
• For Vouchers the amount has to be subtracted from the ticket as discount with the voucher code as the flag.

So that’s my whole idea.
To implement this, im following these two tutorials:
• Coupons: https://sambapos.org/wiki/doku.php/en/promotion_coupons_documentation
[The link i had shared earlier … The Coffee shop example]
• Vouchers: Printing Custom Discount Vouchers
[The Vouchers link from sid252uk]

So i currently need to figure out how to:
• Create a popup text input, and submit this to a Create Entity Action.
• set the date on the Create Entity Action.
• Add discounts to the Ticket with some explanation text (Voucher ID)

Ok. So far i have managed to generate a voucher or coupon at the correct point of time. what i need now is to get the Voucher ID from the Create action to that i can add that the ticket to be able to print it with the bill.

However i cant seem to figure out how to get the Voucher ID from the Create Entity Action and add that to the Ticket.

That was what I was saying.
On your crate coupon button or a confirmation ask question if you prefer it triggers one command rule which has an execute automation command action.
That action has a command value of the random/unique id and the command name triggers a seccond rule which creates entity with that id, then you add a action to select that entity using the command value for the name, then additional update entity actions using command value again for the entity name and using whatever source you need for the update data.
For description use [?Description] which will show a popup with keyboard.
Will demo in half hour for you.

How to use Constraints in an action?

I have a rule when an automation command is executed [Add Deliverer to ticket] At this point i need to make a check if the total amount is more than 1000.

For testing i added a Show Message box, and added {TICKET TOTAL} > 1000 but it doesn’t seem to work

In the message box, {TICKET TOTAL} displays the correct amount. but the same thing in constraints fails to have an affect.

I have tried these for Constrains already:
{TICKET TOTAL} > 1000
{:TICKET TOTAL} > 1000
[TICKET TOTAL] > 1000
[:TICKET TOTAL] > 1000

{TICKET TOTAL} >= 1000
{:TICKET TOTAL} >= 1000
[TICKET TOTAL] >= 1000
[:TICKET TOTAL] >= 1000

Even tried without spaces… without any success…

Firstly thats a bad place to put that as in theory the ticket was closed in the previous action :slight_smile:

When using > or < you should always TN the tag to ensure it is returned as a number not a string TN(’{TICKET TOTAL}’)
Additionally I have always had difficulties getting larger/smaller or = to to work (probably just me) but I opted to stick to just >/< and change the value;

TN('{TICKET TOTAL}') > 999

Where do you intend to put this?