liyinglin 2 years ago
parent 45128d927f
commit b6583ade80

@ -400,7 +400,7 @@ class StatisticsController extends CommonController
}
})->where('admin_id', $user->id)->pluck('area_id');
}
$data = Area::with('project', 'building')->where(function ($query) use ($areaId) {
$data = Area::where('project_id', $project_id)->with('project', 'building')->where(function ($query) use ($areaId) {
if ($areaId) {
$query->whereIn('id', $areaId);
}
@ -412,8 +412,8 @@ class StatisticsController extends CommonController
foreach ($data as $item) {
// 获取所有床位id
$bedIds = Bed::where('project_id', $project_id)->where('area_id', $item->id)->pluck('id');
$order = Orders::where('project_id', $project_id)->whereIn('bed_id', $bedIds)->where('status', 100)->get();
$bedIds = Bed::where('area_id', $item->id)->pluck('id');
$order = Orders::whereIn('bed_id', $bedIds)->where('status', 100)->get();
$item->order_total = $order->sum('total');
$item->lies = $this->getLies($bedIds, $productItem, $factor);
}

Loading…
Cancel
Save