New user in need of a bit of help - Increase/update Expiry Dates

Hello everyone,

First of all allow me to introduce myself, I am currently working on redesigning a POS system that is currently in place at my local social club, while the system they have is very user friendly and looks pretty it seriously lacks in customising functionality, this is where I am trying to step in with Sambapos.

I have used samba before but it was back at version 3 of which I threw together a simple POS system with it for a Indian Restaurant which is still functioning well to this day, however what I am trying to achieve here is somewhat a lot more complex (well for me anyway)

Now the situation,

The social club uses memberships on the system, the current system basically all that it does when a card is scanned it changes the price level from 1 to 2 … 1=normal price 2=members price
This I have already replicated in samba pos and works well … (ticked off the list)

I have created the bar fast service look with the tutorial using custom buttons (forgive me cant remember whos tutorial it was but I will add … it was excellent for a new user)

customers can also top up the card and use it to pay at the bar so basically accounts
already sorted this with the help of the samba card forums and discussions I have been reading on (ticked off list)

the system also shows that the membership has lapsed after a specified date … in the clubs case 31/10/2018 ( or whatever year ) e.g lapsed for this year would be 31/10/2017
again (also ticked off the list using an account status check in the rules).

This is now where I have the problem and no matter where I look on the forum for some guidance I can not find any guide to a possible solution… I have seen it talked about but not really answered

the current system they have they can renew memberships over the bar on the pos, really simple how it works from the front end the renewal is a product (e.g 1 year Membership) and somewhere slapped completely anywhere in the products menus/settings there is a box where you type in …months to add to expiry … so in this case it would be 12.

when this product is selected on the frontend and the card is scanned the account is then reactivated and the expiry date now reads 31/10/2018

replicating this process is not an issue on the product side using sambas famous commands rules and actions and changing the status of the account from active to inactive is not an issue as I have done this through a simple custom field in the customer entity … eg ACTIVE…INACTIVE the rules check this field … and if its inactive it displays a popup box saying “Membership Has Expired … Renewal Required” … so the renewal process… scan the card which loads the entity customers then what ever account it is … in my testing case its Test Account the button is pressed for the renew membership and the sale is finished when this sale finishes the rules update the account status field to ACTIVE … using change ticket entity but that is where my ideas of how to get it to add 12 months onto the date currently in the expiry date field e.g 31/10/2017 + the 12 months = 31/10/2018

I have already found the details on the printer templates with the ADD and ADM functions … which would be great but I’m trying to add it to a static date that is already in the custom entity field and not {DATE} the current system date.

I have been working on this for about 3 weeks up to now and personally I feel I have come rather along way with this… whats more unbelievable is how much you can customise samba … its great of course I didn’t realise this with just quickly working with version 3.

I do really prefer the google … forum … research … play and try approach but after a week of trying to over come this problem I no choice but to get on my knees to you fine people and cry for help.

so to be simple without the story behind it all my question is…

is there a way / variable / string or something I’m missing completely to add 12 months to a already inserted date in the custom entity ?

thank you for your time

Lee

What version you using? 4 or 5.
Dates are always a nightmare to work with with reigonal settings etc.
On my system I have changed the date format to match SQL coding standard of yyyy-mm-dd
What you might want to do is look at scripts. There are some helper functions but I have.often found it’s easier to turn it to the date Unicode number of Ms since 1970 or whatever date it is and then adding Ms in formula x60x24x365 etc then formatting back to date.

You can update Entity Custom Data a few different ways:

  • via “normal” Automation sequences
  • using the Entity API in JScript (JScript Helpers and Functions)
  • using GraphQL mutations
  • doing direct DB edits (not recommended)

Show the Entity Custom Data Field configuration with an indication of which field you want to add months to.

Show the Rule that updates from INACTIVE to ACTIVE.

version 5 sorry suppose that would of been a useful idea to mention that :slight_smile:



Hi QMcKay I’m not at the office at the minute, so I have quickly just recreated it except with a button to start the process off instead of after payment process - remaining amount = 0

I was trying to avoid going down any “major scripting” and just use sambas AC - R - A … its took me 3 weeks to get my head round them and if I’m honest … I’m no where near even close to fully understanding it all, I’m in now way shape or form some one that understands much code if I’m true, so far I’m surprised I have reached this far but I shall march on till the end … or I break the pc :smile:

The guess is there is a Customer Entity attached to the Ticket. So you should be able to update Custom Data Field Expiry Date by using the ADM() function and this tag:

{ENTITY DATA:Customers:Expiry Date}

Assuming the above is correct, something like the following should theoretically work, but it might depend on the Date Format, which you can also change using FD(<date>,<format>), by firing the Update Entity Data Action in a Rule:

[=ADM('{ENTITY DATA:Customers:Expiry Date}',12)]

So your Action should be this:

