@foreach ($orders as $order)

ORDER DETAILS

M/S. {{ $order->debitLedger->name }}

ADD:{{ $order->debitLedger->address }}

PH: {{ $order->debitLedger->mobile_no }}

{{-- GST:{{ $company->gst }}       State:{{ $company->state }} --}}
Order No   {{ $order->order_code }}
Order Date  {{ \Carbon\Carbon::parse($order->order_date)->format('d M Y') }}
Box No  {{ $order->box_no }}
@php $stockCategories = $order->items() ->with(['stockItem.stockItemCategories']) // eager load to avoid N+1 ->get() ->groupBy(function ($item) { $firstCategory = $item->stockItem->stockItemCategories->first(); return $firstCategory ? $firstCategory->id : 'uncategorized'; }); $sl = 1; @endphp @foreach ($stockCategories as $key => $group) @foreach($group as $item) @endforeach @endforeach @for($i=$order->items()->count();$i<=15;$i++) @endfor @php $count = 3; if($order->discount > 0){ $count++; } if($order->freight > 0){ $count++; } $words = new \NumberFormatter('en_IN', \NumberFormatter::SPELLOUT); $words = $words->format($order->amount); $words = str_replace('hundred thousand', 'lakh', $words); @endphp @if($order->discount > 0) @endif @if($order->freight > 0) @endif
sno MRP Particulars Unit Qty Price Amount
{{ $key == 'uncategorized' ? '' : $group[0]->stockItem->stockItemCategories->first()->category->name }}
{{ $sl++ }} {{ $item->stockItem->getMrp($order->order_date) }} {{ $item->stockItem->name }}{{ $item->remarks ? " ({$item->remarks})" : '' }} {{ $item->unit->symbol }} {{ $item->quantity }} {{ number_format($item->price_inc_tax, 2) }} {{ number_format( $item->total,2) }}
 
{{ $words }} SUB TOTAL {{ number_format($order->items()->sum('total'),2)}}
Discount {{ number_format($order->discount,2) }}
Freight {{ number_format($order->freight,2) }}
Round Off {{ number_format($order->round_off,2) }}
Order Amount {{ number_format($order->amount) }}
@if ($orders->last() != $order)
@endif @endforeach