diff --git a/app/Services/Client/ClientService.php b/app/Services/Client/ClientService.php index a1cf2b316e2a..a7f1021bb377 100644 --- a/app/Services/Client/ClientService.php +++ b/app/Services/Client/ClientService.php @@ -51,8 +51,10 @@ class ClientService $credits = $this->client->credits() ->where('is_deleted', false) ->where('balance', '>', 0) - ->whereDate('due_date', '<=', now()->format('Y-m-d')) - ->orWhere('due_date', NULL) + ->where(function ($query){ + $query->whereDate('due_date', '<=', now()->format('Y-m-d')) + ->orWhereNull('due_date'); + }) ->orderBy('created_at','ASC'); return Number::roundValue($credits->sum('balance'), $this->client->currency()->precision);