mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-26 02:40:43 -06:00
Small optimizations to reports.
This commit is contained in:
parent
607d0115f0
commit
53c80aaef8
@ -2,6 +2,7 @@
|
||||
declare(strict_types = 1);
|
||||
namespace FireflyIII\Helpers\Collection;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Models\Budget as BudgetModel;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
@ -24,6 +25,11 @@ class BalanceLine
|
||||
/** @var BudgetModel */
|
||||
protected $budget;
|
||||
|
||||
/** @var Carbon */
|
||||
protected $startDate;
|
||||
/** @var Carbon */
|
||||
protected $endDate;
|
||||
|
||||
/** @var int */
|
||||
protected $role = self::ROLE_DEFAULTROLE;
|
||||
|
||||
@ -113,6 +119,39 @@ class BalanceLine
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Carbon
|
||||
*/
|
||||
public function getStartDate()
|
||||
{
|
||||
return $this->startDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Carbon $startDate
|
||||
*/
|
||||
public function setStartDate($startDate)
|
||||
{
|
||||
$this->startDate = $startDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Carbon
|
||||
*/
|
||||
public function getEndDate()
|
||||
{
|
||||
return $this->endDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Carbon $endDate
|
||||
*/
|
||||
public function setEndDate($endDate)
|
||||
{
|
||||
$this->endDate = $endDate;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If a BalanceLine has a budget/repetition, each BalanceEntry in this BalanceLine
|
||||
* should have a "spent" value, which is the amount of money that has been spent
|
||||
|
@ -95,6 +95,8 @@ class BalanceReportHelper implements BalanceReportHelperInterface
|
||||
{
|
||||
$line = new BalanceLine;
|
||||
$line->setBudget($budget);
|
||||
$line->setStartDate($budget->startdate); // returned by getBudgetsAndLimitsInRange
|
||||
$line->setEndDate($budget->enddate); // returned by getBudgetsAndLimitsInRange
|
||||
|
||||
// loop accounts:
|
||||
foreach ($accounts as $account) {
|
||||
|
@ -71,7 +71,7 @@ class BudgetReportHelper implements BudgetReportHelperInterface
|
||||
$budgetLine = new BudgetLine;
|
||||
$budgetLine->setBudget($budget);
|
||||
$budgetLine->setRepetition($repetition);
|
||||
$expenses = $this->getSumOfRange($start, $end, $totalSpent);
|
||||
$expenses = $this->getSumOfRange($repetition->startdate, $repetition->enddate, $totalSpent);
|
||||
|
||||
// 200 en -100 is 100, vergeleken met 0 === 1
|
||||
// 200 en -200 is 0, vergeleken met 0 === 0
|
||||
|
@ -394,6 +394,7 @@ class BudgetRepository extends ComponentRepository implements BudgetRepositoryIn
|
||||
);
|
||||
}
|
||||
)
|
||||
->orderBy('budgets.id', 'budget_limits.startdate', 'limit_repetitions.enddate')
|
||||
->get(['budgets.*', 'limit_repetitions.startdate', 'limit_repetitions.enddate', 'limit_repetitions.amount']);
|
||||
|
||||
$set = $set->sortBy(
|
||||
|
@ -25,6 +25,11 @@
|
||||
{% if balanceLine.getBudget.id %}
|
||||
<td>
|
||||
<a href="{{ route('budgets.show',balanceLine.getBudget.id) }}">{{ balanceLine.getTitle }}</a>
|
||||
<span class="small"><br>
|
||||
{{ balanceLine.getStartdate.formatLocalized(monthAndDayFormat) }}
|
||||
—
|
||||
{{ balanceLine.getEnddate.formatLocalized(monthAndDayFormat) }}
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
{% if(balanceLine.getBudget.amount) %}
|
||||
|
@ -27,7 +27,11 @@
|
||||
</td>
|
||||
<td>
|
||||
{% if budgetLine.getRepetition.id %}
|
||||
<a href="{{ route('budgets.show', [budgetLine.getBudget.id, budgetLine.getRepetition.id]) }}">{{ budgetLine.getRepetition.startdate.formatLocalized(monthAndDayFormat) }}</a>
|
||||
<a href="{{ route('budgets.show', [budgetLine.getBudget.id, budgetLine.getRepetition.id]) }}">
|
||||
{{ budgetLine.getRepetition.startdate.formatLocalized(monthAndDayFormat) }}
|
||||
—
|
||||
{{ budgetLine.getRepetition.enddate.formatLocalized(monthAndDayFormat) }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
|
Loading…
Reference in New Issue
Block a user