From 3e12efe7a37fd6a85f6e21c2b2dcacfe9fa62ebe Mon Sep 17 00:00:00 2001 From: Gaurav Gusain Date: Tue, 25 Jul 2023 13:52:24 +0530 Subject: [PATCH 01/10] fix finance report --- .../Http/Controllers/CodeTrekController.php | 4 +-- .../Services/CodeTrek/ReportDataService.php | 32 ++++++++++++++++++ .../Services/Finance/ReportDataService.php | 33 +++---------------- 3 files changed, 38 insertions(+), 31 deletions(-) create mode 100644 Modules/Report/Services/CodeTrek/ReportDataService.php diff --git a/Modules/Report/Http/Controllers/CodeTrekController.php b/Modules/Report/Http/Controllers/CodeTrekController.php index d2ae3d7e13..bb76261bbf 100644 --- a/Modules/Report/Http/Controllers/CodeTrekController.php +++ b/Modules/Report/Http/Controllers/CodeTrekController.php @@ -4,7 +4,7 @@ use Illuminate\Routing\Controller; use Illuminate\Http\Request; -use Modules\Report\Services\Finance\ReportDataService; +use Modules\Report\Services\CodeTrek\ReportDataService; class CodeTrekController extends Controller { @@ -20,6 +20,6 @@ public function getApplicantData(Request $request) $type = $request->type; $filters = $request->filters; - return $this->service->getDataForDailyCodeTrekApplications($type, json_decode($filters, true), $request); + return $this->service->getDataForDailyCodeTrekApplications($type, json_decode($filters, true)); } } diff --git a/Modules/Report/Services/CodeTrek/ReportDataService.php b/Modules/Report/Services/CodeTrek/ReportDataService.php new file mode 100644 index 0000000000..e86ac3c3a0 --- /dev/null +++ b/Modules/Report/Services/CodeTrek/ReportDataService.php @@ -0,0 +1,32 @@ +created_at ?? today()->subYear(); + $defaultEndDate = today(); + $filters['start_date'] = empty($filters['start_date']) ? $defaultStartDate : $filters['start_date']; + $filters['end_date'] = empty($filters['end_date']) ? $defaultEndDate : $filters['end_date']; + $applicantChartData = CodeTrekApplicant::select(\DB::Raw('DATE(start_date) as date, COUNT(*) as count')) + ->whereDate('start_date', '>=', $filters['start_date']) + ->whereDate('start_date', '<=', $filters['end_date']) + ->groupBy('date'); + + $dates = $applicantChartData->pluck('date')->toArray(); + $counts = $applicantChartData->pluck('count')->toArray(); + $chartData = [ + 'dates' => $dates, + 'counts' => $counts, + ]; + $reportApplicantData = json_encode($chartData); + + return $reportApplicantData; + } + } +} diff --git a/Modules/Report/Services/Finance/ReportDataService.php b/Modules/Report/Services/Finance/ReportDataService.php index 6292194096..895729dc9b 100644 --- a/Modules/Report/Services/Finance/ReportDataService.php +++ b/Modules/Report/Services/Finance/ReportDataService.php @@ -18,31 +18,6 @@ public function getData($type, $filters) return $filters; } - public function getDataForDailyCodeTrekApplications($type, $filters, $request) - { - if ($type == 'codetrek-application') { - $applicants = CodeTrekApplicant::find('start_date'); - $defaultStartDate = $applicants->created_at ?? today()->subYear(); - $defaultEndDate = today(); - $filters['start_date'] = empty($filters['start_date']) ? $defaultStartDate : $filters['start_date']; - $filters['end_date'] = empty($filters['end_date']) ? $defaultEndDate : $filters['end_date']; - $applicantChartData = CodeTrekApplicant::select(\DB::Raw('DATE(start_date) as date, COUNT(*) as count')) - ->whereDate('start_date', '>=', $filters['start_date']) - ->whereDate('start_date', '<=', $filters['end_date']) - ->groupBy('date'); - - $dates = $applicantChartData->pluck('date')->toArray(); - $counts = $applicantChartData->pluck('count')->toArray(); - $chartData = [ - 'dates' => $dates, - 'counts' => $counts, - ]; - $reportApplicantData = json_encode($chartData); - - return $reportApplicantData; - } - } - public function getDataForClientRevenueReportPage(array $data) { $selectedClient = isset($data['client_id']) ? Client::find($data['client_id']) : Client::orderBy('name')->first(); @@ -61,8 +36,8 @@ private function revenueTrendForClient($filters) $filters['start_date'] = empty($filters['start_date']) ? $defaultStartDate : $filters['start_date']; $filters['end_date'] = empty($filters['end_date']) ? $defaultEndDate : $filters['end_date']; - - $reportData = $this->service->getRevenueReportDataForClient($filters, $client); + $revenueReportService = new RevenueReportService; + $reportData = $revenueReportService->getRevenueReportDataForClient($filters, $client); return [ 'labels' => $reportData['months'], @@ -84,8 +59,8 @@ private function revenueTrend($filters) 'previous_period_end_date' => $defaultPreviousEndDate ]; $filters = array_merge($defaultFilters, request()->all()); - - $reportData = $this->service->getRevenueGroupedByClient($filters); + $revenueReportService = new RevenueReportService; + $reportData = $revenueReportService->getRevenueGroupedByClient($filters); return [ 'labels' => $reportData['clients_name'], From a4ae745e0d6c0e296384bd05e1556bbe4019d12b Mon Sep 17 00:00:00 2001 From: Gaurav Gusain Date: Thu, 27 Jul 2023 11:44:56 +0530 Subject: [PATCH 02/10] code refactoring --- .../Http/Controllers/CodeTrekController.php | 10 ++++------ .../Services/CodeTrek/ReportDataService.php | 17 ++++++++--------- .../Services/Finance/ReportDataService.php | 10 ++++++++-- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/Modules/CodeTrek/Http/Controllers/CodeTrekController.php b/Modules/CodeTrek/Http/Controllers/CodeTrekController.php index b0b06ca1ad..0714d1aea8 100644 --- a/Modules/CodeTrek/Http/Controllers/CodeTrekController.php +++ b/Modules/CodeTrek/Http/Controllers/CodeTrekController.php @@ -29,16 +29,14 @@ public function index(Request $request) // $this->authorize('view', $applicant); There are some issues in the production, which is why these lines are commented out. $centres = OfficeLocation::all(); - $mentors = User::all(); $applicantData = $this->service->getCodeTrekApplicants($request->all()); $applicants = $applicantData['applicants']; $statusCounts = $applicantData['statusCounts']; - $start_date = Carbon::parse($request->application_start_date) ?? today()->subYear(); - $end_date = Carbon::parse($request->application_end_date) ?? today(); - $reportApplicationCounts = CodeTrekApplicant::select(\DB::Raw('DATE(start_date) as date, COUNT(*) as count')) - ->whereDate('start_date', '>=', $start_date) - ->whereDate('start_date', '<=', $end_date) + $startDate = Carbon::parse($request->input('application_start_date', today()->subYear())); + $endDate = Carbon::parse($request->input('application_end_date', today())); + $reportApplicationCounts = CodeTrekApplicant::whereDate('start_date', '>=', $startDate) + ->whereDate('start_date', '<=', $endDate) ->count(); return view('codetrek::index', [ diff --git a/Modules/Report/Services/CodeTrek/ReportDataService.php b/Modules/Report/Services/CodeTrek/ReportDataService.php index e86ac3c3a0..d7e37b9c60 100644 --- a/Modules/Report/Services/CodeTrek/ReportDataService.php +++ b/Modules/Report/Services/CodeTrek/ReportDataService.php @@ -1,6 +1,7 @@ created_at ?? today()->subYear(); - $defaultEndDate = today(); - $filters['start_date'] = empty($filters['start_date']) ? $defaultStartDate : $filters['start_date']; - $filters['end_date'] = empty($filters['end_date']) ? $defaultEndDate : $filters['end_date']; + $filterStartDate = empty($filters['start_date']) ? today()->subYear() : $filters['start_date']; + $filterEndDate = empty($filters['end_date']) ? today() : $filters['end_date']; $applicantChartData = CodeTrekApplicant::select(\DB::Raw('DATE(start_date) as date, COUNT(*) as count')) - ->whereDate('start_date', '>=', $filters['start_date']) - ->whereDate('start_date', '<=', $filters['end_date']) + ->whereDate('start_date', '>=', $filterStartDate) + ->whereDate('start_date', '<=', $filterEndDate) ->groupBy('date'); - + $dates = $applicantChartData->pluck('date')->toArray(); $counts = $applicantChartData->pluck('count')->toArray(); $chartData = [ 'dates' => $dates, - 'counts' => $counts, + 'counts' => $counts ]; + $reportApplicantData = json_encode($chartData); return $reportApplicantData; diff --git a/Modules/Report/Services/Finance/ReportDataService.php b/Modules/Report/Services/Finance/ReportDataService.php index 895729dc9b..307ac968d8 100644 --- a/Modules/Report/Services/Finance/ReportDataService.php +++ b/Modules/Report/Services/Finance/ReportDataService.php @@ -7,6 +7,13 @@ class ReportDataService { + protected $revenueReportService; + + public function __construct(RevenueReportService $revenueReportService) + { + $this->revenueReportService = $service; + } + public function getData($type, $filters) { if ($type == 'revenue-trend') { @@ -36,8 +43,7 @@ private function revenueTrendForClient($filters) $filters['start_date'] = empty($filters['start_date']) ? $defaultStartDate : $filters['start_date']; $filters['end_date'] = empty($filters['end_date']) ? $defaultEndDate : $filters['end_date']; - $revenueReportService = new RevenueReportService; - $reportData = $revenueReportService->getRevenueReportDataForClient($filters, $client); + $reportData = $this->revenueReportService->getRevenueReportDataForClient($filters, $client); return [ 'labels' => $reportData['months'], From 47c29baa5a65dc729e3473f659c89ad25dad6a1c Mon Sep 17 00:00:00 2001 From: Gaurav Gusain Date: Thu, 27 Jul 2023 11:45:26 +0530 Subject: [PATCH 03/10] trim white spaces --- Modules/Report/Services/CodeTrek/ReportDataService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Report/Services/CodeTrek/ReportDataService.php b/Modules/Report/Services/CodeTrek/ReportDataService.php index d7e37b9c60..28e2e28a13 100644 --- a/Modules/Report/Services/CodeTrek/ReportDataService.php +++ b/Modules/Report/Services/CodeTrek/ReportDataService.php @@ -15,7 +15,7 @@ public function getDataForDailyCodeTrekApplications($type, $filters) ->whereDate('start_date', '>=', $filterStartDate) ->whereDate('start_date', '<=', $filterEndDate) ->groupBy('date'); - + $dates = $applicantChartData->pluck('date')->toArray(); $counts = $applicantChartData->pluck('count')->toArray(); $chartData = [ From 2d9e0ec61a31829c31a342bf1522eb130c231912 Mon Sep 17 00:00:00 2001 From: Gaurav Gusain Date: Thu, 27 Jul 2023 11:50:00 +0530 Subject: [PATCH 04/10] Ci fixes --- Modules/Report/Services/Finance/ReportDataService.php | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/Modules/Report/Services/Finance/ReportDataService.php b/Modules/Report/Services/Finance/ReportDataService.php index 307ac968d8..2a031f0cb1 100644 --- a/Modules/Report/Services/Finance/ReportDataService.php +++ b/Modules/Report/Services/Finance/ReportDataService.php @@ -3,17 +3,9 @@ namespace Modules\Report\Services\Finance; use Modules\Client\Entities\Client; -use Modules\CodeTrek\Entities\CodeTrekApplicant; class ReportDataService { - protected $revenueReportService; - - public function __construct(RevenueReportService $revenueReportService) - { - $this->revenueReportService = $service; - } - public function getData($type, $filters) { if ($type == 'revenue-trend') { @@ -43,7 +35,8 @@ private function revenueTrendForClient($filters) $filters['start_date'] = empty($filters['start_date']) ? $defaultStartDate : $filters['start_date']; $filters['end_date'] = empty($filters['end_date']) ? $defaultEndDate : $filters['end_date']; - $reportData = $this->revenueReportService->getRevenueReportDataForClient($filters, $client); + $revenueReportService = new RevenueReportService; + $reportData = $revenueReportService->getRevenueReportDataForClient($filters, $client); return [ 'labels' => $reportData['months'], From 52fe680cacf811f6526389ff6155af22d59478f3 Mon Sep 17 00:00:00 2001 From: Gaurav Gusain Date: Sat, 19 Aug 2023 17:05:17 +0530 Subject: [PATCH 05/10] ci fix --- Modules/Report/Services/CodeTrek/ReportDataService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Report/Services/CodeTrek/ReportDataService.php b/Modules/Report/Services/CodeTrek/ReportDataService.php index 28e2e28a13..8634f16c81 100644 --- a/Modules/Report/Services/CodeTrek/ReportDataService.php +++ b/Modules/Report/Services/CodeTrek/ReportDataService.php @@ -20,7 +20,7 @@ public function getDataForDailyCodeTrekApplications($type, $filters) $counts = $applicantChartData->pluck('count')->toArray(); $chartData = [ 'dates' => $dates, - 'counts' => $counts + 'counts' => $counts, ]; $reportApplicantData = json_encode($chartData); From fc0379490f9005355fd8d57c7a5bf0a2932dfacf Mon Sep 17 00:00:00 2001 From: Gaurav Gusain Date: Sat, 19 Aug 2023 17:10:05 +0530 Subject: [PATCH 06/10] ci fix --- Modules/Report/Services/CodeTrek/ReportDataService.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Modules/Report/Services/CodeTrek/ReportDataService.php b/Modules/Report/Services/CodeTrek/ReportDataService.php index 8634f16c81..5ae8b2d7e9 100644 --- a/Modules/Report/Services/CodeTrek/ReportDataService.php +++ b/Modules/Report/Services/CodeTrek/ReportDataService.php @@ -23,9 +23,7 @@ public function getDataForDailyCodeTrekApplications($type, $filters) 'counts' => $counts, ]; - $reportApplicantData = json_encode($chartData); - - return $reportApplicantData; + return json_encode($chartData); } } } From 30170b8ab000d5185eaf6e0da6fa804c7125550a Mon Sep 17 00:00:00 2001 From: Gaurav Gusain Date: Sat, 19 Aug 2023 17:16:55 +0530 Subject: [PATCH 07/10] Feedback resolved --- Modules/Report/Services/CodeTrek/ReportDataService.php | 5 +++-- Modules/Report/Services/Finance/ReportDataService.php | 6 ++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Modules/Report/Services/CodeTrek/ReportDataService.php b/Modules/Report/Services/CodeTrek/ReportDataService.php index 5ae8b2d7e9..1c610807d8 100644 --- a/Modules/Report/Services/CodeTrek/ReportDataService.php +++ b/Modules/Report/Services/CodeTrek/ReportDataService.php @@ -8,6 +8,7 @@ class ReportDataService { public function getDataForDailyCodeTrekApplications($type, $filters) { + $chartData = []; if ($type == 'codetrek-application') { $filterStartDate = empty($filters['start_date']) ? today()->subYear() : $filters['start_date']; $filterEndDate = empty($filters['end_date']) ? today() : $filters['end_date']; @@ -22,8 +23,8 @@ public function getDataForDailyCodeTrekApplications($type, $filters) 'dates' => $dates, 'counts' => $counts, ]; - - return json_encode($chartData); } + + return json_encode($chartData); } } diff --git a/Modules/Report/Services/Finance/ReportDataService.php b/Modules/Report/Services/Finance/ReportDataService.php index 65d4b8aefc..31e51dcb8c 100644 --- a/Modules/Report/Services/Finance/ReportDataService.php +++ b/Modules/Report/Services/Finance/ReportDataService.php @@ -37,8 +37,7 @@ private function revenueTrendForClient($filters) $filters['start_date'] = empty($filters['start_date']) ? $defaultStartDate : $filters['start_date']; $filters['end_date'] = empty($filters['end_date']) ? $defaultEndDate : $filters['end_date']; - $revenueReportService = new RevenueReportService; - $reportData = $revenueReportService->getRevenueReportDataForClient($filters, $client); + $reportData = RevenueReportService::getRevenueReportDataForClient($filters, $client); return [ 'labels' => $reportData['months'], @@ -60,8 +59,7 @@ private function revenueTrend($filters) 'previous_period_end_date' => $defaultPreviousEndDate, ]; $filters = array_merge($defaultFilters, request()->all()); - $revenueReportService = new RevenueReportService; - $reportData = $revenueReportService->getRevenueGroupedByClient($filters); + $reportData = RevenueReportService::getRevenueGroupedByClient($filters); return [ 'labels' => $reportData['clients_name'], From 63bdc5e2441afe982d0fc9fb46205e3f0017bc17 Mon Sep 17 00:00:00 2001 From: Gaurav Gusain Date: Sat, 19 Aug 2023 17:19:48 +0530 Subject: [PATCH 08/10] minor fix --- Modules/Report/Services/Finance/ReportDataService.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Modules/Report/Services/Finance/ReportDataService.php b/Modules/Report/Services/Finance/ReportDataService.php index 31e51dcb8c..64794e4d78 100644 --- a/Modules/Report/Services/Finance/ReportDataService.php +++ b/Modules/Report/Services/Finance/ReportDataService.php @@ -37,7 +37,8 @@ private function revenueTrendForClient($filters) $filters['start_date'] = empty($filters['start_date']) ? $defaultStartDate : $filters['start_date']; $filters['end_date'] = empty($filters['end_date']) ? $defaultEndDate : $filters['end_date']; - $reportData = RevenueReportService::getRevenueReportDataForClient($filters, $client); + $reportDataService = new RevenueReportService; + $reportData = $reportDataService->getRevenueReportDataForClient($filters, $client); return [ 'labels' => $reportData['months'], @@ -59,7 +60,8 @@ private function revenueTrend($filters) 'previous_period_end_date' => $defaultPreviousEndDate, ]; $filters = array_merge($defaultFilters, request()->all()); - $reportData = RevenueReportService::getRevenueGroupedByClient($filters); + $reportDataService = new RevenueReportService; + $reportData = $reportDataService->getRevenueGroupedByClient($filters); return [ 'labels' => $reportData['clients_name'], From d29eeaf9d286cd045f8fb431e7b8bf62914ed8a9 Mon Sep 17 00:00:00 2001 From: Gaurav Gusain Date: Wed, 13 Sep 2023 18:41:40 +0530 Subject: [PATCH 09/10] Made functions static --- .../Services/Finance/ReportDataService.php | 6 ++---- .../Services/Finance/RevenueReportService.php | 20 +++++++++---------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/Modules/Report/Services/Finance/ReportDataService.php b/Modules/Report/Services/Finance/ReportDataService.php index 64794e4d78..31e51dcb8c 100644 --- a/Modules/Report/Services/Finance/ReportDataService.php +++ b/Modules/Report/Services/Finance/ReportDataService.php @@ -37,8 +37,7 @@ private function revenueTrendForClient($filters) $filters['start_date'] = empty($filters['start_date']) ? $defaultStartDate : $filters['start_date']; $filters['end_date'] = empty($filters['end_date']) ? $defaultEndDate : $filters['end_date']; - $reportDataService = new RevenueReportService; - $reportData = $reportDataService->getRevenueReportDataForClient($filters, $client); + $reportData = RevenueReportService::getRevenueReportDataForClient($filters, $client); return [ 'labels' => $reportData['months'], @@ -60,8 +59,7 @@ private function revenueTrend($filters) 'previous_period_end_date' => $defaultPreviousEndDate, ]; $filters = array_merge($defaultFilters, request()->all()); - $reportDataService = new RevenueReportService; - $reportData = $reportDataService->getRevenueGroupedByClient($filters); + $reportData = RevenueReportService::getRevenueGroupedByClient($filters); return [ 'labels' => $reportData['clients_name'], diff --git a/Modules/Report/Services/Finance/RevenueReportService.php b/Modules/Report/Services/Finance/RevenueReportService.php index 8a73cb4edc..7aeff5f07e 100644 --- a/Modules/Report/Services/Finance/RevenueReportService.php +++ b/Modules/Report/Services/Finance/RevenueReportService.php @@ -49,7 +49,7 @@ public function getParticularReport(string $particularSlug, array $particular, o return $particular; } - public function getRevenueGroupedByClient($filters) + public static function getRevenueGroupedByClient($filters) { $currentPeriodInvoiceDetails = Invoice::with('client') ->whereBetween('sent_on', [$filters['current_period_start_date'], $filters['current_period_end_date']]) @@ -92,36 +92,36 @@ public function getRevenueGroupedByClient($filters) return $data; } - public function getRevenueReportDataForClient($filters, $client) + public static function getRevenueReportDataForClient($filters, $client) { $amountMonthWise = []; $totalAmount = 0; $clientDepartments = $client->linkedAsDepartment; $clientPartners = $client->linkedAsPartner; - $clientInvoiceDetails = $this->getInvoicesForClient($client, $filters); + $clientInvoiceDetails = RevenueReportService::getInvoicesForClient($client, $filters); foreach ($clientInvoiceDetails as $invoice) { - $data = $this->handleInvoiceDataForClient($invoice, $amountMonthWise); + $data = RevenueReportService::handleInvoiceDataForClient($invoice, $amountMonthWise); $totalAmount += $data['invoiceAmount']; $amountMonthWise = $data['amountMonthWise']; } foreach ($clientDepartments as $department) { - $departmentInvoiceDetails = $this->getInvoicesForClient($department, $filters); + $departmentInvoiceDetails = RevenueReportService::getInvoicesForClient($department, $filters); foreach ($departmentInvoiceDetails as $invoice) { - $data = $this->handleInvoiceDataForClient($invoice, $amountMonthWise); + $data = RevenueReportService::handleInvoiceDataForClient($invoice, $amountMonthWise); $totalAmount += $data['invoiceAmount']; $amountMonthWise = $data['amountMonthWise']; } } foreach ($clientPartners as $partner) { - $partnerInvoiceDetails = $this->getInvoicesForClient($partner, $filters); + $partnerInvoiceDetails = RevenueReportService::getInvoicesForClient($partner, $filters); foreach ($partnerInvoiceDetails as $invoice) { - $data = $this->handleInvoiceDataForClient($invoice, $amountMonthWise); + $data = RevenueReportService::handleInvoiceDataForClient($invoice, $amountMonthWise); $totalAmount += $data['invoiceAmount']; $amountMonthWise = $data['amountMonthWise']; } @@ -277,7 +277,7 @@ private function getAmountsForRevenueProceeds($category, $startDate, $endDate) return $results; } - private function handleInvoiceDataForClient($invoice, $amountMonthWise) + private static function handleInvoiceDataForClient($invoice, $amountMonthWise) { $invoiceAmount = round($invoice->total_amount_in_inr, 2); $amountMonthWise[$invoice->sent_on->format('M-Y')] = ($amountMonthWise[$invoice->sent_on->format('M-Y')] ?? 0) + $invoiceAmount; @@ -288,7 +288,7 @@ private function handleInvoiceDataForClient($invoice, $amountMonthWise) ]; } - private function getInvoicesForClient($client, $filters) + private static function getInvoicesForClient($client, $filters) { return Invoice::where('client_id', $client->id) ->whereBetween('sent_on', [$filters['start_date'], $filters['end_date']]) From 85d24ec8b9a8d75326799da780d1637e1d5d9c9b Mon Sep 17 00:00:00 2001 From: Gaurav Gusain Date: Fri, 15 Sep 2023 11:41:19 +0530 Subject: [PATCH 10/10] minor fix --- .../Report/Services/Finance/RevenueReportService.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Modules/Report/Services/Finance/RevenueReportService.php b/Modules/Report/Services/Finance/RevenueReportService.php index 7aeff5f07e..804fe06a7e 100644 --- a/Modules/Report/Services/Finance/RevenueReportService.php +++ b/Modules/Report/Services/Finance/RevenueReportService.php @@ -99,29 +99,29 @@ public static function getRevenueReportDataForClient($filters, $client) $clientDepartments = $client->linkedAsDepartment; $clientPartners = $client->linkedAsPartner; - $clientInvoiceDetails = RevenueReportService::getInvoicesForClient($client, $filters); + $clientInvoiceDetails = self::getInvoicesForClient($client, $filters); foreach ($clientInvoiceDetails as $invoice) { - $data = RevenueReportService::handleInvoiceDataForClient($invoice, $amountMonthWise); + $data = self::handleInvoiceDataForClient($invoice, $amountMonthWise); $totalAmount += $data['invoiceAmount']; $amountMonthWise = $data['amountMonthWise']; } foreach ($clientDepartments as $department) { - $departmentInvoiceDetails = RevenueReportService::getInvoicesForClient($department, $filters); + $departmentInvoiceDetails = self::getInvoicesForClient($department, $filters); foreach ($departmentInvoiceDetails as $invoice) { - $data = RevenueReportService::handleInvoiceDataForClient($invoice, $amountMonthWise); + $data = self::handleInvoiceDataForClient($invoice, $amountMonthWise); $totalAmount += $data['invoiceAmount']; $amountMonthWise = $data['amountMonthWise']; } } foreach ($clientPartners as $partner) { - $partnerInvoiceDetails = RevenueReportService::getInvoicesForClient($partner, $filters); + $partnerInvoiceDetails = self::getInvoicesForClient($partner, $filters); foreach ($partnerInvoiceDetails as $invoice) { - $data = RevenueReportService::handleInvoiceDataForClient($invoice, $amountMonthWise); + $data = self::handleInvoiceDataForClient($invoice, $amountMonthWise); $totalAmount += $data['invoiceAmount']; $amountMonthWise = $data['amountMonthWise']; }