From f0f6822b7ebe317b6c7a58b62e17fe71edbcd0ba Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Sat, 15 Nov 2025 12:19:53 +0800 Subject: [PATCH] E-Invoice - API, Sales Invoice Report (update to exclude data that is marked not to be imported) --- app/Classes/General/Eloquent/Filters/DateRange.php | 7 ++++++- app/Classes/General/Eloquent/Filters/DateRangeNoData.php | 7 ++++++- app/Classes/General/Eloquent/Filters/DateRangeWithData.php | 7 ++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/app/Classes/General/Eloquent/Filters/DateRange.php b/app/Classes/General/Eloquent/Filters/DateRange.php index d55709b4..798b2d4d 100644 --- a/app/Classes/General/Eloquent/Filters/DateRange.php +++ b/app/Classes/General/Eloquent/Filters/DateRange.php @@ -61,8 +61,13 @@ class DateRange implements Filter ApprovalStatus::SUSPENDED, ]) ->where(function ($q) use ($startDate, $endDate) { + $q->where(function ($q) { + $q->whereDoesntHave('company', function ($query) { + $query->where('debtor', 'N/A NO NEED TO IMPORT'); + }); + }) // Bookings without refunds - $q->where(function ($q1) use ($startDate, $endDate) { + ->where(function ($q1) use ($startDate, $endDate) { $q1->where('status', ApprovalStatus::COMPLETED) ->whereHas('transactions', function ($query) use ($startDate, $endDate){ $query->payments() diff --git a/app/Classes/General/Eloquent/Filters/DateRangeNoData.php b/app/Classes/General/Eloquent/Filters/DateRangeNoData.php index e0d730e5..9c2fc6eb 100644 --- a/app/Classes/General/Eloquent/Filters/DateRangeNoData.php +++ b/app/Classes/General/Eloquent/Filters/DateRangeNoData.php @@ -77,8 +77,13 @@ class DateRangeNoData implements Filter ApprovalStatus::SUSPENDED, ]) ->where(function ($q) use ($startDate, $endDate) { + $q->where(function ($q) { + $q->whereDoesntHave('company', function ($query) { + $query->where('debtor', 'N/A NO NEED TO IMPORT'); + }); + }) // Bookings without refunds - $q->where(function ($q1) use ($startDate, $endDate) { + ->where(function ($q1) use ($startDate, $endDate) { $q1->where('status', ApprovalStatus::COMPLETED) ->whereHas('transactions', function ($query) use ($startDate, $endDate){ $query->payments() diff --git a/app/Classes/General/Eloquent/Filters/DateRangeWithData.php b/app/Classes/General/Eloquent/Filters/DateRangeWithData.php index 61c5f437..fa2e5161 100644 --- a/app/Classes/General/Eloquent/Filters/DateRangeWithData.php +++ b/app/Classes/General/Eloquent/Filters/DateRangeWithData.php @@ -78,8 +78,13 @@ class DateRangeWithData implements Filter ApprovalStatus::SUSPENDED, ]) ->where(function ($q) use ($startDate, $endDate) { + $q->where(function ($q) { + $q->whereDoesntHave('company', function ($query) { + $query->where('debtor', 'N/A NO NEED TO IMPORT'); + }); + }) // Bookings without refunds - $q->where(function ($q1) use ($startDate, $endDate) { + ->where(function ($q1) use ($startDate, $endDate) { $q1->where('status', ApprovalStatus::COMPLETED) ->whereHas('transactions', function ($query) use ($startDate, $endDate){ $query->payments()