diff --git a/app/Http/Controllers/Admin/StatisticsController.php b/app/Http/Controllers/Admin/StatisticsController.php index a18084d..8340da4 100755 --- a/app/Http/Controllers/Admin/StatisticsController.php +++ b/app/Http/Controllers/Admin/StatisticsController.php @@ -546,6 +546,7 @@ class StatisticsController extends CommonController // 当月天数 $days = date('t', strtotime($month)); $area = Area::withCount('beds')->where('project_id', $project_id)->get(); + // 合计 $total['order_total'] = $total['shouxufei'] = $total['zengshishui'] = $total['shijishouru'] = $total['guanlifei'] = 0; foreach ($area as $item) { $beds = Bed::where('area_id', $item->id)->where('project_id', $project_id)->get(); @@ -577,7 +578,12 @@ class StatisticsController extends CommonController $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); - + // 总计 + $zongji['order_total'] = $total['order_total'] - $refund['order_total']; + $zongji['shouxufei'] = + $zongji['zengshishui'] = + $zongji['shijishouru'] = $total['shijishouru'] - $refund['shijishouru']; + $zongji['guanlifei'] = $total['guanlifei'] - $refund['guanlifei']; // 导出 if ($is_export) { @@ -606,7 +612,7 @@ class StatisticsController extends CommonController $writer->save('php://output'); exit; } - return view($this->bladePath . ".income", compact("refund","total", "area", "project", "project_id", "month", "projects")); + return view($this->bladePath . ".income", compact("zongji","refund", "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 705377a..c7d0d36 100755 --- a/resources/views/admin/statistics/income.blade.php +++ b/resources/views/admin/statistics/income.blade.php @@ -65,6 +65,14 @@ {{ $refund['shijishouru'] }} {{ $refund['guanlifei'] }} + + 总计 + {{ $zongji['order_total'] }} + + + {{ $zongji['shijishouru'] }} + {{ $zongji['guanlifei'] }} +