From 33f152ae9cffbca3ab16ca72221b0da58891ccf6 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Sat, 2 Oct 2021 15:22:28 +0800 Subject: [PATCH] customer report --- app/Http/Controllers/Reports/MonthlyReportController.php | 2 ++ .../reports/sections/MonthlyReportSectionComponent.vue | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Reports/MonthlyReportController.php b/app/Http/Controllers/Reports/MonthlyReportController.php index eb158c62..96836f97 100644 --- a/app/Http/Controllers/Reports/MonthlyReportController.php +++ b/app/Http/Controllers/Reports/MonthlyReportController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers\Reports; use App\Classes\ValueObjects\Constants\HttpStatus; use App\Classes\ValueObjects\Response\ApiResponseObject; +use App\Models\Company; use App\Models\Container; use App\Models\Order; use Carbon\Carbon; @@ -52,6 +53,7 @@ class MonthlyReportController 'containers' => count($containers), 'activated_orders' => $activeOrders, 'active_customers' => count($customers), + 'new_customers' => Company::whereMonth('created_at', $month->format('m'))->count(), 'total_cbm' => $customers->sum(function($customer){ return $customer['cbm']; }), diff --git a/resources/assets/vue/components/reports/sections/MonthlyReportSectionComponent.vue b/resources/assets/vue/components/reports/sections/MonthlyReportSectionComponent.vue index 14a08e4a..2534893e 100644 --- a/resources/assets/vue/components/reports/sections/MonthlyReportSectionComponent.vue +++ b/resources/assets/vue/components/reports/sections/MonthlyReportSectionComponent.vue @@ -81,13 +81,15 @@

{{report.active_customers}}

+ {{ Math.ceil((((report.new_customers / report.active_customers) * 100) * 100) / 100).toFixed(2)}}% + New Customers: {{report.new_customers}}
-
+