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

{{ translate('Search Data') }}

@if (isset($filter) && $filter == 'custom')
@endif
@php $total = \App\Models\Order::when(isset($zone), function ($query) use ($zone) { return $query->where('zone_id', $zone->id); }) ->when(isset($restaurant), function ($query) use ($restaurant) { return $query->where('restaurant_id', $restaurant->id); }) ->when(isset($from) && isset($to) && $from != null && $to != null && $filter == 'custom', function ($query) use ($from, $to) { return $query->whereBetween('created_at', [$from . ' 00:00:00', $to . ' 23:59:59']); }) ->when(isset($filter) && $filter == 'this_year', function ($query) { return $query->whereYear('created_at', now()->format('Y')); }) ->when(isset($filter) && $filter == 'this_month', function ($query) { return $query->whereMonth('created_at', now()->format('m'))->whereYear('created_at', now()->format('Y')); }) ->when(isset($filter) && $filter == 'this_month', function ($query) { return $query->whereMonth('created_at', now()->format('m'))->whereYear('created_at', now()->format('Y')); }) ->when(isset($filter) && $filter == 'previous_year', function ($query) { return $query->whereYear('created_at', date('Y') - 1); }) ->when(isset($filter) && $filter == 'this_week', function ($query) { return $query->whereBetween('created_at', [ now() ->startOfWeek() ->format('Y-m-d H:i:s'), now() ->endOfWeek() ->format('Y-m-d H:i:s'), ]); }) ->Notpos() ->count(); if ($total == 0) { $total = 0.01; } @endphp
@php $delivered = \App\Models\Order::when(isset($zone), function ($query) use ($zone) { return $query->where('zone_id', $zone->id); }) ->whereIn('order_status', ['delivered','refund_requested','refund_request_canceled']) ->when(isset($restaurant), function ($query) use ($restaurant) { return $query->where('restaurant_id', $restaurant->id); }) ->when(isset($from) && isset($to) && $from != null && $to != null && $filter == 'custom', function ($query) use ($from, $to) { return $query->whereBetween('created_at', [$from . ' 00:00:00', $to . ' 23:59:59']); }) ->when(isset($filter) && $filter == 'this_year', function ($query) { return $query->whereYear('created_at', now()->format('Y')); }) ->when(isset($filter) && $filter == 'this_month', function ($query) { return $query->whereMonth('created_at', now()->format('m'))->whereYear('created_at', now()->format('Y')); }) ->when(isset($filter) && $filter == 'this_month', function ($query) { return $query->whereMonth('created_at', now()->format('m'))->whereYear('created_at', now()->format('Y')); }) ->when(isset($filter) && $filter == 'previous_year', function ($query) { return $query->whereYear('created_at', date('Y') - 1); }) ->when(isset($filter) && $filter == 'this_week', function ($query) { return $query->whereBetween('created_at', [ now() ->startOfWeek() ->format('Y-m-d H:i:s'), now() ->endOfWeek() ->format('Y-m-d H:i:s'), ]); }) ->Notpos() ->sum('order_amount'); @endphp report/new

{{ \App\CentralLogics\Helpers::number_format_short($delivered) }}

{{ translate('Completed Transaction') }}
report/new
@php $canceled = \App\Models\Order::when(isset($zone), function ($query) use ($zone) { return $query->where('zone_id', $zone->id); }) ->where(['order_status' => 'refunded']) ->when(isset($restaurant), function ($query) use ($restaurant) { return $query->where('restaurant_id', $restaurant->id); }) ->when(isset($from) && isset($to) && $from != null && $to != null && $filter == 'custom', function ($query) use ($from, $to) { return $query->whereBetween('created_at', [$from . ' 00:00:00', $to . ' 23:59:59']); }) ->when(isset($filter) && $filter == 'this_year', function ($query) { return $query->whereYear('created_at', now()->format('Y')); }) ->when(isset($filter) && $filter == 'this_month', function ($query) { return $query->whereMonth('created_at', now()->format('m'))->whereYear('created_at', now()->format('Y')); }) ->when(isset($filter) && $filter == 'this_month', function ($query) { return $query->whereMonth('created_at', now()->format('m'))->whereYear('created_at', now()->format('Y')); }) ->when(isset($filter) && $filter == 'previous_year', function ($query) { return $query->whereYear('created_at', date('Y') - 1); }) ->when(isset($filter) && $filter == 'this_week', function ($query) { return $query->whereBetween('created_at', [ now() ->startOfWeek() ->format('Y-m-d H:i:s'), now() ->endOfWeek() ->format('Y-m-d H:i:s'), ]); }) ->Notpos() // ->sum(DB::raw('order_amount - original_delivery_charge')); ->sum(DB::raw('order_amount - delivery_charge - dm_tips')); @endphp report/new

{{ \App\CentralLogics\Helpers::number_format_short($canceled) }}

{{ translate('Refunded Transaction') }}
report/new

{{ translate('Admin Earning') }}

report/new

