{{ $sales->firstitem() + $key }} |
@if($sale->aggregator == 'shero-home'){{ $sale->order_number }}@elseif($sale->aggregator == 'swiggy' || $sale->aggregator == 'zomato' ){{ $sale->aggregator_order_number }} @endif |
{{ $sale->kitchen->name }}
|
{{ $sale->kitchen->phone_number }}
|
{{ $sale->aggregator }}
|
{{ date('d-m-Y', strtotime($sale->booking_date)) }} |
@if($sale->user)
{{ $sale->user->name }}
@else
{{$sale->customer_name}}
@endif
|
@if($sale->user)
{{ $sale->user->mobile_number }}
@else
{{$sale->customer_phone_number}}
@endif
|
@php
$order_details = \App\Models\OrderDetail::Where('order_id', $sale->id)->get();
$sub_total = [];
$addon_total =[];
foreach ($order_details as $key => $value) {
$item_Detail = \App\Models\Variation::Where('item_id', $value->item_id)->first();
if ($item_Detail) {
$pp_price = $item_Detail->pp_price;
} else {
$pp_price = 0;
}
$quantity = $value->quantity;
$sub_total[] = $pp_price * $quantity;
if (count($value->customers_items) > 0) {
foreach ($value->customers_items as $key => $items) {
$item_Details = \App\Models\Variation::Where('item_id', $items->item_id)->first();
$add_pp_price = $item_Details->pp_price;
$addon_total[] = $add_pp_price * $items->quantity;
}
}
}
if ($sale->total_discount == null) {
$discount_amount = $sale->coupon_discount;
} else {
$discount_amount = $sale->total_discount;
}
if(empty($addon_total))
{
$addon_total[] = 0;
}
$total = array_sum($sub_total) + array_sum($addon_total);
$cgst = \App\Models\Tax::Where('id', '1')->first();
$sgst = \App\Models\Tax::Where('id', '2')->first();
$cgst_amount = ($total / 100) * $cgst->percentage;
$sgst_amount = ($total / 100) * $sgst->percentage;
$tax_amount = round($sgst_amount + $cgst_amount);
$grand_total = ((double) $total + (double) $sale->delivery_charge + (double) $tax_amount )- (double) $discount_amount;
@endphp
₹ {{ $grand_total }}
|
@if ($sale->order_status == 'pending')
Pending
@endif
@if ($sale->order_status == 'placed')
Placed
@endif
@if ($sale->order_status == 'process')
Process
@endif
@if ($sale->order_status == 'ready')
Ready
@endif
@if ($sale->order_status == 'rider_assigned')
Rider Assigned
@endif
@if ($sale->order_status == 'dispatched')
Dispatched
@endif
@if ($sale->order_status == 'delivered')
Delivered
@endif
|
@if ($sale->order_status == 'pending')
@endif
@if ($sale->order_status == 'placed')
@endif
@if ($sale->order_status == 'process')
@endif
{{-- @if ($sale->status == 'ready')
@endif
@if ($sale->status == 'dispatched')
@endif --}}
|
|
@endforeach