{{-- Tab "Khách hàng & công nợ" của /statistics (nạp bằng AJAX): khách mới / quay lại, giá trị đơn trung bình, top khách (theo khoảng ngày); công nợ và liệu trình tồn (tính đến hiện tại, chỉ theo chi nhánh). Dữ liệu từ StatisticReportService. --}} @php $returningRate = $retention['buyers'] ? round($retention['returning'] / $retention['buyers'] * 100, 1) : 0; $debtOver90 = collect($debts['buckets'])->last(); $debtMax = max(1, collect($debts['buckets'])->max('amount')); $mixChart = [ 'labels' => ['Khách mua lần đầu', 'Khách quay lại'], 'values' => [(float) $retention['new_sales'], (float) $retention['returning_sales']], ]; @endphp
| Khách hàng | Đơn | Doanh số | Đã trả |
|---|---|---|---|
|
@if($row->customer)
{{ $row->customer->full_name }}
{{ $row->customer->account_code }}
@else
KH #{{ $row->member_id }}
@endif
@if($row->is_returning)
Quay lại
@endif
|
{{ number_format($row->total_orders) }} | {{ number_format($row->sales) }} | {{ number_format($row->paid) }} |
| Đơn hàng | Khách hàng | Ngày tạo | Tổng đơn | Đã trả | Còn nợ | Tuổi nợ |
|---|---|---|---|---|---|---|
| {{ $order->code }} | @if($order->customer) {{ $order->customer->full_name }} @endif | {{ $order->created_at->format('d/m/Y') }} | {{ number_format($order->all_total) }} | {{ number_format($order->gross_revenue) }} | {{ number_format($order->the_rest) }} | {{ $order->age }} ngày |
Đang hiện {{ $debts['top']->count() }}/{{ number_format($debts['orders']) }} đơn nợ nhiều nhất.
@endif @endif| Dịch vụ | Buổi còn lại | Số khách |
|---|---|---|
| {{ $row->name }} | {{ number_format($row->sessions) }} | {{ number_format($row->customers) }} |
| Khách hàng | Đơn | Buổi còn | Chưa quay lại |
|---|---|---|---|
|
@if($order->customer)
{{ $order->customer->full_name }}
{{ $order->customer->phone }}
@endif
|
{{ $order->code }} | {{ number_format($order->count_day) }} | {{ $order->idle_days }} ngày |
Đang hiện {{ $treatments['idle']->count() }}/{{ number_format($treatments['idle_count']) }} khách bỏ dở lâu nhất.
@endif @else