mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 09:44:37 -04:00
Fixes for credit query
This commit is contained in:
parent
37d7da8269
commit
cf5ddfad81
@ -51,8 +51,10 @@ class ClientService
|
|||||||
$credits = $this->client->credits()
|
$credits = $this->client->credits()
|
||||||
->where('is_deleted', false)
|
->where('is_deleted', false)
|
||||||
->where('balance', '>', 0)
|
->where('balance', '>', 0)
|
||||||
->whereDate('due_date', '<=', now()->format('Y-m-d'))
|
->where(function ($query){
|
||||||
->orWhere('due_date', NULL)
|
$query->whereDate('due_date', '<=', now()->format('Y-m-d'))
|
||||||
|
->orWhereNull('due_date');
|
||||||
|
})
|
||||||
->orderBy('created_at','ASC');
|
->orderBy('created_at','ASC');
|
||||||
|
|
||||||
return Number::roundValue($credits->sum('balance'), $this->client->currency()->precision);
|
return Number::roundValue($credits->sum('balance'), $this->client->currency()->precision);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user