I am working on a membership system for a client. The system must track how many times a person visits a club. I have everything working so far except this last part I am about to start working on and trying to figure out how phpRunner can do it.
A person "buys" club visits like this...
Annual Contracts
Bronze 15 visits per year
Silver 30 visits per year
Gold 90 visits per year
Platinum Unlimited Access
Monthly Contracts
Bronze 1 visit per month
Silver 2 visits per month
Gold 7 visits per month
Platinum Unlimited Access
However, if I buy a 3 month membership I can use ALL visits in my first month (so, for 3 month membership I get total of 3 visits and can use them first month).
What I have to do now is figure out a way to put in how many visits a person gets and then subtract out a visit every time they go to a club. I have the system tracking visits now in a table called tbl_visits. This is tied to each member so I can see how many visits each one has.
The hard part is figuring out how to get the total visits a person should get without requiring club owners to do the math...
So, someone walks in the door and signs up for 3 months... I put in the date their contract will end and then the system could calculate that it is "3 months from today - must equal a 3 month membership, so... add the monthly rate of 2 visits per months since they have SILVER plan and add "6" visits to this member account...
Hard to explain...
I guess I could also put it like this...
If I have a number in a member table like this "number_of_visits_allowed"
tbl_member
id, name, number_of_visits_allowed
tbl_visits
id, member_ID, visit_timestamp
I need to show somewhere by subtracting that they are allowed 10 and they have used 4 so they have 6 left...
Then, I will do something to deactivate their account so they cannot get more visits after they hit 10...