Add decryption routine.

This commit is contained in:
James Cole
2015-03-31 21:18:22 +02:00
parent cf23858c10
commit 566fadad15
5 changed files with 43 additions and 13 deletions

View File

@@ -44,7 +44,11 @@
{{$entry->date->format('j F Y')}}
</td>
<td>
<a href="{{route('accounts.show',$entry->account_id)}}">{{{$entry->name}}}</a>
@if(intval($entry->account_encrypted) == 1)
<a href="{{route('accounts.show',$entry->account_id)}}">{{{Crypt::decrypt($entry->name)}}}</a>
@else
<a href="{{route('accounts.show',$entry->account_id)}}">{{{$entry->name}}}</a>
@endif
</td>
</tr>
@endforeach
@@ -67,11 +71,16 @@
<table class="table table-bordered">
<?php $sum = 0;?>
@foreach($expenses as $id => $expense)
<?php $sum += floatval($expense['amount']);?>
<?php
$sum += floatval($expense['amount']);
$name = isset($expense['encrypted']) && intval($expense['encrypted']) ==1 ? Crypt::decrypt($expense['name']) :$expense['name'];
//var_dump($expense);
?>
<tr>
@if($id > 0)
<td><a href="{{route('accounts.show',$id)}}">{{{$expense['name']}}}</a></td>
<td><a href="{{route('accounts.show',$id)}}">{{{$name}}}</a></td>
@else
<td><em>{{{$expense['name']}}}</em></td>
@endif
<td>{!! Amount::format($expense['amount']) !!}</td>

View File

@@ -43,6 +43,12 @@
Account balance
</div>
<table class="table table-bordered table-striped">
<tr>
<th>Name</th>
<th>Balance at start of year</th>
<th>Balance at end of year</th>
<th>Difference</th>
</tr>
<?php
$start = 0;
$end = 0;
@@ -120,9 +126,12 @@
<table class="table">
<?php $sum = 0;?>
@foreach($groupedIncomes as $income)
<?php $sum += floatval($income->amount)*-1;?>
<?php
$sum += floatval($income->amount)*-1;
$name = intval($income->encrypted) == 1 ? Crypt::decrypt($income->name) : $income->name;
?>
<tr>
<td><a href="{{route('accounts.show',$income->account_id)}}">{{{$income->name}}}</a></td>
<td><a href="{{route('accounts.show',$income->account_id)}}">{{{$name}}}</a></td>
<td>{!! Amount::format(floatval($income->amount)*-1) !!}</td>
</tr>
@endforeach
@@ -142,8 +151,11 @@
<table class="table">
<?php $sum = 0;?>
@foreach($groupedExpenses as $id => $expense)
<?php
$name = intval($expense['encrypted']) == 1 ? Crypt::decrypt($expense['name']) : $expense['name'];
?>
<tr>
<td><a href="{{route('accounts.show',$id)}}">{{{$expense['name']}}}</a></td>
<td><a href="{{route('accounts.show',$id)}}">{{{$name}}}</a></td>
<td>{!! Amount::format(floatval($expense['amount'])*-1) !!}</td>
</tr>
<?php $sum += floatval($expense['amount'])*-1;?>