Page 2 of 2

Re: Advice on Calculating Attendance within dates needed

Posted: Wed Aug 05, 2015 10:19 am
by simonmlewis
The membership is for a year.
So they attend the eligible amount of events, and then before a "member" for a year from that date.
Once that date expires, I need to base the "new year" to check if they have done (all we did earlier)....

At the moment it's based on either their Join date, or their Membership date. But if the membership expires.. I'm not sure on what date to based it on....Sorry this isn't making much sense..

Code: Select all

 $querydiary = "SELECT * FROM diary WHERE memberid =:memberid AND dateattended >= '$datestart' ORDER BY dateattended ASC";
This is the problem bit. I need to base it on $datestart.

Re: Advice on Calculating Attendance within dates needed

Posted: Wed Aug 05, 2015 10:29 am
by simonmlewis
Maybe I could run this at the top.

Code: Select all

$datestart = NULL;
if ($row->datemembership == NULL) { $datestart = $row->datejoined;}
else { 
$dateexpire = date('Y-m-d', strtotime("+12 months", strtotime($row->datemembership)));
$todaydate = date('Y-m-d');
if ($dateexpire > $todaydate) 
  { 
  $datestart = $row->datemembership;
  }
else
  {
  $datestart = $dateexpire;
  }
}

Re: Advice on Calculating Attendance within dates needed

Posted: Wed Aug 05, 2015 10:36 am
by Celauran
simonmlewis wrote:Once that date expires, I need to base the "new year" to check if they have done (all we did earlier)....
Base it on what? The last year? The year during which their membership was active?

Re: Advice on Calculating Attendance within dates needed

Posted: Wed Aug 05, 2015 10:46 am
by simonmlewis
I've just realised there is a bit of a hitch here. Not sure if it's a bad hitch. But if someone joins the club, then plays as described before.... they get the membership thing for a year.
But when that year lapses, I guess that membership expires. And there will be a period during which they are no longer a discounted member, until they attend again to renew.

My idea above would work. If the expire date is less than the todaydate, then they are expired and the discount stops.