From 2da6f9136f99a044ee90dbd97baee4a0cb8483f6 Mon Sep 17 00:00:00 2001 From: Ivan Nieto Date: Tue, 26 Jan 2021 14:05:31 -0600 Subject: [PATCH] Add 'Last Audit Date/Next Audit Date' filter to custom report (#8989) * Add 'Last Audit Date/Next Audit Date' filter to custom report * Added a constraint: cannot require a report with a Last Audit Date in the future. --- app/Http/Controllers/ReportsController.php | 8 ++++++ resources/views/reports/custom.blade.php | 33 +++++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.php index 55064c4f0f..4b85b1def6 100644 --- a/app/Http/Controllers/ReportsController.php +++ b/app/Http/Controllers/ReportsController.php @@ -632,6 +632,14 @@ class ReportsController extends Controller if (($request->filled('expected_checkin_start')) && ($request->filled('expected_checkin_end'))) { $assets->whereBetween('assets.expected_checkin', [$request->input('expected_checkin_start'), $request->input('expected_checkin_end')]); } + + if (($request->filled('last_audit_start')) && ($request->filled('last_audit_end'))) { + $assets->whereBetween('assets.last_audit_date', [$request->input('last_audit_start'), $request->input('last_audit_end')]); + } + + if (($request->filled('next_audit_start')) && ($request->filled('next_audit_end'))) { + $assets->whereBetween('assets.next_audit_date', [$request->input('next_audit_start'), $request->input('next_audit_end')]); + } $assets->orderBy('assets.created_at', 'ASC')->chunk(20, function($assets) use($handle, $customfields, $request) { diff --git a/resources/views/reports/custom.blade.php b/resources/views/reports/custom.blade.php index e27254c435..7bd1ba424e 100644 --- a/resources/views/reports/custom.blade.php +++ b/resources/views/reports/custom.blade.php @@ -316,7 +316,25 @@ - + +
+ +
+ + to + +
+
+ + +
+ +
+ + to + +
+