Remove experimental multi period thing.

This commit is contained in:
James Cole
2017-09-02 07:40:05 +02:00
parent 95e91b9af8
commit 7cab89a291
2 changed files with 0 additions and 98 deletions

View File

@@ -246,54 +246,6 @@ class BudgetController extends Controller
);
}
public function multiPeriod()
{
$start = new Carbon;
$start->startOfYear();
$end = clone $start;
$end->endOfYear();
$current = clone $start;
$headers = [];
$range = Preferences::get('viewRange', '1M')->data;
$budgets = $this->repository->getBudgets();
$limits = [];
$defaultCurrency = Amount::getDefaultCurrency();
while ($current < $end) {
$currentEnd = Navigation::endOfPeriod($current, $range);
$format = Navigation::preferredCarbonLocalizedFormat($current, $currentEnd);
$name = Navigation::periodShow($current, $range);
$headers[] = [
'start' => $current,
'end' => $currentEnd,
'date_str' => $current->format('Y_m_d'),
'start_str' => $current->formatLocalized($format),
'end_str' => $currentEnd->formatLocalized($format),
'name' => $name,
'key' => $current->format('Y-m-d') . '-' . $currentEnd->format('Y-m-d'),
];
$current = Navigation::addPeriod($current, $range, 0);
}
// for each budget, get the budget limits
/** @var Budget $budget */
foreach ($budgets as $budget) {
/** @var array $header */
foreach ($headers as $header) {
/** @var BudgetLimit $limit */
$limit = $budget->budgetlimits()
->where('start_date', $header['start']->format('Y-m-d'))
->where('end_date', $header['end']->format('Y-m-d'))->first(['budget_limits.*']);
$key = $header['start']->format('Y-m-d') . '-' . $header['end']->format('Y-m-d');
if (!is_null($limit)) {
$limits[$budget->id][$key] = round($limit->amount, $defaultCurrency->decimal_places);
}
}
}
return view('budgets.multi-period', compact('headers', 'budgets','limits'));
}
/**
* @param Request $request
* @param JournalRepositoryInterface $repository

View File

@@ -1,50 +0,0 @@
{% extends "./layout/default" %}
{% block breadcrumbs %}
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName) }}
{% endblock %}
{% block content %}
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">multi period table</h3>
</div>
<div class="box-body">
<table class="table table-bordered">
<thead>
<tr>
<th>Budget</th>
{% for header in headers %}
<th title="{{ header.start_str }} - {{ header.end_str }}">{{ header.name }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for budget in budgets %}
<tr>
<th>{{ budget.name }}</th>
{% for header in headers %}
<td>
<input name="{{ budget.id }}_{{ header.date_str }}" id="{{ budget.id }}_{{ header.date_str }}"
type="number" class="form-control budget-input" data-id="{{ budget.id }}" data-start="{{ budget.start_str }}"
data-end="{{ budget.end_str }}" value="{{ limits[budget.id][header.key] }}"
>
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
{% endblock %}
{% block styles %}
{% endblock %}
{% block scripts %}
{% endblock %}