Added sum for the current period, see issue #99

This commit is contained in:
James Cole 2015-08-09 17:01:12 +02:00
parent 51e30aed66
commit deefef83bd
5 changed files with 11 additions and 3 deletions

View File

@ -152,10 +152,11 @@ class CategoryController extends Controller
$set = $repository->getJournals($category, $page);
$count = $repository->countJournals($category);
$totalSum = $repository->journalsSum($category);
$periodSum = $repository->journalsSum($category, Session::get('start'), Session::get('end'));
$journals = new LengthAwarePaginator($set, $count, 50, $page);
$journals->setPath('categories/show/' . $category->id);
return view('categories.show', compact('category', 'journals', 'hideCategory', 'totalSum'));
return view('categories.show', compact('category', 'journals', 'hideCategory', 'totalSum', 'periodSum'));
}
/**

View File

@ -16,6 +16,7 @@ return [
'from' => 'From',
'to' => 'To',
'total_sum' => 'Total sum',
'period_sum' => 'Sum for period',
'showEverything' => 'Show everything',
'never' => 'Never',
'search_results_for' => 'Search results for ":query"',

View File

@ -16,6 +16,7 @@ return [
'from' => 'Van',
'to' => 'Tot',
'total_sum' => 'Totale som',
'period_sum' => 'Som van periode',
'showEverything' => 'Laat alles zien',
'never' => 'Nooit',
'search_results_for' => 'Zoekresultaten voor ":query"',

View File

@ -45,7 +45,7 @@
<h3 class="box-title">{{ 'transactions'|_ }}</h3>
</div>
<div class="box-body no-padding">
{% include 'list/journals' with {showPageSum: true,showTotalSum: true} %}
{% include 'list/journals' with {showPageSum: true, showTotalSum: true, showPeriodSum: true} %}
</div>
</div>
</div>

View File

@ -125,13 +125,18 @@
<td colspan="2">{{ _sum|formatAmount }}</td>
</tr>
{% endif %}
{% if showPeriodSum %}
<tr>
<td colspan="3" style="text-align: right;"><em>{{ 'period_sum'|_ }}</em></td>
<td colspan="2">{{ periodSum|formatAmount }}</td>
</tr>
{% endif %}
{% if showTotalSum %}
<tr>
<td colspan="3" style="text-align: right;"><em>{{ 'total_sum'|_ }}</em></td>
<td colspan="2">{{ totalSum|formatAmount }}</td>
</tr>
{% endif %}
</tfoot>
</table>