mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Multiple currency support in dashboard
This commit is contained in:
parent
7364dcf8fc
commit
087fea1f24
@ -19,15 +19,16 @@ class DashboardController extends \BaseController
|
||||
->groupBy('accounts.id')
|
||||
->first();
|
||||
|
||||
$select = DB::raw('SUM(clients.paid_to_date) as value');
|
||||
$select = DB::raw('SUM(clients.paid_to_date) as value, clients.currency_id as currency_id');
|
||||
|
||||
$totalIncome = DB::table('accounts')
|
||||
$totalIncomes = DB::table('accounts')
|
||||
->select($select)
|
||||
->leftJoin('clients', 'accounts.id', '=', 'clients.account_id')
|
||||
->where('accounts.id', '=', Auth::user()->account_id)
|
||||
->where('clients.is_deleted', '=', false)
|
||||
->groupBy('accounts.id')
|
||||
->first();
|
||||
->groupBy('clients.currency_id')
|
||||
->get();
|
||||
|
||||
$activities = Activity::where('activities.account_id', '=', Auth::user()->account_id)
|
||||
->orderBy('created_at', 'desc')->take(6)->get();
|
||||
@ -49,7 +50,7 @@ class DashboardController extends \BaseController
|
||||
->orderBy('due_date', 'asc')->take(6)->get();
|
||||
|
||||
$data = [
|
||||
'totalIncome' => Utils::formatMoney($totalIncome ? $totalIncome->value : 0, Session::get(SESSION_CURRENCY)),
|
||||
'totalIncomes' => $totalIncomes,
|
||||
'billedClients' => $metrics ? $metrics->billed_clients : 0,
|
||||
'invoicesSent' => $metrics ? $metrics->invoices_sent : 0,
|
||||
'activeClients' => $metrics ? $metrics->active_clients : 0,
|
||||
|
@ -8,7 +8,9 @@
|
||||
<div class="panel-body">
|
||||
<img src="{{ asset('images/totalincome.png') }}" class="in-image"/>
|
||||
<div class="in-bold">
|
||||
{{ $totalIncome }}
|
||||
@foreach ($totalIncomes as $totalIncome)
|
||||
{{ Utils::formatMoney($totalIncome->value, $totalIncome->currency_id); }}
|
||||
@endforeach
|
||||
</div>
|
||||
<div class="in-thin">
|
||||
{{ trans('texts.in_total_revenue') }}
|
||||
@ -146,3 +148,4 @@
|
||||
</div>
|
||||
|
||||
@stop
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user