@extends('layouts.dashboard') @section('dash_nav') @include('client_view.home_dashboard.main_navs',['active'=>'customer_dashboard']) @endsection @section('css') @endsection @section('content')

{{ __('Dashboard Results') }}

@csrf
{{-- Title --}}

{{__('Customers Sales Breakdown Analysis')}}

{{-- FIRST CARD --}}
@php $others = array_slice($customers_natures['totals'] , 50 ,null,true ) ; $allFormattedWithOthers = array_merge( array_slice($customers_natures['totals'] , 0 , 50 , true) , count($others) ? [ (object)[ 'customer_name'=>__('Others') . ' ( ' . count($others) . ' )' , 'val'=>array_sum(array_column($others , 'val')) , 'percentage'=>array_sum(array_column($others,'percentage')) ] ] : [] ); @endphp @php $order = 1 ; @endphp @slot('table_header') # {{ __('Customers') }} {{ __('Nature') }} {{ __('Sales Values') }} {{ __('%') }} @endslot @slot('table_body') @foreach ($allFormattedWithOthers as $key => $item) {{$key+1}} {{$item->customer_name }}

{{getCustomerNature($item->customer_name , $customers_natures) }}

{{-- --}} {{number_format($item->val)}} {{$item->percentage}} % @endforeach {{__('Total')}} - {{number_format(array_sum(array_column($allFormattedWithOthers,'val')))}} 100 % @endslot

{{ __('Top 50 Customers Nature Breakdown') }}

