@extends('layouts.admin.app') @section('title', translate('Order Report')) @push('css_or_js') @endpush @section('content')

{{ translate('Order_Report') }}

Image Description

{{ translate('order_Report_Overview') }}

{{ translate('date') }}
( {{ date('Y-m-d ' . config('time_format'), strtotime(session('from_date'))) }} - {{ date('Y-m-d ' . config('time_format'), strtotime(session('to_date'))) }} )
@csrf

{{ translate('Show Data by Date Range') }}

@php $from = session('from_date'); $to = session('to_date'); $total = \App\Models\Order::whereBetween('created_at', [$from, $to])->count(); if ($total == 0) { $total = 0.01; } @endphp
@php $delivered = \App\Models\Order::where(['order_status' => 'delivered']) ->whereBetween('created_at', [$from, $to]) ->count(); @endphp

{{ translate('delivered') }}

{{ $delivered }}
@php $returned = \App\Models\Order::where(['order_status' => 'returned']) ->whereBetween('created_at', [$from, $to]) ->count(); @endphp

{{ translate('returned') }}

{{ $returned }}
@php $failed = \App\Models\Order::where(['order_status' => 'failed']) ->whereBetween('created_at', [$from, $to]) ->count(); @endphp

{{ translate('failed') }}

{{ $failed }}
@php $canceled = \App\Models\Order::where(['order_status' => 'canceled']) ->whereBetween('created_at', [$from, $to]) ->count(); @endphp

{{ translate('canceled') }}

{{ $canceled }}
@php $x = 1; $y = 12; $total = \App\Models\Order::whereBetween('created_at', [ date('Y-' . $x . '-01'), date('Y-' . $y . '-30'), ])->count(); @endphp
{{ translate('total') }} {{ translate('orders') }} of {{ date('Y') }}: {{ round($total) }}
{{ translate('orders') }}
@php $delivered = []; for ($i = 1; $i <= 12; $i++) { $from = date('Y-' . $i . '-01'); $to = date('Y-' . $i . '-30'); $delivered[$i] = \App\Models\Order::where(['order_status' => 'delivered']) ->whereBetween('created_at', [$from, $to]) ->count(); } @endphp @php $ret = []; for ($i = 1; $i <= 12; $i++) { $from = date('Y-' . $i . '-01'); $to = date('Y-' . $i . '-30'); $ret[$i] = \App\Models\Order::where(['order_status' => 'returned']) ->whereBetween('created_at', [$from, $to]) ->count(); } @endphp @php $fai = []; for ($i = 1; $i <= 12; $i++) { $from = date('Y-' . $i . '-01'); $to = date('Y-' . $i . '-30'); $fai[$i] = \App\Models\Order::where(['order_status' => 'failed']) ->whereBetween('created_at', [$from, $to]) ->count(); } @endphp @php $can = []; for ($i = 1; $i <= 12; $i++) { $from = date('Y-' . $i . '-01'); $to = date('Y-' . $i . '-30'); $can[$i] = \App\Models\Order::where(['order_status' => 'canceled']) ->whereBetween('created_at', [$from, $to]) ->count(); } @endphp
@endsection @push('script') @endpush @push('script_2') @endpush