mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-15 14:18:19 +00:00
🤖 Auto commit for release 'develop' on 2025-08-01
This commit is contained in:
@@ -102,26 +102,26 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface
|
||||
/** @var BudgetLimit $limit */
|
||||
foreach ($limits as $limit) {
|
||||
app('log')->debug(sprintf('Budget limit #%d', $limit->id));
|
||||
$currency = $limit->transactionCurrency;
|
||||
$rate = $converter->getCurrencyRate($currency, $primaryCurrency, $end);
|
||||
$currencyCode = $currency->code;
|
||||
$currency = $limit->transactionCurrency;
|
||||
$rate = $converter->getCurrencyRate($currency, $primaryCurrency, $end);
|
||||
$currencyCode = $currency->code;
|
||||
$return[$currencyCode] ??= [
|
||||
'currency_id' => (string) $currency->id,
|
||||
'currency_name' => $currency->name,
|
||||
'currency_symbol' => $currency->symbol,
|
||||
'currency_code' => $currency->code,
|
||||
'currency_decimal_places' => $currency->decimal_places,
|
||||
'currency_id' => (string) $currency->id,
|
||||
'currency_name' => $currency->name,
|
||||
'currency_symbol' => $currency->symbol,
|
||||
'currency_code' => $currency->code,
|
||||
'currency_decimal_places' => $currency->decimal_places,
|
||||
'primary_currency_id' => (string) $primaryCurrency->id,
|
||||
'primary_currency_name' => $primaryCurrency->name,
|
||||
'primary_currency_symbol' => $primaryCurrency->symbol,
|
||||
'primary_currency_code' => $primaryCurrency->code,
|
||||
'primary_currency_decimal_places' => $primaryCurrency->decimal_places,
|
||||
'sum' => '0',
|
||||
'pc_sum' => '0',
|
||||
'sum' => '0',
|
||||
'pc_sum' => '0',
|
||||
];
|
||||
// same period
|
||||
if ($limit->start_date->isSameDay($start) && $limit->end_date->isSameDay($end)) {
|
||||
$return[$currencyCode]['sum'] = bcadd($return[$currencyCode]['sum'], (string) $limit->amount);
|
||||
$return[$currencyCode]['sum'] = bcadd($return[$currencyCode]['sum'], (string) $limit->amount);
|
||||
$return[$currencyCode]['pc_sum'] = bcmul($rate, $return[$currencyCode]['sum']);
|
||||
app('log')->debug(sprintf('Add full amount [1]: %s', $limit->amount));
|
||||
|
||||
@@ -129,16 +129,16 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface
|
||||
}
|
||||
// limit is inside of date range
|
||||
if ($start->lte($limit->start_date) && $end->gte($limit->end_date)) {
|
||||
$return[$currencyCode]['sum'] = bcadd($return[$currencyCode]['sum'], (string) $limit->amount);
|
||||
$return[$currencyCode]['sum'] = bcadd($return[$currencyCode]['sum'], (string) $limit->amount);
|
||||
$return[$currencyCode]['pc_sum'] = bcmul($rate, $return[$currencyCode]['sum']);
|
||||
app('log')->debug(sprintf('Add full amount [2]: %s', $limit->amount));
|
||||
|
||||
continue;
|
||||
}
|
||||
$total = $limit->start_date->diffInDays($limit->end_date, true) + 1; // include the day itself.
|
||||
$days = $this->daysInOverlap($limit, $start, $end);
|
||||
$amount = bcmul(bcdiv((string) $limit->amount, (string) $total), (string) $days);
|
||||
$return[$currencyCode]['sum'] = bcadd($return[$currencyCode]['sum'], $amount);
|
||||
$total = $limit->start_date->diffInDays($limit->end_date, true) + 1; // include the day itself.
|
||||
$days = $this->daysInOverlap($limit, $start, $end);
|
||||
$amount = bcmul(bcdiv((string) $limit->amount, (string) $total), (string) $days);
|
||||
$return[$currencyCode]['sum'] = bcadd($return[$currencyCode]['sum'], $amount);
|
||||
$return[$currencyCode]['pc_sum'] = bcmul($rate, $return[$currencyCode]['sum']);
|
||||
app('log')->debug(
|
||||
sprintf(
|
||||
|
||||
Reference in New Issue
Block a user