prepare($query); $stmt->bindValue(':userId', $userId, SQLITE3_INTEGER); $result = $stmt->execute(); $row = $result->fetchArray(SQLITE3_ASSOC); $code = $row['code']; require_once 'includes/stats_calculations.php'; require_once 'includes/stats_extra_calculations.php'; ?>

1) { ?>
1) { // sort categories by order usort($categories, function ($a, $b) { return $a['order'] - $b['order']; }); ?>
1) { usort($paymentMethods, function ($a, $b) { return $a['order'] <=> $b['order']; }); ?>
html_entity_decode($category['name']), "y" => $category["cost"], ]; } } } usort($categoryDataPoints, fn($a, $b) => $b['y'] <=> $a['y']); $showCategoryCostGraph = count($categoryDataPoints) > 1; $memberDataPoints = []; if (isset($memberCost)) { foreach ($memberCost as $member) { if ($member['cost'] != 0) { $memberDataPoints[] = [ "label" => html_entity_decode($member['name']), "y" => $member["cost"], ]; } } } usort($memberDataPoints, fn($a, $b) => $b['y'] <=> $a['y']); $showMemberCostGraph = count($memberDataPoints) > 1; $paymentMethodDataPoints = []; foreach ($paymentMethodCost as $paymentMethodId => $cost) { if ($cost > 0 && isset($paymentMethodsCount[$paymentMethodId])) { $paymentMethodDataPoints[] = [ "label" => html_entity_decode($paymentMethodsCount[$paymentMethodId]['name']), "y" => round($cost, 2), ]; } } usort($paymentMethodDataPoints, fn($a, $b) => $b['y'] <=> $a['y']); $showPaymentMethodsGraph = count($paymentMethodDataPoints) > 1; $showMonthlyStats = !isset($_GET['budget']) || $_GET['budget'] === 'monthly'; $showPeriodStats = !isset($_GET['budget']) || $_GET['budget'] === 'period'; $showAnyGraph = $showCategoryCostGraph || $showMemberCostGraph || $showPaymentMethodsGraph || $showTotalMonthlyCostGraph || ($showMonthlyStats && $showVsMonthlyBudgetGraph) || ($showPeriodStats && $showVsPeriodBudgetGraph) || $showProjectionGraph || $showLifetimeGraph || $showCycleGraph || $showCurrencyGraph || $showHistogramGraph || $showYearlyNewGraph; $showTrendsSection = $showTotalMonthlyCostGraph || $showProjectionGraph || $monthOverMonthDelta !== null; $showBudgetSection = ($showMonthlyStats && (isset($monthlyBudgetUsed) || isset($monthlyBudgetLeft) || isset($monthlyOverBudgetAmount) || $showVsMonthlyBudgetGraph)) || ($showPeriodStats && (isset($periodBudgetUsed) || isset($periodBudgetLeft) || isset($periodOverBudgetAmount) || $showVsPeriodBudgetGraph)); $showSplitSection = $showMemberCostGraph || $showCategoryCostGraph || $showPaymentMethodsGraph || $showCycleGraph || $showCurrencyGraph || $showHistogramGraph; $showHistorySection = $totalLifetimeSpend > 0 || $oldestSubscription !== null || $averageSubscriptionAge !== null || $showLifetimeGraph || $showYearlyNewGraph; ?>

0) { ?>
0) { ?>

= 0 ? '+' : '-'; ?>
%
()

%
-
-
-
%
-
-
-
()
()
()
()

()
()
()
()
()
(, )

0 || $oldestSubscription !== null || $averageSubscriptionAge !== null) { ?>
0) { ?>
0) { ?>

0) { ?>