prepare($query);
$stmt->bindParam(':currency', $currency, SQLITE3_INTEGER);
$result = $stmt->execute();
$exchangeRate = $result->fetchArray(SQLITE3_ASSOC);
if ($exchangeRate === false) {
return $price;
} else {
$fromRate = $exchangeRate['rate'];
return $price / $fromRate;
}
}
function printSubscriptions($subscriptions, $sort, $categories, $members, $i18n, $colorTheme) {
if ($sort === "price") {
usort($subscriptions, function($a, $b) {
return $a['price'] < $b['price'] ? 1 : -1;
});
}
$currentCategory = 0;
$currentPayerUserId = 0;
$currentPaymentMethodId = 0;
foreach ($subscriptions as $subscription) {
if ($sort == "category_id" && $subscription['category_id'] != $currentCategory) {
?>
= $members[$subscription['payer_user_id']]['name'] ?>
= $subscription['payment_method_name'] ?>
= $subscription['name'] ?>
= $subscription['billing_cycle'] ?>
= $subscription['next_payment'] ?>
= CurrencyFormatter::format($subscription['price'], $subscription['currency_code']) ?>
-
= translate('edit_subscription', $i18n) ?>
-
= translate('delete', $i18n) ?>
-
= translate('clone', $i18n) ?>
= $subscription['name'] ?>
= $members[$subscription['payer_user_id']]['name'] ?>
= $categories[$subscription['category_id']]['name'] ?>
= $subscription['notes'] ?>
prepare($query);
$stmt->bindValue(':userId', $userId, SQLITE3_INTEGER);
$result = $stmt->execute();
$row = $result->fetchArray(SQLITE3_ASSOC);
$mainCurrencyId = $row['main_currency'];
?>