View Single Post
  #10  
Old 10th September 2011, 20:24
erosbk erosbk is offline
Senior Member
 
Join Date: Mar 2011
Posts: 337
Thanks: 49
Thanked 36 Times in 30 Posts
Default

The was a bug in the code, where if month one, it will be calculating all the time stats for month 12... code has been modified to fix this, just replace from BOC 1 to EOC 1

This is the bug code:
Code:
// BOC 1: We need to know which month/year must be used to calculate statistics.

$awmonth = date("m");

if (date("d") == 1)
{
        $awmonth = date("m")-1;
}

$awyear = date("Y");

if (date("m") == 1)
{
        $awyear = date("Y")-1;
        $awmonth = "12";
}

// EOC 1: We have month and year vars to calculate stats at this point, to fix the last day problem

Replace with this code:
Code:
// BOC 1: We need to know which month/year must be used to calculate statistics.

$awmonth = date("m"+1-1);
$awyear = date("Y");

if (date("d") == 1)
{
        $awmonth = date("m")-1;
        if (date("m") == 1)
        {
                $awyear = date("Y")-1;
                $awmonth = "12";
        }
}
// EOC 1: We have month and year vars to calculate stats at this point, to fix the last day problem
Original post has been updated with this changes.

Regards
Reply With Quote