You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
3.9 KiB

@extends("admin.layouts.layout")
@push("header")
<style>
table.dataTable thead .sorting:before, table.dataTable thead .sorting:after {
display: none !important;
}
</style>
<script>
var datatable_configs = {
sorting: false,
paging: true,
};
</script>
@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">
<label class="control-label mr-1">截止</label><input
value="{{ date("Y-m-d",$before_datetime) }}" class="form-control" name="before_date"
data-plugin="date-picker">
<button type="submit" class="btn btn-primary ml-1">查询</button>
</form>
</div>
<h5>客户余额表</h5>
<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>
@foreach($customers as $item)
<tr>
<td class="p-1">{{ $loop->iteration }}</td>
<td class="p-1">{{ $item->mobile }}</td>
<td class="p-1">{{ $item->patients->count() ? $item->patients->first()->name : "无" }}</td>
<td class="p-1">{{ date("Y-m-d H:i:s",$before_datetime) }}</td>
<td class="p-1">{{ $item->balances->filter(function($item) { return $item->belongs_type == "App\Models\Recharge"; })->sum("money") }}</td>
<td class="p-1">{{ $item->balances->filter(function($item) { return $item->belongs_type == "App\Models\Refund"; })->sum("money") }}</td>
<td class="p-1">{{ $item->balances->filter(function($item) { return $item->belongs_type == "App\Models\OrderItems"; })->sum("money") }}</td>
<td class="p-1 {{ $item->balances->sum("money") != $item->balances->first()->balance ? "text-danger" : "" }}">{{ $item->balances->sum("money") }}</td>
</tr>
@endforeach
<tr>
<td class="p-1">&nbsp;</td>
<td class="p-1">&nbsp;</td>
<td class="p-1">&nbsp;</td>
<td class="p-1">&nbsp;</td>
<td class="p-1">&nbsp;</td>
<td class="p-1">&nbsp;</td>
<td class="p-1">总计</td>
<td class="p-1">{{ $customers->each(function($customer) { $customer->balance = $customer->balances->sum("money"); })->sum("balance") }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
@include("plugins.datatable")
@endsection