@foreach ($courier_orders as $data) @php $setting = App\Setting::first(); $couriors = App\Courier::where('active_status', 'active')->get(); $sale_id = $data['sale_id']; $sale = \Illuminate\Support\Facades\DB::table('sales') ->where('sales.id', $sale_id) ->leftjoin('contacts', 'sales.contact_id', '=', 'contacts.id') ->leftjoin('districts', 'contacts.district_id', '=', 'districts.id') ->leftjoin('cities', 'contacts.city', '=', 'cities.id') ->select('sales.*', 'contacts.*', 'districts.name_en as districtName', 'cities.name_en as cityName') ->first(); $item_names = \Illuminate\Support\Facades\DB::table('sale_items') ->join('products', 'sale_items.product_id', '=', 'products.id') ->where('sale_id', $sale_id) ->where('sale_items.deleted_at', null) ->get(); @endphp
@if ($sale->payment_status == 'due')
{{ $setting->name }}
{{ $setting->landmark }}
{{ $setting->landmark_2 }}
{{ $setting->mobile }}
CASH ON DELIVERY
barcode
{{ $sale->waybill_prefix . $sale->waybill_no . $sale->waybill_postfix }}
COD AMOUNT: {!! number_format($sale->invoice_nettotal, 2) !!} @if (!empty($sale->currency_type)) {{ $sale->currency_type == 'usd' ? '$' : ' LKR' }} @else LKR @endif @elseif ($sale->payment_status == 'partial') Balance : {!! number_format($sale->invoice_balance, 2) !!} @if (!empty($sale->currency_type)) {{ $sale->currency_type == 'usd' ? '$' : ' LKR' }} @else LKR @endif @else FREE @endif
INVOICE NUMBER
{!! $sale->ref_no !!}
ORDER DETAILS QTY
@foreach ($item_names as $item) {{ $item->product_name }},  {{ $item->attribute_value }}
@endforeach
@foreach ($item_names as $item) {{ $item->qty }}
@endforeach
ISSUED DATE
{{ Carbon\Carbon::parse($sale->created_at)->format('Y-m-d') }}
COURIER SERVICE
@foreach ($couriors as $courior) @if ($sale->courier == $courior->id) {{ $courior->name }} @endif @endforeach
Dear Courier Partner, Please Contact Us On
{{ $setting->mobile }}
For Any Issues.
Customer Details
NAME
{!! $sale->name !!}

ADDRESS
{!! $sale->landmark !!}

CITY
{!! $sale->cityName !!}

TP 01
{!! $sale->mobile !!}

TP 02
@if (!empty($sale->mobile_2)) {!! $sale->mobile_2 !!} @endif
@if (!$loop->last)
@endif @endforeach