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


#1

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


#2

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.


#3

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.


#4

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


#5



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


#6

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:


#7

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}

#8

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


#9

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)]

#10

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


#11

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

thanks again QMcKay


#12

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.


#13

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.


#14

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)


#15

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:


#16

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


#17

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