|
|
|
|
@ -546,14 +546,14 @@ class StatisticsController extends CommonController
|
|
|
|
|
// 当月天数
|
|
|
|
|
$days = date('t', strtotime($month));
|
|
|
|
|
$area = Area::withCount('beds')->where('project_id', $project_id)->get();
|
|
|
|
|
$beds = Bed::whereIn('area_id', $area->pluck('id'))->where('project_id', $project_id)->get();
|
|
|
|
|
$totalBed = $beds->count();
|
|
|
|
|
// 订单总数
|
|
|
|
|
$orderTotal = Orders::where('project_id', $project_id)
|
|
|
|
|
->where('created_at', 'like', '%' . $month . '%')
|
|
|
|
|
->whereIn('bed_id', $beds->pluck('id'))
|
|
|
|
|
->sum('total');
|
|
|
|
|
|
|
|
|
|
foreach ($area as $item) {
|
|
|
|
|
$beds = Bed::where('area_id', $area->id)->where('project_id', $project_id)->get();
|
|
|
|
|
// 订单总数
|
|
|
|
|
$orderTotal = Orders::where('project_id', $project_id)
|
|
|
|
|
->where('created_at', 'like', '%' . $month . '%')
|
|
|
|
|
->whereIn('bed_id', $beds->pluck('id'))
|
|
|
|
|
->sum('total');
|
|
|
|
|
$item->order_total = $orderTotal;
|
|
|
|
|
$item->shouxufei = $orderTotal * 0.006;
|
|
|
|
|
$item->zengshishui = $orderTotal * 0.06;
|
|
|
|
|
|