liyinglin 2 years ago
parent d575cb2ea1
commit feda33bc8d

@ -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"));
}
}

@ -0,0 +1,59 @@
@extends("admin.layouts.layout")
@push("header")
@endpush
@section("content")
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body" style="overflow: auto">
<div class="mb-3">
<form class="form-inline">
<select class="form-control mr-1" name="project_id"
onchange="$(this).closest('form').submit()">
@foreach($projects as $pp)
<option
value="{{$pp->id}}" @if($pp->id == $project_id) {{ "selected" }}@endif>{{$pp->name}}</option>
@endforeach
</select>
<select class="form-control" name="month" onchange="$(this).closest('form').submit()">
@foreach($months as $mm)
<option value="{{$mm}}" @if($mm == $month) {{ "selected" }}@endif>{{$mm}}</option>
@endforeach
</select>
</form>
</div>
<table class="table table-bordered mb-0 table-datatable">
<thead>
<tr>
<th class="p-1" style="white-space: nowrap">项目</th>
<th class="p-1" style="white-space: nowrap">所属周期</th>
<th class="p-1" style="white-space: nowrap">上月未结算余额</th>
<th class="p-1" style="white-space: nowrap">本月收款</th>
<th class="p-1" style="white-space: nowrap">本月退款</th>
<th class="p-1" style="white-space: nowrap">本月结算</th>
<th class="p-1" style="white-space: nowrap">本月未结算余额</th>
<th class="p-1" style="white-space: nowrap">院方结算</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{ $project->name }}</td>
<td>{{ date("Y年m月", strtotime($month)) }}</td>
<td>{{ $prev_month_balance }}</td>
<td>{{ $this_month_balances->filter(function($item) { return $item->belongs_type == "App\Models\Recharge"; })->sum("money") }}</td>
<td>{{ $this_month_balances->filter(function($item) { return $item->belongs_type == "App\Models\Refund"; })->sum("money") }}</td>
<td>{{ $this_month_balances->filter(function($item) { return $item->belongs_type == "App\Models\OrderItems"; })->sum("money") }}</td>
<td>{{ $this_month_balance }}</td>
<td>@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</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
@endsection

@ -95,6 +95,7 @@ Route::group(["namespace" => "Admin", "prefix" => "admin"], function () {
Route::get("orders/artboard", 'OrdersController@artboard');
Route::get("statistics/bed", 'StatisticsController@bed');
Route::get("statistics/huli", 'StatisticsController@huli');
Route::get("statistics/overview", 'StatisticsController@overview');
Route::get("statistics/salary", 'StatisticsController@salary');

Loading…
Cancel
Save