image

And you would use a Rule with that Action in it, like this:


Depending on the Rule where the Action is being fired, you might need to use the shorter form of the tags which excludes the Entity Type, like this:

{ENTITY NAME}
{ENTITY DATA:Expiry Date}

QMcKay, if you are around the Derbyshire area … I would love to buy you are drink your a star … worked like a charm …

however I have read on the forum somewhere about formatting this be dammed if I can find it now should of book marked it … only reason I’m asking is from the date 31/10/2017 it has updated it to 31/10/2018 00:00:00 … the time could cause an issue in the future as my next plan in this project (long way off) is to get the door controller to read the data from the database … hence the ACTIVE and INACTIVE field

ive just tried this
[=FD(ADM(’{ENTITY DATA:Customers:Expiry Date}’,12),‘dd/MM/yyyy’)]

but all that is doing is clearing the date that is already in the field ? … perhaps I’m not on the right path with this ??
sorry to be a pest

You can try the JS substr(<start>,<length>) function:

[=ADM('{ENTITY DATA:Customers:Expiry Date}',12).substr(0,10)]

… or this should work as well, adding the FD() function along with the substr() function …

[=FD(ADM('{ENTITY DATA:Customers:Expiry Date}',12),'dd/MM/yyyy').substr(0,10)]
2 Likes

the first one gave the same blank result … the last one is the trick :smile:
just tried it 3 times and now I’m on 31/10/2019

I can not thank you enough … once I get further with this project I will share … its probably been achieved 200 times like by other people but someone may find it useful

you have saved me a box of head ache tablets … thank you

1 Like

Membership Expiry Date Checking and updating working perfectly :slight_smile: on that note bed time

thanks again QMcKay

2 Likes

Hey @Djrusty good work!
What logic in the constraint did you come up with to evaluate the popups for “Card Accepted” and “Card Rejected”? This would almost complete the old data handling of Expiry Dates…

Thanks Paul.

Would be intriged on your plan for door access, it’s need mentioned a few times but not seen any solid solutions.

We have a cheapy China network controller which has an admin app which runs on SQL however the update needs to be pushed from the software so even if samba updated access it would needto be pushed out from the software manually - although it has function for expire I’m sure so using that could be achived less frequently.

If I had tinker time I’d maybe attempt a diy controller using say an Arduino or something to read direct from samba possibly.

If you look to expand functionality of your members system to allow user registration and potentially renewal online I am working on a setup for WordPress for outlr new loyalty system where customers and staff register on the site and samba syncs entities and eventually users/staff between our 3 sites which will hopefully offer a plug-in/scripts here (probably for small fee if it comes out as expected)

@pauln might drop you a line on this to see if you have done anything along these lines or interested in some collaboration.

Hi @pauln

in a nutshell it doesn’t actually evaluate the pop up … the check is done on the date itself compared to system date so in my case its

this rule to check the expiry date of what what ever card is scanned in and fires the expired pop up

then the accepted is

it checks onload of the entity (laments terms scanned card)

1 Like

it seems like we are working on the same type of project … granted yours sounds a dam sight more advanced than what this is ever going to be.

the door access side of things like you say is another story … that’s gunna take me some stripping down to see what actually happens probably something along the lines of like you say most controllers the program is required for the final push to the controller … so I was thinking of a more simple solution like samba updates the database and simple automation script on the server to push it from the software to controller…

maybe I’m just dreaming lol but time will tell :slight_smile:

Thats what I was thinking at one point but the software for my controller is mostly in chinglish and not exactly expecting support on it LOL

lol what is it one of the uhppote or what ever it is called I was gunna order one for testing purposes

I have followed this thread to setup a membership renewal which last 1 year /
365 days

What I want to achieve is.
Today’s date is 24/07/2023
A member added into a Entity table, membership expires 30/07/2023. When running this rule

[=FD(ADM(‘{ENTITY DATA:Members:Expiry Date}’,12),‘dd/MM/yyyy’).substr(0,10)]

the date is added to todays date. This needs to be added to the expiry date. Other wise the member loses so many days membership. BUT if the membership has expired ie ran out 01/01/2023, when renewing for another year / 365 days the renewal of 1 year is added to the current date.

1 Like

There seems to be some strange characters used for the quotes in your report.


The top line is one I typed out (I used Customers not Members) and was able to get it to work. The second line is pasted from above. Notice the 2 different quotes used. When I used your formula (and changed Members to Customers) it would not run.

Try copying and pasting this formula:
[=FD(ADM('{ENTITY DATA:Members:Expiry Date}',12),'dd/MM/yyyy').substr(0,10)]

Is it possible you used a word editing program and copied and pasted it? I’m just curious what would cause the different quotes.

—Edit—
I just noticed the your report was not using the forums preformatted text. It might be the forum that changed the quotes.