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)