mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Add decryption routine.
This commit is contained in:
parent
cf23858c10
commit
566fadad15
@ -244,7 +244,9 @@ class ReportQuery implements ReportQueryInterface
|
||||
DB::Raw('SUM(`t_to`.`amount`) as `amount`'),
|
||||
'transaction_journals.date',
|
||||
't_from.account_id as account_id',
|
||||
'ac_from.name as name']
|
||||
'ac_from.name as name',
|
||||
'ac_from.encrypted as account_encrypted'
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -323,7 +325,7 @@ class ReportQuery implements ReportQueryInterface
|
||||
->groupBy('categories.id')
|
||||
->orderBy('amount');
|
||||
|
||||
return $query->get(['categories.id','categories.encrypted', 'categories.name', DB::Raw('SUM(`transactions`.`amount`) AS `amount`')]);
|
||||
return $query->get(['categories.id', 'categories.encrypted', 'categories.name', DB::Raw('SUM(`transactions`.`amount`) AS `amount`')]);
|
||||
|
||||
}
|
||||
|
||||
@ -370,7 +372,7 @@ class ReportQuery implements ReportQueryInterface
|
||||
->groupBy('t_to.account_id')
|
||||
->orderBy('amount', 'DESC');
|
||||
|
||||
return $query->get(['t_to.account_id as id', 'ac_to.name as name', DB::Raw('SUM(t_to.amount) as `amount`')]);
|
||||
return $query->get(['t_to.account_id as id', 'ac_to.name as name', 'ac_to.encrypted', DB::Raw('SUM(t_to.amount) as `amount`')]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -412,7 +414,9 @@ class ReportQuery implements ReportQueryInterface
|
||||
|
||||
$query->groupBy('t_from.account_id')->orderBy('amount');
|
||||
|
||||
return $query->get(['t_from.account_id as account_id', 'ac_from.name as name', DB::Raw('SUM(t_from.amount) as `amount`')]);
|
||||
return $query->get(
|
||||
['t_from.account_id as account_id', 'ac_from.name as name', 'ac_from.encrypted as encrypted', DB::Raw('SUM(t_from.amount) as `amount`')]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -247,6 +247,7 @@ class ReportController extends Controller
|
||||
* Start getExpenseGroupedForMonth DONE
|
||||
*/
|
||||
$set = $this->query->journalsByExpenseAccount($start, $end, $showSharedReports);
|
||||
|
||||
$expenses = Steam::makeArray($set);
|
||||
$expenses = Steam::sortArray($expenses);
|
||||
$expenses = Steam::limitArray($expenses, 10);
|
||||
@ -268,6 +269,7 @@ class ReportController extends Controller
|
||||
$result = $this->query->journalsByCategory($start, $end);
|
||||
$categories = Steam::makeArray($result);
|
||||
|
||||
|
||||
// loop and decrypt if necessary:
|
||||
foreach ($categories as $index => $category) {
|
||||
$categories[$index]['name']
|
||||
@ -283,6 +285,7 @@ class ReportController extends Controller
|
||||
$merged = $categories;
|
||||
}
|
||||
|
||||
|
||||
// sort.
|
||||
$sorted = Steam::sortNegativeArray($merged);
|
||||
|
||||
|
@ -100,11 +100,13 @@ class Steam
|
||||
if (isset($array[$id])) {
|
||||
$array[$id]['amount'] += floatval($entry->amount);
|
||||
$array[$id]['spent'] += floatval($entry->spent);
|
||||
$array[$id]['encrypted'] = intval($entry->encrypted);
|
||||
} else {
|
||||
$array[$id] = [
|
||||
'amount' => floatval($entry->amount),
|
||||
'spent' => floatval($entry->spent),
|
||||
'name' => $entry->name
|
||||
'amount' => floatval($entry->amount),
|
||||
'spent' => floatval($entry->spent),
|
||||
'encrypted' => intval($entry->encrypted),
|
||||
'name' => $entry->name
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -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>
|
||||
|
@ -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;?>
|
||||
|
Loading…
Reference in New Issue
Block a user