diff --git a/app/Http/Controllers/Admin/StatisticsController.php b/app/Http/Controllers/Admin/StatisticsController.php index 2f0150d..b52eb3e 100755 --- a/app/Http/Controllers/Admin/StatisticsController.php +++ b/app/Http/Controllers/Admin/StatisticsController.php @@ -567,6 +567,18 @@ class StatisticsController extends CommonController $total['guanlifei'] += $item->guanlifei; } + // 获取所有订单数据 + $beds = Bed::whereIn('area_id', $area->pluck('id'))->where('project_id', $project_id)->get(); + // 订单总数 + $allOrderTotal = Orders::where('project_id', $project_id) + ->where('created_at', 'like', '%' . $month . '%') + ->whereIn('bed_id', $beds->pluck('id')) + ->get(); + $refund['order_total'] = Refund::where('created_at', 'like', '%' . $month . '%')->whereIn('order_id', $allOrderTotal->pluck('id'))->sum('money'); + $refund['shijishouru'] = $refund['order_total']; + $refund['guanlifei'] = round($refund['order_total'] * 0.06, 2); + + // 导出 if ($is_export) { $area = $area->toArray(); @@ -594,7 +606,7 @@ class StatisticsController extends CommonController $writer->save('php://output'); exit; } - return view($this->bladePath . ".income", compact("total","area", "project", "project_id", "month", "projects")); + return view($this->bladePath . ".income", compact("total", "area", "project", "project_id", "month", "projects")); } } diff --git a/resources/views/admin/statistics/income.blade.php b/resources/views/admin/statistics/income.blade.php index e4e8997..b4b76e4 100755 --- a/resources/views/admin/statistics/income.blade.php +++ b/resources/views/admin/statistics/income.blade.php @@ -57,6 +57,14 @@