From efa6743edff28c979f9af5ec4e0801622ec32ef4 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 21 Feb 2024 14:01:52 +1100 Subject: [PATCH] Adjustments for reports --- app/Services/Report/ARDetailReport.php | 3 +++ app/Services/Report/ARSummaryReport.php | 2 +- app/Services/Report/TaxSummaryReport.php | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/Services/Report/ARDetailReport.php b/app/Services/Report/ARDetailReport.php index f63f16e60761..6e5f6869fe86 100644 --- a/app/Services/Report/ARDetailReport.php +++ b/app/Services/Report/ARDetailReport.php @@ -90,6 +90,9 @@ class ARDetailReport extends BaseExport $query = Invoice::query() ->withTrashed() + ->whereHas('client', function ($query){ + $query->where('is_deleted', 0); + }) ->where('company_id', $this->company->id) ->where('is_deleted', 0) ->where('balance', '>', 0) diff --git a/app/Services/Report/ARSummaryReport.php b/app/Services/Report/ARSummaryReport.php index 04edfe0f5701..7dc41d73aef2 100644 --- a/app/Services/Report/ARSummaryReport.php +++ b/app/Services/Report/ARSummaryReport.php @@ -125,9 +125,9 @@ class ARSummaryReport extends BaseExport $amount = Invoice::withTrashed() ->where('client_id', $this->client->id) ->where('company_id', $this->client->company_id) + ->where('is_deleted', 0) ->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL]) ->where('balance', '>', 0) - ->where('is_deleted', 0) ->where(function ($query) { $query->where('due_date', '>', now()->startOfDay()) ->orWhereNull('due_date'); diff --git a/app/Services/Report/TaxSummaryReport.php b/app/Services/Report/TaxSummaryReport.php index 5a856eecd2c9..9e2e6a62cdc7 100644 --- a/app/Services/Report/TaxSummaryReport.php +++ b/app/Services/Report/TaxSummaryReport.php @@ -75,8 +75,8 @@ class TaxSummaryReport extends BaseExport $query = Invoice::query() ->withTrashed() - ->whereIn('status_id', [2,3,4]) ->where('company_id', $this->company->id) + ->whereIn('status_id', [2,3,4]) ->where('is_deleted', 0) ->orderBy('balance', 'desc');