From 0fe331b372f3576e2a40236417d045e8dafd0596 Mon Sep 17 00:00:00 2001 From: cody <648753004@qq.com> Date: Fri, 28 Jun 2024 11:08:46 +0800 Subject: [PATCH] update --- .../Admin/StatisticsController.php | 8 +++-- .../views/admin/statistics/income.blade.php | 36 +++++++++---------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/app/Http/Controllers/Admin/StatisticsController.php b/app/Http/Controllers/Admin/StatisticsController.php index a44ede8..cebea76 100755 --- a/app/Http/Controllers/Admin/StatisticsController.php +++ b/app/Http/Controllers/Admin/StatisticsController.php @@ -546,10 +546,11 @@ class StatisticsController extends CommonController $months = $this->_getMonths(); // 当月天数 $days = date('t', strtotime($month)); - $area = Area::withCount('beds')->where('project_id', $project_id)->get(); + $areaList = 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) { + $area = []; + foreach ($areaList as $item) { $beds = Bed::where('area_id', $item->id)->where('project_id', $project_id)->get(); // 订单总数 $orderTotal = Orders::where('project_id', $project_id) @@ -561,6 +562,9 @@ class StatisticsController extends CommonController $item->zengshishui = round($orderTotal * 0.06, 2); $item->shijishouru = round($orderTotal - $item->shouxufei - $item->zengshishui, 2); $item->guanlifei = round($item->shijishouru * 0.06, 2); + if (!empty($item->order_total)) { + $area[] = $item; + } // 合计 $total['order_total'] += $item->order_total; $total['shouxufei'] += $item->shouxufei; diff --git a/resources/views/admin/statistics/income.blade.php b/resources/views/admin/statistics/income.blade.php index 1f4c7d4..03a802f 100755 --- a/resources/views/admin/statistics/income.blade.php +++ b/resources/views/admin/statistics/income.blade.php @@ -43,36 +43,36 @@ @foreach ($area as $row) {{ $row->name }} - {{ empty($row->order_total)?'':$row->order_total }} - {{ empty($row->shouxufei)?'':$row->shouxufei }} - {{ empty($row->zengshishui)?'':$row->zengshishui }} - {{ empty($row->shijishouru)?'':$row->shijishouru }} - {{ empty($row->guanlifei)?'':$row->guanlifei }} + {{ $row->order_total }} + {{ $row->shouxufei }} + {{ $row->zengshishui }} + {{ $row->shijishouru }} + {{ $row->guanlifei }} @endforeach 合计 - {{ empty($total['order_total'])?'':$total['order_total'] }} - {{ empty($total['shouxufei'])?'':$total['shouxufei'] }} - {{ empty($total['zengshishui'])?'':$total['zengshishui'] }} - {{ empty($total['shijishouru'])?'':$total['shijishouru'] }} - {{ empty($total['guanlifei'])?'':$total['guanlifei'] }} + {{ $total['order_total'] }} + {{ $total['shouxufei'] }} + {{ $total['zengshishui'] }} + {{ $total['shijishouru'] }} + {{ $total['guanlifei'] }} 退款 - {{ empty($refund['order_total'])?'':$refund['order_total'] }} + {{ $refund['order_total'] }} - {{ empty($refund['shijishouru'])?'':$refund['shijishouru'] }} - {{ empty($refund['guanlifei'] )?'':$refund['guanlifei'] }} + {{ $refund['shijishouru'] }} + {{ $refund['guanlifei'] }} 总计 - {{ empty($zongji['order_total'])?'':$zongji['order_total'] }} - {{ empty($zongji['shouxufei'])?'':$zongji['shouxufei'] }} - {{ empty($zongji['zengshishui'])?'':$zongji['zengshishui'] }} - {{ empty($zongji['shijishouru'])?'':$zongji['shijishouru'] }} - {{ empty($zongji['guanlifei'])?'':$zongji['guanlifei'] }} + {{ $zongji['order_total'] }} + {{ $zongji['shouxufei'] }} + {{ $zongji['zengshishui'] }} + {{ $zongji['shijishouru'] }} + {{ $zongji['guanlifei'] }}