{{ \App\CentralLogics\Helpers::number_format_short($admin_earned) }}

{{ translate('Restaurant Earning') }}

report/new

{{\App\CentralLogics\Helpers::number_format_short($restaurant_earned) }}

{{ translate('Deliveryman Earning') }}

report/new

{{ \App\CentralLogics\Helpers::number_format_short($deliveryman_earned) }}

{{ translate('messages.order') }} {{ translate('messages.transactions') }} {{ $order_transactions->total() }}

@foreach ($order_transactions as $k => $ot) @php $discount_by_admin = 0; if($ot->order->discount_on_product_by == 'admin'){ $discount_by_admin = $ot->order['restaurant_discount_amount']; }; // $discount_by_admin = 0; // if($ot->order->discount_on_product_by == 'admin'){ // $discount_by_admin = $ot->order['restaurant_discount_amount']; // }; @endphp @if ($ot->received_by == 'admin') @elseif ($ot->received_by == 'deliveryman') @elseif ($ot->received_by == 'restaurant') @endif @endforeach
{{ translate('sl') }} {{ translate('messages.order') }} {{ translate('messages.id') }} {{ translate('messages.restaurant') }} {{ translate('messages.customer_name') }} {{ translate('messages.total_item_amount') }} {{ translate('messages.item_discount') }} {{ translate('messages.coupon_discount') }} {{ translate('messages.discounted_amount') }} {{ translate('messages.vat/tax') }} {{ translate('messages.delivery') }} {{ translate('messages.charge') }} {{ translate('messages.order_amount') }} {{ translate('messages.admin_discount') }} {{ translate('messages.restaurant_discount') }} {{ translate('messages.admin_commission') }} {{ translate('commision_on_delivery_charge') }} {{ translate('admin_net_income') }} {{ translate('restaurant_net_income') }} {{ translate('messages.amount') }} {{ translate('messages.received_by') }} {{ translate('messages.payment_method') }} {{ translate('messages.payment_status') }} {{ translate('messages.action') }}
{{ $k + $order_transactions->firstItem() }} {{ $ot->order_id }} @if($ot->order->restaurant) {{Str::limit($ot->order->restaurant->name,25,'...')}} @endif @if ($ot->order->customer) {{ $ot->order->customer['f_name'] . ' ' . $ot->order->customer['l_name'] }} @else @endif {{ \App\CentralLogics\Helpers::format_currency($ot->order['order_amount'] - $ot->order['dm_tips']-$ot->order['delivery_charge'] - $ot['tax'] + $ot->order['coupon_discount_amount'] + $ot->order['restaurant_discount_amount']) }} {{ \App\CentralLogics\Helpers::format_currency($ot->order->details->sum('discount_on_food')) }} {{ \App\CentralLogics\Helpers::format_currency($ot->order['coupon_discount_amount']) }} {{ \App\CentralLogics\Helpers::number_format_short($ot->order['coupon_discount_amount'] + $ot->order['restaurant_discount_amount']) }} {{ \App\CentralLogics\Helpers::format_currency($ot->tax) }} {{ \App\CentralLogics\Helpers::format_currency($ot->delivery_charge + $ot->delivery_fee_comission) }} {{ \App\CentralLogics\Helpers::format_currency($ot->order_amount) }} {{ \App\CentralLogics\Helpers::format_currency($ot->admin_expense) }} {{ \App\CentralLogics\Helpers::format_currency($ot->discount_amount_by_restaurant) }} {{ \App\CentralLogics\Helpers::format_currency($ot->admin_commission + $ot->admin_expense ) }} {{ \App\CentralLogics\Helpers::format_currency($ot->delivery_fee_comission) }} {{ \App\CentralLogics\Helpers::format_currency($ot->admin_commission + $ot->delivery_fee_comission ) }} {{ \App\CentralLogics\Helpers::format_currency($ot->restaurant_amount - $ot->tax) }}{{ translate('messages.admin') }}
{{ translate('messages.delivery_man') }}
@if (isset($ot->order->delivery_man) && $ot->order->delivery_man->earning == 1) {{translate('messages.freelance')}} @elseif (isset($ot->order->delivery_man) && $ot->order->delivery_man->earning == 0 && $ot->order->delivery_man->type == 'restaurant_wise') {{translate('messages.restaurant')}} @elseif (isset($ot->order->delivery_man) && $ot->order->delivery_man->earning == 0 && $ot->order->delivery_man->type == 'zone_wise') {{translate('messages.admin')}} @endif
{{ translate('messages.restaurant') }} {{ translate(str_replace('_', ' ', $ot->order['payment_method'])) }} @if ($ot->status) {{translate('messages.refunded')}} @else {{translate('messages.completed')}} @endif
@if (count($order_transactions) !== 0)
@endif
{!! $order_transactions->links() !!}
@if (count($order_transactions) === 0)
public
{{ translate('no_data_found') }}
@endif
@endsection @push('script') @endpush @push('script_2') @endpush