# Staff Monthly Allowance Discount - Reoccurring Automatically

**URL:** <https://forum.sambapos.com/t/staff-monthly-allowance-discount-reoccurring-automatically/30033>\
**Category:** V5 Tutorial\
**Created:** [January 22, 2025, 1:48am UTC](https://forum.sambapos.com/t/staff-monthly-allowance-discount-reoccurring-automatically/30033 "2025-01-22T01:48:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bob\_be](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/b/e480ec/32.png) [@Bob\_be](https://forum.sambapos.com/u/Bob_be)\
**Post date:** [January 22, 2025, 1:48am UTC](https://forum.sambapos.com/t/staff-monthly-allowance-discount-reoccurring-automatically/30033/1 "2025-01-22T01:48:07Z")

</div>

This setup allows for staff/employees to receive a pre-set dollar amount of free products/services each month. With an automatic reset at the beginning of each month.

> ##### While developing this setup, I was using “Staff Benefit Discount” (SBD), when thinking of a title for this post, Staff Monthly Allowance seemed to be a better fitting title. I did not want to redo tutorial & images for the different name.

3 new custom fields will be added to an entity type. This setup is looking for a value in what is called a “Benefit Amount” field. If found, it will check the “Benefit Month” if it set to the current month format. If not set to the current month, it will adjust the “Benefit Month” and the “Benefit Balance” the the proper values. Any “Benefit Balance” that is left, will be written over, the staff member will lose the previous months “Benefit Balance” amount.

> **Animation Explained: How To Setup Staff Benefit & Operations**
>
> In this animation, “Staff Customer 3” will get a $10 value entered into the “Benefit Amount” field (this is amount that will be carried over from month to month). Then the customer is going to be loaded into the POS screen. Then back to the customer search screen to view the info that was automatically entered in the 2 other fields\*.
> 
> \* In the tutorial has these fields hidden. I have them visible to show what information written in the fields.

![Samba.Presentation_H6unzJ53s6](https://forum.sambapos.com/uploads/default/original/3X/2/5/25325ed78793a814a255c8d5e9a225b8b5510b2c.gif)

> **Animation Explained: Updating Staff Benefit Field**
>
> Continuing on from the previous animation, Staff Customer 3 will have a balance of $7.00 and the “Benefit Month” is set for the current month (formatted as \<Year-Month\>). Staff Member 1 has a benefit amount of $10, we will update it to $12, then load Staff Customer 1. Notice the Benefit Balance column has an amount of $3.25 and the Benefit month is set to the previous month. After loading the Staff customer, notice the Staff Discount button has a $12.00 balance, then will will go back to the Customer search to view the updated information. A sale will be made, using the Ticket Remaining amount. Than another sale will be made with the remaining amount greater than the discount that is available. The system will display the Staff Customer 1 Benefit Balance as an option.

![Samba.Presentation_6Jb9qGCZSo](https://forum.sambapos.com/uploads/default/original/3X/5/9/599f48eaf3117ba3385511a5c1bf9ad180523947.gif)

> ❗ This tutorial is assuming a staff member is listed as a customer. If you have a separate staff entity, replace `<customers>` with your `<staff entity>` name.

# Entity Type: Customers Additional Fields

Entities → Entity Types → Customers → Custom Fields

 ![SBD Customer Custom Fields](https://forum.sambapos.com/uploads/default/original/3X/8/d/8d6262fcd40122598421efefae2f25fe1e30e822.png)

| Custom Field Name | Field Type | Mask Type | Editing Format | Hidden |
| --- | --- | --- | --- | --- |
| Benefit Amount | Number | Reg Ex | `([0-9]*\.[0-9][0-9])?` | `[x]` |
| Benefit Balance | Number | Reg Ex | | `[x]` |
| Benefit Month | String | Reg Ex | `(\d{4}-(January|February|March|April|May|June|July|August|September|October|November|December))?` | `[x]`\* |

\*This will use the format yyyy- (2025-January). If a seasonal worker should work 1 month of the year, the use of a year and month will prevent their discount from not being updated.

These fields are meant to be hidden. There is a chance that 1 or more fields may show up on the New Customers/Edit Customer screen (POS screen → Select Customer → New Customer ). To remove the fields, right click and select “Design Mode”. Select the field(s) and right click and choose the X icon (under the “Abc” button). Right click again in a blank area, and choose “Design Mode” to exit out of design mode.

# New Ticket State

Settings → States → Add State

 ![SBD Ticket State](https://forum.sambapos.com/uploads/default/original/3X/5/8/58e50e92e3c44be9da0a168709cc1c0dd1759e04.png)

| Name: | `Staff Benefit Discount` |
| --- | --- |
| State Name: | `SBDStatus` |
| State Type: | `Ticket State` |
| Color: | `<blank>` |
| Display Format: | `<blank>` |
| Quantity Format: | `<blank>` |
| Price Format: | `<blank>` |
| Show on End of Day Report: | `Checked` |
| Show on Product Report: | `unchecked` |
| Show on Ticket: | `Checked’ |

# New Account

Accounts → Accounts → Add Account

 ![Account Staff Benefit Discount](https://forum.sambapos.com/uploads/default/original/3X/8/f/8f38915b52f45b0ee2122099baf1c193eb2205c8.png)

| | |
| --- | --- |
| Account Name: | `Staff Benefit Discount` |
| Account Type: | `Discount Accounts` |
| Currency: | `<blank>` |

# New Transaction Type

Accounts → Transaction Types → Add Account Transaction Type

 ![Staff Benefit Discount Transaction](https://forum.sambapos.com/uploads/default/original/3X/4/0/40b2081175974e40a56c196c3b272eae970e7943.png)

| Account Transaction Type Name: | `Staff Benefit Discount Transaction` |
| --- | --- |
| Source Account Type (Debit): | `Receivables Account` |
| Target Account Type (Credit): | `Discount Accounts` |
| Default Source Account: | `Receivables` |
| Default Target Account: | `Staff Benefit Discount` |
| Currency: | `<blank>` |

# Calculation Type

Tickets → Calculation Types → Add Calculation Type

 ![Calculation Type Staff Benefit Discount](https://forum.sambapos.com/uploads/default/original/3X/a/2/a2fe19dbd161af956485f3aee9b4e66044e80bbe.png)

| Template Name: | `Staff Benefit Discount` |
| --- | --- |
| Account Transaction Type: | `Staff Benefit Discount Transaction` |
| Calculation Method: | `Fixed Amount` |
| Rate or Amount: | `0` |
| Max Amount: | `0` |
| Rounding: | `0` |
| Include Tax: | `unchecked` |
| Decrease Amount: | `Checked` |
| Use Plain Sum: | `unchecked` |
| Toggle: | `unchecked` |
| This calculations is about Ticket: | `unchecked` |

# Automation Commands

**1 of 1**

 ![SBD Auto Command 1](https://forum.sambapos.com/uploads/default/original/3X/5/4/542c67ab32c3a87ca7520b276ecc7727ead38304.png)  
 ![SBD Auto Command 2](https://forum.sambapos.com/uploads/default/original/3X/9/6/964838da549ef083b535971fb2d48cc8aab1417b.png)

| Name: | `SBD - Staff Benefit Discount` |
| --- | --- |
| Category: | `<blank>` |
| Button Header: | `Staff Benefit\rDiscount\r<b>Bal: {ENTITY DATA:Customers:Benefit Balance}</b>` |
| Color: | `Yellow` |
| Font Size: | `26` |
| Confirmation: | `None` or `Admin Pin` |
| Execute Once: | `Checked` |
| Clear Selection: | `Checked` |
| Toggle Values: | `unchecked` |
| Ask Text Input: | `unchecked` |
| Ask Numeric Input: | `unchecked` |
| Values: | `<blank>` |

| Mappings: | |
| --- | --- |
| Enabled States: | `Staff Benefit Discount` |
| Visible States: | `Staff Benefit Discount` |

# Actions

**Action 1 of 7**

 ![Action SBD - Ask Question](https://forum.sambapos.com/uploads/default/original/3X/c/e/ce3a360a64e5ebc2a240366f2506e479213431f9.png)

| Action Name: | SBD - Ask Question |
| --- | --- |
| Action Type: | `Ask Question` |
| Question: | `[:title]` |
| Buttons: | `[:buttons]` |
| Description: | `[:explanation]` |
| Automation Command Name: | `[:command name]` |
| The remaining fields: | `<blank>` |

**Action 2 of 7**

 ![Action SBD - Execute Automation Command](https://forum.sambapos.com/uploads/default/original/3X/c/7/c7cdbc77e6ed8b6fb547ee7b37e27288af46f2b5.png)

| Action Name: | SBD - Execute Automation Command |
| --- | --- |
| Action Type: | `Execute Automation Command` |
| Automation Command Name: | `[:command name]` |
| Command Value: | `[:command value]` |
| The remaining fields: | `<blank>` |

**Action 3 of 7**

 ![Action SBD - Update Benefit Balance](https://forum.sambapos.com/uploads/default/original/3X/9/c/9cd0c8693c9289c3b70d6ff9e36784e715fd436d.png)

| Action Name: | SBD - Update Benefit Balance |
| --- | --- |
| Action Type: | Update Entity Data |
| Entity Type Name: | `Customers` |
| Entity Name: | `{ENTITY NAME:Customers}` |
| Field Name: | `Benefit Balance` |
| Field Value: | `[:balance amount]` |

**Action 4 of 7**

 ![Action SBD - Update Benefit Month](https://forum.sambapos.com/uploads/default/original/3X/9/0/90bd7393cf51dae5a29e6d37b113b661e7753bfc.png)

| Action Name: | SBD - Update Benefit Month |
| --- | --- |
| Action type: | Update Entity Data |
| Entity Type Name: | `Customers` |
| Entity Name: | `{ENTITY NAME:Customers}` |
| Field Name: | `Benefit Month` |
| Field Value: | `{DATE:yyyy-MMMM}` |

**Action 5 of 7**

 ![Action Action SBD - Staff Benefit Discount Calculation](https://forum.sambapos.com/uploads/default/original/3X/1/0/1076a2b87acdaca4459b507de1001ade80fd962c.png)

| Action Name: | SBD - Staff Benefit Discount Calculation |
| --- | --- |
| Action type: | Update Ticket Calculation |
| Calculation Type: | `Staff Benefit Discount` |
| Amount: | `[:amount]` |
| The remaining fields: | `<blank>` |

**Action 6 of 7**

 ![Action SBD - Staff Benefit Discount Status - Ticket State](https://forum.sambapos.com/uploads/default/original/3X/c/b/cb72b0a4caccb341829235a73a4493d0b9f1465a.png)

| Action Name: | SBD - Staff Benefit Discount Status - Ticket State |
| --- | --- |
| Action type: | Update Ticket State |
| State Name: | `SBDStatus` |
| Current State: | `<blank>` |
| State: | `[:state]` |
| The remaining fields: | `<blank>` |

**Action 7 of 7**

 ![Dsiplay Ticket](https://forum.sambapos.com/uploads/default/original/3X/8/0/8037c9ba79734c1c70e1bf06569eac980981bebf.png)

| Action Name: | `Display Ticket` |
| --- | --- |
| Action type: | Display Ticket |
| Ticket Id: | `[:ticket id]` |

# Rules

### - Rule 1 of 7

 ![Rule SBD - Staff Benefit Discount - Ask Amount - Step 1](https://forum.sambapos.com/uploads/default/original/3X/5/7/57bbf8ac65cfd11a402b38ea26e0eb5e99f82ee4.png)

Name: **SBD - Staff Benefit Discount - Ask Amount - Step 1 - Benefit Balance**

Event Name: `Automation Command Executed`

| Constraints: | | |
| --- | --- | --- |
| `Automation Command Name` | **Equals** | `SBD - Staff Benefit Discount` |
| `{REMAINING TOTAL}` | **Greater** | `[=TN('{ENTITY CUSTOMDATA BY NAME:Customers.{ENTITY NAME:Customers}:Benefit Balance}')]` |

### Actions: 1

| Action Name: | SBD - Execute Automation Command |
| --- | --- |
| Constraint: | `<blank>` |
| command name: | `SBD - Staff Benefit Discount - Step 2` |
| command value: | `[?Discount Amount;\d{0,2}(\.\d{1,2})?;{ENTITY DATA:Customer:Benefit Balance};ONC;]` |

### - Rule 2 of 7

 ![SBD - Staff Benefit Discount - Ask Amount - Step 1 - Remaining Balance](https://forum.sambapos.com/uploads/default/original/3X/a/c/ac93eb4685b9639788d77e86c491b7888ae06565.png)

SBD - Staff Benefit Discount - Ask Amount - Step 1 - Remaining Balance

Event Name: `Automation Command Executed`

| Constraint: | | |
| --- | --- | --- |
| `Automation Command Name` | **Equals** | `SBD - Staff Benefit Discount` |
| `{REMAINING TOTAL}` | **Less** | `[={ENTITY CUSTOMDATA BY NAME:Customers.{ENTITY NAME:Customers}:Benefit Balance} +.01]` |

### Actions: 1

| Action Name: | SBD - Execute Automation Command |
| --- | --- |
| Constraint: | `<blank>` |
| command name: | `SBD - Staff Benefit Discount - Step 2` |
| command value: | `[?Discount Amount;\d{0,2}(\.\d{1,2})?;{REMAINING TOTAL};ONC;]` |

### - Rule 3 of 7

 ![Rule SBD - Staff Benefit Discount - Ask Amount - Step 2 - Error](https://forum.sambapos.com/uploads/default/original/3X/5/e/5e8b205f050b3624d451ead1f4d759c858964d19.png)

SBD - Staff Benefit Discount - Ask Amount - Step 2 - Error

Event Name: `Automation Command Executed`

| Constraint: | | |
| --- | --- | --- |
| `Automation Command Name` | **Equals** | `SBD - Staff Benefit Discount - Step 2` |
| `Command Value` | **Greater** | `{REMAINING TOTAL}` |
| `Command Value` | **Greater** | `{ENTITY DATA:Customers:Benefit Balance}` |

### Actions 1:

| Action Name: | SBD - Ask Question |
| --- | --- |
| Constraint: | `'[=TN('{ENTITY DATA:Customers:Benefit Balance}')]' < '{TICKET TOTAL}'` |
| title: | `You Have Entered An Amount That Is Too High.\rPlease Enter An Amount Less than or equal to <b>$ [= '{ENTITY DATA:Customers:Benefit Balance}' > '{TICKET TOTAL}' ? '{TICKET TOTAL}' : '{ENTITY DATA:Customers:Benefit Balance}']</b>` |
| explanation: | `<blank>` |
| buttons: | `OK` |
| command name: | `SBD - Staff Benefit Discount` |

### - Rule 4 of 7

 ![Rule SBD - Staff Benefit Discount - Ask Amount - Step 2 - Correct](https://forum.sambapos.com/uploads/default/original/3X/e/b/ebb8af40010209d5db153782c71a5808371bf18e.png)

SBD - Staff Benefit Discount - Ask Amount - Step 2 - Correct

Event Name: `Automation Command Executed`

| Constraint: | | |
| --- | --- | --- |
| `Automation Command Name` | **Equals** | `SBD - Staff Benefit Discount - Step 2` |
| `Command Value` | **Less** | `[={REMAINING TOTAL}+.01]` |
| `Command Value` | **Less** | `[=TN('{ENTITY DATA:Customers:Benefit Balance}')+.01]` |

### Actions 2:

| Action Name: | SBD - Staff Benefit Discount Calculation |
| --- | --- |
| Constraint: | `<blank>` |
| amount: | `[:CommandValue]` |

| Action Name: | Display Ticket |
| --- | --- |
| Constraint: | `<blank>` |
| ticket id: | `<blank>` |

### - Rule 5 of 7

 ![Rule SBD - Update Staff Benefit Balance](https://forum.sambapos.com/uploads/default/original/3X/c/a/cab1f1e6ab6fd836adedf41a9b6eb8bdc8b6e4b9.png)

SBD - Update Staff Benefit Balance

Event Name: `Ticket Closing`

| Constraint: | | |
| --- | --- | --- |
| `{TICKET STATE:SBDStatus}` | **Equals** | `Staff Benefit Discount` |
| `Remaining Amount` | **Equals** | `0.00` |
| `{TICKET DETAILS:CA.Staff Benefit Discount}` | **Is Not Null** | `<blank>` |

### Actions 1:

| Action Name: | SBD - Staff Benefit Balance |
| --- | --- |
| Constraint: | `<blank>` |
| balance amount: | `[=F(TN('{ENTITY DATA:Customers:Benefit Balance}')+TN('{TICKET DETAILS:CA.Staff Benefit Discount}'), '0.00')]` |

### - Rule 6 of 7

 ![Rule SBD - Update Data on Entity Selected](https://forum.sambapos.com/uploads/default/original/3X/c/c/cc555877dce5ee7c6d12cf469112b7e65f23cf43.png)

SBD - Update Data on Entity Selected

Event Name: `Ticket Entity Changed`

| Constraint: | | |
| --- | --- | --- |
| `{ENTITY DATA:Customers:Benefit Amount}` | **Is Not Null** | `<blank>` |

### Actions 3:

| Action Name: | SBD - Staff Benefit Month |
| --- | --- |
| Constraint: | `'{ENTITY DATA:Customers:Benefit Month}' != '{DATE:yyyy-MMMM}'` |

| Action Name: | SBD - Update Benefit Balance |
| --- | --- |
| Constraint: | `'{ENTITY DATA:Customers:Benefit Month}' != '{DATE:yyyy-MMMM}'` |
| balance amount: | `[=F(TN('{ENTITY DATA:Customers:Benefit Amount}'),'0.00')]` |

| Action Name: | SBD - Staff Benefit Discount Status - Ticket State |
| --- | --- |
| Constraint: | `<blank>` |
| state: | `Staff Benefit Discount` |

### - Rule 7 of 7

 ![Rule SBD - Remove Calculation When Staff Changed](https://forum.sambapos.com/uploads/default/original/3X/5/a/5ad601f93c3a29de53cd6ac68973b3f21e807b10.png)

SBD - Remove Calculation When Staff Changed

Event Name: `Ticket Entity Changed`

| Constraints: |
| --- |
| `<none>` |

### Actions 2:

| Action Name: | SBD - Staff Benefit Discount Calculation |
| --- | --- |
| Constraint: | `<blank>` |
| amount: | `<blank>` |

| Action Name: | SBD - Staff Benefit Discount Status - Ticket State |
| --- | --- |
| Constraint: | `'{ENTITY DATA:Customers:Benefit Amount}' == ''` |
| state: | `<blank>` |

# Reports

Manage → Reports → Add Report

```auto
[Staff Benefit Discount Report:1,1,1,1]
>Ticket No|Items Total|Staff Discount|Ticket Amount
@{REPORT TICKET DETAILS:EN.Customers.asc:(TS.SBDStatus=Staff Benefit Discount)::,}
>$1 - Current Benefit Amnt: {REPORT ENTITY DETAILS:EC.Benefit Amount:(EN=$1)}
{REPORT TICKET DETAILS:T.TicketNumber,=[T.TotalAmount]-[CA.Staff Benefit Discount];0.00,CA.Staff Benefit Discount,T.TotalAmount:(TS.SBDStatus=Staff Benefit Discount) && (TEN.Customers=$1):{0}|$ {1}|$ {2}|$ {3}}
>{REPORT TICKET DETAILS:=[T.TotalAmount.sum]-[CA.Staff Benefit Discount.sum];0.00,CA.Staff Benefit Discount.sum,T.TotalAmount.sum:(TS.SBDStatus=Staff Benefit Discount) && (TEN.Customers=$1):Total|$ {0}|$ {1}|$ {2}}

```

Report Sample:

 ![Samba.Presentation_XBloozQvRP](https://forum.sambapos.com/uploads/default/original/3X/f/5/f546c7edc0c7895f501f3334f4aad5949719ba92.png)

---

<div class="post-metadata">

**Author:** ![domenic85martha](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/d/958977/32.png) [@domenic85martha](https://forum.sambapos.com/u/domenic85martha)\
**Post date:** [February 27, 2025, 6:22am UTC](https://forum.sambapos.com/t/staff-monthly-allowance-discount-reoccurring-automatically/30033/2 "2025-02-27T06:22:47Z")

</div>

Hello,

I really appreciate the time and effort you’ve put into. Thank you for sharing your expertise!

Best Regard,  
Domenic

---

<div class="post-metadata">

**Author:** ![Muzzargh](https://forum.sambapos.com/user_avatar/forum.sambapos.com/muzzargh/32/55913_2.png) [@Muzzargh](https://forum.sambapos.com/u/Muzzargh)\
**Post date:** [September 4, 2025, 12:23am UTC](https://forum.sambapos.com/t/staff-monthly-allowance-discount-reoccurring-automatically/30033/3 "2025-09-04T00:23:53Z")

</div>

Can this be set up so the previous months balance can be carried over rather than written over?

---

<div class="post-metadata">

**Author:** ![Bob\_be](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/b/e480ec/32.png) [@Bob\_be](https://forum.sambapos.com/u/Bob_be)\
**Post date:** [September 4, 2025, 12:41am UTC](https://forum.sambapos.com/t/staff-monthly-allowance-discount-reoccurring-automatically/30033/4 "2025-09-04T00:41:46Z")

</div>

I have not tested this. Try this procedure on a test machine first.

I think if you adjust the 2nd action (SBD - Update Benefit Balance) in Rule #6 (SBD - Update Data on Entity Selected) with this formula:

```auto
[=F(TN('{ENTITY DATA:Customers:Benefit Balance}')+TN('{ENTITY DATA:Customers:Benefit Amount}'),'0.00')]

```

It should take the balance the employee has at the end of the month and their monthly benefit amount.

 ![F8Yxhr1lG5](https://forum.sambapos.com/uploads/default/original/3X/4/3/43e2f1dcf39259736ec1603073838b3195ad299d.png)

Just be aware that some employees may not use their benefits and build up a large amount. It would be advisable to to have some sort of policy in place.

---

<div class="post-metadata">

**Author:** ![Muzzargh](https://forum.sambapos.com/user_avatar/forum.sambapos.com/muzzargh/32/55913_2.png) [@Muzzargh](https://forum.sambapos.com/u/Muzzargh)\
**Post date:** [September 4, 2025, 12:45am UTC](https://forum.sambapos.com/t/staff-monthly-allowance-discount-reoccurring-automatically/30033/5 "2025-09-04T00:45:34Z")

</div>

Awesome, I’ll try that out.  
Thanks for your speedy reply. 👍👍👍
