Fixes for upcoming and past due invoice queries
This commit is contained in:
parent
8115cf1a9e
commit
3b73c4bb05
|
|
@ -167,7 +167,9 @@ class InvoiceFilters extends QueryFilters
|
||||||
|
|
||||||
$query->whereNull('due_date')
|
$query->whereNull('due_date')
|
||||||
->orWhere(function ($q) {
|
->orWhere(function ($q) {
|
||||||
$q->where('due_date', '>=', now()->startOfDay()->subSecond())->where('partial', 0);
|
$q->where('due_date', '>=', now()->startOfDay()->subSecond())->where(function ($qq){
|
||||||
|
$qq->where('partial', 0)->orWhere('balance', '>', 0);
|
||||||
|
});
|
||||||
})
|
})
|
||||||
->orWhere(function ($q) {
|
->orWhere(function ($q) {
|
||||||
$q->where('partial_due_date', '>=', now()->startOfDay()->subSecond())->where('partial', '>', 0);
|
$q->where('partial_due_date', '>=', now()->startOfDay()->subSecond())->where('partial', '>', 0);
|
||||||
|
|
@ -193,8 +195,8 @@ class InvoiceFilters extends QueryFilters
|
||||||
->where('is_deleted', 0)
|
->where('is_deleted', 0)
|
||||||
->where('balance', '>', 0)
|
->where('balance', '>', 0)
|
||||||
->where(function ($query) {
|
->where(function ($query) {
|
||||||
$query->where('due_date', '<', now())
|
$query->where('due_date', '<', now()->startOfDay()->addDay())
|
||||||
->orWhere('partial_due_date', '<', now());
|
->orWhere('partial_due_date', '<', now()->startOfDay()->addDay());
|
||||||
})
|
})
|
||||||
->orderBy('due_date', 'ASC');
|
->orderBy('due_date', 'ASC');
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -345,7 +345,7 @@ class SubscriptionController extends BaseController
|
||||||
* ),
|
* ),
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
public function update(UpdateSubscriptionRequest $request, Subscription $subscription): \Illuminate\Http\Response
|
public function update(UpdateSubscriptionRequest $request, Subscription $subscription)
|
||||||
{
|
{
|
||||||
if ($request->entityIsDeleted($subscription)) {
|
if ($request->entityIsDeleted($subscription)) {
|
||||||
return $request->disallowUpdate();
|
return $request->disallowUpdate();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue