master
cody 2 years ago
parent a568c8070b
commit 0e86c51eb5

@ -553,10 +553,10 @@ class StatisticsController extends CommonController
foreach ($areaList as $item) { foreach ($areaList as $item) {
$beds = Bed::where('area_id', $item->id)->where('project_id', $project_id)->get(); $beds = Bed::where('area_id', $item->id)->where('project_id', $project_id)->get();
// 订单总数 // 订单总数
$orderTotal = OrderItems::where('created_at', 'like', '%' . $month . '%') $orderTotal = Balance::where('created_at', 'like', '%' . $month . '%')
->whereIn('bed_id', $beds->pluck('id')) ->whereHas("order", function ($query) use ($project_id) {
->whereNotNull('paid_at') $query->where("project_id", $project_id);
->sum('total'); })->sum("money");
$item->order_total = $orderTotal; $item->order_total = $orderTotal;
$item->shouxufei = round($orderTotal * 0.006, 2); $item->shouxufei = round($orderTotal * 0.006, 2);
$item->zengshishui = round($orderTotal * 0.06, 2); $item->zengshishui = round($orderTotal * 0.06, 2);

Loading…
Cancel
Save