mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-21 10:41:22 +00:00
First attempt at unifying code for categories and budgets, which are basically the same thing.
This commit is contained in:
@@ -84,7 +84,7 @@ class BudgetController extends BaseController
|
||||
$budgets = $repos->get();
|
||||
|
||||
// get the limits for the current month.
|
||||
$date = \Session::get('start');
|
||||
$date = \Session::get('start');
|
||||
$spent = 0;
|
||||
/** @var \Budget $budget */
|
||||
foreach ($budgets as $budget) {
|
||||
@@ -114,9 +114,9 @@ class BudgetController extends BaseController
|
||||
}
|
||||
|
||||
$budgetAmount = $preferences->get('budgetIncomeTotal' . $date->format('FY'), 1000);
|
||||
$amount = floatval($budgetAmount->data);
|
||||
$overspent = $spent > $amount;
|
||||
if($overspent) {
|
||||
$amount = floatval($budgetAmount->data);
|
||||
$overspent = $spent > $amount;
|
||||
if ($overspent) {
|
||||
// overspent on total amount
|
||||
$spentPCT = ceil($amount / $spent * 100);
|
||||
} else {
|
||||
@@ -124,7 +124,7 @@ class BudgetController extends BaseController
|
||||
$spentPCT = ceil($spent / $amount * 100);
|
||||
}
|
||||
|
||||
return View::make('budgets.index', compact('budgets','spent','spentPCT','overspent'))->with('budgetAmount', $budgetAmount);
|
||||
return View::make('budgets.index', compact('budgets', 'spent', 'spentPCT', 'overspent'))->with('budgetAmount', $budgetAmount);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user