diff --git a/app/Ninja/Repositories/DashboardRepository.php b/app/Ninja/Repositories/DashboardRepository.php index 845ef5383fea..b0b1a95696b1 100644 --- a/app/Ninja/Repositories/DashboardRepository.php +++ b/app/Ninja/Repositories/DashboardRepository.php @@ -136,6 +136,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)) @@ -166,6 +167,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){ @@ -227,6 +229,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); @@ -292,6 +295,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')); @@ -318,6 +322,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');