🤖 Auto commit for release 'develop' on 2025-12-22

This commit is contained in:
JC5
2025-12-22 04:36:14 +01:00
parent 92a535c644
commit bc4018481f
45 changed files with 303 additions and 272 deletions

View File

@@ -45,6 +45,7 @@ use Illuminate\Routing\Redirector;
use Illuminate\Support\Collection;
use Illuminate\View\View;
use FireflyIII\Support\Facades\Steam;
use FireflyIII\Support\Facades\Amount;
/**
* Class BudgetLimitController
@@ -205,14 +206,14 @@ class BudgetLimitController extends Controller
// add some extra metadata:
$spentArr = $this->opsRepository->sumExpenses($limit->start_date, $limit->end_date, null, new Collection()->push($budget), $currency);
$array['spent'] = $spentArr[$currency->id]['sum'] ?? '0';
$array['left_formatted'] = \FireflyIII\Support\Facades\Amount::formatAnything($limit->transactionCurrency, bcadd($array['spent'], (string) $array['amount']));
$array['amount_formatted'] = \FireflyIII\Support\Facades\Amount::formatAnything($limit->transactionCurrency, $limit['amount']);
$array['left_formatted'] = Amount::formatAnything($limit->transactionCurrency, bcadd($array['spent'], (string) $array['amount']));
$array['amount_formatted'] = Amount::formatAnything($limit->transactionCurrency, $limit['amount']);
$array['days_left'] = (string) $this->activeDaysLeft($start, $end);
// left per day:
$array['left_per_day'] = 0 === bccomp('0', $array['days_left']) ? bcadd((string) $array['spent'], (string) $array['amount']) : bcdiv(bcadd((string) $array['spent'], (string) $array['amount']), $array['days_left']);
// left per day formatted.
$array['left_per_day_formatted'] = \FireflyIII\Support\Facades\Amount::formatAnything($limit->transactionCurrency, $array['left_per_day']);
$array['left_per_day_formatted'] = Amount::formatAnything($limit->transactionCurrency, $array['left_per_day']);
// notes:
$array['notes'] = $this->blRepository->getNoteText($limit);
@@ -239,8 +240,8 @@ class BudgetLimitController extends Controller
$this->blRepository->destroyBudgetLimit($budgetLimit);
$array = [
'budget_id' => $budgetId,
'left_formatted' => \FireflyIII\Support\Facades\Amount::formatAnything($currency, '0'),
'left_per_day_formatted' => \FireflyIII\Support\Facades\Amount::formatAnything($currency, '0'),
'left_formatted' => Amount::formatAnything($currency, '0'),
'left_per_day_formatted' => Amount::formatAnything($currency, '0'),
'transaction_currency_id' => $currency->id,
];
@@ -269,14 +270,14 @@ class BudgetLimitController extends Controller
);
$daysLeft = $this->activeDaysLeft($limit->start_date, $limit->end_date);
$array['spent'] = $spentArr[$budgetLimit->transactionCurrency->id]['sum'] ?? '0';
$array['left_formatted'] = \FireflyIII\Support\Facades\Amount::formatAnything($limit->transactionCurrency, bcadd($array['spent'], (string) $array['amount']));
$array['amount_formatted'] = \FireflyIII\Support\Facades\Amount::formatAnything($limit->transactionCurrency, $limit['amount']);
$array['left_formatted'] = Amount::formatAnything($limit->transactionCurrency, bcadd($array['spent'], (string) $array['amount']));
$array['amount_formatted'] = Amount::formatAnything($limit->transactionCurrency, $limit['amount']);
$array['days_left'] = (string) $daysLeft;
$array['left_per_day'] = 0 === $daysLeft ? bcadd((string) $array['spent'], (string) $array['amount']) : bcdiv(bcadd((string) $array['spent'], (string) $array['amount']), $array['days_left']);
// left per day formatted.
$array['amount'] = Steam::bcround($limit['amount'], $limit->transactionCurrency->decimal_places);
$array['left_per_day_formatted'] = \FireflyIII\Support\Facades\Amount::formatAnything($limit->transactionCurrency, $array['left_per_day']);
$array['left_per_day_formatted'] = Amount::formatAnything($limit->transactionCurrency, $array['left_per_day']);
if ('true' === $request->get('redirect')) {
return redirect(route('budgets.index'));
}