diff --git a/app/Http/Controllers/DashboardApiController.php b/app/Http/Controllers/DashboardApiController.php index e77a1409a070..afd35bc1cf16 100644 --- a/app/Http/Controllers/DashboardApiController.php +++ b/app/Http/Controllers/DashboardApiController.php @@ -44,14 +44,14 @@ class DashboardApiController extends BaseAPIController $data = [ 'id' => 1, - 'paidToDate' => $paidToDate->count() && $paidToDate[0]->value ? $paidToDate[0]->value : 0, - 'paidToDateCurrency' => $paidToDate->count() && $paidToDate[0]->currency_id ? $paidToDate[0]->currency_id : $defaultCurrency, - 'balances' => $balances->count() && $balances[0]->value ? $balances[0]->value : 0, - 'balancesCurrency' => $balances->count() && $balances[0]->currency_id ? $balances[0]->currency_id : $defaultCurrency, - 'averageInvoice' => $averageInvoice->count() && $averageInvoice[0]->invoice_avg ? $averageInvoice[0]->invoice_avg : 0, - 'averageInvoiceCurrency' => $averageInvoice->count() && $averageInvoice[0]->currency_id ? $averageInvoice[0]->currency_id : $defaultCurrency, - 'invoicesSent' => $metrics ? $metrics->invoices_sent : 0, - 'activeClients' => $metrics ? $metrics->active_clients : 0, + 'paidToDate' => (float) ($paidToDate->count() && $paidToDate[0]->value ? $paidToDate[0]->value : 0), + 'paidToDateCurrency' => (int) ($paidToDate->count() && $paidToDate[0]->currency_id ? $paidToDate[0]->currency_id : $defaultCurrency), + 'balances' => (float) ($balances->count() && $balances[0]->value ? $balances[0]->value : 0), + 'balancesCurrency' => (int) ($balances->count() && $balances[0]->currency_id ? $balances[0]->currency_id : $defaultCurrency), + 'averageInvoice' => (float) ($averageInvoice->count() && $averageInvoice[0]->invoice_avg ? $averageInvoice[0]->invoice_avg : 0), + 'averageInvoiceCurrency' => (int) ($averageInvoice->count() && $averageInvoice[0]->currency_id ? $averageInvoice[0]->currency_id : $defaultCurrency), + 'invoicesSent' => (int) ($metrics ? $metrics->invoices_sent : 0), + 'activeClients' => (int) ($metrics ? $metrics->active_clients : 0), 'activities' => $this->createCollection($activities, new ActivityTransformer(), ENTITY_ACTIVITY), ];