@foreach(getSummaryCustomerDashboardForEachType($allFormattedWithOthers , $customers_natures) as $arrKey=> $data ) @if($arrKey) @endif @endforeach
nature count sales
{{ $arrKey }} {{ $data['count'] ?? 0 }} {{ isset($data['sales']) ? number_format($data['sales']) : 0 }}
{{-- @slot('table_header') # {{ __('Customers') }} {{ __('Sales Values') }} {{ __('Percentages %') }} @endslot @slot('table_body') @php $total = array_sum(array_column($customers_breakdown_data,'Sales Value')) @endphp @foreach ($customers_breakdown_data as $key => $item) {{$key+1}} {{$item['item']?? '-'}} {{number_format($item['Sales Value']??0)}} {{$total == 0 ? 0 : number_format((($item['Sales Value']/$total)*100) , 1) . ' %'}} @endforeach {{__('Total')}} {{number_format($total)}} 100 % @endslot --}}

{{__('Customers Natures Analysis')}}

@slot('table_header') {{ __('Customer Nature') }} {{ __('Count') }} {{ __('Count %') }} {{ __('Sales Value [Yr -') . date('Y',strtotime($date)) .']'}} {{ __('Sales Value %') }} {{ __('View') }} @endslot @slot('table_body') @php $totalCount = array_sum(array_map("count", $customers_natures['statictics'])) ; $totalSales = 0 ; foreach( $customers_natures['statictics'] as $key => $val ){ $totalSales += array_sum ( array_column($val , 'total_sales') ); } @endphp @foreach($customers_natures['statictics'] as $staticName=>$vals) @php $countVals = count($vals) ; $totalSaleForCustomerType = array_sum(array_column($vals,'total_sales')); @endphp {{$staticName}} {{$countVals}} {{ $totalCount ? number_format(($countVals / $totalCount)*100 , 1 ) . ' %' : 0 }} {{number_format($totalSaleForCustomerType,0)}} {{ $totalSales ? number_format(($totalSaleForCustomerType / $totalSales)*100 , 1 ) . ' %' : 0 }} @if ($countVals > 0) @if ($countVals > 0) @endif @else {{__('No Customers')}} @endif @endforeach {{__('Total')}} {{number_format($totalCount)}} {{number_format(100) . '%'}} {{number_format($totalSales)}} {{number_format(100) . '%'}} - @php $totalCount = array_sum(array_map("count", $customers_natures['stops'])) ; foreach( $customers_natures['stops'] as $key => $val ){ } @endphp @foreach ($customers_natures['stops'] as $name => $vals) @php $countVals = count($vals) ; $totalSaleForCustomerType = array_sum(array_column($vals,'total_sales')); @endphp {{$name}} {{$countVals}} -- {{-- {{ $totalCount ? number_format(($countVals / $totalCount)*100 , 1 ) . ' %' : 0 }} --}} {{number_format($totalSaleForCustomerType,0)}} {{ $totalSales ? number_format(($totalSaleForCustomerType / $totalSales)*100 , 1 ) . ' %' : 0 }} @if ($countVals > 0) @else {{__('No Customers')}} @endif @endforeach @endslot @foreach ($customers_natures['stops'] as $name => $vals) @if ($countVals > 0) @endif @endforeach
{{--
@slot('table_header') {{ __('Customer Nature') }} {{ __('Count') }} {{ __('Count %') }} {{ __('Sales Value [Yr -') . date('Y',strtotime($date)) .']'}} {{ __('Sales Value %') }} {{ __('View') }} @endslot @slot('table_body') @php $data_without_dead_stop = $customers_natures; $dead_stop_data = [ 'Stop'=> $customers_natures['Stop'], 'Dead'=> $customers_natures['Dead'], ]; unset($data_without_dead_stop['Stop']); unset($data_without_dead_stop['Dead']); $total_count = array_sum(array_column($data_without_dead_stop,'count')) ; $total_sales_values = array_sum(array_column($data_without_dead_stop,'Total Sales Values')) ; $total_count_percentage = 0; $total_sales_values_percentage = 0; @endphp @foreach ($data_without_dead_stop as $customer_nature => $customer_data) @php $id = str_replace(['/',' '],'',$customer_nature); @endphp @php $customer_count = $customer_data['count'] ?? 0; $customer_sales_value = $customer_data['Total Sales Values'] ?? 0; $count_percentage = $total_count == 0 ? 0 : (($customer_count/$total_count)*100) ; $sales_values_percentage = $total_sales_values == 0 ? 0 : (($customer_sales_value/$total_sales_values)*100) ; $total_count_percentage += $count_percentage; $total_sales_values_percentage += $sales_values_percentage; @endphp {{$customer_nature}} {{$customer_count}} {{ number_format($count_percentage , 1) . ' %'}} {{number_format($customer_sales_value)}} {{number_format($sales_values_percentage , 1) . ' %'}} @if ($customer_count > 0) @else {{__('No Customers')}} @endif @endforeach {{__('Total')}} {{number_format($total_count)}} {{number_format($total_count_percentage) . '%'}} {{number_format($total_sales_values)}} {{number_format($total_sales_values_percentage) . '%'}} - @foreach ($dead_stop_data as $customer_nature => $customer_data) @php $id = str_replace(['/',' '],'',$customer_nature); @endphp @php $customer_count = $customer_data['count'] ?? 0; $customer_sales_value = $customer_data['Total Sales Values'] ?? 0; $count_percentage = $total_count == 0 ? 0 : (($customer_count/$total_count)*100) ; $sales_values_percentage = $total_sales_values == 0 ? 0 : (($customer_sales_value/$total_sales_values)*100) ; // $total_count_percentage += $count_percentage; // $total_sales_values_percentage += $sales_values_percentage; @endphp {{$customer_nature}} {{$customer_count}} {{ number_format($count_percentage , 1) . ' %'}} {{number_format($customer_sales_value)}} {{number_format($sales_values_percentage , 1) . ' %'}} @if ($customer_count > 0) @else {{__('No Customers')}} @endif @endforeach @endslot @foreach ($customers_natures as $customer_nature => $customer_data) @php $id = str_replace(['/',' '],'',$customer_nature); @endphp @if (($customer_data['count'] ??0) > 0) @endif @endforeach
--}} @endsection @section('js') @endsection