weizong song 2 years ago
parent 3b92d11c68
commit c3f7732996

@ -90,10 +90,12 @@ class StatisticsController extends CommonController
$query->where("project_id", $project_id);
})->pluck("paramedic_id")->toArray();
$query->where("project_id", $project_id)->orWhereIn("id", $order_item_paramedic_ids);
})->with(["orderItems" => function ($query) use ($month) {
})->with(["orderItems" => function ($query) use ($month, $project_id) {
$query->whereRaw("(DATE_FORMAT(`service_date`,'%Y-%m') = '{$month}' or DATE_FORMAT(`paid_at`,'%Y-%m') = '{$month}')")
->where("total", ">", 0)
->whereHas("order")
->whereHas("order", function ($query) use ($project_id) {
$query->where("project_id", $project_id);
})
->with(["order", "product", "productItem", "productParamedicLevel", "paramedic", "bed", "room", "building", "area"])
->orderBy("id");
}])->get();

Loading…
Cancel
Save