generated from liutk/owl-admin-base
Update
parent
8267ed071c
commit
2d9a8faf66
|
|
@ -21,10 +21,15 @@ class StatisticService
|
||||||
public function ledger(array $input = []): array
|
public function ledger(array $input = []): array
|
||||||
{
|
{
|
||||||
$aggregate = Ledger::filter($input, LedgerFilter::class)
|
$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();
|
->first();
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
'new_customers' => $aggregate->new_customers ?? 0,
|
||||||
'sales' => trim_zeros($aggregate->sales ?? 0),
|
'sales' => trim_zeros($aggregate->sales ?? 0),
|
||||||
'expenditure' => trim_zeros($aggregate->expenditure ?? 0),
|
'expenditure' => trim_zeros($aggregate->expenditure ?? 0),
|
||||||
];
|
];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue