From 2d9a8faf66f6a19f074d44c889d93ed134ca7b76 Mon Sep 17 00:00:00 2001 From: Jing Li Date: Tue, 28 May 2024 10:11:07 +0800 Subject: [PATCH] Update --- app/Services/StatisticService.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Services/StatisticService.php b/app/Services/StatisticService.php index 036c4f7..bc27202 100644 --- a/app/Services/StatisticService.php +++ b/app/Services/StatisticService.php @@ -21,10 +21,15 @@ class StatisticService public function ledger(array $input = []): array { $aggregate = Ledger::filter($input, LedgerFilter::class) - ->select([DB::raw('SUM(sales) as sales'), DB::raw('SUM(expenditure) as expenditure')]) + ->select([ + DB::raw('SUM(new_customers) as new_customers'), + DB::raw('SUM(sales) as sales'), + DB::raw('SUM(expenditure) as expenditure'), + ]) ->first(); return [ + 'new_customers' => $aggregate->new_customers ?? 0, 'sales' => trim_zeros($aggregate->sales ?? 0), 'expenditure' => trim_zeros($aggregate->expenditure ?? 0), ];