Key Figures

From MyMemberSoftware wiki
Jump to: navigation, search

Description

Key figures are statistics of the organization. How many members, how many New members etc.

Debug 314: the results of the key figures were not correct, because the month was sent in a format with a 0 in front of the month, while the array consists of months in integers. For example 01 instead of 1, which cant be found in the array.

Open

Calculating the ceiled number of months (and thus the number of rows in the table) is not straightforward, because there is no such php function. One can count the number of days, years, seconds, but not directly how many months there are between 2014-12-01 (startdate) and 2015-01-31 (enddate). In our code it is done now by:

$interval = $jStartDate->diff($jEndDate);
$maanden = ($interval->format("%y") * 12) + $interval->format("%m") + 1;

Unfortunately, it doesnt give the rounded number of months:

        $startDate = new DateTime("2014-12-01");
        $endDate = new DateTime("2015-01-30");
        $interval = $startDate->diff($endDate);
        $maanden = ($interval->format("%y") * 12) + $interval->format("%m") + 1;
        echo "Maanden: ". $maanden ."<br>";

results in 2.

        $startDate = new DateTime("2014-12-01");
        $endDate = new DateTime("2015-01-31");
        $interval = $startDate->diff($endDate);
        $maanden = ($interval->format("%y") * 12) + $interval->format("%m") + 1;
        echo "Maanden: ". $maanden ."<br>";

results in 3. (should be 2)...