diff --git a/reports/Churn_Rate.php b/reports/Churn_Rate.php index ca2006a..7fe356e 100644 --- a/reports/Churn_Rate.php +++ b/reports/Churn_Rate.php @@ -115,8 +115,16 @@ $domains['end'][$tmonth] = $domains['start'][$tmonth] + $domains['variation'][$tmonth]; } - $productsChurnRate = number_format(($products['terminated'][$tmonth] / $products['start'][$tmonth]) * 100, 1, '.', '') + 0; - $domainsChurnRate = number_format(($domains['terminated'][$tmonth] / $domains['start'][$tmonth]) * 100, 1, '.', '') + 0; + if (isset($productStart[$tmonth - 1]) && $productStart[$tmonth - 1] != 0) { + $productsChurnRate = number_format(($products['terminated'][$tmonth] / $products['start'][$tmonth]) * 100, 1, '.', '') + 0; + } else { + $productChurnRate = 0; + } + if (isset($domainStart[$tmonth - 1]) && $domainStart[$tmonth - 1] != 0) { + $domainsChurnRate = number_format(($domains['terminated'][$tmonth] / $domains['start'][$tmonth]) * 100, 1, '.', '') + 0; + } else { + $domainChurnRate = 0; + } if (sprintf("%02d", $tmonth) > $month AND date('Y') == $year) {