diff --git a/app/Ninja/Repositories/DashboardRepository.php b/app/Ninja/Repositories/DashboardRepository.php index 951993d56081..926043c73def 100644 --- a/app/Ninja/Repositories/DashboardRepository.php +++ b/app/Ninja/Repositories/DashboardRepository.php @@ -141,6 +141,7 @@ class DashboardRepository if ($entityType == ENTITY_INVOICE) { $records->select(DB::raw('sum(invoices.amount) as total, sum(invoices.balance) as balance, count(invoices.id) as count, '.$timeframe.' as '.$groupBy)) ->where('invoice_type_id', '=', INVOICE_TYPE_STANDARD) + ->where('invoices.is_public', '=', true) ->where('is_recurring', '=', false); } elseif ($entityType == ENTITY_PAYMENT) { $records->select(DB::raw('sum(payments.amount - payments.refunded) as total, count(payments.id) as count, '.$timeframe.' as '.$groupBy)) @@ -171,6 +172,7 @@ class DashboardRepository ->where('clients.is_deleted', '=', false) ->where('invoices.is_deleted', '=', false) ->where('invoices.is_recurring', '=', false) + ->where('invoices.is_public', '=', true) ->where('invoices.invoice_type_id', '=', INVOICE_TYPE_STANDARD); if (! $viewAll) { @@ -232,6 +234,7 @@ class DashboardRepository ->where('accounts.id', '=', $accountId) ->where('clients.is_deleted', '=', false) ->where('invoices.is_deleted', '=', false) + ->where('invoices.is_public', '=', true) ->where('invoices.invoice_type_id', '=', INVOICE_TYPE_STANDARD) ->where('invoices.is_recurring', '=', false); @@ -297,6 +300,7 @@ class DashboardRepository ->where('invoices.balance', '>', 0) ->where('invoices.is_deleted', '=', false) ->where('invoices.deleted_at', '=', null) + ->where('invoices.is_public', '=', true) ->where('contacts.is_primary', '=', true) ->where('invoices.due_date', '<', date('Y-m-d')); @@ -323,6 +327,7 @@ class DashboardRepository ->where('invoices.quote_invoice_id', '=', null) ->where('invoices.balance', '>', 0) ->where('invoices.is_deleted', '=', false) + ->where('invoices.is_public', '=', true) ->where('contacts.is_primary', '=', true) ->where('invoices.due_date', '>=', date('Y-m-d')) ->orderBy('invoices.due_date', 'asc');