Fix statistics calculation for weekly subscriptions
This commit is contained in:
parent
ff2f2635df
commit
4e75456b16
11
stats.php
11
stats.php
@ -92,14 +92,14 @@ if ($result) {
|
|||||||
|
|
||||||
if ($nextPaymentDate >= $tomorrow && $nextPaymentDate <= $endOfMonth) {
|
if ($nextPaymentDate >= $tomorrow && $nextPaymentDate <= $endOfMonth) {
|
||||||
$timesToPay = 1;
|
$timesToPay = 1;
|
||||||
|
$daysInMonth = $endOfMonth->diff($tomorrow)->days + 1;
|
||||||
|
$daysRemaining = $endOfMonth->diff($nextPaymentDate)->days + 1;
|
||||||
if ($cycle == 1) {
|
if ($cycle == 1) {
|
||||||
$daysInMonth = $endOfMonth->diff($tomorrow)->days + 1;
|
|
||||||
$daysRemaining = $endOfMonth->diff($nextPaymentDate)->days + 1;
|
|
||||||
$timesToPay = $daysRemaining / $frequency;
|
$timesToPay = $daysRemaining / $frequency;
|
||||||
}
|
}
|
||||||
if ($cycle == 2) {
|
if ($cycle == 2) {
|
||||||
$weeksInMonth = $endOfMonth->diff($tomorrow)->weeks + 1;
|
$weeksInMonth = ceil($daysInMonth / 7);
|
||||||
$weeksRemaining = $endOfMonth->diff($nextPaymentDate)->weeks + 1;
|
$weeksRemaining = ceil($daysRemaining / 7);
|
||||||
$timesToPay = $weeksRemaining / $frequency;
|
$timesToPay = $weeksRemaining / $frequency;
|
||||||
}
|
}
|
||||||
$amountDueThisMonth += $originalSubscriptionPrice * $timesToPay;
|
$amountDueThisMonth += $originalSubscriptionPrice * $timesToPay;
|
||||||
@ -126,6 +126,9 @@ if ($result) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Calculate cost per household member
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<section class="contain">
|
<section class="contain">
|
||||||
<div class="statistics">
|
<div class="statistics">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user