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')
|
->groupBy('accounts.id')
|
||||||
->first();
|
->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)
|
->select($select)
|
||||||
->leftJoin('clients', 'accounts.id', '=', 'clients.account_id')
|
->leftJoin('clients', 'accounts.id', '=', 'clients.account_id')
|
||||||
->where('accounts.id', '=', Auth::user()->account_id)
|
->where('accounts.id', '=', Auth::user()->account_id)
|
||||||
->where('clients.is_deleted', '=', false)
|
->where('clients.is_deleted', '=', false)
|
||||||
->groupBy('accounts.id')
|
->groupBy('accounts.id')
|
||||||
->first();
|
->groupBy('clients.currency_id')
|
||||||
|
->get();
|
||||||
|
|
||||||
$activities = Activity::where('activities.account_id', '=', Auth::user()->account_id)
|
$activities = Activity::where('activities.account_id', '=', Auth::user()->account_id)
|
||||||
->orderBy('created_at', 'desc')->take(6)->get();
|
->orderBy('created_at', 'desc')->take(6)->get();
|
||||||
@ -49,7 +50,7 @@ class DashboardController extends \BaseController
|
|||||||
->orderBy('due_date', 'asc')->take(6)->get();
|
->orderBy('due_date', 'asc')->take(6)->get();
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'totalIncome' => Utils::formatMoney($totalIncome ? $totalIncome->value : 0, Session::get(SESSION_CURRENCY)),
|
'totalIncomes' => $totalIncomes,
|
||||||
'billedClients' => $metrics ? $metrics->billed_clients : 0,
|
'billedClients' => $metrics ? $metrics->billed_clients : 0,
|
||||||
'invoicesSent' => $metrics ? $metrics->invoices_sent : 0,
|
'invoicesSent' => $metrics ? $metrics->invoices_sent : 0,
|
||||||
'activeClients' => $metrics ? $metrics->active_clients : 0,
|
'activeClients' => $metrics ? $metrics->active_clients : 0,
|
||||||
|
@ -8,7 +8,9 @@
|
|||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<img src="{{ asset('images/totalincome.png') }}" class="in-image"/>
|
<img src="{{ asset('images/totalincome.png') }}" class="in-image"/>
|
||||||
<div class="in-bold">
|
<div class="in-bold">
|
||||||
{{ $totalIncome }}
|
@foreach ($totalIncomes as $totalIncome)
|
||||||
|
{{ Utils::formatMoney($totalIncome->value, $totalIncome->currency_id); }}
|
||||||
|
@endforeach
|
||||||
</div>
|
</div>
|
||||||
<div class="in-thin">
|
<div class="in-thin">
|
||||||
{{ trans('texts.in_total_revenue') }}
|
{{ trans('texts.in_total_revenue') }}
|
||||||
@ -146,3 +148,4 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
@stop
|
@stop
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user