diff --git a/app/Http/Controllers/Admin/StatisticsController.php b/app/Http/Controllers/Admin/StatisticsController.php index d943d21..b95ad25 100755 --- a/app/Http/Controllers/Admin/StatisticsController.php +++ b/app/Http/Controllers/Admin/StatisticsController.php @@ -442,4 +442,29 @@ class StatisticsController extends CommonController return $list; } + /** + * 床位统计 + * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View + */ + public function bed() + { + $projects = $this->_checkProjects(); + if (!$projects->count()) { + return $this->error($this->noProjects); + } + $project_id = request()->project_id ?? $projects->first()->id; + $project = Project::find($project_id); + + $month = request()->month ?? date("Y-m"); + $months = $this->_getMonths(); + $area = Area::withCount('beds')->where('project_id', $project_id)->get(); + $totalBed = Bed::whereIn('area_id', $area->pluck('id'))->where('project_id', $project_id)->count(); + foreach ($area as $item) { + dd($item); + // $item->bed_rate = round($item->beds_count/) + + } + return view($this->bladePath . ".bed", compact("area", "project", "month")); + } + } diff --git a/resources/views/admin/statistics/bed.blade.php b/resources/views/admin/statistics/bed.blade.php new file mode 100755 index 0000000..1f9dfb4 --- /dev/null +++ b/resources/views/admin/statistics/bed.blade.php @@ -0,0 +1,59 @@ +@extends("admin.layouts.layout") + +@push("header") + +@endpush + +@section("content") +
| 项目 | +所属周期 | +上月未结算余额 | +本月收款 | +本月退款 | +本月结算 | +本月未结算余额 | +院方结算 | +
|---|---|---|---|---|---|---|---|
| {{ $project->name }} | +{{ date("Y年m月", strtotime($month)) }} | +{{ $prev_month_balance }} | +{{ $this_month_balances->filter(function($item) { return $item->belongs_type == "App\Models\Recharge"; })->sum("money") }} | +{{ $this_month_balances->filter(function($item) { return $item->belongs_type == "App\Models\Refund"; })->sum("money") }} | +{{ $this_month_balances->filter(function($item) { return $item->belongs_type == "App\Models\OrderItems"; })->sum("money") }} | +{{ $this_month_balance }} | +@if($project->percent_first_party){{ -$this_month_balances->filter(function($item) { return $item->belongs_type == "App\Models\OrderItems"; })->sum("money") * $project->percent_first_party / 100 }}@else{{ "未设置" }}@endif | +